File indexing completed on 2025-12-16 10:29:44
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef HISTFACTORY_SAMPLE_H
0012 #define HISTFACTORY_SAMPLE_H
0013
0014 #include <string>
0015 #include <fstream>
0016 #include <vector>
0017 #include <iostream>
0018
0019 class TH1;
0020
0021 #include "RooStats/HistFactory/HistRef.h"
0022 #include "RooStats/HistFactory/Systematics.h"
0023
0024 namespace RooStats{
0025 namespace HistFactory {
0026
0027 class Sample {
0028
0029
0030 public:
0031
0032 Sample();
0033 Sample(std::string Name);
0034 Sample(const Sample& other);
0035 Sample& operator=(const Sample& other);
0036
0037 Sample(std::string Name, std::string HistoName, std::string InputFile, std::string HistoPath="");
0038
0039 void Print(std::ostream& = std::cout) const;
0040 void PrintXML( std::ofstream& xml ) const;
0041 void writeToFile( std::string FileName, std::string DirName );
0042
0043 const TH1* GetHisto() const;
0044
0045 void SetHisto( TH1* histo ) { fhNominal = histo; fHistoName=histo->GetName(); }
0046 void SetValue( double Val ) ;
0047
0048
0049
0050
0051
0052 void ActivateStatError();
0053 void ActivateStatError( std::string HistoName, std::string InputFile, std::string HistoPath="" );
0054
0055 void AddOverallSys( std::string Name, double Low, double High );
0056 void AddOverallSys( const OverallSys& Sys );
0057
0058 void AddNormFactor( std::string const& Name, double Val, double Low, double High );
0059 void AddNormFactor( const NormFactor& Factor );
0060
0061 void AddHistoSys( std::string Name, std::string HistoNameLow, std::string HistoFileLow, std::string HistoPathLow,
0062 std::string HistoNameHigh, std::string HistoFileHigh, std::string HistoPathHigh );
0063 void AddHistoSys( const HistoSys& Sys );
0064
0065 void AddHistoFactor( std::string Name, std::string HistoNameLow, std::string HistoFileLow, std::string HistoPathLow,
0066 std::string HistoNameHigh, std::string HistoFileHigh, std::string HistoPathHigh );
0067 void AddHistoFactor( const HistoFactor& Factor );
0068
0069 void AddShapeFactor( std::string Name );
0070 void AddShapeFactor( const ShapeFactor& Factor );
0071
0072 void AddShapeSys( std::string Name, Constraint::Type ConstraintType, std::string HistoName, std::string HistoFile, std::string HistoPath="" );
0073 void AddShapeSys( const ShapeSys& Sys );
0074
0075
0076 void SetNormalizeByTheory( bool norm ) { fNormalizeByTheory = norm; }
0077
0078 bool GetNormalizeByTheory() const { return fNormalizeByTheory; }
0079
0080
0081
0082 std::string GetName() const { return fName; }
0083
0084 void SetName(const std::string& Name) { fName = Name; }
0085
0086
0087 std::string GetInputFile() const { return fInputFile; }
0088
0089 void SetInputFile(const std::string& InputFile) { fInputFile = InputFile; }
0090
0091
0092 std::string GetHistoName() const { return fHistoName; }
0093
0094 void SetHistoName(const std::string& HistoName) { fHistoName = HistoName; }
0095
0096
0097 std::string GetHistoPath() const { return fHistoPath; }
0098
0099 void SetHistoPath(const std::string& HistoPath) { fHistoPath = HistoPath; }
0100
0101
0102 std::string GetChannelName() const { return fChannelName; }
0103
0104 void SetChannelName(const std::string& ChannelName) { fChannelName = ChannelName; }
0105
0106
0107
0108 std::vector< RooStats::HistFactory::OverallSys >& GetOverallSysList() { return fOverallSysList; }
0109 std::vector< RooStats::HistFactory::NormFactor >& GetNormFactorList() { return fNormFactorList; }
0110 std::vector< RooStats::HistFactory::HistoSys >& GetHistoSysList() { return fHistoSysList; }
0111 std::vector< RooStats::HistFactory::HistoFactor >& GetHistoFactorList() { return fHistoFactorList; }
0112 std::vector< RooStats::HistFactory::ShapeSys >& GetShapeSysList() { return fShapeSysList; }
0113 std::vector< RooStats::HistFactory::ShapeFactor >& GetShapeFactorList() { return fShapeFactorList; }
0114
0115 const std::vector< RooStats::HistFactory::OverallSys >& GetOverallSysList() const { return fOverallSysList; }
0116 const std::vector< RooStats::HistFactory::NormFactor >& GetNormFactorList() const { return fNormFactorList; }
0117 const std::vector< RooStats::HistFactory::HistoSys >& GetHistoSysList() const { return fHistoSysList; }
0118 const std::vector< RooStats::HistFactory::HistoFactor >& GetHistoFactorList() const { return fHistoFactorList; }
0119 const std::vector< RooStats::HistFactory::ShapeSys >& GetShapeSysList() const { return fShapeSysList; }
0120 const std::vector< RooStats::HistFactory::ShapeFactor >& GetShapeFactorList() const { return fShapeFactorList; }
0121
0122
0123 bool HasStatError() const { return fStatErrorActivate; }
0124 RooStats::HistFactory::StatError& GetStatError() { return fStatError; }
0125 const RooStats::HistFactory::StatError& GetStatError() const { return fStatError; }
0126 void SetStatError( RooStats::HistFactory::StatError Error ) {
0127 fStatError = std::move(Error);
0128 }
0129
0130 protected:
0131
0132 std::string fName;
0133 std::string fInputFile;
0134 std::string fHistoName;
0135 std::string fHistoPath;
0136
0137
0138 std::string fChannelName;
0139
0140
0141
0142
0143
0144 std::vector< RooStats::HistFactory::OverallSys > fOverallSysList;
0145 std::vector< RooStats::HistFactory::NormFactor > fNormFactorList;
0146
0147 std::vector< RooStats::HistFactory::HistoSys > fHistoSysList;
0148 std::vector< RooStats::HistFactory::HistoFactor > fHistoFactorList;
0149
0150 std::vector< RooStats::HistFactory::ShapeSys > fShapeSysList;
0151 std::vector< RooStats::HistFactory::ShapeFactor > fShapeFactorList;
0152
0153
0154
0155 RooStats::HistFactory::StatError fStatError;
0156
0157 bool fNormalizeByTheory = false;
0158 bool fStatErrorActivate = false;
0159
0160
0161
0162 HistRef fhNominal;
0163 std::unique_ptr<TH1> fhCountingHist;
0164
0165 };
0166
0167
0168 }
0169 }
0170
0171 #endif