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