89 HistoToWorkspaceFactoryFast::Configuration
const &cfg)
97 cxcoutIHF <<
"Making Model and Measurements (Fast) for measurement: " <<
measurement.GetName() << std::endl;
102 <<
" including bins between " <<
measurement.GetBinLow() <<
" and " <<
measurement.GetBinHigh() << std::endl;
118 std::string prefix =
measurement.GetOutputFilePrefix();
124 size_t pos = prefix.rfind(
'/');
125 if (pos != std::string::npos) {
126 std::string
outputDir = prefix.substr(0,pos);
127 cxcoutDHF <<
"Checking if output directory : " <<
outputDir <<
" - exists" << std::endl;
129 cxcoutDHF <<
"Output directory : " <<
outputDir <<
" - does not exist, try to create" << std::endl;
145 tableFile.open(
measurement.GetOutputFilePrefix() +
"_results.table", std::ios::out | std::ios::app);
147 cxcoutIHF <<
"Creating the HistoToWorkspaceFactoryFast factory" << std::endl;
148 HistoToWorkspaceFactoryFast factory{
measurement, cfg};
152 cxcoutIHF <<
"Setting preprocess functions" << std::endl;
153 factory.SetFunctionsToPreprocess(
measurement.GetPreprocessFunctions() );
162 if( ! channel.CheckHistograms() ) {
163 cxcoutEHF <<
"MakeModelAndMeasurementsFast: Channel: " << channel.GetName()
164 <<
" has uninitialized histogram pointers" << std::endl;
169 std::string
ch_name = channel.GetName();
172 std::unique_ptr<RooWorkspace>
ws_single{factory.MakeSingleChannelModel(
measurement, channel )};
174 if (cfg.createPerRegionWorkspaces) {
185 meas_chan.GetChannels().push_back( channel );
186 cxcoutIHF <<
"About to write channel measurement to file" << std::endl;
188 cxcoutPHF <<
"Successfully wrote channel to file" << std::endl;
198 <<
", no parameter of interest" << std::endl;
225 HistoToWorkspaceFactoryFast::ConfigureWorkspaceForMeasurement(
"simPdf", ws.get(),
measurement);
248 <<
", no parameter of interest" << std::endl;
251 if(ws->data(
"obsData")){
279 cxcoutEHF <<
"Error: no ModelConfig found in Measurement: "
294 <<
", no poi found" << std::endl;
300 if( model==
nullptr ) {
317 <<
"\nDoing "<< channel <<
" Fit"
318 <<
"\n---------------\n\n" << std::endl;
324 if(
POIs->empty() ) {
332 <<
" at " << poi->
getVal()<<
" high "
349 std::unique_ptr<RooAbsReal> profile{nll->createProfile(*poi)};
351 std::unique_ptr<RooPlot> frame{poi->
frame()};
357 nll->plotOn(frame.get(), ShiftToZero(), LineColor(
kRed), LineStyle(
kDashed));
358 profile->plotOn(frame.get());
359 frame->SetMinimum(0);
360 frame->SetMaximum(2.);
374 cxcoutEHF <<
"Error: Failed to make channel directory: " << channel << std::endl;
379 cxcoutEHF <<
"Error: Failed to make Summary directory for channel: "
380 << channel << std::endl;
405 combined.loadSnapshot(
"InitialValues");
414 cxcoutIHF <<
"In Fit Model" << std::endl;
417 cxcoutEHF <<
"no model config " <<
"ModelConfig" <<
" exiting" << std::endl;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
const_iterator begin() const
const_iterator end() const
Abstract base class for binned and unbinned datasets.
Abstract interface for all probability density functions.
RooFit::OwningPtr< RooAbsReal > createNLL(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Construct representation of -log(L) of PDF with given dataset.
RooFit::OwningPtr< RooFitResult > fitTo(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Fit PDF to given dataset.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
One-dimensional graphical representation of a real-valued function.
static RooMsgService & instance()
Return reference to singleton instance.
Plot frame and a container for graphics objects within that frame.
void SetTitle(const char *name) override
Set the title of the RooPlot to 'title'.
void addObject(TObject *obj, Option_t *drawOptions="", bool invisible=false)
Add a generic object to this plot.
RooAbsRealLValue * getPlotVar() const
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
double getErrorLo() const
double getErrorHi() const
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Persistable container for RooFit projects.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Describe directory structure in memory.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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.
A TGraph is an object made of two arrays X and Y with npoints each.
Use the TLine constructor to create a simple line.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
void SetPadBorderMode(Int_t mode=1)
void SetCanvasBorderMode(Int_t mode=1)
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
virtual int MakeDirectory(const char *name)
Make a directory.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
OwningPtr< T > makeOwningPtr(std::unique_ptr< T > &&ptr)
Internal helper to turn a std::unique_ptr<T> into an OwningPtr.
void FitModelAndPlot(const std::string &measurementName, const std::string &fileNamePrefix, RooWorkspace &, std::string, std::string, TFile &, std::ostream &)
RooFit::OwningPtr< RooWorkspace > MakeModelAndMeasurementFast(RooStats::HistFactory::Measurement &measurement, HistoToWorkspaceFactoryFast::Configuration const &cfg={})
void FitModel(RooWorkspace *, std::string data_name="obsData")
void FormatFrameForLikelihood(RooPlot *frame, std::string xTitle=std::string("#sigma / #sigma_{SM}"), std::string yTitle=std::string("-log likelihood"))