166 std::vector< HistFactory::Measurement > measurement_list;
187 for(
unsigned int i = 0; i < measurement_list.size(); ++i) {
199 std::string rowTitle = measurement.
GetName();
204 TFile* outFile =
new TFile(outputFileName.c_str(),
"recreate");
206 measurement.
GetLumi(), lumiError,
210 vector<RooWorkspace*> channel_workspaces;
211 vector<string> channel_names;
220 for(
unsigned int chanItr = 0; chanItr < measurement.
GetChannels().size(); ++chanItr ) {
225 string ch_name=channel.
GetName();
226 channel_names.push_back(ch_name);
228 std::vector< EstimateSummary > dummy;
231 std::cout <<
"Failed to create SingleChannelModel for channel: " << channel.
GetName()
232 <<
" and measurement: " << measurement.
GetName() << std::endl;
236 channel_workspaces.push_back(
ws);
241 std::cout <<
"Setting Parameter of Interest as :" << measurement.
GetPOI() << endl;
254 proto_config->
SetPdf( *
ws->pdf(
"newSimPdf") );
262 std::string ChannelFileName = measurement.
GetOutputFilePrefix() +
"_" + ch_name +
"_" + rowTitle +
"_model.root";
263 ws->writeToFile( ChannelFileName.c_str() );
277 cout <<
"can't do fit for this channel, no parameter of interest"<<endl;
279 factory.
FitModel(
ws, ch_name,
"newSimPdf",
"expData",
false);
282 fprintf(factory.
pFile,
" & " );
289 std::cout <<
"Error: Failed to create workspace" << std::endl;
300 cout <<
"Setting Parameter of Interest as :" << measurement.
GetPOI() << endl;
313 combined_config->
SetPdf(*
ws->pdf(
"newSimPdf"));
318 std::string CombinedFileName = measurement.
GetOutputFilePrefix()+
"_combined_"+rowTitle+
"_model.root";
319 ws->writeToFile( CombinedFileName.c_str() );
330 cout <<
"can't do fit for this channel, no parameter of interest"<<endl;
332 factory.
FitModel(
ws,
"combined",
"simPdf",
"simData",
false);
void topDriver(string input)
RooAbsData is the common abstract base class for binned and unbinned datasets.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
RooRealVar represents a variable that can be changed from the outside.
This class encapsulates all information for the statistical interpretation of one experiment.
std::string GetName() const
get name of channel
std::vector< RooStats::HistFactory::Measurement > GetMeasurementsFromXML(std::string input)
The "main" method.
void EditSyst(RooWorkspace *proto, const char *pdfNameChar, std::map< std::string, double > gammaSyst, std::map< std::string, double > uniformSyst, std::map< std::string, double > logNormSyst)
cout << "in edit, gammamap.size = " << gammaSyst.size() << ", unimap.size = " << uniformSyst....
void FitModel(RooWorkspace *, std::string, std::string, std::string, bool=false)
RooWorkspace * MakeCombinedModel(std::vector< std::string >, std::vector< RooWorkspace * >)
RooWorkspace * MakeSingleChannelModel(std::vector< RooStats::HistFactory::EstimateSummary > summary, std::vector< std::string > systToFix, bool doRatio=false)
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 > & GetGammaSyst()
std::map< std::string, double > & GetLogNormSyst()
double GetLumiRelErr()
retrieve relative uncertainty on luminosity
std::map< std::string, double > & GetUniformSyst()
std::vector< std::string > & GetConstantParams()
get vector of all constant parameters
std::vector< RooStats::HistFactory::Channel > & GetChannels()
std::string GetOutputFilePrefix()
retrieve prefix for output files
double GetLumi()
retrieve integrated luminosity
std::string GetPOI(unsigned int i=0)
get name of PoI at given index
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
void GuessObsAndNuisance(const RooAbsData &data, bool printModelConfig=true)
Makes sensible guesses of observables, parameters of interest and nuisance parameters if one or multi...
virtual void SetParametersOfInterest(const RooArgSet &set)
Specify parameters of interest.
virtual void SetPdf(const RooAbsPdf &pdf)
Set the Pdf, add to the the workspace if not already there.
The RooWorkspace is a persistable container for RooFit projects.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
void Close(Option_t *option="") override
Close a file.
virtual const char * GetName() const
Returns name of object.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Namespace for the RooStats classes.