Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
MakeModelAndMeasurementsFast.cxx
Go to the documentation of this file.
1// @(#)root/roostats:$Id: cranmer $
2// Author: Kyle Cranmer, Akira Shibata
3/*************************************************************************
4 * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
12
13// from roofit
14#include "RooFit/ModelConfig.h"
15
16// from this package
19
20#include "HFMsgService.h"
21
22#include <TFile.h>
23#include <TH1F.h>
24#include <TCanvas.h>
25#include <TStyle.h>
26#include <TLine.h>
27#include <TSystem.h>
28
29#include <string>
30#include <vector>
31#include <map>
32#include <fstream>
33#include <sstream>
34
35
36/** ********************************************************************************************
37 \ingroup HistFactory
38
39 <p>
40 This is a package that creates a RooFit probability density function from ROOT histograms
41 of expected distributions and histograms that represent the +/- 1 sigma variations
42 from systematic effects. The resulting probability density function can then be used
43 with any of the statistical tools provided within RooStats, such as the profile
44 likelihood ratio, Feldman-Cousins, etc. In this version, the model is directly
45 fed to a likelihood ratio test, but it needs to be further factorized.</p>
46
47 <p>
48 The user needs to provide histograms (in picobarns per bin) and configure the job
49 with XML. The configuration XML is defined in the file `$ROOTSYS/config/HistFactorySchema.dtd`, but essentially
50 it is organized as follows (see the examples in `${ROOTSYS}/tutorials/histfactory/`)</p>
51
52 <ul>
53 <li> a top level 'Combination' that is composed of:</li>
54 <ul>
55 <li> several 'Channels' (eg. ee, emu, mumu), which are composed of:</li>
56 <ul>
57 <li> several 'Samples' (eg. signal, bkg1, bkg2, ...), each of which has:</li>
58 <ul>
59 <li> a name</li>
60 <li> if the sample is normalized by theory (eg N = L*sigma) or not (eg. data driven)</li>
61 <li> a nominal expectation histogram</li>
62 <li> a named 'Normalization Factor' (which can be fixed or allowed to float in a fit)</li>
63 <li> several 'Overall Systematics' in normalization with:</li>
64 <ul>
65 <li> a name</li>
66 <li> +/- 1 sigma variations (eg. 1.05 and 0.95 for a 5% uncertainty)</li>
67 </ul>
68 <li> several 'Histogram Systematics' in shape with:</li>
69 <ul>
70 <li> a name (which can be shared with the OverallSyst if correlated)</li>
71 <li> +/- 1 sigma variational histograms</li>
72 </ul>
73 </ul>
74 </ul>
75 <li> several 'Measurements' (corresponding to a full fit of the model) each of which specifies</li>
76 <ul>
77 <li> a name for this fit to be used in tables and files</li>
78 <li> what is the luminosity associated to the measurement in picobarns</li>
79 <li> which bins of the histogram should be used</li>
80 <li> what is the relative uncertainty on the luminosity </li>
81 <li> what is (are) the parameter(s) of interest that will be measured</li>
82 <li> which parameters should be fixed/floating (eg. nuisance parameters)</li>
83 </ul>
84 </ul>
85 </ul>
86*/
89 HistoToWorkspaceFactoryFast::Configuration const &cfg)
90{
91 std::unique_ptr<TFile> outFile;
92 std::ofstream tableFile;
93
94 auto& msgSvc = RooMsgService::instance();
95 msgSvc.getStream(1).removeTopic(RooFit::ObjectHandling);
96
97 cxcoutIHF << "Making Model and Measurements (Fast) for measurement: " << measurement.GetName() << std::endl;
98
99 double lumiError = measurement.GetLumi()*measurement.GetLumiRelErr();
100
101 cxcoutIHF << "using lumi = " << measurement.GetLumi() << " and lumiError = " << lumiError
102 << " including bins between " << measurement.GetBinLow() << " and " << measurement.GetBinHigh() << std::endl;
103
104 std::ostringstream parameterMessage;
105 parameterMessage << "fixing the following parameters:" << std::endl;
106
107 for(std::vector<std::string>::iterator itr=measurement.GetConstantParams().begin(); itr!=measurement.GetConstantParams().end(); ++itr){
108 parameterMessage << " " << *itr << '\n';
109 }
110 cxcoutIHF << parameterMessage.str();
111
112 std::string rowTitle = measurement.GetName();
113
114 std::vector<std::unique_ptr<RooWorkspace>> channel_workspaces;
115 std::vector<std::string> channel_names;
116
117 // Create the outFile - first check if the outputfile exists
118 std::string prefix = measurement.GetOutputFilePrefix();
119 // parse prefix to find output directory -
120 // assume there is a file prefix after the last "/" that we remove
121 // to get the directory name.
122 // We do by finding last occurrence of "/" and using as directory name what is before
123 // if we do not have a "/" in the prefix there is no output directory to be checked or created
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;
128 if (gSystem->OpenDirectory( outputDir.c_str() ) == nullptr ) {
129 cxcoutDHF << "Output directory : " << outputDir << " - does not exist, try to create" << std::endl;
130 int success = gSystem->MakeDirectory( outputDir.c_str() );
131 if( success != 0 ) {
132 std::string fullOutputDir = std::string(gSystem->pwd()) + std::string("/") + outputDir;
133 cxcoutEHF << "Error: Failed to make output directory: " << fullOutputDir << std::endl;
134 throw hf_exc();
135 }
136 }
137 }
138
139 // This holds the TGraphs that are created during the fit
140 std::string outputFileName = measurement.GetOutputFilePrefix() + "_" + measurement.GetName() + ".root";
141 cxcoutIHF << "Creating the output file: " << outputFileName << std::endl;
142 outFile = std::make_unique<TFile>(outputFileName.c_str(), "recreate");
143
144 // Create the table file, which holds the table of fitted values and errors
145 tableFile.open(measurement.GetOutputFilePrefix() + "_results.table", std::ios::out | std::ios::app);
146
147 cxcoutIHF << "Creating the HistoToWorkspaceFactoryFast factory" << std::endl;
148 HistoToWorkspaceFactoryFast factory{measurement, cfg};
149
150 // Make the factory, and do some preprocessing
151 // HistoToWorkspaceFactoryFast factory(measurement, rowTitle, outFile);
152 cxcoutIHF << "Setting preprocess functions" << std::endl;
153 factory.SetFunctionsToPreprocess( measurement.GetPreprocessFunctions() );
154
155 // for results tables
156 tableFile << " " << rowTitle << " &";
157
158 // First: Loop to make the individual channels
159 for( unsigned int chanItr = 0; chanItr < measurement.GetChannels().size(); ++chanItr ) {
160
161 HistFactory::Channel& channel = measurement.GetChannels().at( chanItr );
162 if( ! channel.CheckHistograms() ) {
163 cxcoutEHF << "MakeModelAndMeasurementsFast: Channel: " << channel.GetName()
164 << " has uninitialized histogram pointers" << std::endl;
165 throw hf_exc();
166 }
167
168 // Make the workspace for this individual channel
169 std::string ch_name = channel.GetName();
170 cxcoutPHF << "Starting to process channel: " << ch_name << std::endl;
171 channel_names.push_back(ch_name);
172 std::unique_ptr<RooWorkspace> ws_single{factory.MakeSingleChannelModel( measurement, channel )};
173
174 {
175 // Make the output
176 std::string ChannelFileName = measurement.GetOutputFilePrefix() + "_"
177 + ch_name + "_" + rowTitle + "_model.root";
178 cxcoutIHF << "Opening File to hold channel: " << ChannelFileName << std::endl;
179 std::unique_ptr<TFile> chanFile{TFile::Open( ChannelFileName.c_str(), "RECREATE" )};
180 chanFile->WriteTObject(ws_single.get());
181 // Now, write the measurement to the file
182 // Make a new measurement for only this channel
183 RooStats::HistFactory::Measurement meas_chan( measurement );
184 meas_chan.GetChannels().clear();
185 meas_chan.GetChannels().push_back( channel );
186 cxcoutIHF << "About to write channel measurement to file" << std::endl;
187 meas_chan.writeToFile( chanFile.get() );
188 cxcoutPHF << "Successfully wrote channel to file" << std::endl;
189 }
190
191 // Get the Parameter of Interest as a RooRealVar
192 RooRealVar* poi = dynamic_cast<RooRealVar*>( ws_single->var(measurement.GetPOI()));
193
194 // do fit unless exportOnly requested
195 if(! measurement.GetExportOnly()){
196 if(!poi) {
197 cxcoutWHF << "Can't do fit for: " << measurement.GetName()
198 << ", no parameter of interest" << std::endl;
199 } else {
200 if(ws_single->data("obsData")) {
201 FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), *ws_single,
202 ch_name, "obsData", *outFile, tableFile);
203 } else {
204 FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), *ws_single,
205 ch_name, "asimovData", *outFile, tableFile);
206 }
207 }
208 }
209
210 tableFile << " & ";
211
212 channel_workspaces.emplace_back(std::move(ws_single));
213 } // End loop over channels
214
215 /***
216 Second: Make the combined model:
217 If you want output histograms in root format, create and pass it to the combine routine.
218 "combine" : will do the individual cross-section measurements plus combination
219 ***/
220
221 // Use HistFactory to combine the individual channel workspaces
222 std::unique_ptr<RooWorkspace> ws{factory.MakeCombinedModel(channel_names, channel_workspaces)};
223
224 // Configure that workspace
225 HistoToWorkspaceFactoryFast::ConfigureWorkspaceForMeasurement("simPdf", ws.get(), measurement);
226
227 // Get the Parameter of interest as a RooRealVar
228 RooRealVar* poi = dynamic_cast<RooRealVar*>( ws->var(measurement.GetPOI()));
229
230 {
231 std::string CombinedFileName = measurement.GetOutputFilePrefix() + "_combined_"
232 + rowTitle + "_model.root";
233 cxcoutPHF << "Writing combined workspace to file: " << CombinedFileName << std::endl;
234 std::unique_ptr<TFile> combFile{TFile::Open( CombinedFileName.c_str(), "RECREATE" )};
235 if( combFile == nullptr ) {
236 cxcoutEHF << "Error: Failed to open file " << CombinedFileName << std::endl;
237 throw hf_exc();
238 }
239 combFile->WriteTObject(ws.get());
240 cxcoutPHF << "Writing combined measurement to file: " << CombinedFileName << std::endl;
241 measurement.writeToFile( combFile.get() );
242 }
243
244 // Fit the combined model
245 if(! measurement.GetExportOnly()){
246 if(!poi) {
247 cxcoutWHF << "Can't do fit for: " << measurement.GetName()
248 << ", no parameter of interest" << std::endl;
249 }
250 else {
251 if(ws->data("obsData")){
252 FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), *ws,"combined",
253 "obsData", *outFile, tableFile);
254 }
255 else {
256 FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), *ws,"combined",
257 "asimovData", *outFile, tableFile);
258 }
259 }
260 }
261
262 tableFile << " \\\\ \n";
263
264 msgSvc.getStream(1).addTopic(RooFit::ObjectHandling);
265
266 return RooFit::Detail::owningPtr(std::move(ws));
267}
268
269
270///////////////////////////////////////////////
271void RooStats::HistFactory::FitModelAndPlot(const std::string &MeasurementName, const std::string &FileNamePrefix,
272 RooWorkspace &combined, std::string channel, std::string data_name,
273 TFile &outFile, std::ostream &tableStream)
274{
275 using namespace RooFit;
276
277 auto combined_config = static_cast<ModelConfig *>(combined.obj("ModelConfig"));
278 if(!combined_config){
279 cxcoutEHF << "Error: no ModelConfig found in Measurement: "
280 << MeasurementName << std::endl;
281 throw hf_exc();
282 }
283
284 RooAbsData* simData = combined.data(data_name);
285 if(!simData){
286 cxcoutEHF << "Error: Failed to get dataset: " << data_name
287 << " in measurement: " << MeasurementName << std::endl;
288 throw hf_exc();
289 }
290
291 const RooArgSet* POIs = combined_config->GetParametersOfInterest();
292 if(!POIs) {
293 cxcoutEHF << "Not Fitting Model for measurement: " << MeasurementName
294 << ", no poi found" << std::endl;
295 // Should I throw an exception here?
296 return;
297 }
298
299 RooAbsPdf* model = combined_config->GetPdf();
300 if( model==nullptr ) {
301 cxcoutEHF << "Error: Failed to find pdf in ModelConfig: " << combined_config->GetName()
302 << std::endl;
303 throw hf_exc();
304 }
305
306 // Save a Snapshot
307 RooArgSet PoiPlusNuisance;
308 if( combined_config->GetNuisanceParameters() ) {
309 PoiPlusNuisance.add( *combined_config->GetNuisanceParameters() );
310 }
311 PoiPlusNuisance.add( *combined_config->GetParametersOfInterest() );
312 combined.saveSnapshot("InitialValues", PoiPlusNuisance);
313
314 ///////////////////////////////////////
315 // Do the fit
316 cxcoutPHF << "\n---------------"
317 << "\nDoing "<< channel << " Fit"
318 << "\n---------------\n\n" << std::endl;
319 const int printLevel = RooMsgService::instance().isActive(nullptr, RooFit::HistFactory, RooFit::DEBUG) ? 1 : -1;
320 model->fitTo(*simData, Minos(true), PrintLevel(printLevel));
321
322 // If there are no parameters of interest,
323 // we exit the function here
324 if( POIs->empty() ) {
325 cxcoutWHF << "WARNING: No POIs found in measurement: " << MeasurementName << std::endl;
326 return;
327 }
328
329 // Loop over all POIs and print their fitted values
330 for (auto const *poi : static_range_cast<RooRealVar *>(*POIs)) {
331 cxcoutIHF << "printing results for " << poi->GetName()
332 << " at " << poi->getVal()<< " high "
333 << poi->getErrorLo() << " low "
334 << poi->getErrorHi() << std::endl;
335 }
336
337 // But we only make detailed plots and tables
338 // for the 'first' POI
339 RooRealVar* poi = static_cast<RooRealVar *>(POIs->first());
340
341 // Print the MINOS errors to the TableFile
342 const auto oldPrecision = tableStream.precision();
343 tableStream.precision(4);
344 tableStream << " " << poi->getErrorLo() << " / " << poi->getErrorHi() << " ";
345 tableStream.precision(oldPrecision);
346
347 // Make the Profile Likelihood Plot
348 std::unique_ptr<RooAbsReal> nll{model->createNLL(*simData)};
349 std::unique_ptr<RooAbsReal> profile{nll->createProfile(*poi)};
350
351 std::unique_ptr<RooPlot> frame{poi->frame()};
352
353 // Draw the likelihood curve
354 FormatFrameForLikelihood(frame.get());
355 {
356 TCanvas profileLikelihoodCanvas{channel.c_str(), "",800,600};
357 nll->plotOn(frame.get(), ShiftToZero(), LineColor(kRed), LineStyle(kDashed));
358 profile->plotOn(frame.get());
359 frame->SetMinimum(0);
360 frame->SetMaximum(2.);
361 frame->Draw();
362 std::string profilePlotName = FileNamePrefix+"_"+channel+"_"+MeasurementName+"_profileLR.eps";
363 profileLikelihoodCanvas.SaveAs( profilePlotName.c_str() );
364 }
365
366 // Now, we save our results to the 'output' file
367 // (I'm not sure if users actually look into this file,
368 // but adding additional information and useful plots
369 // may make it more attractive)
370
371 // Save to the output file
372 TDirectory* channel_dir = outFile.mkdir(channel.c_str());
373 if( channel_dir == nullptr ) {
374 cxcoutEHF << "Error: Failed to make channel directory: " << channel << std::endl;
375 throw hf_exc();
376 }
377 TDirectory* summary_dir = channel_dir->mkdir("Summary");
378 if( summary_dir == nullptr ) {
379 cxcoutEHF << "Error: Failed to make Summary directory for channel: "
380 << channel << std::endl;
381 throw hf_exc();
382 }
383 summary_dir->cd();
384
385 // Save a graph of the profile likelihood curve
386 RooCurve* curve=frame->getCurve();
387 Int_t curve_N=curve->GetN();
388 double* curve_x=curve->GetX();
389
390 std::vector<double> x_arr(curve_N);
391 std::vector<double> y_arr_nll(curve_N);
392
393 for(int i=0; i<curve_N; i++){
394 double f=curve_x[i];
395 poi->setVal(f);
396 x_arr[i]=f;
397 y_arr_nll[i]=nll->getVal();
398 }
399
400 TGraph g{curve_N, x_arr.data(), y_arr_nll.data()};
401 g.SetName( (FileNamePrefix +"_nll").c_str() );
402 g.Write();
403
404 // Finally, restore the initial values
405 combined.loadSnapshot("InitialValues");
406
407}
408
409
410void RooStats::HistFactory::FitModel(RooWorkspace * combined, std::string data_name )
411{
412 using namespace RooFit;
413
414 cxcoutIHF << "In Fit Model" << std::endl;
415 ModelConfig * combined_config = (ModelConfig *) combined->obj("ModelConfig");
416 if(!combined_config){
417 cxcoutEHF << "no model config " << "ModelConfig" << " exiting" << std::endl;
418 return;
419 }
420
421 RooAbsData* simData = combined->data(data_name);
422 if(!simData){
423 cxcoutEHF << "no data " << data_name << " exiting" << std::endl;
424 return;
425 }
426
427 const RooArgSet * POIs=combined_config->GetParametersOfInterest();
428 if(!POIs){
429 cxcoutEHF << "no poi " << data_name << " exiting" << std::endl;
430 return;
431 }
432
433 RooAbsPdf* model=combined_config->GetPdf();
434 model->fitTo(*simData, Minos(true), PrintLevel(1));
435
436 }
437
438
440 std::string YTitle)
441{
442 using namespace RooFit;
443
446 // gStyle->SetPadColor(0);
447 // gStyle->SetCanvasColor(255);
448 // gStyle->SetTitleFillColor(255);
449 // gStyle->SetFrameFillColor(0);
450 // gStyle->SetStatColor(255);
451
452 RooAbsRealLValue* var = frame->getPlotVar();
453 double xmin = var->getMin();
454 double xmax = var->getMax();
455
456 frame->SetTitle("");
457 // frame->GetXaxis()->SetTitle(XTitle.c_str());
458 frame->GetXaxis()->SetTitle(var->GetTitle());
459 frame->GetYaxis()->SetTitle(YTitle.c_str());
460 frame->SetMaximum(2.);
461 frame->SetMinimum(0.);
462 TLine * line = new TLine(xmin,.5,xmax,.5);
464 TLine * line90 = new TLine(xmin,2.71/2.,xmax,2.71/2.);
465 line90->SetLineColor(kGreen);
466 TLine * line95 = new TLine(xmin,3.84/2.,xmax,3.84/2.);
467 line95->SetLineColor(kGreen);
468 frame->addObject(line);
469 frame->addObject(line90);
470 frame->addObject(line95);
471}
#define cxcoutPHF
#define cxcoutDHF
#define cxcoutIHF
#define cxcoutWHF
#define cxcoutEHF
#define f(i)
Definition RSha256.hxx:104
#define g(i)
Definition RSha256.hxx:105
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
@ kRed
Definition Rtypes.h:66
@ kGreen
Definition Rtypes.h:66
@ kDashed
Definition TAttLine.h:48
float xmin
float xmax
R__EXTERN TStyle * gStyle
Definition TStyle.h:433
R__EXTERN TSystem * gSystem
Definition TSystem.h:560
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
RooAbsArg * first() const
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
RooFit::OwningPtr< RooAbsReal > createNLL(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Construct representation of -log(L) of PDF with given dataset.
Definition RooAbsPdf.h:162
RooFit::OwningPtr< RooFitResult > fitTo(RooAbsData &data, CmdArgs_t const &... cmdArgs)
Fit PDF to given dataset.
Definition RooAbsPdf.h:156
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
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.
Definition RooAbsReal.h:103
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
A RooCurve is a one-dimensional graphical representation of a real-valued function.
Definition RooCurve.h:36
static RooMsgService & instance()
Return reference to singleton instance.
bool isActive(T self, RooFit::MsgTopic topic, RooFit::MsgLevel level)
Check if logging is active for given object/topic/RooFit::MsgLevel combination.
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:43
void SetTitle(const char *name) override
Set the title of the RooPlot to 'title'.
Definition RooPlot.cxx:1258
void addObject(TObject *obj, Option_t *drawOptions="", bool invisible=false)
Add a generic object to this plot.
Definition RooPlot.cxx:383
virtual void SetMinimum(double minimum=-1111)
Set minimum value of Y axis.
Definition RooPlot.cxx:1062
virtual void SetMaximum(double maximum=-1111)
Set maximum value of Y axis.
Definition RooPlot.cxx:1052
TAxis * GetYaxis() const
Definition RooPlot.cxx:1279
RooAbsRealLValue * getPlotVar() const
Definition RooPlot.h:137
TAxis * GetXaxis() const
Definition RooPlot.cxx:1277
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:37
void setVal(double value) override
Set value of variable to 'value'.
double getErrorLo() const
Definition RooRealVar.h:67
double getErrorHi() const
Definition RooRealVar.h:68
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
Definition Measurement.h:31
void writeToFile(TFile *file)
A measurement, once fully configured, can be saved into a ROOT file.
double GetLumiRelErr()
retrieve relative uncertainty on luminosity
Definition Measurement.h:91
std::vector< std::string > & GetConstantParams()
get vector of all constant parameters
Definition Measurement.h:60
std::vector< RooStats::HistFactory::Channel > & GetChannels()
std::string GetOutputFilePrefix()
retrieve prefix for output files
Definition Measurement.h:42
std::vector< std::string > GetPreprocessFunctions() const
Returns a list of defined preprocess function expressions.
double GetLumi()
retrieve integrated luminosity
Definition Measurement.h:89
std::string GetPOI(unsigned int i=0)
get name of PoI at given index
Definition Measurement.h:49
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition ModelConfig.h:35
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return nullptr if not existing)
RooAbsPdf * GetPdf() const
get model PDF (return nullptr if pdf has not been specified or does not exist)
Persistable container for RooFit projects.
TObject * obj(RooStringView name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name)
bool saveSnapshot(RooStringView, const char *paramNames)
Save snapshot of values and attributes (including "Constant") of given parameters.
RooAbsData * data(RooStringView name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
bool loadSnapshot(const char *name)
Load the values and attributes of the parameters in the snapshot saved with the given name.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition TAttLine.h:40
The Canvas class.
Definition TCanvas.h:23
void Draw(Option_t *option="") override
Draw a canvas.
Definition TCanvas.cxx:851
TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE) override
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
Int_t WriteTObject(const TObject *obj, const char *name=nullptr, Option_t *option="", Int_t bufsize=0) override
Write object obj to this directory.
Describe directory structure in memory.
Definition TDirectory.h:45
virtual Bool_t cd()
Change current directory to "this" directory.
virtual TDirectory * mkdir(const char *name, const char *title="", Bool_t returnExistingDirectory=kFALSE)
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
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.
Definition TFile.cxx:4075
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
Int_t GetN() const
Definition TGraph.h:130
Double_t * GetX() const
Definition TGraph.h:137
Use the TLine constructor to create a simple line.
Definition TLine.h:22
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
void SetPadBorderMode(Int_t mode=1)
Definition TStyle.h:354
void SetCanvasBorderMode(Int_t mode=1)
Definition TStyle.h:343
const char * pwd()
Definition TSystem.h:423
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition TSystem.cxx:823
virtual int MakeDirectory(const char *name)
Make a directory.
Definition TSystem.cxx:814
TLine * line
OwningPtr< T > owningPtr(std::unique_ptr< T > &&ptr)
Internal helper to turn a std::unique_ptr<T> into an OwningPtr.
Definition Config.h:50
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26
@ ObjectHandling
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
Definition Config.h:43
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"))