164 std::vector< HistFactory::Measurement > measurement_list;
185 for(
unsigned int i = 0; i < measurement_list.size(); ++i) {
197 std::string rowTitle = measurement.
GetName();
202 TFile* outFile =
new TFile(outputFileName.c_str(),
"recreate");
204 measurement.
GetLumi(), lumiError,
208 vector<RooWorkspace*> channel_workspaces;
209 vector<string> channel_names;
218 for(
unsigned int chanItr = 0; chanItr < measurement.
GetChannels().
size(); ++chanItr ) {
223 string ch_name=channel.
GetName();
224 channel_names.push_back(ch_name);
226 std::vector< EstimateSummary > dummy;
229 std::cout <<
"Failed to create SingleChannelModel for channel: " << channel.
GetName()
230 <<
" and measurement: " << measurement.
GetName() << std::endl;
234 channel_workspaces.push_back(
ws);
239 std::cout <<
"Setting Parameter of Interest as :" << measurement.
GetPOI() << endl;
252 proto_config->
SetPdf( *
ws->pdf(
"newSimPdf") );
260 std::string ChannelFileName = measurement.
GetOutputFilePrefix() +
"_" + ch_name +
"_" + rowTitle +
"_model.root";
261 ws->writeToFile( ChannelFileName.c_str() );
275 cout <<
"can't do fit for this channel, no parameter of interest"<<endl;
277 factory.
FitModel(
ws, ch_name,
"newSimPdf",
"expData",
false);
280 fprintf(factory.
pFile,
" & " );
287 std::cout <<
"Error: Failed to create workspace" << std::endl;
298 cout <<
"Setting Parameter of Interest as :" << measurement.
GetPOI() << endl;
311 combined_config->
SetPdf(*
ws->pdf(
"newSimPdf"));
316 std::string CombinedFileName = measurement.
GetOutputFilePrefix()+
"_combined_"+rowTitle+
"_model.root";
317 ws->writeToFile( CombinedFileName.c_str() );
328 cout <<
"can't do fit for this channel, no parameter of interest"<<endl;
330 factory.
FitModel(
ws,
"combined",
"simPdf",
"simData",
false);
void topDriver(string input)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
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.