ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MakeModelAndMeasurements.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 
82 // from roofit
83 #include "RooStats/ModelConfig.h"
84 
85 // from this package
86 #include "Helper.h"
91 
92 
93 using namespace RooFit;
94 using namespace RooStats;
95 using namespace HistFactory;
96 
97 using namespace std;
98 
99 void topDriver(string input);
100 // void fastDriver(string input); // in MakeModelAndMeasurementsFast
101 
102 /*
103 //_____________________________batch only_____________________
104 #ifndef __CINT__
105 
106 int main(int argc, char** argv) {
107 
108  if(! (argc>1)) {
109  cerr << "need input file" << endl;
110  exit(1);
111  }
112 
113  if(argc==2){
114  string input(argv[1]);
115  try {
116  fastDriver(input);
117  }
118  catch (std::string str) {
119  cerr << "caught exception: " << str << endl ;
120  }
121  catch( const exception& e ) {
122  cerr << "Caught Exception: " << e.what() << endl;
123  }
124  }
125 
126  if(argc==3){
127  string flag(argv[1]);
128  string input(argv[2]);
129  if(flag=="-standard_form")
130  try {
131  fastDriver(input);
132  }
133  catch (std::string str) {
134  cerr << "caught exception: " << str << endl ;
135  }
136  catch( const exception& e ) {
137  cerr << "Caught Exception: " << e.what() << endl;
138  }
139  else if(flag=="-number_counting_form")
140  try {
141  topDriver(input);
142  }
143  catch (std::string str) {
144  cerr << "caught exception: " << str << endl ;
145  }
146  catch( const exception& e ) {
147  cerr << "Caught Exception: " << e.what() << endl;
148  }
149 
150  else
151  cerr <<"unrecognized flag. Options are -standard_form or -number_counting_form"<<endl;
152 
153  }
154  return 0;
155 }
156 
157 #endif
158 */
159 
160 void topDriver( string input ) {
161 
162 
163  // Make the list of measurements and channels
164  std::vector< HistFactory::Measurement > measurement_list;
165  //std::vector< HistFactory::Channel > channel_list;
166 
167 
168  HistFactory::ConfigParser xmlParser;
169 
170  // Fill them using the XML parser
171  //xmlParser.FillMeasurementsAndChannelsFromXML( input, measurement_list, channel_list );
172 
173  measurement_list = xmlParser.GetMeasurementsFromXML( input );
174 
175  // At this point, we have all the information we need
176  // from the xml files.
177 
178 
179  // We will make the measurements 1-by-1
180  // This part will be migrated to the
181  // MakeModelAndMeasurements function,
182  // but is here for now.
183 
184 
185  for(unsigned int i = 0; i < measurement_list.size(); ++i) {
186 
187  HistFactory::Measurement measurement = measurement_list.at(i);
188 
189  // Add the channels to this measurement
190  //for( unsigned int chanItr = 0; chanItr < channel_list.size(); ++chanItr ) {
191  // measurement.channels.push_back( channel_list.at( chanItr ) );
192  //}
193 
194  // This part (OF COURSE) needs to be added:
195 
196 
197  std::string rowTitle = measurement.GetName();
198  std::string outputFileName = measurement.GetOutputFilePrefix() + "_" + measurement.GetName() + ".root";
199 
200  double lumiError = measurement.GetLumi()*measurement.GetLumiRelErr();
201 
202  TFile* outFile = new TFile(outputFileName.c_str(), "recreate");
203  HistoToWorkspaceFactory factory(measurement.GetOutputFilePrefix(), rowTitle, measurement.GetConstantParams(),
204  measurement.GetLumi(), lumiError,
205  measurement.GetBinLow(), measurement.GetBinHigh(), outFile);
206 
207  // Create the workspaces for the channels
208  vector<RooWorkspace*> channel_workspaces;
209  vector<string> channel_names;
210 
211 
212  // Loop over channels and make the individual
213  // channel fits:
214 
215 
216  // read the xml for each channel and combine
217 
218  for( unsigned int chanItr = 0; chanItr < measurement.GetChannels().size(); ++chanItr ) {
219 
220  HistFactory::Channel& channel = measurement.GetChannels().at( chanItr );
221 
222 
223  string ch_name=channel.GetName();
224  channel_names.push_back(ch_name);
225 
226  std::vector< EstimateSummary > dummy;
227  RooWorkspace* ws = factory.MakeSingleChannelModel( dummy, measurement.GetConstantParams() );
228  if( ws==NULL ) {
229  std::cout << "Failed to create SingleChannelModel for channel: " << channel.GetName()
230  << " and measurement: " << measurement.GetName() << std::endl;
231  throw hf_exc();
232  }
233  //RooWorkspace* ws = factory.MakeSingleChannelModel( channel );
234  channel_workspaces.push_back(ws);
235 
236  // set poi in ModelConfig
237  ModelConfig* proto_config = (ModelConfig *) ws->obj("ModelConfig");
238 
239  std::cout << "Setting Parameter of Interest as :" << measurement.GetPOI() << endl;
240  RooRealVar* poi = (RooRealVar*) ws->var( (measurement.GetPOI()).c_str() );
241  RooArgSet * params= new RooArgSet;
242  if(poi){
243  params->add(*poi);
244  }
245  proto_config->SetParametersOfInterest(*params);
246 
247 
248  // Gamma/Uniform Constraints:
249  // turn some Gaussian constraints into Gamma/Uniform/LogNorm constraints, rename model newSimPdf
250  if( measurement.GetGammaSyst().size()>0 || measurement.GetUniformSyst().size()>0 || measurement.GetLogNormSyst().size()>0) {
251  factory.EditSyst( ws, ("model_"+ch_name).c_str(), measurement.GetGammaSyst(), measurement.GetUniformSyst(), measurement.GetLogNormSyst());
252  proto_config->SetPdf( *ws->pdf("newSimPdf") );
253  }
254 
255  // fill out ModelConfig and export
256  RooAbsData* expData = ws->data("expData");
257  if(poi){
258  proto_config->GuessObsAndNuisance(*expData);
259  }
260  std::string ChannelFileName = measurement.GetOutputFilePrefix() + "_" + ch_name + "_" + rowTitle + "_model.root";
261  ws->writeToFile( ChannelFileName.c_str() );
262 
263  // Now, write the measurement to the file
264  // Make a new measurement for only this channel
265  RooStats::HistFactory::Measurement meas_chan( measurement );
266  meas_chan.GetChannels().clear();
267  meas_chan.GetChannels().push_back( channel );
268  TFile* chanFile = TFile::Open( ChannelFileName.c_str(), "UPDATE" );
269  meas_chan.writeToFile( chanFile );
270  chanFile->Close();
271 
272  // do fit unless exportOnly requested
273  if(! measurement.GetExportOnly() ){
274  if(!poi){
275  cout <<"can't do fit for this channel, no parameter of interest"<<endl;
276  } else{
277  factory.FitModel(ws, ch_name, "newSimPdf", "expData", false);
278  }
279  }
280  fprintf(factory.pFile, " & " );
281  }
282 
283 
284  // Now, combine the channels
285  RooWorkspace* ws=factory.MakeCombinedModel(channel_names, channel_workspaces);
286  if( ws == NULL ) {
287  std::cout << "Error: Failed to create workspace" << std::endl;
288  throw hf_exc();
289  }
290  // Gamma/Uniform Constraints:
291  // turn some Gaussian constraints into Gamma/Uniform/logNormal constraints, rename model newSimPdf
292  if( measurement.GetGammaSyst().size()>0 || measurement.GetUniformSyst().size()>0 || measurement.GetLogNormSyst().size()>0)
293  factory.EditSyst(ws, "simPdf", measurement.GetGammaSyst(), measurement.GetUniformSyst(), measurement.GetLogNormSyst());
294  //
295  // set parameter of interest according to the configuration
296  //
297  ModelConfig * combined_config = (ModelConfig *) ws->obj("ModelConfig");
298  cout << "Setting Parameter of Interest as :" << measurement.GetPOI() << endl;
299  RooRealVar* poi = (RooRealVar*) ws->var( (measurement.GetPOI()).c_str() );
300  //RooRealVar* poi = (RooRealVar*) ws->var((POI+"_comb").c_str());
301  RooArgSet * params= new RooArgSet;
302  cout << poi << endl;
303  if(poi){
304  params->add(*poi);
305  }
306  combined_config->SetParametersOfInterest(*params);
307  ws->Print();
308 
309  // Set new PDF if there are gamma/uniform constraint terms
310  if( measurement.GetGammaSyst().size()>0 || measurement.GetUniformSyst().size()>0 || measurement.GetLogNormSyst().size()>0)
311  combined_config->SetPdf(*ws->pdf("newSimPdf"));
312 
313  RooAbsData* simData = ws->data("simData");
314  combined_config->GuessObsAndNuisance(*simData);
315  // ws->writeToFile(("results/model_combined_edited.root").c_str());
316  std::string CombinedFileName = measurement.GetOutputFilePrefix()+"_combined_"+rowTitle+"_model.root";
317  ws->writeToFile( CombinedFileName.c_str() );
318  TFile* combFile = TFile::Open( CombinedFileName.c_str(), "UPDATE" );
319  measurement.writeToFile( combFile );
320  combFile->Close();
321 
322 
323 
324  // TO DO:
325  // Totally factorize the statistical test in "fit Model" to a different area
326  if(! measurement.GetExportOnly() ){
327  if(!poi){
328  cout <<"can't do fit for this channel, no parameter of interest"<<endl;
329  } else{
330  factory.FitModel(ws, "combined", "simPdf", "simData", false);
331  }
332  }
333 
334 
335  } // End Loop over measurement_list
336 
337  // Done
338 
339 }
340 
341 /*
342 
343 void topDriver(string input ){
344 
345  // TO DO:
346  // would like to fully factorize the XML parsing.
347  // No clear need to have some here and some in ConfigParser
348 
349  / *** read in the input xml *** /
350  TDOMParser xmlparser;
351  Int_t parseError = xmlparser.ParseFile( input.c_str() );
352  if( parseError ) {
353  std::cerr << "Loading of xml document \"" << input
354  << "\" failed" << std::endl;
355  }
356 
357  cout << "reading input : " << input << endl;
358  TXMLDocument* xmldoc = xmlparser.GetXMLDocument();
359  TXMLNode* rootNode = xmldoc->GetRootNode();
360 
361  if( rootNode->GetNodeName() == TString( "Combination" ) ){
362  string outputFileName, outputFileNamePrefix;
363  vector<string> xml_input;
364 
365  TListIter attribIt = rootNode->GetAttributes();
366  TXMLAttr* curAttr = 0;
367  while( ( curAttr = dynamic_cast< TXMLAttr* >( attribIt() ) ) != 0 ) {
368  if( curAttr->GetName() == TString( "OutputFilePrefix" ) ) {
369  outputFileNamePrefix=string(curAttr->GetValue());
370  cout << "output file is : " << outputFileName << endl;
371  }
372  }
373 
374  TXMLNode* node = rootNode->GetChildren();
375  while( node != 0 ) {
376  if( node->GetNodeName() == TString( "Input" ) ) {
377  xml_input.push_back(node->GetText());
378  }
379  node = node->GetNextNode();
380  }
381  node = rootNode->GetChildren();
382  while( node != 0 ) {
383  if( node->GetNodeName() == TString( "Measurement" ) ) {
384 
385  Double_t nominalLumi=0, lumiRelError=0, lumiError=0;
386  Int_t lowBin=0, highBin=0;
387  string rowTitle, POI, mode;
388  vector<string> systToFix;
389  map<string,double> gammaSyst;
390  map<string,double> uniformSyst;
391  map<string,double> logNormSyst;
392  bool exportOnly = false;
393 
394  // TListIter attribIt = node->GetAttributes();
395  // TXMLAttr* curAttr = 0;
396  attribIt = node->GetAttributes();
397  curAttr = 0;
398  while( ( curAttr = dynamic_cast< TXMLAttr* >( attribIt() ) ) != 0 ) {
399 
400  if( curAttr->GetName() == TString( "Lumi" ) ) {
401  nominalLumi=atof(curAttr->GetValue());
402  }
403  if( curAttr->GetName() == TString( "LumiRelErr" ) ) {
404  lumiRelError=atof(curAttr->GetValue());
405  }
406  if( curAttr->GetName() == TString( "BinLow" ) ) {
407  lowBin=atoi(curAttr->GetValue());
408  }
409  if( curAttr->GetName() == TString( "BinHigh" ) ) {
410  highBin=atoi(curAttr->GetValue());
411  }
412  if( curAttr->GetName() == TString( "Name" ) ) {
413  rowTitle=curAttr->GetValue();
414  outputFileName=outputFileNamePrefix+"_"+rowTitle+".root";
415  }
416  if( curAttr->GetName() == TString( "Mode" ) ) {
417  cout <<"\n INFO: Mode attribute is deprecated, will ignore\n"<<endl;
418  mode=curAttr->GetValue();
419  }
420  if( curAttr->GetName() == TString( "ExportOnly" ) ) {
421  if(curAttr->GetValue() == TString( "True" ) )
422  exportOnly = true;
423  else
424  exportOnly = false;
425  }
426  }
427 
428  if(highBin==0){
429  cout <<"\nERROR: In -number_counting_form must specify BinLow and BinHigh\n"<<endl;
430  return;
431  }
432 
433  lumiError=nominalLumi*lumiRelError;
434 
435  TXMLNode* mnode = node->GetChildren();
436  while( mnode != 0 ) {
437  if( mnode->GetNodeName() == TString( "POI" ) ) {
438  POI=mnode->GetText();
439  }
440  if( mnode->GetNodeName() == TString( "ParamSetting" ) ) {
441  // TListIter attribIt = mnode->GetAttributes();
442  //TXMLAttr* curAttr = 0;
443  attribIt = mnode->GetAttributes();
444  curAttr = 0;
445  while( ( curAttr = dynamic_cast< TXMLAttr* >( attribIt() ) ) != 0 ) {
446  if( curAttr->GetName() == TString( "Const" ) ) {
447  if(curAttr->GetValue()==TString("True")){
448  AddSubStrings(systToFix, mnode->GetText());
449  }
450  }
451  }
452  }
453  if( mnode->GetNodeName() == TString( "ConstraintTerm" ) ) {
454  vector<string> syst; string type = ""; double rel = 0;
455  AddSubStrings(syst,mnode->GetText());
456  // TListIter attribIt = mnode->GetAttributes();
457  // TXMLAttr* curAttr = 0;
458  attribIt = mnode->GetAttributes();
459  curAttr = 0;
460  while( ( curAttr = dynamic_cast< TXMLAttr* >( attribIt() ) ) != 0 ) {
461  if( curAttr->GetName() == TString( "Type" ) ) {
462  type = curAttr->GetValue();
463  }
464  if( curAttr->GetName() == TString( "RelativeUncertainty" ) ) {
465  rel = atof(curAttr->GetValue());
466  }
467  }
468  if (type=="Gamma" && rel!=0) {
469  for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); it++) gammaSyst[(*it).c_str()] = rel;
470  }
471  if (type=="Uniform" && rel!=0) {
472  for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); it++) uniformSyst[(*it).c_str()] = rel;
473  }
474  if (type=="LogNormal" && rel!=0) {
475  for (vector<string>::const_iterator it=syst.begin(); it!=syst.end(); it++) logNormSyst[(*it).c_str()] = rel;
476  }
477  }
478  mnode = mnode->GetNextNode();
479  }
480 
481  / * Do measurement * /
482  cout << "using lumi = " << nominalLumi << " and lumiError = " << lumiError
483  << " including bins between " << lowBin << " and " << highBin << endl;
484  cout << "fixing the following parameters:" << endl;
485  for(vector<string>::iterator itr=systToFix.begin(); itr!=systToFix.end(); ++itr){
486  cout << " " << *itr << endl;
487  }
488 
489  / ***
490  Construction of Model. Only requirement is that they return vector<vector<EstimateSummary> >
491  This is where we use the factory.
492  *** /
493 
494  vector<vector<EstimateSummary> > summaries;
495  if(xml_input.empty()){
496  cerr << "no input channels found" << endl;
497  exit(1);
498  }
499 
500 
501  vector<RooWorkspace*> chs;
502  vector<string> ch_names;
503  TFile* outFile = new TFile(outputFileName.c_str(), "recreate");
504  HistoToWorkspaceFactory factory(outputFileNamePrefix, rowTitle, systToFix, nominalLumi, lumiError, lowBin, highBin , outFile);
505 
506 
507  // for results tables
508  fprintf(factory.pFile, " %s &", rowTitle.c_str() );
509 
510  // read the xml for each channel and combine
511  for(vector<string>::iterator itr=xml_input.begin(); itr!=xml_input.end(); ++itr){
512  vector<EstimateSummary> oneChannel;
513  // read xml
514  ReadXmlConfig(*itr, oneChannel, nominalLumi);
515  // not really needed anymore
516  summaries.push_back(oneChannel);
517  // use factory to create the workspace
518  string ch_name=oneChannel[0].channel;
519  ch_names.push_back(ch_name);
520  RooWorkspace * ws = factory.MakeSingleChannelModel(oneChannel, systToFix);
521  chs.push_back(ws);
522  // set poi in ModelConfig
523  ModelConfig * proto_config = (ModelConfig *) ws->obj("ModelConfig");
524  cout << "Setting Parameter of Interest as :" << POI << endl;
525  RooRealVar* poi = (RooRealVar*) ws->var(POI.c_str());
526  RooArgSet * params= new RooArgSet;
527  if(poi){
528  params->add(*poi);
529  }
530  proto_config->SetParametersOfInterest(*params);
531 
532 
533  // Gamma/Uniform Constraints:
534  // turn some Gaussian constraints into Gamma/Uniform/LogNorm constraints, rename model newSimPdf
535  if(gammaSyst.size()>0 || uniformSyst.size()>0 || logNormSyst.size()>0) {
536  factory.EditSyst(ws,("model_"+oneChannel[0].channel).c_str(),gammaSyst,uniformSyst,logNormSyst);
537  proto_config->SetPdf(*ws->pdf("newSimPdf"));
538  }
539 
540  // fill out ModelConfig and export
541  RooAbsData* expData = ws->data("expData");
542  if(poi){
543  proto_config->GuessObsAndNuisance(*expData);
544  }
545  ws->writeToFile((outputFileNamePrefix+"_"+ch_name+"_"+rowTitle+"_model.root").c_str());
546 
547  // do fit unless exportOnly requested
548  if(!exportOnly){
549  if(!poi){
550  cout <<"can't do fit for this channel, no parameter of interest"<<endl;
551  } else{
552  factory.FitModel(ws, ch_name, "newSimPdf", "expData", false);
553  }
554  }
555  fprintf(factory.pFile, " & " );
556  }
557 
558  / ***
559  Make the combined model:
560  If you want output histograms in root format, create and pass it to the combine routine.
561  "combine" : will do the individual cross-section measurements plus combination
562 
563  *** /
564 
565 
566 
567  if(true || mode.find("comb")!=string::npos){ //KC: deprecating Mode="Comb"
568  RooWorkspace* ws=factory.MakeCombinedModel(ch_names,chs);
569  // Gamma/Uniform Constraints:
570  // turn some Gaussian constraints into Gamma/Uniform/logNormal constraints, rename model newSimPdf
571  if(gammaSyst.size()>0 || uniformSyst.size()>0 || logNormSyst.size()>0)
572  factory.EditSyst(ws,"simPdf",gammaSyst,uniformSyst,logNormSyst);
573  //
574  // set parameter of interest according to the configuration
575  //
576  ModelConfig * combined_config = (ModelConfig *) ws->obj("ModelConfig");
577  cout << "Setting Parameter of Interest as :" << POI << endl;
578  RooRealVar* poi = (RooRealVar*) ws->var((POI).c_str());
579  //RooRealVar* poi = (RooRealVar*) ws->var((POI+"_comb").c_str());
580  RooArgSet * params= new RooArgSet;
581  cout << poi << endl;
582  if(poi){
583  params->add(*poi);
584  }
585  combined_config->SetParametersOfInterest(*params);
586  ws->Print();
587 
588  // Set new PDF if there are gamma/uniform constraint terms
589  if(gammaSyst.size()>0 || uniformSyst.size()>0 || logNormSyst.size()>0)
590  combined_config->SetPdf(*ws->pdf("newSimPdf"));
591 
592  RooAbsData* simData = ws->data("simData");
593  combined_config->GuessObsAndNuisance(*simData);
594  // ws->writeToFile(("results/model_combined_edited.root").c_str());
595  ws->writeToFile((outputFileNamePrefix+"_combined_"+rowTitle+"_model.root").c_str());
596 
597  // TO DO:
598  // Totally factorize the statistical test in "fit Model" to a different area
599  if(!exportOnly){
600  if(!poi){
601  cout <<"can't do fit for this channel, no parameter of interest"<<endl;
602  } else{
603  factory.FitModel(ws, "combined", "simPdf", "simData", false);
604  }
605  }
606 
607  }
608 
609 
610  fprintf(factory.pFile, " \\\\ \n");
611 
612  outFile->Close();
613  delete outFile;
614 
615  }
616  node = node->GetNextNode(); // next measurement
617  }
618  }
619 }
620 
621 
622 
623 */
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:52
void topDriver(string input)
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found...
void GuessObsAndNuisance(const RooAbsData &data)
guesses Observables and ParametersOfInterest if not already set
Definition: ModelConfig.cxx:32
std::string GetPOI(unsigned int i=0)
Definition: Measurement.h:49
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:3851
RooAbsPdf * pdf(const char *name) const
Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found.
std::vector< RooStats::HistFactory::Channel > & GetChannels()
Definition: Measurement.h:105
virtual void SetPdf(const RooAbsPdf &pdf)
Set the Pdf, add to the the workspace if not already there.
Definition: ModelConfig.h:97
std::map< std::string, double > & GetUniformSyst()
Definition: Measurement.h:122
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:37
std::vector< RooStats::HistFactory::Measurement > GetMeasurementsFromXML(std::string input)
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
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
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found...
std::vector< std::string > & GetConstantParams()
Definition: Measurement.h:60
static RooMathCoreReg dummy
std::map< std::string, double > & GetLogNormSyst()
Definition: Measurement.h:123
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name) ...
void Print(Option_t *opts=0) const
Print contents of the workspace.
#define NULL
Definition: Rtypes.h:82
virtual void SetParametersOfInterest(const RooArgSet &set)
Definition: ModelConfig.h:115
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set.
Definition: RooArgSet.cxx:448
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:42
std::map< std::string, double > & GetGammaSyst()
Definition: Measurement.h:121