11#ifndef HISTFACTORY_MEASUREMENT_H
12#define HISTFACTORY_MEASUREMENT_H
56 void Print(std::ostream & = std::cout)
const;
83 void Print(std::ostream & = std::cout)
const;
113 virtual void Print(std::ostream & = std::cout)
const;
115 virtual void writeToFile(
const std::string &FileName,
const std::string &DirName);
166 void PrintXML(std::ostream &)
const override;
175 void PrintXML(std::ostream &)
const override;
206 void Print(std::ostream & = std::cout)
const override;
207 void PrintXML(std::ostream &)
const override;
208 void writeToFile(
const std::string &FileName,
const std::string &DirName)
override;
227 void Print(std::ostream & = std::cout)
const override;
228 void PrintXML(std::ostream &)
const override;
229 void writeToFile(
const std::string &FileName,
const std::string &DirName)
override;
275 void Print(std::ostream & = std::cout)
const override;
276 void PrintXML(std::ostream &)
const override;
277 void writeToFile(
const std::string &FileName,
const std::string &DirName)
override;
312 void Print(std::ostream & = std::cout)
const;
313 void PrintXML(std::ostream &)
const;
383 PreprocessFunction(std::string
const &
name, std::string
const &expression, std::string
const &dependents);
385 void Print(std::ostream & = std::cout)
const;
386 void PrintXML(std::ostream &)
const;
426 void Print(std::ostream & = std::cout);
427 void PrintXML(std::ostream &)
const;
428 void writeToFile(std::string FileName, std::string DirName);
456 void Print(std::ostream & = std::cout)
const;
458 void writeToFile(std::string FileName, std::string DirName);
472 void AddOverallSys(std::string Name,
double Low,
double High);
475 void AddNormFactor(std::string
const &Name,
double Val,
double Low,
double High);
623 void Print(std::ostream & = std::cout);
624 void PrintXML(std::string
const &
directory, std::string
const &prefix =
"")
const;
642 std::vector<RooStats::HistFactory::Sample>
fSamples;
645 std::map<std::string, std::unique_ptr<TFile>> &
lsof);
655 Measurement(
const char *Name,
const char *Title =
"");
667 std::string
GetPOI(
unsigned int i = 0) {
return fPOI.at(i); }
721 void PrintTree(std::ostream & = std::cout);
#define ClassDefOverride(name, id)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
TODO Here, we are missing some documentation.
void SetName(const std::string &name)
void SetParamValue(const std::string ¶m, double value)
Asimov(std::string Name="")
std::map< std::string, double > fParamValsToSet
std::map< std::string, double > & GetParamsToSet()
void ConfigureWorkspace(RooWorkspace *)
std::map< std::string, bool > fParamsToFix
void SetFixedParam(const std::string ¶m, bool constant=true)
std::map< std::string, bool > & GetParamsToFix()
This class encapsulates all information for the statistical interpretation of one experiment.
void SetName(const std::string &Name)
set name of channel
std::vector< RooStats::HistFactory::Sample > fSamples
std::vector< RooStats::HistFactory::Data > fAdditionalData
One can add additional datasets These are simply added to the xml under a different name.
const RooStats::HistFactory::Data & GetData() const
std::vector< RooStats::HistFactory::Data > & GetAdditionalData()
retrieve vector of additional data objects
void Print(std::ostream &=std::cout)
const HistFactory::StatErrorConfig & GetStatErrorConfig() const
HistFactory::StatErrorConfig & GetStatErrorConfig()
get information about threshold for statistical uncertainties and constraint term
RooStats::HistFactory::Data & GetData()
get data object
void AddAdditionalData(const RooStats::HistFactory::Data &data)
add additional data object
std::string GetInputFile() const
get name of input file
HistFactory::StatErrorConfig fStatErrorConfig
std::string GetHistoPath() const
get path to histograms in input file
void SetData(const RooStats::HistFactory::Data &data)
set data object
void SetInputFile(const std::string &file)
set name of input file containing histograms
void AddSample(RooStats::HistFactory::Sample sample)
bool CheckHistograms() const
TH1 * GetHistogram(std::string InputFile, std::string HistoPath, std::string HistoName, std::map< std::string, std::unique_ptr< TFile > > &lsof)
Open a file and copy a histogram.
const std::vector< RooStats::HistFactory::Sample > & GetSamples() const
void SetStatErrorConfig(double RelErrorThreshold, Constraint::Type ConstraintType)
void PrintXML(std::string const &directory, std::string const &prefix="") const
std::vector< RooStats::HistFactory::Sample > & GetSamples()
get vector of samples for this channel
void SetHistoPath(const std::string &file)
set path for histograms in input file
void SetStatErrorConfig(RooStats::HistFactory::StatErrorConfig Config)
define treatment of statistical uncertainties
std::string GetName() const
get name of channel
void Print(std::ostream &=std::cout)
std::string const & GetInputFile() const
void PrintXML(std::ostream &) const
void SetInputFile(const std::string &InputFile)
void SetHistoPath(const std::string &HistoPath)
void writeToFile(std::string FileName, std::string DirName)
void SetName(const std::string &name)
std::string const & GetHistoName() const
void SetHistoName(const std::string &HistoName)
std::string const & GetHistoPath() const
std::string const & GetName() const
Internal class wrapping an histogram and managing its content.
HistRef(TH1 *h=nullptr)
constructor - use gives away ownerhip of the given pointer
HistRef & operator=(const HistRef &other)
assignment operator (delete previous contained histogram)
void SetObject(TH1 *h)
set the object - user gives away the ownerhisp
std::unique_ptr< TH1 > fHist
pointer to contained histogram
static TH1 * CopyObject(const TH1 *h)
TH1 * ReleaseObject()
Release ownership of object.
Configuration for an *un*constrained, coherent shape variation of affected samples.
void PrintXML(std::ostream &) const override
Configuration for a constrained, coherent shape variation of affected samples.
void PrintXML(std::ostream &) const override
////////////////////////////////////////////////////////////////////////////////////////////Base clas...
void SetInputFileHigh(const std::string &InputFileHigh)
std::unique_ptr< TH1 > fhHigh
void SetHistoHigh(TH1 *High)
void SetName(const std::string &Name)
std::string fHistoPathHigh
virtual void writeToFile(const std::string &FileName, const std::string &DirName)
std::string fInputFileLow
virtual void PrintXML(std::ostream &) const =0
void SetHistoPathHigh(const std::string &HistoPathHigh)
HistogramUncertaintyBase()
std::string fHistoPathLow
const std::string & GetName() const
void SetInputFileLow(const std::string &InputFileLow)
const TH1 * GetHistoHigh() const
const std::string & GetHistoNameHigh() const
std::string fHistoNameLow
std::string fHistoNameHigh
const std::string & GetHistoNameLow() const
std::string fInputFileHigh
void SetHistoNameHigh(const std::string &HistoNameHigh)
void SetHistoNameLow(const std::string &HistoNameLow)
virtual void Print(std::ostream &=std::cout) const
HistogramUncertaintyBase & operator=(const HistogramUncertaintyBase &oth)
const std::string & GetHistoPathLow() const
HistogramUncertaintyBase & operator=(HistogramUncertaintyBase &&)
const std::string & GetInputFileHigh() const
const std::string & GetInputFileLow() const
void SetHistoPathLow(const std::string &HistoPathLow)
void SetHistoLow(TH1 *Low)
std::unique_ptr< TH1 > fhLow
const std::string & GetHistoPathHigh() const
HistogramUncertaintyBase(HistogramUncertaintyBase &&)
const TH1 * GetHistoLow() const
virtual ~HistogramUncertaintyBase()
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
void writeToFile(TFile *file)
A measurement, once fully configured, can be saved into a ROOT file.
std::map< std::string, double > fUniformSyst
std::map< std::string, double > const & GetNoSyst() const
std::map< std::string, double > const & GetGammaSyst() const
std::string fOutputFilePrefix
Configurables of this measurement.
void AddGammaSyst(std::string syst, double uncert)
Set constraint term for given systematic to Gamma distribution.
void ClearParamValues()
clear map of parameter values
std::map< std::string, double > & GetGammaSyst()
std::map< std::string, double > & GetLogNormSyst()
std::string GetDirPath(TDirectory *dir)
Return the directory's path, stripped of unnecessary prefixes.
std::map< std::string, double > const & GetLogNormSyst() const
std::map< std::string, double > & GetParamValues()
get map: parameter name <--> parameter value
std::map< std::string, double > fNoSyst
std::map< std::string, double > & GetNoSyst()
const std::vector< RooStats::HistFactory::PreprocessFunction > & GetFunctionObjects() const
std::vector< RooStats::HistFactory::Channel > fChannels
Channels that make up this measurement.
void AddPOI(const std::string &POI)
append parameter to vector of PoIs
std::vector< std::string > & GetPOIList()
get vector of PoI names
void AddLogNormSyst(std::string syst, double uncert)
Set constraint term for given systematic to LogNormal distribution.
void PrintXML(std::string Directory="", std::string NewOutputPrefix="")
Print to a stream.
void SetLumi(double Lumi)
set integrated luminosity used to normalise histograms (if NormalizeByTheory is true for this sample)
void SetParamValue(const std::string ¶m, double value)
Set a parameter to a specific value (And optionally fix it)
std::map< std::string, double > fGammaSyst
List of Alternate constraint terms.
double GetLumiRelErr()
retrieve relative uncertainty on luminosity
std::map< std::string, double > fParamValues
Map of parameter names to initial values to be set.
std::map< std::string, double > & GetUniformSyst()
std::string fInterpolationScheme
std::vector< std::string > & GetConstantParams()
get vector of all constant parameters
void CollectHistograms()
The most common way to add histograms to channels is to have them stored in ROOT files and to give Hi...
const std::vector< RooStats::HistFactory::Channel > & GetChannels() const
std::vector< RooStats::HistFactory::PreprocessFunction > fFunctionObjects
List of Preprocess Function objects.
RooStats::HistFactory::Channel & GetChannel(std::string)
Get channel with given name from this measurement throws an exception in case the channel is not foun...
std::vector< RooStats::HistFactory::Asimov > fAsimovDatasets
List of Asimov datasets to generate.
void AddChannel(RooStats::HistFactory::Channel chan)
add a completely configured channel
void SetOutputFilePrefix(const std::string &prefix)
set output prefix
bool HasChannel(std::string)
Check if the given channel is part of this measurement.
void AddUniformSyst(std::string syst)
Set constraint term for given systematic to uniform distribution.
void PrintTree(std::ostream &=std::cout)
Print information about measurement object in tree-like structure to given stream.
void SetBinLow(int BinLow)
std::vector< RooStats::HistFactory::Channel > & GetChannels()
std::vector< RooStats::HistFactory::Asimov > & GetAsimovDatasets()
get vector of defined Asimov Datasets
void SetBinHigh(int BinHigh)
Measurement()
Standard constructor.
void AddNoSyst(std::string syst)
Define given systematics to have no external constraint.
void SetPOI(const std::string &POI)
insert PoI at beginning of vector of PoIs
std::string GetOutputFilePrefix()
retrieve prefix for output files
void AddConstantParam(const std::string ¶m)
Add a parameter to be set as constant (Similar to ParamSetting method below)
void AddFunctionObject(const RooStats::HistFactory::PreprocessFunction function)
add a preprocess function object
void ClearConstantParams()
empty vector of constant parameters
std::vector< RooStats::HistFactory::PreprocessFunction > & GetFunctionObjects()
get vector of defined function objects
void SetFunctionObjects(std::vector< RooStats::HistFactory::PreprocessFunction > objects)
std::string GetInterpolationScheme()
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.
std::map< std::string, double > fLogNormSyst
void SetLumiRelErr(double RelErr)
set relative uncertainty on luminosity
std::vector< std::string > fPOI
std::map< std::string, double > const & GetUniformSyst() const
double GetLumi()
retrieve integrated luminosity
void AddAsimovDataset(RooStats::HistFactory::Asimov dataset)
add an Asimov Dataset
std::vector< std::string > fConstantParams
List of Parameters to be set constant.
std::string GetPOI(unsigned int i=0)
get name of PoI at given index
Configuration for an un- constrained overall systematic to scale sample normalisations.
std::string GetName() const
void Print(std::ostream &=std::cout) const
void PrintXML(std::ostream &) const
void SetHigh(double High)
void SetName(const std::string &Name)
Configuration for a constrained overall systematic to scale sample normalisations.
void SetName(const std::string &Name)
const std::string & GetName() const
void PrintXML(std::ostream &) const
void SetHigh(double High)
void Print(std::ostream &=std::cout) const
void SetName(const std::string &name)
void Print(std::ostream &=std::cout) const
std::string GetCommand() const
void PrintXML(std::ostream &) const
std::string const & GetExpression() const
std::string const & GetDependents() const
void SetExpression(const std::string &expression)
void SetDependents(const std::string &dependents)
std::string const & GetName() const
std::vector< RooStats::HistFactory::ShapeFactor > fShapeFactorList
std::unique_ptr< TH1 > fhCountingHist
std::vector< RooStats::HistFactory::OverallSys > & GetOverallSysList()
std::string GetHistoName() const
get histogram name
void SetStatError(RooStats::HistFactory::StatError Error)
void AddShapeSys(std::string Name, Constraint::Type ConstraintType, std::string HistoName, std::string HistoFile, std::string HistoPath="")
void AddOverallSys(std::string Name, double Low, double High)
std::string GetName() const
get name of sample
void writeToFile(std::string FileName, std::string DirName)
const TH1 * GetHisto() const
void SetInputFile(const std::string &InputFile)
set input ROOT file
void SetValue(double Val)
RooStats::HistFactory::StatError fStatError
Properties.
void SetChannelName(const std::string &ChannelName)
set name of associated channel
std::vector< RooStats::HistFactory::NormFactor > fNormFactorList
void AddNormFactor(std::string const &Name, double Val, double Low, double High)
const RooStats::HistFactory::StatError & GetStatError() const
void SetHistoName(const std::string &HistoName)
set histogram name
Sample & operator=(const Sample &other)
std::string fChannelName
The Name of the parent channel.
std::vector< RooStats::HistFactory::OverallSys > fOverallSysList
void SetHisto(TH1 *histo)
void Print(std::ostream &=std::cout) const
const std::vector< RooStats::HistFactory::HistoFactor > & GetHistoFactorList() const
const std::vector< RooStats::HistFactory::HistoSys > & GetHistoSysList() const
std::vector< RooStats::HistFactory::HistoSys > fHistoSysList
bool HasStatError() const
std::string GetHistoPath() const
get histogram path
void SetNormalizeByTheory(bool norm)
defines whether the normalization scale with luminosity
const std::vector< RooStats::HistFactory::ShapeFactor > & GetShapeFactorList() const
RooStats::HistFactory::StatError & GetStatError()
void AddHistoFactor(std::string Name, std::string HistoNameLow, std::string HistoFileLow, std::string HistoPathLow, std::string HistoNameHigh, std::string HistoFileHigh, std::string HistoPathHigh)
std::vector< RooStats::HistFactory::ShapeFactor > & GetShapeFactorList()
void SetName(const std::string &Name)
set name of sample
std::vector< RooStats::HistFactory::HistoFactor > & GetHistoFactorList()
void SetHistoPath(const std::string &HistoPath)
set histogram path
std::string GetChannelName() const
get name of associated channel
std::vector< RooStats::HistFactory::NormFactor > & GetNormFactorList()
std::string GetInputFile() const
get input ROOT file
const std::vector< RooStats::HistFactory::OverallSys > & GetOverallSysList() const
std::vector< RooStats::HistFactory::HistoSys > & GetHistoSysList()
std::vector< RooStats::HistFactory::HistoFactor > fHistoFactorList
bool GetNormalizeByTheory() const
does the normalization scale with luminosity
std::vector< RooStats::HistFactory::ShapeSys > fShapeSysList
HistRef fhNominal
The Nominal Shape.
void AddShapeFactor(std::string Name)
const std::vector< RooStats::HistFactory::NormFactor > & GetNormFactorList() const
std::vector< RooStats::HistFactory::ShapeSys > & GetShapeSysList()
void AddHistoSys(std::string Name, std::string HistoNameLow, std::string HistoFileLow, std::string HistoPathLow, std::string HistoNameHigh, std::string HistoFileHigh, std::string HistoPathHigh)
void PrintXML(std::ofstream &xml) const
const std::vector< RooStats::HistFactory::ShapeSys > & GetShapeSysList() const
*Un*constrained bin-by-bin variation of affected histogram.
void PrintXML(std::ostream &) const override
const std::string & GetHistoPath() const
const TH1 * GetInitialShape() const
void SetInitialShape(TH1 *shape)
void SetInputFile(const std::string &InputFile)
void SetHistoName(const std::string &HistoName)
void writeToFile(const std::string &FileName, const std::string &DirName) override
void Print(std::ostream &=std::cout) const override
const std::string & GetInputFile() const
void SetConstant(bool constant)
bool HasInitialShape() const
void SetHistoPath(const std::string &HistoPath)
const std::string & GetHistoName() const
Constrained bin-by-bin variation of affected histogram.
std::string GetHistoPath() const
void PrintXML(std::ostream &) const override
Constraint::Type GetConstraintType() const
const TH1 * GetErrorHist() const
Constraint::Type fConstraintType
std::string GetHistoName() const
ShapeSys & operator=(ShapeSys &&)=default
ShapeSys(const ShapeSys &other)
void SetInputFile(const std::string &InputFile)
void writeToFile(const std::string &FileName, const std::string &DirName) override
void Print(std::ostream &=std::cout) const override
ShapeSys & operator=(const ShapeSys &oth)
void SetHistoName(const std::string &HistoName)
void SetConstraintType(Constraint::Type ConstrType)
std::string GetInputFile() const
void SetErrorHist(TH1 *hError)
void SetHistoPath(const std::string &HistoPath)
Configuration to automatically assign nuisance parameters for the statistical error of the Monte Carl...
double fRelErrorThreshold
void PrintXML(std::ostream &) const
void SetConstraintType(Constraint::Type ConstrType)
Constraint::Type fConstraintType
double GetRelErrorThreshold() const
void SetRelErrorThreshold(double Threshold)
Constraint::Type GetConstraintType() const
void Print(std::ostream &=std::cout) const
Statistical error of Monte Carlo predictions.
const std::string & GetHistoPath() const
void Activate(bool IsActive=true)
void SetHistoPath(const std::string &HistoPath)
void SetInputFile(const std::string &InputFile)
const TH1 * GetErrorHist() const
void SetErrorHist(TH1 *Error)
const std::string & GetInputFile() const
void SetHistoName(const std::string &HistoName)
const std::string & GetHistoName() const
void SetUseHisto(bool UseHisto=true)
void Print(std::ostream &=std::cout) const override
void PrintXML(std::ostream &) const override
void writeToFile(const std::string &FileName, const std::string &DirName) override
Persistable container for RooFit projects.
Describe directory structure in memory.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
TH1 is the base class of all histogram classes in ROOT.
The TNamed class is the base class for all named ROOT classes.
Type GetType(const std::string &Name)
std::string Name(Type type)