Logo ROOT   6.08/07
Reference Guide
MakeModelAndMeasurementsFast.cxx
Go to the documentation of this file.
1 // @(#)root/roostats:$Id: cranmer $
2 // Author: Kyle Cranmer, Akira Shibata
3 /*************************************************************************
4  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 ////////////////////////////////////////////////////////////////////////////////
12 
13 /*
14  BEGIN_HTML
15  <p>
16  This is a package that creates a RooFit probability density function from ROOT histograms
17  of expected distributions and histograms that represent the +/- 1 sigma variations
18  from systematic effects. The resulting probability density function can then be used
19  with any of the statistical tools provided within RooStats, such as the profile
20  likelihood ratio, Feldman-Cousins, etc. In this version, the model is directly
21  fed to a likelihodo ratio test, but it needs to be further factorized.</p>
22 
23  <p>
24  The user needs to provide histograms (in picobarns per bin) and configure the job
25  with XML. The configuration XML is defined in the file config/Config.dtd, but essentially
26  it is organized as follows (see config/Combination.xml and config/ee.xml for examples)</p>
27 
28  <ul>
29  <li> - a top level 'Combination' that is composed of:</li>
30  <ul>
31  <li>- several 'Channels' (eg. ee, emu, mumu), which are composed of:</li>
32  <ul>
33  <li>- several 'Samples' (eg. signal, bkg1, bkg2, ...), each of which has:</li>
34  <ul>
35  <li> - a name</li>
36  <li> - if the sample is normalized by theory (eg N = L*sigma) or not (eg. data driven)</li>
37  <li> - a nominal expectation histogram</li>
38  <li> - a named 'Normalization Factor' (which can be fixed or allowed to float in a fit)</li>
39  <li> - several 'Overall Systematics' in normalization with:</li>
40  <ul>
41  <li> - a name</li>
42  <li> - +/- 1 sigma variations (eg. 1.05 and 0.95 for a 5% uncertainty)</li>
43  </ul>
44  <li>- several 'Histogram Systematics' in shape with:</li>
45  <ul>
46  <li>- a name (which can be shared with the OverallSyst if correlated)</li>
47  <li>- +/- 1 sigma variational histograms</li>
48  </ul>
49  </ul>
50  </ul>
51  <li>- several 'Measurements' (corresponding to a full fit of the model) each of which specifies</li>
52  <ul>
53  <li>- a name for this fit to be used in tables and files</li>
54  <ul>
55  <li> - what is the luminosity associated to the measurement in picobarns</li>
56  <li> - which bins of the histogram should be used</li>
57  <li> - what is the relative uncertainty on the luminosity </li>
58  <li> - what is (are) the parameter(s) of interest that will be measured</li>
59  <li> - which parameters should be fixed/floating (eg. nuisance parameters)</li>
60  </ul>
61  </ul>
62  </ul>
63  END_HTML
64 */
65 //
66 
67 
68 // from std
69 #include <string>
70 #include <vector>
71 #include <map>
72 #include <iostream>
73 #include <sstream>
74 
75 // from root
76 #include "TFile.h"
77 #include "TH1F.h"
78 #include "TDOMParser.h"
79 #include "TXMLAttr.h"
80 #include "TString.h"
81 #include "TCanvas.h"
82 #include "TStyle.h"
83 #include "TLine.h"
84 #include "TSystem.h"
85 
86 
87 // from roofit
88 #include "RooStats/ModelConfig.h"
89 
90 // from this package
91 #include "Helper.h"
96 
98 
99 using namespace RooFit;
100 //using namespace RooStats;
101 //using namespace HistFactory;
102 
103 //using namespace std;
104 
105 
106 
108 
109  // This will be returned
110  RooWorkspace* ws = NULL;
111  TFile* outFile = NULL;
112  FILE* tableFile=NULL;
113 
114  try {
115 
116  std::cout << "Making Model and Measurements (Fast) for measurement: " << measurement.GetName() << std::endl;
117 
118  double lumiError = measurement.GetLumi()*measurement.GetLumiRelErr();
119 
120  std::cout << "using lumi = " << measurement.GetLumi() << " and lumiError = " << lumiError
121  << " including bins between " << measurement.GetBinLow() << " and " << measurement.GetBinHigh() << std::endl;
122  std::cout << "fixing the following parameters:" << std::endl;
123 
124  for(std::vector<std::string>::iterator itr=measurement.GetConstantParams().begin(); itr!=measurement.GetConstantParams().end(); ++itr){
125  std::cout << " " << *itr << std::endl;
126  }
127 
128  std::string rowTitle = measurement.GetName();
129 
130  std::vector<RooWorkspace*> channel_workspaces;
131  std::vector<std::string> channel_names;
132 
133  // Create the outFile - first check if the outputfile exists
134  std::string prefix = measurement.GetOutputFilePrefix();
135  // parse prefix to find output directory -
136  // assume there is a file prefix after the last "/" that we remove
137  // to get the directory name.
138  // We do by finding last occurrence of "/" and using as directory name what is before
139  // if we do not have a "/" in the prefix there is no output directory to be checked or created
140  size_t pos = prefix.rfind("/");
141  if (pos != std::string::npos) {
142  std::string outputDir = prefix.substr(0,pos);
143  std::cout << "Checking if output directory : " << outputDir << " - exists" << std::endl;
144  if (gSystem->OpenDirectory( outputDir.c_str() ) == 0 ) {
145  std::cout << "Output directory : " << outputDir << " - does not exist, try to create" << std::endl;
146  int success = gSystem->MakeDirectory( outputDir.c_str() );
147  if( success != 0 ) {
148  std::string fullOutputDir = std::string(gSystem->pwd()) + std::string("/") + outputDir;
149  std::cout << "Error: Failed to make output directory: " << fullOutputDir << std::endl;
150  throw hf_exc();
151  }
152  }
153  }
154 
155  // This holds the TGraphs that are created during the fit
156  std::string outputFileName = measurement.GetOutputFilePrefix() + "_" + measurement.GetName() + ".root";
157  std::cout << "Creating the output file: " << outputFileName << std::endl;
158  outFile = new TFile(outputFileName.c_str(), "recreate");
159 
160  // Create the table file
161  // This holds the table of fitted values and errors
162  std::string tableFileName = measurement.GetOutputFilePrefix() + "_results.table";
163  std::cout << "Creating the table file: " << tableFileName << std::endl;
164  tableFile = fopen( tableFileName.c_str(), "a");
165 
166  std::cout << "Creating the HistoToWorkspaceFactoryFast factory" << std::endl;
167  HistoToWorkspaceFactoryFast factory( measurement );
168 
169  // Make the factory, and do some preprocessing
170  // HistoToWorkspaceFactoryFast factory(measurement, rowTitle, outFile);
171  std::cout << "Setting preprocess functions" << std::endl;
172  factory.SetFunctionsToPreprocess( measurement.GetPreprocessFunctions() );
173 
174  // for results tables
175  fprintf(tableFile, " %s &", rowTitle.c_str() );
176 
177  // First: Loop to make the individual channels
178  for( unsigned int chanItr = 0; chanItr < measurement.GetChannels().size(); ++chanItr ) {
179 
180  HistFactory::Channel& channel = measurement.GetChannels().at( chanItr );
181  if( ! channel.CheckHistograms() ) {
182  std::cout << "MakeModelAndMeasurementsFast: Channel: " << channel.GetName()
183  << " has uninitialized histogram pointers" << std::endl;
184  throw hf_exc();
185  }
186 
187  // Make the workspace for this individual channel
188  std::string ch_name = channel.GetName();
189  std::cout << "Starting to process channel: " << ch_name << std::endl;
190  channel_names.push_back(ch_name);
191  RooWorkspace* ws_single = factory.MakeSingleChannelModel( measurement, channel );
192  channel_workspaces.push_back(ws_single);
193 
194  // Make the output
195  std::string ChannelFileName = measurement.GetOutputFilePrefix() + "_"
196  + ch_name + "_" + rowTitle + "_model.root";
197  ws_single->writeToFile( ChannelFileName.c_str() );
198 
199  // Now, write the measurement to the file
200  // Make a new measurement for only this channel
201  RooStats::HistFactory::Measurement meas_chan( measurement );
202  meas_chan.GetChannels().clear();
203  meas_chan.GetChannels().push_back( channel );
204  std::cout << "Opening File to hold channel: " << ChannelFileName << std::endl;
205  TFile* chanFile = TFile::Open( ChannelFileName.c_str(), "UPDATE" );
206  std::cout << "About to write channel measurement to file" << std::endl;
207  meas_chan.writeToFile( chanFile );
208  std::cout << "Successfully wrote channel to file" << std::endl;
209  chanFile->Close();
210 
211  // Get the Paramater of Interest as a RooRealVar
212  RooRealVar* poi = dynamic_cast<RooRealVar*>( ws_single->var( (measurement.GetPOI()).c_str() ) );
213 
214  // do fit unless exportOnly requested
215  if(! measurement.GetExportOnly()){
216  if(!poi) {
217  std::cout << "Can't do fit for: " << measurement.GetName()
218  << ", no parameter of interest" << std::endl;
219  } else {
220  if(ws_single->data("obsData")) {
221  FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), ws_single,
222  ch_name, "obsData", outFile, tableFile);
223  } else {
224  FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), ws_single,
225  ch_name, "asimovData", outFile, tableFile);
226  }
227  }
228  }
229 
230  fprintf(tableFile, " & " );
231  } // End loop over channels
232 
233  /***
234  Second: Make the combined model:
235  If you want output histograms in root format, create and pass it to the combine routine.
236  "combine" : will do the individual cross-section measurements plus combination
237  ***/
238 
239  // Use HistFactory to combine the individual channel workspaces
240  ws = factory.MakeCombinedModel(channel_names, channel_workspaces);
241 
242  // Configure that workspace
243  HistoToWorkspaceFactoryFast::ConfigureWorkspaceForMeasurement( "simPdf", ws, measurement );
244 
245  // Get the Parameter of interest as a RooRealVar
246  RooRealVar* poi = dynamic_cast<RooRealVar*>( ws->var( (measurement.GetPOI()).c_str() ) );
247 
248  std::string CombinedFileName = measurement.GetOutputFilePrefix() + "_combined_"
249  + rowTitle + "_model.root";
250  std::cout << "Writing combined workspace to file: " << CombinedFileName << std::endl;
251  ws->writeToFile( CombinedFileName.c_str() );
252  std::cout << "Writing combined measurement to file: " << CombinedFileName << std::endl;
253  TFile* combFile = TFile::Open( CombinedFileName.c_str(), "UPDATE" );
254  if( combFile == NULL ) {
255  std::cout << "Error: Failed to open file " << CombinedFileName << std::endl;
256  throw hf_exc();
257  }
258  measurement.writeToFile( combFile );
259  combFile->Close();
260 
261  // Fit the combined model
262  if(! measurement.GetExportOnly()){
263  if(!poi) {
264  std::cout << "Can't do fit for: " << measurement.GetName()
265  << ", no parameter of interest" << std::endl;
266  }
267  else {
268  if(ws->data("obsData")){
269  FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), ws,"combined",
270  "obsData", outFile, tableFile);
271  }
272  else {
273  FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), ws,"combined",
274  "asimovData", outFile, tableFile);
275  }
276  }
277  }
278 
279  fprintf(tableFile, " \\\\ \n");
280 
281  outFile->Close();
282  delete outFile;
283 
284  fclose( tableFile );
285 
286  }
287  catch(...) {
288  if( tableFile ) fclose(tableFile);
289  if(outFile) outFile->Close();
290  throw;
291  }
292 
293  return ws;
294 
295 }
296 
297 
298 ///////////////////////////////////////////////
299 void RooStats::HistFactory::FitModelAndPlot(const std::string& MeasurementName,
300  const std::string& FileNamePrefix,
301  RooWorkspace * combined, std::string channel,
302  std::string data_name,
303  TFile* outFile, FILE* tableFile ) {
304 
305  if( outFile == NULL ) {
306  std::cout << "Error: Output File in FitModelAndPlot is NULL" << std::endl;
307  throw hf_exc();
308  }
309 
310  if( tableFile == NULL ) {
311  std::cout << "Error: tableFile in FitModelAndPlot is NULL" << std::endl;
312  throw hf_exc();
313  }
314 
315  if( combined == NULL ) {
316  std::cout << "Error: Supplied workspace in FitModelAndPlot is NULL" << std::endl;
317  throw hf_exc();
318  }
319 
320  ModelConfig* combined_config = (ModelConfig *) combined->obj("ModelConfig");
321  if(!combined_config){
322  std::cout << "Error: no ModelConfig found in Measurement: "
323  << MeasurementName << std::endl;
324  throw hf_exc();
325  }
326 
327  RooAbsData* simData = combined->data(data_name.c_str());
328  if(!simData){
329  std::cout << "Error: Failed to get dataset: " << data_name
330  << " in measurement: " << MeasurementName << std::endl;
331  throw hf_exc();
332  }
333 
334  const RooArgSet* POIs = combined_config->GetParametersOfInterest();
335  if(!POIs) {
336  std::cout << "Not Fitting Model for measurement: " << MeasurementName
337  << ", no poi found" << std::endl;
338  // Should I throw an exception here?
339  return;
340  }
341 
342  RooAbsPdf* model = combined_config->GetPdf();
343  if( model==NULL ) {
344  std::cout << "Error: Failed to find pdf in ModelConfig: " << combined_config->GetName()
345  << std::endl;
346  throw hf_exc();
347  }
348 
349  // Save a Snapshot
350  RooArgSet PoiPlusNuisance;
351  if( combined_config->GetNuisanceParameters() ) {
352  PoiPlusNuisance.add( *combined_config->GetNuisanceParameters() );
353  }
354  PoiPlusNuisance.add( *combined_config->GetParametersOfInterest() );
355  combined->saveSnapshot("InitialValues", PoiPlusNuisance);
356 
357  ///////////////////////////////////////
358  // Do the fit
359  std::cout << "\n\n---------------" << std::endl;
360  std::cout << "---------------- Doing "<< channel << " Fit" << std::endl;
361  std::cout << "---------------\n\n" << std::endl;
362  model->fitTo(*simData, Minos(kTRUE), PrintLevel(1));
363 
364  // If there are no parameters of interest,
365  // we exit the function here
366  if( POIs->getSize()==0 ) {
367  std::cout << "WARNING: No POIs found in measurement: " << MeasurementName << std::endl;
368  return;
369  }
370 
371  // Loop over all POIs and print their fitted values
372  RooRealVar* poi = NULL; // (RooRealVar*) POIs->first();
373  TIterator* params_itr = POIs->createIterator();
374  TObject* poi_obj=NULL;
375  while( (poi_obj=params_itr->Next()) ) {
376  //poi = (RooRealVar*) poi_obj;
377  poi = dynamic_cast<RooRealVar*>(poi_obj);
378  std::cout << "printing results for " << poi->GetName()
379  << " at " << poi->getVal()<< " high "
380  << poi->getErrorLo() << " low "
381  << poi->getErrorHi() << std::endl;
382  }
383 
384  // But we only make detailed plots and tables
385  // for the 'first' POI
386  poi = dynamic_cast<RooRealVar*>(POIs->first());
387 
388  // Print the MINOS errors to the TableFile
389  fprintf(tableFile, " %.4f / %.4f ", poi->getErrorLo(), poi->getErrorHi());
390 
391  // Make the Profile Likelihood Plot
392  RooAbsReal* nll = model->createNLL(*simData);
393  RooAbsReal* profile = nll->createProfile(*poi);
394  if( profile==NULL ) {
395  std::cout << "Error: Failed to make ProfileLikelihood for: " << poi->GetName()
396  << " using model: " << model->GetName()
397  << " and data: " << simData->GetName()
398  << std::endl;
399  throw hf_exc();
400  }
401 
402  RooPlot* frame = poi->frame();
403  if( frame == NULL ) {
404  std::cout << "Error: Failed to create RooPlot frame for: " << poi->GetName() << std::endl;
405  throw hf_exc();
406  }
407 
408  // Draw the likelihood curve
410  TCanvas* ProfileLikelihoodCanvas = new TCanvas( channel.c_str(), "",800,600);
411  nll->plotOn(frame, ShiftToZero(), LineColor(kRed), LineStyle(kDashed));
412  profile->plotOn(frame);
413  frame->SetMinimum(0);
414  frame->SetMaximum(2.);
415  frame->Draw();
416  std::string ProfilePlotName = FileNamePrefix+"_"+channel+"_"+MeasurementName+"_profileLR.eps";
417  ProfileLikelihoodCanvas->SaveAs( ProfilePlotName.c_str() );
418  delete ProfileLikelihoodCanvas;
419 
420  // Now, we save our results to the 'output' file
421  // (I'm not sure if users actually look into this file,
422  // but adding additional information and useful plots
423  // may make it more attractive)
424 
425  // Save to the output file
426  TDirectory* channel_dir = outFile->mkdir(channel.c_str());
427  if( channel_dir == NULL ) {
428  std::cout << "Error: Failed to make channel directory: " << channel << std::endl;
429  throw hf_exc();
430  }
431  TDirectory* summary_dir = channel_dir->mkdir("Summary");
432  if( summary_dir == NULL ) {
433  std::cout << "Error: Failed to make Summary directory for channel: "
434  << channel << std::endl;
435  throw hf_exc();
436  }
437  summary_dir->cd();
438 
439  // Save a graph of the profile likelihood curve
440  RooCurve* curve=frame->getCurve();
441  Int_t curve_N=curve->GetN();
442  Double_t* curve_x=curve->GetX();
443  delete frame;
444 
445  Double_t * x_arr = new Double_t[curve_N];
446  Double_t * y_arr_nll = new Double_t[curve_N];
447 
448  for(int i=0; i<curve_N; i++){
449  double f=curve_x[i];
450  poi->setVal(f);
451  x_arr[i]=f;
452  y_arr_nll[i]=nll->getVal();
453  }
454 
455  TGraph* g = new TGraph(curve_N, x_arr, y_arr_nll);
456  g->SetName( (FileNamePrefix +"_nll").c_str() );
457  g->Write();
458  delete g;
459  delete [] x_arr;
460  delete [] y_arr_nll;
461 
462  // Finally, restore the initial values
463  combined->loadSnapshot("InitialValues");
464 
465 }
466 
467 
468 void RooStats::HistFactory::FitModel(RooWorkspace * combined, std::string data_name ) {
469 
470  std::cout << "In Fit Model" << std::endl;
471  ModelConfig * combined_config = (ModelConfig *) combined->obj("ModelConfig");
472  if(!combined_config){
473  std::cout << "no model config " << "ModelConfig" << " exiting" << std::endl;
474  return;
475  }
476 
477  RooAbsData* simData = combined->data(data_name.c_str());
478  if(!simData){
479  std::cout << "no data " << data_name << " exiting" << std::endl;
480  return;
481  }
482 
483  const RooArgSet * POIs=combined_config->GetParametersOfInterest();
484  if(!POIs){
485  std::cout << "no poi " << data_name << " exiting" << std::endl;
486  return;
487  }
488 
489  RooAbsPdf* model=combined_config->GetPdf();
490  model->fitTo(*simData, Minos(kTRUE), PrintLevel(1));
491 
492  }
493 
494 
495 void RooStats::HistFactory::FormatFrameForLikelihood(RooPlot* frame, std::string /*XTitle*/,
496  std::string YTitle){
497 
500  // gStyle->SetPadColor(0);
501  // gStyle->SetCanvasColor(255);
502  // gStyle->SetTitleFillColor(255);
503  // gStyle->SetFrameFillColor(0);
504  // gStyle->SetStatColor(255);
505 
506  RooAbsRealLValue* var = frame->getPlotVar();
507  double xmin = var->getMin();
508  double xmax = var->getMax();
509 
510  frame->SetTitle("");
511  // frame->GetXaxis()->SetTitle(XTitle.c_str());
512  frame->GetXaxis()->SetTitle(var->GetTitle());
513  frame->GetYaxis()->SetTitle(YTitle.c_str());
514  frame->SetMaximum(2.);
515  frame->SetMinimum(0.);
516  TLine * line = new TLine(xmin,.5,xmax,.5);
517  line->SetLineColor(kGreen);
518  TLine * line90 = new TLine(xmin,2.71/2.,xmax,2.71/2.);
519  line90->SetLineColor(kGreen);
520  TLine * line95 = new TLine(xmin,3.84/2.,xmax,3.84/2.);
521  line95->SetLineColor(kGreen);
522  frame->addObject(line);
523  frame->addObject(line90);
524  frame->addObject(line95);
525 }
526 
527 
virtual RooAbsReal * createNLL(RooAbsData &data, const RooLinkedList &cmdList)
Construct representation of -log(L) of PDFwith given dataset.
Definition: RooAbsPdf.cxx:777
virtual Double_t getMin(const char *name=0) const
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:830
Bool_t saveSnapshot(const char *name, const char *paramNames)
Save snapshot of values and attributes (including "Constant") of parameters &#39;params&#39; If importValues ...
TIterator * createIterator(Bool_t dir=kIterForward) const
RooWorkspace * MakeCombinedModel(std::vector< std::string >, std::vector< RooWorkspace *>)
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg(), const RooCmdArg &arg10=RooCmdArg()) const
Plot (project) PDF on specified frame.
float xmin
Definition: THbookFile.cxx:93
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:52
A RooCurve is a one-dimensional graphical representation of a real-valued function.
Definition: RooCurve.h:32
virtual Double_t getMax(const char *name=0) const
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
Definition: RooArgSet.h:86
TAxis * GetYaxis() const
Definition: RooPlot.cxx:1118
TAxis * GetXaxis() const
Definition: RooPlot.cxx:1117
RooCmdArg LineColor(Color_t color)
TLine * line
RooWorkspace * MakeModelAndMeasurementFast(RooStats::HistFactory::Measurement &measurement)
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
Definition: RooPlot.cxx:392
Definition: Rtypes.h:61
RooCmdArg PrintLevel(Int_t code)
Double_t getVal(const RooArgSet *set=0) const
Definition: RooAbsReal.h:64
RooCmdArg Minos(Bool_t flag=kTRUE)
R__EXTERN TStyle * gStyle
Definition: TStyle.h:418
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:131
std::string GetPOI(unsigned int i=0)
Definition: Measurement.h:49
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TSystem.cxx:822
int Int_t
Definition: RtypesCore.h:41
virtual TDirectory * mkdir(const char *name, const char *title="")
Create a sub-directory and return a pointer to the created directory.
Definition: TDirectory.cxx:957
void SetTitle(const char *name)
Set the title of the RooPlot to &#39;title&#39;.
Definition: RooPlot.cxx:1099
Definition: Rtypes.h:61
Iterator abstract base class.
Definition: TIterator.h:32
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
Definition: TFile.cxx:3907
std::vector< std::string > GetPreprocessFunctions()
void SetFunctionsToPreprocess(std::vector< std::string > lines)
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
Definition: RooPlot.cxx:959
Double_t getErrorLo() const
Definition: RooRealVar.h:63
RooCmdArg LineStyle(Style_t style)
std::vector< RooStats::HistFactory::Channel > & GetChannels()
Definition: Measurement.h:105
RooCmdArg ShiftToZero()
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:37
const char * pwd()
Definition: TSystem.h:415
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found...
virtual void setVal(Double_t value)
Set value of variable to &#39;value&#39;.
Definition: RooRealVar.cxx:205
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:46
Int_t getSize() const
void SetPadBorderMode(Int_t mode=1)
Definition: TStyle.h:347
void SetCanvasBorderMode(Int_t mode=1)
Definition: TStyle.h:336
R__EXTERN TSystem * gSystem
Definition: TSystem.h:549
RooAbsArg * first() const
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum value of Y axis.
Definition: RooPlot.cxx:949
void FitModel(RooWorkspace *, std::string data_name="obsData")
A simple line.
Definition: TLine.h:33
Int_t GetN() const
Definition: TGraph.h:133
Bool_t writeToFile(const char *fileName, Bool_t recreate=kTRUE)
Save this current workspace into given file.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
float xmax
Definition: THbookFile.cxx:93
Bool_t loadSnapshot(const char *name)
Load the values and attributes of the parameters in the snapshot saved with the given name...
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name) ...
A RooPlot is a plot frame and a container for graphics objects within that frame. ...
Definition: RooPlot.h:41
std::vector< std::string > & GetConstantParams()
Definition: Measurement.h:60
Double_t * GetX() const
Definition: TGraph.h:140
RooWorkspace * MakeSingleChannelModel(Measurement &measurement, Channel &channel)
The Canvas class.
Definition: TCanvas.h:41
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
Definition: ModelConfig.h:244
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return NULL if not existing)
Definition: ModelConfig.h:247
double f(double x)
RooCurve * getCurve(const char *name=0) const
Return a RooCurve pointer of the named object in this plot, or zero if the named object does not exis...
Definition: RooPlot.cxx:775
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
Describe directory structure in memory.
Definition: TDirectory.h:44
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
Mother of all ROOT objects.
Definition: TObject.h:37
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
Definition: TDirectory.cxx:435
RooAbsRealLValue * getPlotVar() const
Definition: RooPlot.h:132
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return NULL if not existing)
Definition: ModelConfig.h:250
virtual RooAbsReal * createProfile(const RooArgSet &paramsOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function...
Definition: RooAbsReal.cxx:463
virtual TObject * Next()=0
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:53
void FormatFrameForLikelihood(RooPlot *frame, std::string xTitle=std::string("#sigma / #sigma_{SM}"), std::string yTitle=std::string("-log likelihood"))
void FitModelAndPlot(const std::string &measurementName, const std::string &fileNamePrefix, RooWorkspace *, std::string, std::string, TFile *, FILE *)
#define NULL
Definition: Rtypes.h:82
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition: TSystem.cxx:831
virtual RooFitResult * fitTo(RooAbsData &data, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none())
Fit PDF to given dataset.
Definition: RooAbsPdf.cxx:1056
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save Pad contents in a file in one of various formats.
Definition: TPad.cxx:5037
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:155
Double_t getErrorHi() const
Definition: RooRealVar.h:64
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:42
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:559
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52