Logo ROOT   6.16/01
Reference Guide
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
11////////////////////////////////////////////////////////////////////////////////
12
13/**
14 \ingroup HistFactory
15 BEGIN_HTML
16 <p>
17 This is a package that creates a RooFit probability density function from ROOT histograms
18 of expected distributions and histograms that represent the +/- 1 sigma variations
19 from systematic effects. The resulting probability density function can then be used
20 with any of the statistical tools provided within RooStats, such as the profile
21 likelihood ratio, Feldman-Cousins, etc. In this version, the model is directly
22 fed to a likelihodo ratio test, but it needs to be further factorized.</p>
23
24 <p>
25 The user needs to provide histograms (in picobarns per bin) and configure the job
26 with XML. The configuration XML is defined in the file config/Config.dtd, but essentially
27 it is organized as follows (see config/Combination.xml and config/ee.xml for examples)</p>
28
29 <ul>
30 <li> - a top level 'Combination' that is composed of:</li>
31 <ul>
32 <li>- several 'Channels' (eg. ee, emu, mumu), which are composed of:</li>
33 <ul>
34 <li>- several 'Samples' (eg. signal, bkg1, bkg2, ...), each of which has:</li>
35 <ul>
36 <li> - a name</li>
37 <li> - if the sample is normalized by theory (eg N = L*sigma) or not (eg. data driven)</li>
38 <li> - a nominal expectation histogram</li>
39 <li> - a named 'Normalization Factor' (which can be fixed or allowed to float in a fit)</li>
40 <li> - several 'Overall Systematics' in normalization with:</li>
41 <ul>
42 <li> - a name</li>
43 <li> - +/- 1 sigma variations (eg. 1.05 and 0.95 for a 5% uncertainty)</li>
44 </ul>
45 <li>- several 'Histogram Systematics' in shape with:</li>
46 <ul>
47 <li>- a name (which can be shared with the OverallSyst if correlated)</li>
48 <li>- +/- 1 sigma variational histograms</li>
49 </ul>
50 </ul>
51 </ul>
52 <li>- several 'Measurements' (corresponding to a full fit of the model) each of which specifies</li>
53 <ul>
54 <li>- a name for this fit to be used in tables and files</li>
55 <ul>
56 <li> - what is the luminosity associated to the measurement in picobarns</li>
57 <li> - which bins of the histogram should be used</li>
58 <li> - what is the relative uncertainty on the luminosity </li>
59 <li> - what is (are) the parameter(s) of interest that will be measured</li>
60 <li> - which parameters should be fixed/floating (eg. nuisance parameters)</li>
61 </ul>
62 </ul>
63 </ul>
64 END_HTML
65*/
66//
67
68
69// from std
70#include <string>
71#include <vector>
72#include <map>
73#include <iostream>
74#include <sstream>
75
76// from root
77#include "TFile.h"
78#include "TH1F.h"
79#include "TDOMParser.h"
80#include "TXMLAttr.h"
81#include "TString.h"
82#include "TCanvas.h"
83#include "TStyle.h"
84#include "TLine.h"
85#include "TSystem.h"
86
87
88// from roofit
90
91// from this package
92#include "Helper.h"
97
99
100using namespace RooFit;
101//using namespace RooStats;
102//using namespace HistFactory;
103
104//using namespace std;
105
106
107
109
110 // This will be returned
111 RooWorkspace* ws = NULL;
112 TFile* outFile = NULL;
113 FILE* tableFile=NULL;
114
115 try {
116
117 std::cout << "Making Model and Measurements (Fast) for measurement: " << measurement.GetName() << std::endl;
118
119 double lumiError = measurement.GetLumi()*measurement.GetLumiRelErr();
120
121 std::cout << "using lumi = " << measurement.GetLumi() << " and lumiError = " << lumiError
122 << " including bins between " << measurement.GetBinLow() << " and " << measurement.GetBinHigh() << std::endl;
123 std::cout << "fixing the following parameters:" << std::endl;
124
125 for(std::vector<std::string>::iterator itr=measurement.GetConstantParams().begin(); itr!=measurement.GetConstantParams().end(); ++itr){
126 std::cout << " " << *itr << std::endl;
127 }
128
129 std::string rowTitle = measurement.GetName();
130
131 std::vector<RooWorkspace*> channel_workspaces;
132 std::vector<std::string> channel_names;
133
134 // Create the outFile - first check if the outputfile exists
135 std::string prefix = measurement.GetOutputFilePrefix();
136 // parse prefix to find output directory -
137 // assume there is a file prefix after the last "/" that we remove
138 // to get the directory name.
139 // We do by finding last occurrence of "/" and using as directory name what is before
140 // if we do not have a "/" in the prefix there is no output directory to be checked or created
141 size_t pos = prefix.rfind("/");
142 if (pos != std::string::npos) {
143 std::string outputDir = prefix.substr(0,pos);
144 std::cout << "Checking if output directory : " << outputDir << " - exists" << std::endl;
145 if (gSystem->OpenDirectory( outputDir.c_str() ) == 0 ) {
146 std::cout << "Output directory : " << outputDir << " - does not exist, try to create" << std::endl;
147 int success = gSystem->MakeDirectory( outputDir.c_str() );
148 if( success != 0 ) {
149 std::string fullOutputDir = std::string(gSystem->pwd()) + std::string("/") + outputDir;
150 std::cout << "Error: Failed to make output directory: " << fullOutputDir << std::endl;
151 throw hf_exc();
152 }
153 }
154 }
155
156 // This holds the TGraphs that are created during the fit
157 std::string outputFileName = measurement.GetOutputFilePrefix() + "_" + measurement.GetName() + ".root";
158 std::cout << "Creating the output file: " << outputFileName << std::endl;
159 outFile = new TFile(outputFileName.c_str(), "recreate");
160
161 // Create the table file
162 // This holds the table of fitted values and errors
163 std::string tableFileName = measurement.GetOutputFilePrefix() + "_results.table";
164 std::cout << "Creating the table file: " << tableFileName << std::endl;
165 tableFile = fopen( tableFileName.c_str(), "a");
166
167 std::cout << "Creating the HistoToWorkspaceFactoryFast factory" << std::endl;
169
170 // Make the factory, and do some preprocessing
171 // HistoToWorkspaceFactoryFast factory(measurement, rowTitle, outFile);
172 std::cout << "Setting preprocess functions" << std::endl;
173 factory.SetFunctionsToPreprocess( measurement.GetPreprocessFunctions() );
174
175 // for results tables
176 fprintf(tableFile, " %s &", rowTitle.c_str() );
177
178 // First: Loop to make the individual channels
179 for( unsigned int chanItr = 0; chanItr < measurement.GetChannels().size(); ++chanItr ) {
180
181 HistFactory::Channel& channel = measurement.GetChannels().at( chanItr );
182 if( ! channel.CheckHistograms() ) {
183 std::cout << "MakeModelAndMeasurementsFast: Channel: " << channel.GetName()
184 << " has uninitialized histogram pointers" << std::endl;
185 throw hf_exc();
186 }
187
188 // Make the workspace for this individual channel
189 std::string ch_name = channel.GetName();
190 std::cout << "Starting to process channel: " << ch_name << std::endl;
191 channel_names.push_back(ch_name);
192 RooWorkspace* ws_single = factory.MakeSingleChannelModel( measurement, channel );
193 channel_workspaces.push_back(ws_single);
194
195 // Make the output
196 std::string ChannelFileName = measurement.GetOutputFilePrefix() + "_"
197 + ch_name + "_" + rowTitle + "_model.root";
198 ws_single->writeToFile( ChannelFileName.c_str() );
199
200 // Now, write the measurement to the file
201 // Make a new measurement for only this channel
202 RooStats::HistFactory::Measurement meas_chan( measurement );
203 meas_chan.GetChannels().clear();
204 meas_chan.GetChannels().push_back( channel );
205 std::cout << "Opening File to hold channel: " << ChannelFileName << std::endl;
206 TFile* chanFile = TFile::Open( ChannelFileName.c_str(), "UPDATE" );
207 std::cout << "About to write channel measurement to file" << std::endl;
208 meas_chan.writeToFile( chanFile );
209 std::cout << "Successfully wrote channel to file" << std::endl;
210 chanFile->Close();
211
212 // Get the Paramater of Interest as a RooRealVar
213 RooRealVar* poi = dynamic_cast<RooRealVar*>( ws_single->var( (measurement.GetPOI()).c_str() ) );
214
215 // do fit unless exportOnly requested
216 if(! measurement.GetExportOnly()){
217 if(!poi) {
218 std::cout << "Can't do fit for: " << measurement.GetName()
219 << ", no parameter of interest" << std::endl;
220 } else {
221 if(ws_single->data("obsData")) {
222 FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), ws_single,
223 ch_name, "obsData", outFile, tableFile);
224 } else {
225 FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), ws_single,
226 ch_name, "asimovData", outFile, tableFile);
227 }
228 }
229 }
230
231 fprintf(tableFile, " & " );
232 } // End loop over channels
233
234 /***
235 Second: Make the combined model:
236 If you want output histograms in root format, create and pass it to the combine routine.
237 "combine" : will do the individual cross-section measurements plus combination
238 ***/
239
240 // Use HistFactory to combine the individual channel workspaces
241 ws = factory.MakeCombinedModel(channel_names, channel_workspaces);
242
243 // Configure that workspace
244 HistoToWorkspaceFactoryFast::ConfigureWorkspaceForMeasurement( "simPdf", ws, measurement );
245
246 // Get the Parameter of interest as a RooRealVar
247 RooRealVar* poi = dynamic_cast<RooRealVar*>( ws->var( (measurement.GetPOI()).c_str() ) );
248
249 std::string CombinedFileName = measurement.GetOutputFilePrefix() + "_combined_"
250 + rowTitle + "_model.root";
251 std::cout << "Writing combined workspace to file: " << CombinedFileName << std::endl;
252 ws->writeToFile( CombinedFileName.c_str() );
253 std::cout << "Writing combined measurement to file: " << CombinedFileName << std::endl;
254 TFile* combFile = TFile::Open( CombinedFileName.c_str(), "UPDATE" );
255 if( combFile == NULL ) {
256 std::cout << "Error: Failed to open file " << CombinedFileName << std::endl;
257 throw hf_exc();
258 }
259 measurement.writeToFile( combFile );
260 combFile->Close();
261
262 // Fit the combined model
263 if(! measurement.GetExportOnly()){
264 if(!poi) {
265 std::cout << "Can't do fit for: " << measurement.GetName()
266 << ", no parameter of interest" << std::endl;
267 }
268 else {
269 if(ws->data("obsData")){
270 FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), ws,"combined",
271 "obsData", outFile, tableFile);
272 }
273 else {
274 FitModelAndPlot(measurement.GetName(), measurement.GetOutputFilePrefix(), ws,"combined",
275 "asimovData", outFile, tableFile);
276 }
277 }
278 }
279
280 fprintf(tableFile, " \\\\ \n");
281
282 outFile->Close();
283 delete outFile;
284
285 fclose( tableFile );
286
287 }
288 catch(...) {
289 if( tableFile ) fclose(tableFile);
290 if(outFile) outFile->Close();
291 throw;
292 }
293
294 return ws;
295
296}
297
298
299///////////////////////////////////////////////
300void RooStats::HistFactory::FitModelAndPlot(const std::string& MeasurementName,
301 const std::string& FileNamePrefix,
302 RooWorkspace * combined, std::string channel,
303 std::string data_name,
304 TFile* outFile, FILE* tableFile ) {
305
306 if( outFile == NULL ) {
307 std::cout << "Error: Output File in FitModelAndPlot is NULL" << std::endl;
308 throw hf_exc();
309 }
310
311 if( tableFile == NULL ) {
312 std::cout << "Error: tableFile in FitModelAndPlot is NULL" << std::endl;
313 throw hf_exc();
314 }
315
316 if( combined == NULL ) {
317 std::cout << "Error: Supplied workspace in FitModelAndPlot is NULL" << std::endl;
318 throw hf_exc();
319 }
320
321 ModelConfig* combined_config = (ModelConfig *) combined->obj("ModelConfig");
322 if(!combined_config){
323 std::cout << "Error: no ModelConfig found in Measurement: "
324 << MeasurementName << std::endl;
325 throw hf_exc();
326 }
327
328 RooAbsData* simData = combined->data(data_name.c_str());
329 if(!simData){
330 std::cout << "Error: Failed to get dataset: " << data_name
331 << " in measurement: " << MeasurementName << std::endl;
332 throw hf_exc();
333 }
334
335 const RooArgSet* POIs = combined_config->GetParametersOfInterest();
336 if(!POIs) {
337 std::cout << "Not Fitting Model for measurement: " << MeasurementName
338 << ", no poi found" << std::endl;
339 // Should I throw an exception here?
340 return;
341 }
342
343 RooAbsPdf* model = combined_config->GetPdf();
344 if( model==NULL ) {
345 std::cout << "Error: Failed to find pdf in ModelConfig: " << combined_config->GetName()
346 << std::endl;
347 throw hf_exc();
348 }
349
350 // Save a Snapshot
351 RooArgSet PoiPlusNuisance;
352 if( combined_config->GetNuisanceParameters() ) {
353 PoiPlusNuisance.add( *combined_config->GetNuisanceParameters() );
354 }
355 PoiPlusNuisance.add( *combined_config->GetParametersOfInterest() );
356 combined->saveSnapshot("InitialValues", PoiPlusNuisance);
357
358 ///////////////////////////////////////
359 // Do the fit
360 std::cout << "\n\n---------------" << std::endl;
361 std::cout << "---------------- Doing "<< channel << " Fit" << std::endl;
362 std::cout << "---------------\n\n" << std::endl;
363 model->fitTo(*simData, Minos(kTRUE), PrintLevel(1));
364
365 // If there are no parameters of interest,
366 // we exit the function here
367 if( POIs->getSize()==0 ) {
368 std::cout << "WARNING: No POIs found in measurement: " << MeasurementName << std::endl;
369 return;
370 }
371
372 // Loop over all POIs and print their fitted values
373 RooRealVar* poi = NULL; // (RooRealVar*) POIs->first();
374 TIterator* params_itr = POIs->createIterator();
375 TObject* poi_obj=NULL;
376 while( (poi_obj=params_itr->Next()) ) {
377 //poi = (RooRealVar*) poi_obj;
378 poi = dynamic_cast<RooRealVar*>(poi_obj);
379 std::cout << "printing results for " << poi->GetName()
380 << " at " << poi->getVal()<< " high "
381 << poi->getErrorLo() << " low "
382 << poi->getErrorHi() << std::endl;
383 }
384
385 // But we only make detailed plots and tables
386 // for the 'first' POI
387 poi = dynamic_cast<RooRealVar*>(POIs->first());
388
389 // Print the MINOS errors to the TableFile
390 fprintf(tableFile, " %.4f / %.4f ", poi->getErrorLo(), poi->getErrorHi());
391
392 // Make the Profile Likelihood Plot
393 RooAbsReal* nll = model->createNLL(*simData);
394 RooAbsReal* profile = nll->createProfile(*poi);
395 if( profile==NULL ) {
396 std::cout << "Error: Failed to make ProfileLikelihood for: " << poi->GetName()
397 << " using model: " << model->GetName()
398 << " and data: " << simData->GetName()
399 << std::endl;
400 throw hf_exc();
401 }
402
403 RooPlot* frame = poi->frame();
404 if( frame == NULL ) {
405 std::cout << "Error: Failed to create RooPlot frame for: " << poi->GetName() << std::endl;
406 throw hf_exc();
407 }
408
409 // Draw the likelihood curve
411 TCanvas* ProfileLikelihoodCanvas = new TCanvas( channel.c_str(), "",800,600);
413 profile->plotOn(frame);
414 frame->SetMinimum(0);
415 frame->SetMaximum(2.);
416 frame->Draw();
417 std::string ProfilePlotName = FileNamePrefix+"_"+channel+"_"+MeasurementName+"_profileLR.eps";
418 ProfileLikelihoodCanvas->SaveAs( ProfilePlotName.c_str() );
419 delete ProfileLikelihoodCanvas;
420
421 // Now, we save our results to the 'output' file
422 // (I'm not sure if users actually look into this file,
423 // but adding additional information and useful plots
424 // may make it more attractive)
425
426 // Save to the output file
427 TDirectory* channel_dir = outFile->mkdir(channel.c_str());
428 if( channel_dir == NULL ) {
429 std::cout << "Error: Failed to make channel directory: " << channel << std::endl;
430 throw hf_exc();
431 }
432 TDirectory* summary_dir = channel_dir->mkdir("Summary");
433 if( summary_dir == NULL ) {
434 std::cout << "Error: Failed to make Summary directory for channel: "
435 << channel << std::endl;
436 throw hf_exc();
437 }
438 summary_dir->cd();
439
440 // Save a graph of the profile likelihood curve
441 RooCurve* curve=frame->getCurve();
442 Int_t curve_N=curve->GetN();
443 Double_t* curve_x=curve->GetX();
444
445 Double_t * x_arr = new Double_t[curve_N];
446 Double_t * y_arr_nll = new Double_t[curve_N];
447
448 for(int i=0; i<curve_N; i++){
449 double f=curve_x[i];
450 poi->setVal(f);
451 x_arr[i]=f;
452 y_arr_nll[i]=nll->getVal();
453 }
454
455 delete frame;
456
457 TGraph* g = new TGraph(curve_N, x_arr, y_arr_nll);
458 g->SetName( (FileNamePrefix +"_nll").c_str() );
459 g->Write();
460 delete g;
461 delete [] x_arr;
462 delete [] y_arr_nll;
463
464 // Finally, restore the initial values
465 combined->loadSnapshot("InitialValues");
466
467}
468
469
470void RooStats::HistFactory::FitModel(RooWorkspace * combined, std::string data_name ) {
471
472 std::cout << "In Fit Model" << std::endl;
473 ModelConfig * combined_config = (ModelConfig *) combined->obj("ModelConfig");
474 if(!combined_config){
475 std::cout << "no model config " << "ModelConfig" << " exiting" << std::endl;
476 return;
477 }
478
479 RooAbsData* simData = combined->data(data_name.c_str());
480 if(!simData){
481 std::cout << "no data " << data_name << " exiting" << std::endl;
482 return;
483 }
484
485 const RooArgSet * POIs=combined_config->GetParametersOfInterest();
486 if(!POIs){
487 std::cout << "no poi " << data_name << " exiting" << std::endl;
488 return;
489 }
490
491 RooAbsPdf* model=combined_config->GetPdf();
492 model->fitTo(*simData, Minos(kTRUE), PrintLevel(1));
493
494 }
495
496
497void RooStats::HistFactory::FormatFrameForLikelihood(RooPlot* frame, std::string /*XTitle*/,
498 std::string YTitle){
499
502 // gStyle->SetPadColor(0);
503 // gStyle->SetCanvasColor(255);
504 // gStyle->SetTitleFillColor(255);
505 // gStyle->SetFrameFillColor(0);
506 // gStyle->SetStatColor(255);
507
508 RooAbsRealLValue* var = frame->getPlotVar();
509 double xmin = var->getMin();
510 double xmax = var->getMax();
511
512 frame->SetTitle("");
513 // frame->GetXaxis()->SetTitle(XTitle.c_str());
514 frame->GetXaxis()->SetTitle(var->GetTitle());
515 frame->GetYaxis()->SetTitle(YTitle.c_str());
516 frame->SetMaximum(2.);
517 frame->SetMinimum(0.);
518 TLine * line = new TLine(xmin,.5,xmax,.5);
520 TLine * line90 = new TLine(xmin,2.71/2.,xmax,2.71/2.);
521 line90->SetLineColor(kGreen);
522 TLine * line95 = new TLine(xmin,3.84/2.,xmax,3.84/2.);
523 line95->SetLineColor(kGreen);
524 frame->addObject(line);
525 frame->addObject(line90);
526 frame->addObject(line95);
527}
528
529
#define f(i)
Definition: RSha256.hxx:104
#define g(i)
Definition: RSha256.hxx:105
int Int_t
Definition: RtypesCore.h:41
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
@ kRed
Definition: Rtypes.h:63
@ kGreen
Definition: Rtypes.h:63
@ kDashed
Definition: TAttLine.h:48
float xmin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
R__EXTERN TStyle * gStyle
Definition: TStyle.h:406
R__EXTERN TSystem * gSystem
Definition: TSystem.h:540
Int_t getSize() const
RooAbsArg * first() const
TIterator * createIterator(Bool_t dir=kIterForward) const
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getMax(const char *name=0) const
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
virtual Double_t getMin(const char *name=0) const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg(), const RooCmdArg &arg2=RooCmdArg(), const RooCmdArg &arg3=RooCmdArg(), const RooCmdArg &arg4=RooCmdArg(), const RooCmdArg &arg5=RooCmdArg(), const RooCmdArg &arg6=RooCmdArg(), const RooCmdArg &arg7=RooCmdArg(), const RooCmdArg &arg8=RooCmdArg(), const RooCmdArg &arg9=RooCmdArg(), const RooCmdArg &arg10=RooCmdArg()) const
Plot (project) PDF on specified frame.
virtual RooAbsReal * createProfile(const RooArgSet &paramsOfInterest)
Create a RooProfileLL object that eliminates all nuisance parameters in the present function.
Definition: RooAbsReal.cxx:462
Double_t getVal(const RooArgSet *set=0) const
Evaluate object. Returns either cached value or triggers a recalculation.
Definition: RooAbsReal.h:64
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
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...
Definition: RooArgSet.h:88
A RooCurve is a one-dimensional graphical representation of a real-valued function.
Definition: RooCurve.h:32
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:41
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
Definition: RooPlot.cxx:391
void SetTitle(const char *name)
Set the title of the RooPlot to 'title'.
Definition: RooPlot.cxx:1104
virtual void SetMinimum(Double_t minimum=-1111)
Set minimum value of Y axis.
Definition: RooPlot.cxx:958
TAxis * GetYaxis() const
Definition: RooPlot.cxx:1123
RooAbsRealLValue * getPlotVar() const
Definition: RooPlot.h:132
TAxis * GetXaxis() const
Definition: RooPlot.cxx:1122
virtual void SetMaximum(Double_t maximum=-1111)
Set maximum value of Y axis.
Definition: RooPlot.cxx:948
RooCurve * getCurve(const char *name=0) const
Return a RooCurve pointer of the named object in this plot, or zero if the named object does not exis...
Definition: RooPlot.cxx:774
virtual void Draw(Option_t *options=0)
Draw this plot and all of the elements it contains.
Definition: RooPlot.cxx:558
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
Double_t getErrorHi() const
Definition: RooRealVar.h:63
Double_t getErrorLo() const
Definition: RooRealVar.h:62
virtual void setVal(Double_t value)
Set value of variable to 'value'.
Definition: RooRealVar.cxx:204
This class encapsulates all information for the statistical interpretation of one experiment.
Definition: Channel.h:26
std::string GetName()
get name of channel
Definition: Channel.h:39
The RooStats::HistFactory::Measurement class can be used to construct a model by combining multiple R...
Definition: Measurement.h:30
double GetLumiRelErr()
retrieve relative uncertainty on luminosity
Definition: Measurement.h:90
std::vector< std::string > & GetConstantParams()
get vector of all constant parameters
Definition: Measurement.h:60
std::vector< RooStats::HistFactory::Channel > & GetChannels()
Definition: Measurement.h:105
std::string GetOutputFilePrefix()
retrieve prefix for output files
Definition: Measurement.h:42
double GetLumi()
retrieve integrated luminosity
Definition: Measurement.h:88
std::string GetPOI(unsigned int i=0)
get name of PoI at given index
Definition: Measurement.h:49
std::vector< std::string > GetPreprocessFunctions()
ModelConfig is a simple class that holds configuration information specifying how a model should be u...
Definition: ModelConfig.h:30
const RooArgSet * GetParametersOfInterest() const
get RooArgSet containing the parameter of interest (return NULL if not existing)
Definition: ModelConfig.h:231
const RooArgSet * GetNuisanceParameters() const
get RooArgSet containing the nuisance parameters (return NULL if not existing)
Definition: ModelConfig.h:234
RooAbsPdf * GetPdf() const
get model PDF (return NULL if pdf has not been specified or does not exist)
Definition: ModelConfig.h:228
The RooWorkspace is a persistable container for RooFit projects.
Definition: RooWorkspace.h:43
RooAbsData * data(const char *name) const
Retrieve dataset (binned or unbinned) with given name. A null pointer is returned if not found.
Bool_t writeToFile(const char *fileName, Bool_t recreate=kTRUE)
Save this current workspace into given file.
Bool_t saveSnapshot(const char *name, const char *paramNames)
Save snapshot of values and attributes (including "Constant") of parameters 'params' If importValues ...
Bool_t loadSnapshot(const char *name)
Load the values and attributes of the parameters in the snapshot saved with the given name.
RooRealVar * var(const char *name) const
Retrieve real-valued variable (RooRealVar) with given name. A null pointer is returned if not found.
TObject * obj(const char *name) const
Return any type of object (RooAbsArg, RooAbsData or generic object) with given name)
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
The Canvas class.
Definition: TCanvas.h:31
Describe directory structure in memory.
Definition: TDirectory.h:34
virtual Bool_t cd(const char *path=0)
Change current directory to "this" directory.
Definition: TDirectory.cxx:497
virtual TDirectory * mkdir(const char *name, const char *title="")
Create a sub-directory "a" or a hierarchy of sub-directories "a/b/c/...".
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.
Definition: TFile.cxx:3975
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
Int_t GetN() const
Definition: TGraph.h:123
Double_t * GetX() const
Definition: TGraph.h:130
Iterator abstract base class.
Definition: TIterator.h:30
virtual TObject * Next()=0
A simple line.
Definition: TLine.h:23
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
virtual void SaveAs(const char *filename="", Option_t *option="") const
Save Pad contents in a file in one of various formats.
Definition: TPad.cxx:5539
void SetPadBorderMode(Int_t mode=1)
Definition: TStyle.h:334
void SetCanvasBorderMode(Int_t mode=1)
Definition: TStyle.h:323
const char * pwd()
Definition: TSystem.h:405
virtual void * OpenDirectory(const char *name)
Open a directory. Returns 0 if directory does not exist.
Definition: TSystem.cxx:843
virtual int MakeDirectory(const char *name)
Make a directory.
Definition: TSystem.cxx:834
TLine * line
RooCmdArg ShiftToZero()
RooCmdArg PrintLevel(Int_t code)
RooCmdArg LineColor(Color_t color)
RooCmdArg LineStyle(Style_t style)
RooCmdArg Minos(Bool_t flag=kTRUE)
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"))
void FitModelAndPlot(const std::string &measurementName, const std::string &fileNamePrefix, RooWorkspace *, std::string, std::string, TFile *, FILE *)
RooWorkspace * MakeModelAndMeasurementFast(RooStats::HistFactory::Measurement &measurement)
Make a model from histograms.
void ws()
Definition: ws.C:63