97using namespace HistFactory;
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)
static RooMathCoreReg dummy
RooAbsData is the common abstract base class for binned and unbinned datasets.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
RooRealVar represents a fundamental (non-derived) real valued object.
This class encapsulates all information for the statistical interpretation of one experiment.
std::string GetName()
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...
virtual void SetParametersOfInterest(const RooArgSet &set)
void GuessObsAndNuisance(const RooAbsData &data)
guesses Observables and ParametersOfInterest if not already set
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.
virtual void Close(Option_t *option="")
Close a file.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose, Int_t netopt=0)
Create / open a file.
virtual const char * GetName() const
Returns name of object.
Template specialisation used in RooAbsArg:
Namespace for the RooStats classes.