Logo ROOT  
Reference Guide
Measurement.cxx
Go to the documentation of this file.
1 // @(#)root/roostats:$Id$
2 // Author: Kyle Cranmer, George Lewis
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 /** \class RooStats::HistFactory::Measurement
12  * \ingroup HistFactory
13 The RooStats::HistFactory::Measurement class can be used to construct a model
14 by combining multiple RooStats::HistFactory::Channel objects. It also allows
15 to set some general properties like the integrated luminosity, its relative
16 uncertainty or the functional form of constraints on nuisance parameters.
17 */
18 
19 
22 
23 #include "HFMsgService.h"
24 
25 #include <ctime>
26 #include <iostream>
27 #include <algorithm>
28 #include <sys/stat.h>
29 #include "TSystem.h"
30 #include "TTimeStamp.h"
31 
32 
33 using namespace std;
34 
36 
37 /// Standard constructor
39  fPOI(), fLumi( 1.0 ), fLumiRelErr( .10 ),
40  fBinLow( 0 ), fBinHigh( 1 ), fExportOnly( false )
41 {
42 
43 }
44 
45 /*
46 RooStats::HistFactory::Measurement::Measurement(const Measurement& other) :
47  POI( other.POI ), Lumi( other.Lumi ), LumiRelErr( other.LumiRelErr ),
48  BinLow( other.BinLow ), BinHigh( other.BinHigh ), ExportOnly( other.ExportOnly ),
49  channels( other.channels ), OutputFilePrefix( other.outputFilePrefix ),
50  constantParams( other.constantParams ), { ; }
51 */
52 
53 /// Standard constructor specifying name and title of measurement
55  TNamed( Name, Title ),
56  fPOI(), fLumi( 1.0 ), fLumiRelErr( .10 ),
57  fBinLow( 0 ), fBinHigh( 1 ), fExportOnly( false )
58 {
59 
60 }
61 
62 
63 /// Set a parameter in the model to be constant.
64 /// the parameter does not have to exist yet, the information will be used when
65 /// the model is actually created.
66 ///
67 /// Also checks if the parameter is already set constant.
68 /// We don't need to set it constant twice,
69 /// and we issue a warning in case this is a hint
70 /// of a possible bug
72 {
73 
74 
75  if( std::find(fConstantParams.begin(), fConstantParams.end(), param) != fConstantParams.end() ) {
76  cxcoutWHF << "Warning: Setting parameter: " << param
77  << " to constant, but it is already listed as constant. "
78  << "You may ignore this warning."
79  << std::endl;
80  return;
81  }
82 
83  fConstantParams.push_back( param );
84 
85 }
86 
87 
88 /// Set parameter of the model to given value
89 void RooStats::HistFactory::Measurement::SetParamValue( const std::string& param, double value )
90 {
91  // Check if this parameter is already set to a value
92  // If so, issue a warning
93  // (Not sure if we want to throw an exception here, or
94  // issue a warning and move along. Thoughts?)
95  if( fParamValues.find(param) != fParamValues.end() ) {
96  cxcoutWHF << "Warning: Chainging parameter: " << param
97  << " value from: " << fParamValues[param]
98  << " to: " << value
99  << std::endl;
100  }
101 
102  // Store the parameter and its value
103  cxcoutIHF << "Setting parameter: " << param
104  << " value to " << value
105  << std::endl;
106 
107  fParamValues[param] = value;
108 
109 }
110 
111 
112 /// Add a preprocessed function by giving the function a name,
113 /// a functional expression, and a string with a bracketed list of dependencies (eg "SigXsecOverSM[0,3]")
114 void RooStats::HistFactory::Measurement::AddPreprocessFunction( std::string name, std::string expression, std::string dependencies )
115 {
116 
117 
118  PreprocessFunction func(name, expression, dependencies);
119  AddFunctionObject(func);
120 
121 }
122 
123 /// Returns a list of defined preprocess function expressions
125 {
126 
127 
128  std::vector<std::string> PreprocessFunctionExpressions;
129  for( unsigned int i = 0; i < fFunctionObjects.size(); ++i ) {
130  std::string expression = fFunctionObjects.at(i).GetCommand();
131  PreprocessFunctionExpressions.push_back( expression );
132  }
133  return PreprocessFunctionExpressions;
134 }
135 
136 /// Set constraint term for given systematic to Gamma distribution
137 void RooStats::HistFactory::Measurement::AddGammaSyst(std::string syst, double uncert)
138 {
139  fGammaSyst[syst] = uncert;
140 }
141 
142 /// Set constraint term for given systematic to LogNormal distribution
143 void RooStats::HistFactory::Measurement::AddLogNormSyst(std::string syst, double uncert)
144 {
145  fLogNormSyst[syst] = uncert;
146 }
147 
148 /// Set constraint term for given systematic to uniform distribution
150 {
151  fUniformSyst[syst] = 1.0; // Is this parameter simply a dummy?
152 }
153 
154 /// Define given systematics to have no external constraint
156 {
157  fNoSyst[syst] = 1.0; // dummy value
158 }
159 
160 /// Check if the given channel is part of this measurement
162 {
163 
164 
165  for( unsigned int i = 0; i < fChannels.size(); ++i ) {
166 
167  Channel& chan = fChannels.at(i);
168  if( chan.GetName() == ChanName ) {
169  return true;
170  }
171 
172  }
173 
174  return false;
175 
176 }
177 
178 
179 /// Get channel with given name from this measurement
180 /// throws an exception in case the channel is not found
182 {
183  for( unsigned int i = 0; i < fChannels.size(); ++i ) {
184 
185  Channel& chan = fChannels.at(i);
186  if( chan.GetName() == ChanName ) {
187  return chan;
188  }
189 
190  }
191 
192  // If we get here, we didn't find the channel
193 
194  cxcoutEHF << "Error: Did not find channel: " << ChanName
195  << " in measurement: " << GetName() << std::endl;
196  throw hf_exc();
197 
198  // No Need to return after throwing exception
199  // return RooStats::HistFactory::BadChannel;
200 
201 
202 }
203 
204 /*
205  void RooStats::HistFactory::Measurement::Print( Option_t* option ) const {
206  RooStats::HistFactory::Measurement::Print( std::cout );
207  return;
208  }
209 */
210 
211 /// Print information about measurement object in tree-like structure to given stream
213 {
214 
215 
216  stream << "Measurement Name: " << GetName()
217  << "\t OutputFilePrefix: " << fOutputFilePrefix
218  << "\t POI: ";
219  for(unsigned int i = 0; i < fPOI.size(); ++i) {
220  stream << fPOI.at(i);
221  }
222  stream << "\t Lumi: " << fLumi
223  << "\t LumiRelErr: " << fLumiRelErr
224  << "\t BinLow: " << fBinLow
225  << "\t BinHigh: " << fBinHigh
226  << "\t ExportOnly: " << fExportOnly
227  << std::endl;
228 
229 
230  if( fConstantParams.size() != 0 ) {
231  stream << "Constant Params: ";
232  for( unsigned int i = 0; i < fConstantParams.size(); ++i ) {
233  stream << " " << fConstantParams.at(i);
234  }
235  stream << std::endl;
236  }
237 
238  if( fFunctionObjects.size() != 0 ) {
239  stream << "Preprocess Functions: ";
240  for( unsigned int i = 0; i < fFunctionObjects.size(); ++i ) {
241  stream << " " << fFunctionObjects.at(i).GetCommand();
242  }
243  stream << std::endl;
244  }
245 
246  if( fChannels.size() != 0 ) {
247  stream << "Channels:" << std::endl;
248  for( unsigned int i = 0; i < fChannels.size(); ++i ) {
249  fChannels.at(i).Print( stream );
250  }
251  }
252 
253  cxcoutIHF << "End Measurement: " << GetName() << std::endl;
254 
255 }
256 
257 
258 /// Create XML files for this measurement in the given directory.
259 /// XML files can be configured with a different output prefix
260 /// Create an XML file for this measurement
261 /// First, create the XML driver
262 /// Then, create xml files for each channel
263 void RooStats::HistFactory::Measurement::PrintXML( std::string directory, std::string newOutputPrefix )
264 {
265  // First, check that the directory exists:
266  auto testExists = [](const std::string& theDirectory) {
267  void* dir = gSystem->OpenDirectory(theDirectory.c_str());
268  bool exists = dir != nullptr;
269  if (exists)
270  gSystem->FreeDirectory(dir);
271 
272  return exists;
273  };
274 
275  if ( !directory.empty() && !testExists(directory) ) {
276  int success = gSystem->MakeDirectory(directory.c_str() );
277  if( success != 0 ) {
278  cxcoutEHF << "Error: Failed to make directory: " << directory << std::endl;
279  throw hf_exc();
280  }
281  }
282 
283  // If supplied new Prefix, use that one:
284 
285  cxcoutPHF << "Printing XML Files for measurement: " << GetName() << std::endl;
286 
287  std::string XMLName = std::string(GetName()) + ".xml";
288  if( directory != "" ) XMLName = directory + "/" + XMLName;
289 
290  ofstream xml( XMLName.c_str() );
291 
292  if( ! xml.is_open() ) {
293  cxcoutEHF << "Error opening xml file: " << XMLName << std::endl;
294  throw hf_exc();
295  }
296 
297 
298  // Add the time
299  xml << "<!--" << std::endl;
300  xml << "This xml file created automatically on: " << std::endl;
301 /*
302  time_t t = time(0); // get time now
303  struct tm * now = localtime( &t );
304  xml << (now->tm_year + 1900) << '-'
305  << (now->tm_mon + 1) << '-'
306  << now->tm_mday
307  << std::endl;
308 */
309  // LM: use TTimeStamp
310  TTimeStamp t;
311  UInt_t year = 0;
312  UInt_t month = 0;
313  UInt_t day = 0;
314  t.GetDate(true, 0, &year, &month, &day);
315  xml << year << '-'
316  << month << '-'
317  << day
318  << std::endl;
319 
320  xml << "-->" << std::endl;
321 
322  // Add the doctype
323  xml << "<!DOCTYPE Combination SYSTEM 'HistFactorySchema.dtd'>" << std::endl << std::endl;
324 
325  // Add the combination name
326  if (newOutputPrefix.empty() ) newOutputPrefix = fOutputFilePrefix;
327  xml << "<Combination OutputFilePrefix=\"" << newOutputPrefix /*OutputFilePrefix*/ << "\" >" << std::endl << std::endl;
328 
329  // Add the Preprocessed Functions
330  for( unsigned int i = 0; i < fFunctionObjects.size(); ++i ) {
331  RooStats::HistFactory::PreprocessFunction func = fFunctionObjects.at(i);
332  func.PrintXML(xml);
333  /*
334  xml << "<Function Name=\"" << func.GetName() << "\" "
335  << "Expression=\"" << func.GetExpression() << "\" "
336  << "Dependents=\"" << func.GetDependents() << "\" "
337  << "/>" << std::endl;
338  */
339  }
340 
341  xml << std::endl;
342 
343  // Add the list of channels
344  for( unsigned int i = 0; i < fChannels.size(); ++i ) {
345  xml << " <Input>" << "./";
346  if (!directory.empty() ) xml << directory << "/";
347  xml << GetName() << "_" << fChannels.at(i).GetName() << ".xml" << "</Input>" << std::endl;
348  }
349 
350  xml << std::endl;
351 
352  // Open the Measurement, Set Lumi
353  xml << " <Measurement Name=\"" << GetName() << "\" "
354  << "Lumi=\"" << fLumi << "\" "
355  << "LumiRelErr=\"" << fLumiRelErr << "\" "
356  //<< "BinLow=\"" << fBinLow << "\" "
357  // << "BinHigh=\"" << fBinHigh << "\" "
358  << "ExportOnly=\"" << (fExportOnly ? std::string("True") : std::string("False")) << "\" "
359  << " >" << std::endl;
360 
361 
362  // Set the POI
363  xml << " <POI>" ;
364  for(unsigned int i = 0; i < fPOI.size(); ++i) {
365  if(i==0) xml << fPOI.at(i);
366  else xml << " " << fPOI.at(i);
367  }
368  xml << "</POI> " << std::endl;
369 
370  // Set the Constant Parameters
371  if(fConstantParams.size()) {
372  xml << " <ParamSetting Const=\"True\">";
373  for( unsigned int i = 0; i < fConstantParams.size(); ++i ) {
374  if (i==0) xml << fConstantParams.at(i);
375  else xml << " " << fConstantParams.at(i);;
376  }
377  xml << "</ParamSetting>" << std::endl;
378  }
379 
380  // Set the Parameters with new Constraint Terms
381  std::map<std::string, double>::iterator ConstrItr;
382 
383  // Gamma
384  for( ConstrItr = fGammaSyst.begin(); ConstrItr != fGammaSyst.end(); ++ConstrItr ) {
385  xml << "<ConstraintTerm Type=\"Gamma\" RelativeUncertainty=\""
386  << ConstrItr->second << "\">" << ConstrItr->first
387  << "</ConstraintTerm>" << std::endl;
388  }
389  // Uniform
390  for( ConstrItr = fUniformSyst.begin(); ConstrItr != fUniformSyst.end(); ++ConstrItr ) {
391  xml << "<ConstraintTerm Type=\"Uniform\" RelativeUncertainty=\""
392  << ConstrItr->second << "\">" << ConstrItr->first
393  << "</ConstraintTerm>" << std::endl;
394  }
395  // LogNormal
396  for( ConstrItr = fLogNormSyst.begin(); ConstrItr != fLogNormSyst.end(); ++ConstrItr ) {
397  xml << "<ConstraintTerm Type=\"LogNormal\" RelativeUncertainty=\""
398  << ConstrItr->second << "\">" << ConstrItr->first
399  << "</ConstraintTerm>" << std::endl;
400  }
401  // NoSyst
402  for( ConstrItr = fNoSyst.begin(); ConstrItr != fNoSyst.end(); ++ConstrItr ) {
403  xml << "<ConstraintTerm Type=\"NoSyst\" RelativeUncertainty=\""
404  << ConstrItr->second << "\">" << ConstrItr->first
405  << "</ConstraintTerm>" << std::endl;
406  }
407 
408 
409  // Close the Measurement
410  xml << " </Measurement> " << std::endl << std::endl;
411 
412  // Close the combination
413  xml << "</Combination>" << std::endl;
414 
415  xml.close();
416 
417  // Now, make the xml files
418  // for the individual channels:
419 
420  std::string prefix = std::string(GetName()) + "_";
421 
422  for( unsigned int i = 0; i < fChannels.size(); ++i ) {
423  fChannels.at(i).PrintXML( directory, prefix );
424  }
425 
426 
427  cxcoutPHF << "Finished printing XML files" << std::endl;
428 
429 }
430 
431 
432 /// A measurement, once fully configured, can be saved into a ROOT
433 /// file. This will persitify the Measurement object, along with any
434 /// channels and samples that have been added to it. It can then be
435 /// loaded, potentially modified, and used to create new models.
436 ///
437 /// Write every histogram to the file.
438 /// Edit the measurement to point to this file
439 /// and to point to each histogram in this file
440 /// Then write the measurement itself.
442 {
443 
444  // Create a tempory measurement
445  // (This is the one that is actually written)
446  RooStats::HistFactory::Measurement outMeas( *this );
447 
448  std::string OutputFileName = file->GetName();
449 
450  // Collect all histograms from file:
451  // HistCollector collector;
452 
453 
454  for( unsigned int chanItr = 0; chanItr < outMeas.fChannels.size(); ++chanItr ) {
455 
456  // Go to the main directory
457  // in the file
458  file->cd();
459  file->Flush();
460 
461  // Get the name of the channel:
462  RooStats::HistFactory::Channel& channel = outMeas.fChannels.at( chanItr );
463  std::string chanName = channel.GetName();
464 
465 
466  if( ! channel.CheckHistograms() ) {
467  cxcoutEHF << "Measurement.writeToFile(): Channel: " << chanName
468  << " has uninitialized histogram pointers" << std::endl;
469  throw hf_exc();
470  return;
471  }
472 
473  // Get and cache the histograms for this channel:
474  //collector.CollectHistograms( channel );
475  // Do I need this...?
476  // channel.CollectHistograms();
477 
478  // Make a directory to store the histograms
479  // for this channel
480 
481  TDirectory* chanDir = file->mkdir( (chanName + "_hists").c_str() );
482  if( chanDir == NULL ) {
483  cxcoutEHF << "Error: Cannot create channel " << (chanName + "_hists")
484  << std::endl;
485  throw hf_exc();
486  }
487  chanDir->cd();
488 
489  // Save the data:
490  TDirectory* dataDir = chanDir->mkdir( "data" );
491  if( dataDir == NULL ) {
492  cxcoutEHF << "Error: Cannot make directory " << chanDir << std::endl;
493  throw hf_exc();
494  }
495  dataDir->cd();
496 
497  channel.fData.writeToFile( OutputFileName, GetDirPath(dataDir) );
498 
499  /*
500  // Write the data file to this directory
501  TH1* hData = channel.data.GetHisto();
502  hData->Write();
503 
504  // Set the location of the data
505  // in the output measurement
506 
507  channel.data.InputFile = OutputFileName;
508  channel.data.HistoName = hData->GetName();
509  channel.data.HistoPath = GetDirPath( dataDir );
510  */
511 
512  // Loop over samples:
513 
514  for( unsigned int sampItr = 0; sampItr < channel.GetSamples().size(); ++sampItr ) {
515 
516  RooStats::HistFactory::Sample& sample = channel.GetSamples().at( sampItr );
517  std::string sampName = sample.GetName();
518 
519  cxcoutPHF << "Writing sample: " << sampName << std::endl;
520 
521  file->cd();
522  chanDir->cd();
523  TDirectory* sampleDir = chanDir->mkdir( sampName.c_str() );
524  if( sampleDir == NULL ) {
525  cxcoutEHF << "Error: Directory " << sampName << " not created properly" << std::endl;
526  throw hf_exc();
527  }
528  std::string sampleDirPath = GetDirPath( sampleDir );
529 
530  if( ! sampleDir ) {
531  cxcoutEHF << "Error making directory: " << sampName
532  << " in directory: " << chanName
533  << std::endl;
534  throw hf_exc();
535  }
536 
537  // Write the data file to this directory
538  sampleDir->cd();
539 
540  sample.writeToFile( OutputFileName, sampleDirPath );
541  /*
542  TH1* hSample = sample.GetHisto();
543  if( ! hSample ) {
544  std::cout << "Error getting histogram for sample: "
545  << sampName << std::endl;
546  throw -1;
547  }
548  sampleDir->cd();
549  hSample->Write();
550 
551  sample.InputFile = OutputFileName;
552  sample.HistoName = hSample->GetName();
553  sample.HistoPath = sampleDirPath;
554  */
555 
556  // Write the histograms associated with
557  // systematics
558 
559  /* THIS IS WHAT I"M COMMENTING
560  sample.GetStatError().writeToFile( OutputFileName, sampleDirPath );
561 
562  // Must write all systematics that contain internal histograms
563  // (This is not all systematics)
564 
565  for( unsigned int i = 0; i < sample.GetHistoSysList().size(); ++i ) {
566  sample.GetHistoSysList().at(i).writeToFile( OutputFileName, sampleDirPath );
567  }
568  for( unsigned int i = 0; i < sample.GetHistoFactorList().size(); ++i ) {
569  sample.GetHistoFactorList().at(i).writeToFile( OutputFileName, sampleDirPath );
570  }
571  for( unsigned int i = 0; i < sample.GetShapeSysList().size(); ++i ) {
572  sample.GetShapeSysList().at(i).writeToFile( OutputFileName, sampleDirPath );
573  }
574  END COMMENT */
575  /*
576  sample.statError.writeToFile( OutputFileName, sampleDirPath );
577 
578  // Now, get the Stat config histograms
579  if( sample.statError.HistoName != "" ) {
580  TH1* hStatError = sample.statError.GetErrorHist();
581  if( ! hStatError ) {
582  std::cout << "Error getting stat error histogram for sample: "
583  << sampName << std::endl;
584  throw -1;
585  }
586  hStatError->Write();
587 
588  sample.statError.InputFile = OutputFileName;
589  sample.statError.HistoName = hStatError->GetName();
590  sample.statError.HistoPath = sampleDirPath;
591 
592  }
593  */
594 
595  }
596 
597  }
598 
599 
600  // Finally, write the measurement itself:
601 
602  cxcoutPHF << "Saved all histograms" << std::endl;
603 
604  file->cd();
605  outMeas.Write();
606 
607  cxcoutPHF << "Saved Measurement" << std::endl;
608 
609 }
610 
611 /// Return the directory's path,
612 /// stripped of unnecessary prefixes
614 {
615 
616 
617  std::string path = dir->GetPath();
618 
619  if( path.find(":") != std::string::npos ) {
620  size_t index = path.find(":");
621  path.replace( 0, index+1, "" );
622  }
623 
624  path = path + "/";
625 
626  return path;
627 
628  /*
629  if( path.find(":") != std::string::npos ) {
630  size_t index = path.find(":");
631  SampleName.replace( 0, index, "" );
632  }
633 
634  // Remove the file:
635  */
636 
637 }
638 
639 
640 /// The most common way to add histograms to channels is to have them
641 /// stored in ROOT files and to give HistFactory the location of these
642 /// files. This means providing the path to the ROOT file and the path
643 /// and name of the histogram within that file. When providing these
644 /// in a script, HistFactory doesn't load the histogram from the file
645 /// right away. Instead, once all such histograms have been supplied,
646 /// one should run this method to open all ROOT files and to copy and
647 /// save all necessary histograms.
649 {
650 
651 
652  for( unsigned int chanItr = 0; chanItr < fChannels.size(); ++chanItr) {
653 
654  RooStats::HistFactory::Channel& chan = fChannels.at( chanItr );
655 
656  chan.CollectHistograms();
657 
658  }
659 
660 }
661 
662 
663 
RooStats::HistFactory::Sample
Definition: Sample.h:27
RooStats::HistFactory::Measurement::PrintXML
void PrintXML(std::string Directory="", std::string NewOutputPrefix="")
Print to a stream.
Definition: Measurement.cxx:263
TDirectory::mkdir
virtual TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE)
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
Definition: TDirectory.cxx:1042
RooStats::HistFactory::PreprocessFunction::PrintXML
void PrintXML(std::ostream &)
Definition: PreprocessFunction.cxx:41
RooStats::HistFactory::Measurement::AddNoSyst
void AddNoSyst(std::string syst)
Define given systematics to have no external constraint.
Definition: Measurement.cxx:155
RooStats::HistFactory::Measurement::PrintTree
void PrintTree(std::ostream &=std::cout)
Print information about measurement object in tree-like structure to given stream.
Definition: Measurement.cxx:212
RooStats::HistFactory::Channel::GetSamples
std::vector< RooStats::HistFactory::Sample > & GetSamples()
get vector of samples for this channel
Definition: Channel.h:75
TTimeStamp.h
TSystem::FreeDirectory
virtual void FreeDirectory(void *dirp)
Free a directory.
Definition: TSystem.cxx:844
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TTimeStamp::GetDate
UInt_t GetDate(Bool_t inUTC=kTRUE, Int_t secOffset=0, UInt_t *year=0, UInt_t *month=0, UInt_t *day=0) const
Return date in form of 19971224 (i.e.
Definition: TTimeStamp.cxx:353
RooStats::HistFactory::Measurement::GetPreprocessFunctions
std::vector< std::string > GetPreprocessFunctions()
Returns a list of defined preprocess function expressions.
Definition: Measurement.cxx:124
HFMsgService.h
cxcoutIHF
#define cxcoutIHF
Definition: HFMsgService.h:17
xmlio::Title
const char * Title
Definition: TXMLSetup.cxx:74
HistFactoryException.h
RooStats::HistFactory::hf_exc
Definition: HistFactoryException.h:34
TSystem::MakeDirectory
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TSystem.cxx:826
TDirectory::cd
virtual Bool_t cd(const char *path=nullptr)
Change current directory to "this" directory.
Definition: TDirectory.cxx:498
RooStats::HistFactory::Channel::CollectHistograms
void CollectHistograms()
Definition: Channel.cxx:219
RooStats::HistFactory::Data::writeToFile
void writeToFile(std::string FileName, std::string DirName)
Definition: Data.cxx:44
RooStats::HistFactory::Channel
Definition: Channel.h:30
cxcoutWHF
#define cxcoutWHF
Definition: HFMsgService.h:19
RooStats::HistFactory::Measurement::GetDirPath
std::string GetDirPath(TDirectory *dir)
Return the directory's path, stripped of unnecessary prefixes.
Definition: Measurement.cxx:613
RooStats::HistFactory::Measurement::AddGammaSyst
void AddGammaSyst(std::string syst, double uncert)
Set constraint term for given systematic to Gamma distribution.
Definition: Measurement.cxx:137
cxcoutEHF
#define cxcoutEHF
Definition: HFMsgService.h:20
RooStats::HistFactory::Measurement
Definition: Measurement.h:42
RooStats::HistFactory::Measurement::AddLogNormSyst
void AddLogNormSyst(std::string syst, double uncert)
Set constraint term for given systematic to LogNormal distribution.
Definition: Measurement.cxx:143
TSystem.h
Measurement.h
cxcoutPHF
#define cxcoutPHF
Definition: HFMsgService.h:18
RooStats::HistFactory::Measurement::AddPreprocessFunction
void AddPreprocessFunction(std::string name, std::string expression, std::string dependencies)
Add a preprocessed function by giving the function a name, a functional expression,...
Definition: Measurement.cxx:114
TNamed
Definition: TNamed.h:29
RooStats::HistFactory::Measurement::HasChannel
bool HasChannel(std::string)
Check if the given channel is part of this measurement.
Definition: Measurement.cxx:161
RooStats::HistFactory::Measurement::AddConstantParam
void AddConstantParam(const std::string &param)
Add a parameter to be set as constant (Similar to ParamSetting method below)
Definition: Measurement.cxx:71
RooStats::HistFactory::Channel::GetName
std::string GetName()
get name of channel
Definition: Channel.h:43
TFile
Definition: TFile.h:54
RooStats::HistFactory::Measurement::SetParamValue
void SetParamValue(const std::string &param, double value)
Set a parameter to a specific value (And optionally fix it)
Definition: Measurement.cxx:89
RooStats::HistFactory::Sample::GetName
std::string GetName() const
get name of sample
Definition: Sample.h:83
TDirectory::GetPath
virtual const char * GetPath() const
Returns the full path of the directory.
Definition: TDirectory.cxx:988
unsigned int
gSystem
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
RooStats::HistFactory::Measurement::writeToFile
void writeToFile(TFile *file)
A measurement, once fully configured, can be saved into a ROOT file.
Definition: Measurement.cxx:441
RooStats::HistFactory::Measurement::GetChannel
RooStats::HistFactory::Channel & GetChannel(std::string)
Get channel with given name from this measurement throws an exception in case the channel is not foun...
Definition: Measurement.cxx:181
xmlio::Name
const char * Name
Definition: TXMLSetup.cxx:73
RooStats::HistFactory::Channel::CheckHistograms
bool CheckHistograms()
Definition: Channel.cxx:333
TSystem::OpenDirectory
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition: TSystem.cxx:835
file
Definition: file.py:1
TObject::Write
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:795
name
char name[80]
Definition: TGX11.cxx:110
TDirectory
Definition: TDirectory.h:40
RooStats::HistFactory::PreprocessFunction
Definition: PreprocessFunction.h:11
RooStats::HistFactory::Measurement::CollectHistograms
void CollectHistograms()
The most common way to add histograms to channels is to have them stored in ROOT files and to give Hi...
Definition: Measurement.cxx:648
RooStats::HistFactory::Measurement::Measurement
Measurement()
Standard constructor.
Definition: Measurement.cxx:38
TTimeStamp
Definition: TTimeStamp.h:71
RooStats::HistFactory::Channel::fData
HistFactory::Data fData
Definition: Channel.h:89
RooStats::HistFactory::Sample::writeToFile
void writeToFile(std::string FileName, std::string DirName)
Definition: Sample.cxx:105
RooStats::HistFactory::Measurement::fChannels
std::vector< RooStats::HistFactory::Channel > fChannels
Channels that make up this measurement.
Definition: Measurement.h:158
RooStats::HistFactory::Measurement::AddUniformSyst
void AddUniformSyst(std::string syst)
Set constraint term for given systematic to uniform distribution.
Definition: Measurement.cxx:149