74 cxcoutWHF <<
"Warning: Setting parameter: " << param
75 <<
" to constant, but it is already listed as constant. "
76 <<
"You may ignore this warning."
93 if( fParamValues.find(param) != fParamValues.end() ) {
94 cxcoutWHF <<
"Warning: Chainging parameter: " << param
95 <<
" value from: " << fParamValues[param]
101 cxcoutIHF <<
"Setting parameter: " << param
102 <<
" value to " <<
value
105 fParamValues[param] =
value;
117 AddFunctionObject(func);
135void RooStats::HistFactory::Measurement::AddGammaSyst(std::string
syst,
double uncert)
141void RooStats::HistFactory::Measurement::AddLogNormSyst(std::string
syst,
double uncert)
147void RooStats::HistFactory::Measurement::AddUniformSyst(std::string
syst)
153void RooStats::HistFactory::Measurement::AddNoSyst(std::string
syst)
159bool RooStats::HistFactory::Measurement::HasChannel( std::string
ChanName )
163 for(
unsigned int i = 0; i <
fChannels.size(); ++i ) {
181 for(
unsigned int i = 0; i <
fChannels.size(); ++i ) {
193 <<
" in measurement: " << GetName() << std::endl;
210void RooStats::HistFactory::Measurement::PrintTree( std::ostream& stream )
214 stream <<
"Measurement Name: " << GetName()
217 for(
unsigned int i = 0; i < fPOI.size(); ++i) {
218 stream << fPOI.at(i);
220 stream <<
"\t Lumi: " <<
fLumi
229 stream <<
"Constant Params: ";
237 stream <<
"Preprocess Functions: ";
245 stream <<
"Channels:" << std::endl;
246 for(
unsigned int i = 0; i <
fChannels.size(); ++i ) {
251 cxcoutIHF <<
"End Measurement: " << GetName() << std::endl;
266 bool exists = dir !=
nullptr;
283 cxcoutPHF <<
"Printing XML Files for measurement: " << GetName() << std::endl;
285 std::string
XMLName = std::string(GetName()) +
".xml";
290 if( !
xml.is_open() ) {
297 xml <<
"<!--" << std::endl;
298 xml <<
"This xml file created automatically on: " << std::endl;
318 xml <<
"-->" << std::endl;
321 xml <<
"<!DOCTYPE Combination SYSTEM 'HistFactorySchema.dtd'>" << std::endl << std::endl;
325 xml <<
"<Combination OutputFilePrefix=\"" <<
newOutputPrefix <<
"\" >" << std::endl << std::endl;
342 for(
unsigned int i = 0; i <
fChannels.size(); ++i ) {
343 xml <<
" <Input>" <<
"./";
345 xml << GetName() <<
"_" <<
fChannels.at(i).GetName() <<
".xml" <<
"</Input>" << std::endl;
351 xml <<
" <Measurement Name=\"" << GetName() <<
"\" "
352 <<
"Lumi=\"" <<
fLumi <<
"\" "
356 <<
"ExportOnly=\"" << (
fExportOnly ? std::string(
"True") : std::string(
"False")) <<
"\" "
357 <<
" >" << std::endl;
362 for(
unsigned int i = 0; i < fPOI.size(); ++i) {
363 if(i==0)
xml << fPOI.at(i);
364 else xml <<
" " << fPOI.at(i);
366 xml <<
"</POI> " << std::endl;
370 xml <<
" <ParamSetting Const=\"True\">";
375 xml <<
"</ParamSetting>" << std::endl;
379 std::map<std::string, double>::iterator
ConstrItr;
383 xml <<
"<ConstraintTerm Type=\"Gamma\" RelativeUncertainty=\""
385 <<
"</ConstraintTerm>" << std::endl;
389 xml <<
"<ConstraintTerm Type=\"Uniform\" RelativeUncertainty=\""
391 <<
"</ConstraintTerm>" << std::endl;
395 xml <<
"<ConstraintTerm Type=\"LogNormal\" RelativeUncertainty=\""
397 <<
"</ConstraintTerm>" << std::endl;
401 xml <<
"<ConstraintTerm Type=\"NoSyst\" RelativeUncertainty=\""
403 <<
"</ConstraintTerm>" << std::endl;
408 xml <<
" </Measurement> " << std::endl << std::endl;
411 xml <<
"</Combination>" << std::endl;
418 std::string prefix = std::string(GetName()) +
"_";
420 for(
unsigned int i = 0; i <
fChannels.size(); ++i ) {
425 cxcoutPHF <<
"Finished printing XML files" << std::endl;
439void RooStats::HistFactory::Measurement::writeToFile(
TFile* file )
466 <<
" has uninitialized histogram pointers" << std::endl;
523 cxcoutEHF <<
"Error: Directory " <<
sampName <<
" not created properly" << std::endl;
600 cxcoutPHF <<
"Saved all histograms" << std::endl;
605 cxcoutPHF <<
"Saved Measurement" << std::endl;
611std::string RooStats::HistFactory::Measurement::GetDirPath(
TDirectory* dir )
615 std::string path = dir->
GetPath();
617 if( path.find(
':') != std::string::npos ) {
618 size_t index = path.find(
':');
619 path.replace( 0,
index+1,
"" );
646void RooStats::HistFactory::Measurement::CollectHistograms() {
653 chan.CollectHistograms();
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
R__EXTERN TSystem * gSystem
const_iterator begin() const
const_iterator end() const
This class encapsulates all information for the statistical interpretation of one experiment.
bool CheckHistograms() const
std::vector< RooStats::HistFactory::Sample > & GetSamples()
get vector of samples for this channel
std::string GetName() const
get name of channel
void writeToFile(std::string FileName, std::string DirName)
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
void SetParamValue(const std::string ¶m, double value)
Set a parameter to a specific value (And optionally fix it)
Measurement()
Standard constructor.
void AddConstantParam(const std::string ¶m)
Add a parameter to be set as constant (Similar to ParamSetting method below)
void AddPreprocessFunction(std::string name, std::string expression, std::string dependencies)
Add a preprocessed function by giving the function a name, a functional expression,...
std::vector< std::string > GetPreprocessFunctions() const
Returns a list of defined preprocess function expressions.
void PrintXML(std::ostream &) const
Bool_t cd() override
Change current directory to "this" directory.
TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE) override
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
Describe directory structure in memory.
virtual const char * GetPath() const
Returns the full path of the directory.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
virtual void Flush()
Synchronize a file's in-memory and on-disk states.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
virtual void FreeDirectory(void *dirp)
Free a directory.
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual int MakeDirectory(const char *name)
Make a directory.
The TTimeStamp encapsulates seconds and ns since EPOCH.
UInt_t GetDate(Bool_t inUTC=kTRUE, Int_t secOffset=0, UInt_t *year=nullptr, UInt_t *month=nullptr, UInt_t *day=nullptr) const
Return date in form of 19971224 (i.e.