File indexing completed on 2025-12-18 10:35:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef HISTFACTORY_MEASUREMENT_H
0012 #define HISTFACTORY_MEASUREMENT_H
0013
0014 #include <string>
0015 #include <map>
0016 #include <fstream>
0017 #include <iostream>
0018 #include <vector>
0019
0020 #include "TNamed.h"
0021
0022 #include "PreprocessFunction.h"
0023 #include "RooStats/HistFactory/Channel.h"
0024 #include "RooStats/HistFactory/Asimov.h"
0025
0026 class TFile;
0027
0028 namespace RooStats{
0029 namespace HistFactory {
0030
0031 class Measurement : public TNamed {
0032
0033 public:
0034
0035 Measurement();
0036
0037 Measurement(const char* Name, const char* Title="");
0038
0039
0040 void SetOutputFilePrefix( const std::string& prefix ) { fOutputFilePrefix = prefix; }
0041
0042 std::string GetOutputFilePrefix() { return fOutputFilePrefix; }
0043
0044
0045 void SetPOI( const std::string& POI ) { fPOI.insert( fPOI.begin(), POI ); }
0046
0047 void AddPOI( const std::string& POI ) { fPOI.push_back(POI); }
0048
0049 std::string GetPOI(unsigned int i=0) { return fPOI.at(i); }
0050
0051 std::vector<std::string>& GetPOIList() { return fPOI; }
0052
0053
0054
0055
0056 void AddConstantParam( const std::string& param );
0057
0058 void ClearConstantParams() { fConstantParams.clear(); }
0059
0060 std::vector< std::string >& GetConstantParams() { return fConstantParams; }
0061
0062
0063
0064 void SetParamValue( const std::string& param, double value);
0065
0066 std::map<std::string, double>& GetParamValues() { return fParamValues; }
0067
0068 void ClearParamValues() { fParamValues.clear(); }
0069
0070 void AddPreprocessFunction( std::string name, std::string expression, std::string dependencies );
0071
0072 void AddFunctionObject( const RooStats::HistFactory::PreprocessFunction function) { fFunctionObjects.push_back( function ); }
0073 void SetFunctionObjects( std::vector< RooStats::HistFactory::PreprocessFunction > objects ) { fFunctionObjects = objects; }
0074
0075 std::vector< RooStats::HistFactory::PreprocessFunction >& GetFunctionObjects() { return fFunctionObjects; }
0076 const std::vector< RooStats::HistFactory::PreprocessFunction >& GetFunctionObjects() const { return fFunctionObjects; }
0077 std::vector< std::string > GetPreprocessFunctions() const;
0078
0079
0080 std::vector< RooStats::HistFactory::Asimov >& GetAsimovDatasets() { return fAsimovDatasets; }
0081
0082 void AddAsimovDataset( RooStats::HistFactory::Asimov dataset ) { fAsimovDatasets.push_back(dataset); }
0083
0084
0085 void SetLumi(double Lumi ) { fLumi = Lumi; }
0086
0087 void SetLumiRelErr( double RelErr ) { fLumiRelErr = RelErr; }
0088
0089 double GetLumi() { return fLumi; }
0090
0091 double GetLumiRelErr() { return fLumiRelErr; }
0092
0093 void SetBinLow( int BinLow ) { fBinLow = BinLow; }
0094 void SetBinHigh ( int BinHigh ) { fBinHigh = BinHigh; }
0095 int GetBinLow() { return fBinLow; }
0096 int GetBinHigh() { return fBinHigh; }
0097
0098 void PrintTree( std::ostream& = std::cout );
0099 void PrintXML( std::string Directory="", std::string NewOutputPrefix="" );
0100
0101 std::vector< RooStats::HistFactory::Channel >& GetChannels() { return fChannels; }
0102 const std::vector< RooStats::HistFactory::Channel >& GetChannels() const { return fChannels; }
0103 RooStats::HistFactory::Channel& GetChannel( std::string );
0104
0105 void AddChannel( RooStats::HistFactory::Channel chan ) { fChannels.push_back( chan ); }
0106
0107 bool HasChannel( std::string );
0108 void writeToFile( TFile* file );
0109
0110 void CollectHistograms();
0111
0112
0113 void AddGammaSyst(std::string syst, double uncert);
0114 void AddLogNormSyst(std::string syst, double uncert);
0115 void AddUniformSyst(std::string syst);
0116 void AddNoSyst(std::string syst);
0117
0118 std::map< std::string, double >& GetGammaSyst() { return fGammaSyst; }
0119 std::map< std::string, double >& GetUniformSyst() { return fUniformSyst; }
0120 std::map< std::string, double >& GetLogNormSyst() { return fLogNormSyst; }
0121 std::map< std::string, double >& GetNoSyst() { return fNoSyst; }
0122
0123 std::map< std::string, double > const& GetGammaSyst() const { return fGammaSyst; }
0124 std::map< std::string, double > const& GetUniformSyst() const { return fUniformSyst; }
0125 std::map< std::string, double > const& GetLogNormSyst() const { return fLogNormSyst; }
0126 std::map< std::string, double > const& GetNoSyst() const { return fNoSyst; }
0127
0128 std::string GetInterpolationScheme() { return fInterpolationScheme; }
0129
0130 private:
0131
0132
0133 std::string fOutputFilePrefix;
0134 std::vector<std::string> fPOI;
0135 double fLumi;
0136 double fLumiRelErr;
0137 int fBinLow;
0138 int fBinHigh;
0139 bool fExportOnly = true;
0140 std::string fInterpolationScheme;
0141
0142
0143 std::vector< RooStats::HistFactory::Channel > fChannels;
0144
0145
0146 std::vector< std::string > fConstantParams;
0147
0148
0149 std::map< std::string, double > fParamValues;
0150
0151
0152 std::vector< RooStats::HistFactory::PreprocessFunction > fFunctionObjects;
0153
0154
0155 std::vector< RooStats::HistFactory::Asimov > fAsimovDatasets;
0156
0157
0158 std::map< std::string, double > fGammaSyst;
0159 std::map< std::string, double > fUniformSyst;
0160 std::map< std::string, double > fLogNormSyst;
0161 std::map< std::string, double > fNoSyst;
0162
0163 std::string GetDirPath( TDirectory* dir );
0164
0165 ClassDefOverride(RooStats::HistFactory::Measurement, 3);
0166
0167 };
0168
0169 }
0170 }
0171
0172 #endif