Logo ROOT   6.16/01
Reference Guide
RooMCStudy.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/**
18\file RooMCStudy.cxx
19\class RooMCStudy
20\ingroup Roofitcore
21
22RooMCStudy is a help class to facilitate Monte Carlo studies
23such as 'goodness-of-fit' studies, that involve fitting a PDF
24to multiple toy Monte Carlo sets generated from the same PDF
25or another PDF.
26
27Given a fit PDF and a generator PDF, RooMCStudy can produce
28large numbers of toyMC samples and/or fit these samples
29and accumulate the final parameters of each fit in a dataset.
30Additional plotting routines simplify the task of plotting
31the distribution of the minimized likelihood, the fitted parameter values,
32fitted error and pull distribution.
33RooMCStudy provides the option to insert add-in modules
34that modify the generate and fit cycle and allow to perform
35extra steps in the cycle. Output of these modules can be stored
36alongside the fit results in the aggregate results dataset.
37These study modules should derive from class RooAbsMCStudyModel
38
39**/
40
41
42
43#include "RooFit.h"
44#include "Riostream.h"
45
46#include "RooMCStudy.h"
47#include "RooAbsMCStudyModule.h"
48
49#include "RooGenContext.h"
50#include "RooAbsPdf.h"
51#include "RooDataSet.h"
52#include "RooDataHist.h"
53#include "RooRealVar.h"
54#include "RooFitResult.h"
55#include "RooErrorVar.h"
56#include "RooFormulaVar.h"
57#include "RooArgList.h"
58#include "RooPlot.h"
59#include "RooGenericPdf.h"
60#include "RooRandom.h"
61#include "RooCmdConfig.h"
62#include "RooGlobalFunc.h"
63#include "RooPullVar.h"
64#include "RooMsgService.h"
65#include "RooProdPdf.h"
66
67using namespace std ;
68
70 ;
71
72
73/**
74Construct Monte Carlo Study Manager. This class automates generating data from a given PDF,
75fitting the PDF to that data and accumulating the fit statistics.
76
77\param[in] model The PDF to be studied
78\param[in] observables The variables of the PDF to be considered the observables
79\param[in] argX Arguments from the table below
80
81<table>
82<tr><th> Optional arguments <th>
83<tr><td> Silence() <td> Suppress all RooFit messages during running below PROGRESS level
84<tr><td> FitModel(const RooAbsPdf&) <td> The PDF for fitting, if it is different from the PDF for generating
85<tr><td> ConditionalObservables(const RooArgSet& set) <td> The set of observables that the PDF should _not_ be normalized over
86<tr><td> Binned(Bool_t flag) <td> Bin the dataset before fitting it. Speeds up fitting of large data samples
87<tr><td> FitOptions(const char*) <td> Classic fit options, provided for backward compatibility
88<tr><td> FitOptions(....) <td> Options to be used for fitting. All named arguments inside FitOptions() are passed to RooAbsPdf::fitTo()
89<tr><td> Verbose(Bool_t flag) <td> Activate informational messages in event generation phase
90<tr><td> Extended(Bool_t flag) <td> Determine number of events for each sample anew from a Poisson distribution
91<tr><td> Constrain(const RooArgSet& pars) <td> Apply internal constraints on given parameters in fit and sample constrained parameter values from constraint p.d.f for each toy.
92<tr><td> ExternalConstraints(const RooArgSet& ) <td> Apply internal constraints on given parameters in fit and sample constrained parameter values from constraint p.d.f for each toy.
93<tr><td> ProtoData(const RooDataSet&, Bool_t randOrder)
94 <td> Prototype data for the event generation. If the randOrder flag is set, the order of the dataset will be re-randomized for each generation
95 cycle to protect against systematic biases if the number of generated events does not exactly match the number of events in the prototype dataset
96 at the cost of reduced precision with mu equal to the specified number of events
97</table>
98*/
100 const RooCmdArg& arg1, const RooCmdArg& arg2,
101 const RooCmdArg& arg3,const RooCmdArg& arg4,const RooCmdArg& arg5,
102 const RooCmdArg& arg6,const RooCmdArg& arg7,const RooCmdArg& arg8) : TNamed("mcstudy","mcstudy")
103
104{
105 // Stuff all arguments in a list
106 RooLinkedList cmdList;
107 cmdList.Add(const_cast<RooCmdArg*>(&arg1)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg2)) ;
108 cmdList.Add(const_cast<RooCmdArg*>(&arg3)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg4)) ;
109 cmdList.Add(const_cast<RooCmdArg*>(&arg5)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg6)) ;
110 cmdList.Add(const_cast<RooCmdArg*>(&arg7)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg8)) ;
111
112 // Select the pdf-specific commands
113 RooCmdConfig pc(Form("RooMCStudy::RooMCStudy(%s)",model.GetName())) ;
114
115 pc.defineObject("fitModel","FitModel",0,0) ;
116 pc.defineObject("condObs","ProjectedDependents",0,0) ;
117 pc.defineObject("protoData","PrototypeData",0,0) ;
118 pc.defineSet("cPars","Constrain",0,0) ;
119 pc.defineSet("extCons","ExternalConstraints",0,0) ;
120 pc.defineInt("silence","Silence",0,0) ;
121 pc.defineInt("randProtoData","PrototypeData",0,0) ;
122 pc.defineInt("verboseGen","Verbose",0,0) ;
123 pc.defineInt("extendedGen","Extended",0,0) ;
124 pc.defineInt("binGenData","Binned",0,0) ;
125 pc.defineString("fitOpts","FitOptions",0,"") ;
126 pc.defineInt("dummy","FitOptArgs",0,0) ;
127 pc.defineMutex("FitOptions","FitOptArgs") ; // can have either classic or new-style fit options
128 pc.defineMutex("Constrain","FitOptions") ; // constraints only work with new-style fit options
129 pc.defineMutex("ExternalConstraints","FitOptions") ; // constraints only work with new-style fit options
130
131 // Process and check varargs
132 pc.process(cmdList) ;
133 if (!pc.ok(kTRUE)) {
134 // WVE do something here
135 throw std::string("RooMCStudy::RooMCStudy() Error in parsing arguments passed to contructor") ;
136 return ;
137 }
138
139 // Save fit command options
140 if (pc.hasProcessed("FitOptArgs")) {
141 RooCmdArg* fitOptArg = static_cast<RooCmdArg*>(cmdList.FindObject("FitOptArgs")) ;
142 for (Int_t i=0 ; i<fitOptArg->subArgs().GetSize() ;i++) {
143 _fitOptList.Add(new RooCmdArg(static_cast<RooCmdArg&>(*fitOptArg->subArgs().At(i)))) ;
144 }
145 }
146
147 // Decode command line arguments
148 _silence = pc.getInt("silence") ;
149 _verboseGen = pc.getInt("verboseGen") ;
150 _extendedGen = pc.getInt("extendedGen") ;
151 _binGenData = pc.getInt("binGenData") ;
152 _randProto = pc.getInt("randProtoData") ;
153
154 // Process constraints specifications
155 const RooArgSet* cParsTmp = pc.getSet("cPars") ;
156 const RooArgSet* extCons = pc.getSet("extCons") ;
157
158 RooArgSet* cPars = new RooArgSet ;
159 if (cParsTmp) {
160 cPars->add(*cParsTmp) ;
161 }
162
163 // If constraints are specified, add to fit options
164 if (cPars) {
166 }
167 if (extCons) {
169 }
170
171 // Make list of all constraints
172 RooArgSet allConstraints ;
173 RooArgSet consPars ;
174 if (cPars) {
175 RooArgSet* constraints = model.getAllConstraints(observables,*cPars,kTRUE) ;
176 if (constraints) {
177 allConstraints.add(*constraints) ;
178 delete constraints ;
179 }
180 }
181
182 // Construct constraint p.d.f
183 if (allConstraints.getSize()>0) {
184 _constrPdf = new RooProdPdf("mcs_constr_prod","RooMCStudy constraints product",allConstraints) ;
185
186 if (cPars) {
187 consPars.add(*cPars) ;
188 } else {
189 RooArgSet* params = model.getParameters(observables) ;
190 RooArgSet* cparams = _constrPdf->getObservables(*params) ;
191 consPars.add(*cparams) ;
192 delete params ;
193 delete cparams ;
194 }
196
198
199 coutI(Generation) << "RooMCStudy::RooMCStudy: INFO have pdf with constraints, will generate parameters from constraint pdf for each experiment" << endl ;
200
201
202 } else {
203 _constrPdf = 0 ;
205
207 }
208
209
210 // Extract generator and fit models
211 _genModel = const_cast<RooAbsPdf*>(&model) ;
212 _genSample = 0 ;
213 RooAbsPdf* fitModel = static_cast<RooAbsPdf*>(pc.getObject("fitModel",0)) ;
214 _fitModel = fitModel ? fitModel : _genModel ;
215
216 // Extract conditional observables and prototype data
217 _genProtoData = static_cast<RooDataSet*>(pc.getObject("protoData",0)) ;
218 if (pc.getObject("condObs",0)) {
219 _projDeps.add(static_cast<RooArgSet&>(*pc.getObject("condObs",0))) ;
220 }
221
222 _dependents.add(observables) ;
223
225 _fitOptions = pc.getString("fitOpts") ;
227
229 oocoutW(_fitModel,Generation) << "RooMCStudy::RooMCStudy: WARNING Using generator option 'e' (Poisson distribution of #events) together " << endl
230 << " with a prototype dataset implies incomplete sampling or oversampling of proto data." << endl
231 << " Use option \"r\" to randomize prototype dataset order and thus to randomize" << endl
232 << " the set of over/undersampled prototype events for each generation cycle." << endl ;
233 }
234
236 if (!_binGenData) {
239 } else {
240 _genContext = 0 ;
241 }
242
244
245 // Store list of parameters and save initial values separately
248
250
251 // Place holder for NLL
252 _nllVar = new RooRealVar("NLL","-log(Likelihood)",0) ;
253
254 // Place holder for number of generated events
255 _ngenVar = new RooRealVar("ngen","number of generated events",0) ;
256
257 // Create data set containing parameter values, errors and pulls
258 RooArgSet tmp2(*_fitParams) ;
259 tmp2.add(*_nllVar) ;
260 tmp2.add(*_ngenVar) ;
261
262 // Mark all variable to store their errors in the dataset
263 tmp2.setAttribAll("StoreError",kTRUE) ;
264 tmp2.setAttribAll("StoreAsymError",kTRUE) ;
265 TString fpdName ;
266 if (_fitModel==_genModel) {
267 fpdName = Form("fitParData_%s",_fitModel->GetName()) ;
268 } else {
269 fpdName= Form("fitParData_%s_%s",_fitModel->GetName(),_genModel->GetName()) ;
270 }
271
272 _fitParData = new RooDataSet(fpdName.Data(),"Fit Parameters DataSet",tmp2) ;
273 tmp2.setAttribAll("StoreError",kFALSE) ;
274 tmp2.setAttribAll("StoreAsymError",kFALSE) ;
275
276 if (_perExptGenParams) {
277 _genParData = new RooDataSet("genParData","Generated Parameters dataset",*_genParams) ;
278 } else {
279 _genParData = 0 ;
280 }
281
282 // Append proto variables to allDependents
283 if (_genProtoData) {
285 }
286
287 // Call module initializers
288 list<RooAbsMCStudyModule*>::iterator iter ;
289 for (iter=_modList.begin() ; iter!= _modList.end() ; ++iter) {
290 Bool_t ok = (*iter)->doInitializeInstance(*this) ;
291 if (!ok) {
292 oocoutE(_fitModel,Generation) << "RooMCStudy::ctor: removing study module " << (*iter)->GetName() << " from analysis chain because initialization failed" << endl ;
293 iter = _modList.erase(iter) ;
294 }
295 }
296
297}
298
299
300////////////////////////////////////////////////////////////////////////////////
301/// \deprecated PLEASE USE CONSTRUCTOR WITH NAMED ARGUMENTS. RETAINED FOR BACKWARD COMPATIBILY.
302///
303/// Constructor with a generator and fit model. Both models may point
304/// to the same object. The 'dependents' set of variables is generated
305/// in the generator phase. The optional prototype dataset is passed to
306/// the generator
307///
308/// Available generator options
309/// v - Verbose
310/// e - Extended: use Poisson distribution for Nevts generated
311///
312/// Available fit options
313/// See RooAbsPdf::fitTo()
314///
315
316RooMCStudy::RooMCStudy(const RooAbsPdf& genModel, const RooAbsPdf& fitModel,
317 const RooArgSet& dependents, const char* genOptions,
318 const char* fitOptions, const RooDataSet* genProtoData,
319 const RooArgSet& projDeps) :
320 TNamed("mcstudy","mcstudy"),
321 _genModel((RooAbsPdf*)&genModel),
322 _genProtoData(genProtoData),
323 _projDeps(projDeps),
324 _constrPdf(0),
325 _constrGenContext(0),
326 _dependents(dependents),
327 _allDependents(dependents),
328 _fitModel((RooAbsPdf*)&fitModel),
329 _nllVar(0),
330 _ngenVar(0),
331 _genParData(0),
332 _fitOptions(fitOptions),
333 _canAddFitResults(kTRUE),
334 _perExptGenParams(0),
335 _silence(kFALSE)
336{
337 // Decode generator options
338 TString genOpt(genOptions) ;
339 genOpt.ToLower() ;
340 _verboseGen = genOpt.Contains("v") ;
341 _extendedGen = genOpt.Contains("e") ;
342 _binGenData = genOpt.Contains("b") ;
343 _randProto = genOpt.Contains("r") ;
344
345 if (_extendedGen && genProtoData && !_randProto) {
346 oocoutE(_fitModel,Generation) << "RooMCStudy::RooMCStudy: WARNING Using generator option 'e' (Poisson distribution of #events) together " << endl
347 << " with a prototype dataset implies incomplete sampling or oversampling of proto data." << endl
348 << " Use option \"r\" to randomize prototype dataset order and thus to randomize" << endl
349 << " the set of over/undersampled prototype events for each generation cycle." << endl ;
350 }
351
352 if (!_binGenData) {
353 _genContext = genModel.genContext(dependents,genProtoData,0,_verboseGen) ;
354 } else {
355 _genContext = 0 ;
356 }
358 _genSample = 0 ;
359 RooArgSet* tmp = genModel.getParameters(&dependents) ;
361 delete tmp ;
362
363 // Store list of parameters and save initial values separately
364 _fitParams = fitModel.getParameters(&dependents) ;
366
367 _nExpGen = _extendedGen ? genModel.expectedEvents(&dependents) : 0 ;
368
369 // Place holder for NLL
370 _nllVar = new RooRealVar("NLL","-log(Likelihood)",0) ;
371
372 // Place holder for number of generated events
373 _ngenVar = new RooRealVar("ngen","number of generated events",0) ;
374
375 // Create data set containing parameter values, errors and pulls
376 RooArgSet tmp2(*_fitParams) ;
377 tmp2.add(*_nllVar) ;
378 tmp2.add(*_ngenVar) ;
379
380 // Mark all variable to store their errors in the dataset
381 tmp2.setAttribAll("StoreError",kTRUE) ;
382 tmp2.setAttribAll("StoreAsymError",kTRUE) ;
383 _fitParData = new RooDataSet("fitParData","Fit Parameters DataSet",tmp2) ;
384 tmp2.setAttribAll("StoreError",kFALSE) ;
385 tmp2.setAttribAll("StoreAsymError",kFALSE) ;
386
387 // Append proto variables to allDependents
388 if (genProtoData) {
389 _allDependents.add(*genProtoData->get(),kTRUE) ;
390 }
391
392 // Call module initializers
393 list<RooAbsMCStudyModule*>::iterator iter ;
394 for (iter=_modList.begin() ; iter!= _modList.end() ; ++iter) {
395 Bool_t ok = (*iter)->doInitializeInstance(*this) ;
396 if (!ok) {
397 oocoutE(_fitModel,Generation) << "RooMCStudy::ctor: removing study module " << (*iter)->GetName() << " from analysis chain because initialization failed" << endl ;
398 iter = _modList.erase(iter) ;
399 }
400 }
401
402}
403
404
405
406////////////////////////////////////////////////////////////////////////////////
407
409{
412 delete _ngenVar ;
413 delete _fitParData ;
414 delete _genParData ;
415 delete _fitInitParams ;
416 delete _fitParams ;
417 delete _genInitParams ;
418 delete _genParams ;
419 delete _genContext ;
420 delete _nllVar ;
421 delete _constrPdf ;
422 delete _constrGenContext ;
423}
424
425
426
427////////////////////////////////////////////////////////////////////////////////
428/// Insert given RooMCStudy add-on module to the processing chain
429/// of this MCStudy object
430
432{
433 module.doInitializeInstance(*this) ;
434 _modList.push_back(&module) ;
435}
436
437
438
439////////////////////////////////////////////////////////////////////////////////
440/// Run engine method. Generate and/or fit, according to flags, 'nSamples' samples of 'nEvtPerSample' events.
441/// If keepGenData is set, all generated data sets will be kept in memory and can be accessed
442/// later via genData().
443///
444/// When generating, data sets will be written out in ascii form if the pattern string is supplied
445/// The pattern, which is a template for snprintf, should look something like "data/toymc_%04d.dat"
446/// and should contain one integer field that encodes the sample serial number.
447///
448/// When fitting only, data sets may optionally be read from ascii files, using the same file
449/// pattern.
450///
451
452Bool_t RooMCStudy::run(Bool_t doGenerate, Bool_t DoFit, Int_t nSamples, Int_t nEvtPerSample, Bool_t keepGenData, const char* asciiFilePat)
453{
455 if (_silence) {
458 }
459
460 list<RooAbsMCStudyModule*>::iterator iter ;
461 for (iter=_modList.begin() ; iter!= _modList.end() ; ++iter) {
462 (*iter)->initializeRun(nSamples) ;
463 }
464
465 Int_t prescale = nSamples>100 ? Int_t(nSamples/100) : 1 ;
466
467 while(nSamples--) {
468
469 if (nSamples%prescale==0) {
470 oocoutP(_fitModel,Generation) << "RooMCStudy::run: " ;
471 if (doGenerate) ooccoutI(_fitModel,Generation) << "Generating " ;
472 if (doGenerate && DoFit) ooccoutI(_fitModel,Generation) << "and " ;
473 if (DoFit) ooccoutI(_fitModel,Generation) << "fitting " ;
474 ooccoutP(_fitModel,Generation) << "sample " << nSamples << endl ;
475 }
476
477 _genSample = 0;
478 Bool_t existingData = kFALSE ;
479 if (doGenerate) {
480 // Generate sample
481 Int_t nEvt(nEvtPerSample) ;
482
483 // Reset generator parameters to initial values
485
486 // If constraints are present, sample generator values from constraints
487 if (_constrPdf) {
489 *_genParams = *tmp->get() ;
490 delete tmp ;
491 }
492
493 // Save generated parameters if required
494 if (_genParData) {
496 }
497
498 // Call module before-generation hook
499 list<RooAbsMCStudyModule*>::iterator iter2 ;
500 for (iter2=_modList.begin() ; iter2!= _modList.end() ; ++iter2) {
501 (*iter2)->processBeforeGen(nSamples) ;
502 }
503
504 if (_binGenData) {
505
506 // Calculate the number of (extended) events for this run
507 if (_extendedGen) {
509 nEvt = RooRandom::randomGenerator()->Poisson(nEvtPerSample==0?_nExpGen:nEvtPerSample) ;
510 }
511
512 // Binned generation
514
515 } else {
516
517 // Calculate the number of (extended) events for this run
518 if (_extendedGen) {
520 nEvt = RooRandom::randomGenerator()->Poisson(nEvtPerSample==0?_nExpGen:nEvtPerSample) ;
521 }
522
523 // Optional randomization of protodata for this run
525 oocoutI(_fitModel,Generation) << "RooMCStudy: (Re)randomizing event order in prototype dataset (Nevt=" << nEvt << ")" << endl ;
527 _genContext->setProtoDataOrder(newOrder) ;
528 delete[] newOrder ;
529 }
530
531 cout << "RooMCStudy: now generating " << nEvt << " events" << endl ;
532
533 // Actual generation of events
534 if (nEvt>0) {
536 } else {
537 // Make empty dataset
538 _genSample = new RooDataSet("emptySample","emptySample",_dependents) ;
539 }
540 }
541
542
543 //} else if (asciiFilePat && &asciiFilePat) { //warning: the address of 'asciiFilePat' will always evaluate as 'true'
544 } else if (asciiFilePat) {
545
546 // Load sample from ASCII file
547 char asciiFile[1024] ;
548 snprintf(asciiFile,1024,asciiFilePat,nSamples) ;
549 RooArgList depList(_allDependents) ;
550 _genSample = RooDataSet::read(asciiFile,depList,"q") ;
551
552 } else {
553
554 // Load sample from internal list
555 _genSample = (RooDataSet*) _genDataList.At(nSamples) ;
556 existingData = kTRUE ;
557 if (!_genSample) {
558 oocoutW(_fitModel,Generation) << "RooMCStudy::run: WARNING: Sample #" << nSamples << " not loaded, skipping" << endl ;
559 continue ;
560 }
561 }
562
563 // Save number of generated events
565
566 // Call module between generation and fitting hook
567 list<RooAbsMCStudyModule*>::iterator iter3 ;
568 for (iter3=_modList.begin() ; iter3!= _modList.end() ; ++iter3) {
569 (*iter3)->processBetweenGenAndFit(nSamples) ;
570 }
571
572 if (DoFit) fitSample(_genSample) ;
573
574 // Call module between generation and fitting hook
575 for (iter3=_modList.begin() ; iter3!= _modList.end() ; ++iter3) {
576 (*iter3)->processAfterFit(nSamples) ;
577 }
578
579 // Optionally write to ascii file
580 if (doGenerate && asciiFilePat && *asciiFilePat) {
581 char asciiFile[1024] ;
582 snprintf(asciiFile,1024,asciiFilePat,nSamples) ;
583 RooDataSet* unbinnedData = dynamic_cast<RooDataSet*>(_genSample) ;
584 if (unbinnedData) {
585 unbinnedData->write(asciiFile) ;
586 } else {
587 coutE(InputArguments) << "RooMCStudy::run(" << GetName() << ") ERROR: ASCII writing of binned datasets is not supported" << endl ;
588 }
589 }
590
591 // Add to list or delete
592 if (!existingData) {
593 if (keepGenData) {
595 } else {
596 delete _genSample ;
597 }
598 }
599 }
600
601 for (iter=_modList.begin() ; iter!= _modList.end() ; ++iter) {
602 RooDataSet* auxData = (*iter)->finalizeRun() ;
603 if (auxData) {
604 _fitParData->merge(auxData) ;
605 }
606 }
607
609
610 if (_genParData) {
611 const RooArgSet* genPars = _genParData->get() ;
612 TIterator* iter2 = genPars->createIterator() ;
613 RooAbsArg* arg ;
614 while((arg=(RooAbsArg*)iter2->Next())) {
615 _genParData->changeObservableName(arg->GetName(),Form("%s_gen",arg->GetName())) ;
616 }
617 delete iter2 ;
618
620 }
621
622 if (DoFit) calcPulls() ;
623
624 if (_silence) {
626 }
627
628 return kFALSE ;
629}
630
631
632
633
634
635
636////////////////////////////////////////////////////////////////////////////////
637/// Generate and fit 'nSamples' samples of 'nEvtPerSample' events.
638/// If keepGenData is set, all generated data sets will be kept in memory and can be accessed
639/// later via genData().
640///
641/// Data sets will be written out in ascii form if the pattern string is supplied.
642/// The pattern, which is a template for snprintf, should look something like "data/toymc_%04d.dat"
643/// and should contain one integer field that encodes the sample serial number.
644///
645
646Bool_t RooMCStudy::generateAndFit(Int_t nSamples, Int_t nEvtPerSample, Bool_t keepGenData, const char* asciiFilePat)
647{
648 // Clear any previous data in memory
649 _fitResList.Delete() ; // even though the fit results are owned by gROOT, we still want to scratch them here.
651 _fitParData->reset() ;
652
653 return run(kTRUE,kTRUE,nSamples,nEvtPerSample,keepGenData,asciiFilePat) ;
654}
655
656
657
658////////////////////////////////////////////////////////////////////////////////
659/// Generate 'nSamples' samples of 'nEvtPerSample' events.
660/// If keepGenData is set, all generated data sets will be kept in memory
661/// and can be accessed later via genData().
662///
663/// Data sets will be written out in ascii form if the pattern string is supplied.
664/// The pattern, which is a template for snprintf, should look something like "data/toymc_%04d.dat"
665/// and should contain one integer field that encodes the sample serial number.
666///
667
668Bool_t RooMCStudy::generate(Int_t nSamples, Int_t nEvtPerSample, Bool_t keepGenData, const char* asciiFilePat)
669{
670 // Clear any previous data in memory
672
673 return run(kTRUE,kFALSE,nSamples,nEvtPerSample,keepGenData,asciiFilePat) ;
674}
675
676
677
678////////////////////////////////////////////////////////////////////////////////
679/// Fit 'nSamples' datasets, which are read from ASCII files.
680///
681/// The ascii file pattern, which is a template for snprintf, should look something like "data/toymc_%04d.dat"
682/// and should contain one integer field that encodes the sample serial number.
683///
684
685Bool_t RooMCStudy::fit(Int_t nSamples, const char* asciiFilePat)
686{
687 // Clear any previous data in memory
688 _fitResList.Delete() ; // even though the fit results are owned by gROOT, we still want to scratch them here.
689 _fitParData->reset() ;
690
691 return run(kFALSE,kTRUE,nSamples,0,kFALSE,asciiFilePat) ;
692}
693
694
695
696////////////////////////////////////////////////////////////////////////////////
697/// Fit 'nSamples' datasets, as supplied in 'dataSetList'
698///
699
700Bool_t RooMCStudy::fit(Int_t nSamples, TList& dataSetList)
701{
702 // Clear any previous data in memory
703 _fitResList.Delete() ; // even though the fit results are owned by gROOT, we still want to scratch them here.
705 _fitParData->reset() ;
706
707 // Load list of data sets
708 TIterator* iter = dataSetList.MakeIterator() ;
709 RooAbsData* gset ;
710 while((gset=(RooAbsData*)iter->Next())) {
711 _genDataList.Add(gset) ;
712 }
713 delete iter ;
714
715 return run(kFALSE,kTRUE,nSamples,0,kTRUE,0) ;
716}
717
718
719
720////////////////////////////////////////////////////////////////////////////////
721/// Reset all fit parameters to the initial model
722/// parameters at the time of the RooMCStudy constructor
723
725{
727}
728
729
730
731////////////////////////////////////////////////////////////////////////////////
732/// Internal function. Performs actual fit according to specifications
733
735{
736 // Fit model to data set
737 TString fitOpt2(_fitOptions) ; fitOpt2.Append("r") ;
738 if (_silence) {
739 fitOpt2.Append("b") ;
740 }
741
742 // Optionally bin dataset before fitting
744 if (_binGenData) {
745 RooArgSet* depList = _fitModel->getObservables(genSample) ;
746 data = new RooDataHist(genSample->GetName(),genSample->GetTitle(),*depList,*genSample) ;
747 delete depList ;
748 } else {
749 data = genSample ;
750 }
751
752 RooFitResult* fr ;
753 if (_fitOptList.GetSize()==0) {
754 if (_projDeps.getSize()>0) {
756 } else {
758 }
759 } else {
760 RooCmdArg save = RooFit::Save() ;
762 RooCmdArg plevel = RooFit::PrintLevel(-1) ;
763 RooLinkedList fitOptList(_fitOptList) ;
764 fitOptList.Add(&save) ;
765 if (_projDeps.getSize()>0) {
766 fitOptList.Add(&condo) ;
767 }
768 if (_silence) {
769 fitOptList.Add(&plevel) ;
770 }
771 fr = (RooFitResult*) _fitModel->fitTo(*data,fitOptList) ;
772 }
773
774 if (_binGenData) delete data ;
775
776 return fr ;
777}
778
779
780
781////////////////////////////////////////////////////////////////////////////////
782/// Redo fit on 'current' toy sample, or if genSample is not NULL
783/// do fit on given sample instead
784
786{
787 if (!genSample) {
788 genSample = _genSample ;
789 }
790
791 RooFitResult* fr(0) ;
792 if (genSample->sumEntries()>0) {
793 fr = doFit(genSample) ;
794 }
795
796 return fr ;
797}
798
799
800
801////////////////////////////////////////////////////////////////////////////////
802/// Internal method. Fit given dataset with fit model. If fit
803/// converges (TMinuit status code zero) The fit results are appended
804/// to the fit results dataset
805///
806/// If the fit option "r" is supplied, the RooFitResult
807/// objects will always be saved, regardless of the
808/// fit status. RooFitResults objects can be retrieved
809/// later via fitResult().
810///
811
813{
814 // Reset all fit parameters to their initial values
816
817 // Perform actual fit
818 Bool_t ok ;
819 RooFitResult* fr(0) ;
820 if (genSample->sumEntries()>0) {
821 fr = doFit(genSample) ;
822 ok = (fr->status()==0) ;
823 } else {
824 ok = kFALSE ;
825 }
826
827 // If fit converged, store parameters and NLL
828 if (ok) {
829 _nllVar->setVal(fr->minNll()) ;
830 RooArgSet tmp(*_fitParams) ;
831 tmp.add(*_nllVar) ;
832 tmp.add(*_ngenVar) ;
833
834 _fitParData->add(tmp) ;
835 }
836
837 // Store fit result if requested by user
838 Bool_t userSaveRequest = kFALSE ;
839 if (_fitOptList.GetSize()>0) {
840 if (_fitOptList.FindObject("Save")) userSaveRequest = kTRUE ;
841 } else {
842 if (_fitOptions.Contains("r")) userSaveRequest = kTRUE ;
843 }
844
845 if (userSaveRequest) {
846 _fitResList.Add(fr) ;
847 } else {
848 delete fr ;
849 }
850
851 return !ok ;
852}
853
854
855
856////////////////////////////////////////////////////////////////////////////////
857/// Utility function to add fit result from external fit to this RooMCStudy
858/// and process its results through the standard RooMCStudy statistics gathering tools.
859/// This function allows users to run the toy MC generation and/or fitting
860/// in a distributed way and to collect and analyze the results in a RooMCStudy
861/// as if they were run locally.
862///
863/// This method is only functional if this RooMCStudy object is cleanm, i.e. it was not used
864/// to generate and/or fit any samples.
865
867{
868 if (!_canAddFitResults) {
869 oocoutE(_fitModel,InputArguments) << "RooMCStudy::addFitResult: ERROR cannot add fit results in current state" << endl ;
870 return kTRUE ;
871 }
872
873 // Transfer contents of fit result to fitParams ;
875
876 // If fit converged, store parameters and NLL
877 Bool_t ok = (fr.status()==0) ;
878 if (ok) {
879 _nllVar->setVal(fr.minNll()) ;
880 RooArgSet tmp(*_fitParams) ;
881 tmp.add(*_nllVar) ;
882 tmp.add(*_ngenVar) ;
883 _fitParData->add(tmp) ;
884 }
885
886 // Store fit result if requested by user
887 if (_fitOptions.Contains("r")) {
888 _fitResList.Add((TObject*)&fr) ;
889 }
890
891 return kFALSE ;
892}
893
894
895
896////////////////////////////////////////////////////////////////////////////////
897/// Calculate the pulls for all fit parameters in
898/// the fit results data set, and add them to that dataset
899
901{
903 RooRealVar* par ;
904 while((par=(RooRealVar*)iter->Next())) {
905
906 RooErrorVar* err = par->errorVar() ;
907 _fitParData->addColumn(*err) ;
908 delete err ;
909
910 TString name(par->GetName()), title(par->GetTitle()) ;
911 name.Append("pull") ;
912 title.Append(" Pull") ;
913
914 // First look in fitParDataset to see if per-experiment generated value has been stored
915 RooAbsReal* genParOrig = (RooAbsReal*) _fitParData->get()->find(Form("%s_gen",par->GetName())) ;
916 if (genParOrig && _perExptGenParams) {
917
918 RooPullVar pull(name,title,*par,*genParOrig) ;
920
921 } else {
922 // If not use fixed generator value
923 genParOrig = (RooAbsReal*)_genInitParams->find(par->GetName()) ;
924
925 if (genParOrig) {
926 RooAbsReal* genPar = (RooAbsReal*) genParOrig->Clone("truth") ;
927 RooPullVar pull(name,title,*par,*genPar) ;
928
930 delete genPar ;
931
932 }
933
934 }
935
936 }
937 delete iter ;
938
939}
940
941
942
943
944////////////////////////////////////////////////////////////////////////////////
945/// Return a RooDataSet the resulting fit parameters of each toy cycle.
946/// This dataset also contains any additional output that was generated
947/// by study modules that were added to this RooMCStudy
948
950{
951 if (_canAddFitResults) {
952 calcPulls() ;
954 }
955
956 return *_fitParData ;
957}
958
959
960
961////////////////////////////////////////////////////////////////////////////////
962/// Return an argset with the fit parameters for the given sample number
963///
964/// NB: The fit parameters are only stored for successfull fits,
965/// thus the maximum sampleNum can be less that the number
966/// of generated samples and if so, the indeces will
967/// be out of synch with genData() and fitResult()
968
969const RooArgSet* RooMCStudy::fitParams(Int_t sampleNum) const
970{
971 // Check if sampleNum is in range
972 if (sampleNum<0 || sampleNum>=_fitParData->numEntries()) {
973 oocoutE(_fitModel,InputArguments) << "RooMCStudy::fitParams: ERROR, invalid sample number: " << sampleNum << endl ;
974 return 0 ;
975 }
976
977 return _fitParData->get(sampleNum) ;
978}
979
980
981
982////////////////////////////////////////////////////////////////////////////////
983/// Return the RooFitResult object of the fit to given sample
984
986{
987 // Check if sampleNum is in range
988 if (sampleNum<0 || sampleNum>=_fitResList.GetSize()) {
989 oocoutE(_fitModel,InputArguments) << "RooMCStudy::fitResult: ERROR, invalid sample number: " << sampleNum << endl ;
990 return 0 ;
991 }
992
993 // Retrieve fit result object
994 const RooFitResult* fr = (RooFitResult*) _fitResList.At(sampleNum) ;
995 if (fr) {
996 return fr ;
997 } else {
998 oocoutE(_fitModel,InputArguments) << "RooMCStudy::fitResult: ERROR, no fit result saved for sample "
999 << sampleNum << ", did you use the 'r; fit option?" << endl ;
1000 }
1001 return 0 ;
1002}
1003
1004
1005
1006////////////////////////////////////////////////////////////////////////////////
1007/// Return the given generated dataset. This method will only return datasets
1008/// if during the run cycle it was indicated that generator data should be saved.
1009
1011{
1012 // Check that generated data was saved
1013 if (_genDataList.GetSize()==0) {
1014 oocoutE(_fitModel,InputArguments) << "RooMCStudy::genData() ERROR, generated data was not saved" << endl ;
1015 return 0 ;
1016 }
1017
1018 // Check if sampleNum is in range
1019 if (sampleNum<0 || sampleNum>=_genDataList.GetSize()) {
1020 oocoutE(_fitModel,InputArguments) << "RooMCStudy::genData() ERROR, invalid sample number: " << sampleNum << endl ;
1021 return 0 ;
1022 }
1023
1024 return (RooAbsData*) _genDataList.At(sampleNum) ;
1025}
1026
1027
1028
1029////////////////////////////////////////////////////////////////////////////////
1030/// Plot the distribution of fitted values of a parameter. The parameter shown is the one from which the RooPlot
1031/// was created, e.g.
1032///
1033/// RooPlot* frame = param.frame(100,-10,10) ;
1034/// mcstudy.paramOn(frame,LineStyle(kDashed)) ;
1035///
1036/// Any named arguments passed to plotParamOn() are forwarded to the underlying plotOn() call
1037
1038RooPlot* RooMCStudy::plotParamOn(RooPlot* frame, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4,
1039 const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)
1040{
1041 _fitParData->plotOn(frame,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
1042 return frame ;
1043}
1044
1045
1046
1047////////////////////////////////////////////////////////////////////////////////
1048/// Plot the distribution of the fitted value of the given parameter on a newly created frame.
1049///
1050/// <table>
1051/// <tr><th> Optional arguments <th>
1052/// <tr><td> FrameRange(double lo, double hi) <td> Set range of frame to given specification
1053/// <tr><td> FrameBins(int bins) <td> Set default number of bins of frame to given number
1054/// <tr><td> Frame() <td> Pass supplied named arguments to RooAbsRealLValue::frame() function. See there
1055/// for list of allowed arguments
1056/// </table>
1057/// If no frame specifications are given, the AutoRange() feature will be used to set the range
1058/// Any other named argument is passed to the RooAbsData::plotOn() call. See that function for allowed options
1059
1060RooPlot* RooMCStudy::plotParam(const char* paramName, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4,
1061 const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)
1062{
1063
1064 // Find parameter in fitParDataSet
1065 RooRealVar* param = static_cast<RooRealVar*>(_fitParData->get()->find(paramName)) ;
1066 if (!param) {
1067 oocoutE(_fitModel,InputArguments) << "RooMCStudy::plotParam: ERROR: no parameter defined with name " << paramName << endl ;
1068 return 0 ;
1069 }
1070
1071 // Forward to implementation below
1072 return plotParam(*param,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
1073}
1074
1075
1076
1077////////////////////////////////////////////////////////////////////////////////
1078/// Plot the distribution of the fitted value of the given parameter on a newly created frame.
1079/// \copydetails RooMCStudy::plotParam(const char* paramName, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4,
1080/// const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)
1081
1082RooPlot* RooMCStudy::plotParam(const RooRealVar& param, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4,
1083 const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8)
1084{
1085 // Stuff all arguments in a list
1086 RooLinkedList cmdList;
1087 cmdList.Add(const_cast<RooCmdArg*>(&arg1)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg2)) ;
1088 cmdList.Add(const_cast<RooCmdArg*>(&arg3)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg4)) ;
1089 cmdList.Add(const_cast<RooCmdArg*>(&arg5)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg6)) ;
1090 cmdList.Add(const_cast<RooCmdArg*>(&arg7)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg8)) ;
1091
1092 RooPlot* frame = makeFrameAndPlotCmd(param, cmdList) ;
1093 if (frame) {
1094 _fitParData->plotOn(frame, cmdList) ;
1095 }
1096
1097 return frame ;
1098}
1099
1100
1101
1102////////////////////////////////////////////////////////////////////////////////
1103/// Plot the distribution of the -log(L) values on a newly created frame.
1104///
1105/// <table>
1106/// <tr><th> Optional arguments <th>
1107/// <tr><td> FrameRange(double lo, double hi) <td> Set range of frame to given specification
1108/// <tr><td> FrameBins(int bins) <td> Set default number of bins of frame to given number
1109/// <tr><td> Frame() <td> Pass supplied named arguments to RooAbsRealLValue::frame() function. See there
1110/// for list of allowed arguments
1111/// </table>
1112///
1113/// If no frame specifications are given, the AutoRange() feature will be used to set the range.
1114/// Any other named argument is passed to the RooAbsData::plotOn() call. See that function for allowed options
1115
1117 const RooCmdArg& arg3, const RooCmdArg& arg4,
1118 const RooCmdArg& arg5, const RooCmdArg& arg6,
1119 const RooCmdArg& arg7, const RooCmdArg& arg8)
1120{
1121 return plotParam(*_nllVar,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
1122}
1123
1124
1125
1126////////////////////////////////////////////////////////////////////////////////
1127/// Plot the distribution of the fit errors for the specified parameter on a newly created frame.
1128///
1129/// <table>
1130/// <tr><th> Optional arguments <th>
1131/// <tr><td> FrameRange(double lo, double hi) <td> Set range of frame to given specification
1132/// <tr><td> FrameBins(int bins) <td> Set default number of bins of frame to given number
1133/// <tr><td> Frame() <td> Pass supplied named arguments to RooAbsRealLValue::frame() function. See there
1134/// for list of allowed arguments
1135/// </table>
1136///
1137/// If no frame specifications are given, the AutoRange() feature will be used to set the range
1138/// Any other named argument is passed to the RooAbsData::plotOn() call. See that function for allowed options
1139
1140RooPlot* RooMCStudy::plotError(const RooRealVar& param, const RooCmdArg& arg1, const RooCmdArg& arg2,
1141 const RooCmdArg& arg3, const RooCmdArg& arg4,
1142 const RooCmdArg& arg5, const RooCmdArg& arg6,
1143 const RooCmdArg& arg7, const RooCmdArg& arg8)
1144{
1145 if (_canAddFitResults) {
1146 calcPulls() ;
1148 }
1149
1150 RooErrorVar* evar = param.errorVar() ;
1151 RooRealVar* evar_rrv = static_cast<RooRealVar*>(evar->createFundamental()) ;
1152 RooPlot* frame = plotParam(*evar_rrv,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) ;
1153 delete evar_rrv ;
1154 delete evar ;
1155 return frame ;
1156}
1157
1158
1159
1160////////////////////////////////////////////////////////////////////////////////
1161/// Plot the distribution of pull values for the specified parameter on a newly created frame. If asymmetric
1162/// errors are calculated in the fit (by MINOS) those will be used in the pull calculation
1163///
1164/// <table>
1165/// <tr><th> Optional arguments <th>
1166/// <tr><td> FrameRange(double lo, double hi) <td> Set range of frame to given specification
1167/// <tr><td> FrameBins(int bins) <td> Set default number of bins of frame to given number
1168/// <tr><td> Frame() <td> Pass supplied named arguments to RooAbsRealLValue::frame() function. See there
1169/// for list of allowed arguments
1170/// <tr><td> FitGauss(Bool_t flag) <td> Add a gaussian fit to the frame
1171/// </table>
1172///
1173/// If no frame specifications are given, the AutoSymRange() feature will be used to set the range
1174/// Any other named argument is passed to the RooAbsData::plotOn() call. See that function for allowed options
1175
1176RooPlot* RooMCStudy::plotPull(const RooRealVar& param, const RooCmdArg& arg1, const RooCmdArg& arg2,
1177 const RooCmdArg& arg3, const RooCmdArg& arg4,
1178 const RooCmdArg& arg5, const RooCmdArg& arg6,
1179 const RooCmdArg& arg7, const RooCmdArg& arg8)
1180{
1181 // Stuff all arguments in a list
1182 RooLinkedList cmdList;
1183 cmdList.Add(const_cast<RooCmdArg*>(&arg1)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg2)) ;
1184 cmdList.Add(const_cast<RooCmdArg*>(&arg3)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg4)) ;
1185 cmdList.Add(const_cast<RooCmdArg*>(&arg5)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg6)) ;
1186 cmdList.Add(const_cast<RooCmdArg*>(&arg7)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg8)) ;
1187
1188 TString name(param.GetName()), title(param.GetTitle()) ;
1189 name.Append("pull") ; title.Append(" Pull") ;
1190 RooRealVar pvar(name,title,-100,100) ;
1191 pvar.setBins(100) ;
1192
1193
1194 RooPlot* frame = makeFrameAndPlotCmd(pvar, cmdList, kTRUE) ;
1195 if (frame) {
1196
1197 // Pick up optonal FitGauss command from list
1198 RooCmdConfig pc(Form("RooMCStudy::plotPull(%s)",_genModel->GetName())) ;
1199 pc.defineInt("fitGauss","FitGauss",0,0) ;
1200 pc.allowUndefined() ;
1201 pc.process(cmdList) ;
1202 Bool_t fitGauss=pc.getInt("fitGauss") ;
1203
1204 // Pass stripped command list to plotOn()
1205 pc.stripCmdList(cmdList,"FitGauss") ;
1206 _fitParData->plotOn(frame,cmdList) ;
1207
1208 // Add Gaussian fit if requested
1209 if (fitGauss) {
1210 RooRealVar pullMean("pullMean","Mean of pull",0,-10,10) ;
1211 RooRealVar pullSigma("pullSigma","Width of pull",1,0.1,5) ;
1212 RooGenericPdf pullGauss("pullGauss","Gaussian of pull",
1213 "exp(-0.5*(@0-@1)*(@0-@1)/(@2*@2))",
1214 RooArgSet(pvar,pullMean,pullSigma)) ;
1216 pullGauss.plotOn(frame) ;
1217 pullGauss.paramOn(frame,_fitParData) ;
1218 }
1219 }
1220 return frame ; ;
1221}
1222
1223
1224
1225////////////////////////////////////////////////////////////////////////////////
1226/// Internal function. Construct RooPlot from given parameter and modify the list of named
1227/// arguments 'cmdList' to only contain the plot arguments that should be forwarded to
1228/// RooAbsData::plotOn()
1229
1231{
1232 // Select the frame-specific commands
1233 RooCmdConfig pc(Form("RooMCStudy::plotParam(%s)",_genModel->GetName())) ;
1234 pc.defineInt("nbins","Bins",0,0) ;
1235 pc.defineDouble("xlo","Range",0,0) ;
1236 pc.defineDouble("xhi","Range",1,0) ;
1237 pc.defineInt("dummy","FrameArgs",0,0) ;
1238 pc.defineMutex("Bins","FrameArgs") ;
1239 pc.defineMutex("Range","FrameArgs") ;
1240
1241 // Process and check varargs
1242 pc.allowUndefined() ;
1243 pc.process(cmdList) ;
1244 if (!pc.ok(kTRUE)) {
1245 return 0 ;
1246 }
1247
1248 // Make frame according to specs
1249 Int_t nbins = pc.getInt("nbins") ;
1250 Double_t xlo = pc.getDouble("xlo") ;
1251 Double_t xhi = pc.getDouble("xhi") ;
1252 RooPlot* frame ;
1253
1254 if (pc.hasProcessed("FrameArgs")) {
1255 // Explicit frame arguments are given, pass them on
1256 RooCmdArg* frameArg = static_cast<RooCmdArg*>(cmdList.FindObject("FrameArgs")) ;
1257 frame = param.frame(frameArg->subArgs()) ;
1258 } else {
1259 // FrameBins, FrameRange or none are given, build custom frame command list
1260 RooCmdArg bins = RooFit::Bins(nbins) ;
1261 RooCmdArg range = RooFit::Range(xlo,xhi) ;
1263 RooLinkedList frameCmdList ;
1264
1265 if (pc.hasProcessed("Bins")) frameCmdList.Add(&bins) ;
1266 if (pc.hasProcessed("Range")) {
1267 frameCmdList.Add(&range) ;
1268 } else {
1269 frameCmdList.Add(&autor) ;
1270 }
1271 frame = param.frame(frameCmdList) ;
1272 }
1273
1274 // Filter frame command from list and pass on to plotOn()
1275 pc.stripCmdList(cmdList,"FrameArgs,Bins,Range") ;
1276
1277 return frame ;
1278}
1279
1280
1281
1282////////////////////////////////////////////////////////////////////////////////
1283/// Create a RooPlot of the -log(L) distribution in the range lo-hi
1284/// with 'nBins' bins
1285
1287{
1288 RooPlot* frame = _nllVar->frame(lo,hi,nBins) ;
1289
1290 _fitParData->plotOn(frame) ;
1291 return frame ;
1292}
1293
1294
1295
1296////////////////////////////////////////////////////////////////////////////////
1297/// Create a RooPlot of the distribution of the fitted errors of the given parameter.
1298/// The frame is created with a range [lo,hi] and plotted data will be binned in 'nbins' bins
1299
1301{
1302 if (_canAddFitResults) {
1303 calcPulls() ;
1305 }
1306
1307 RooErrorVar* evar = param.errorVar() ;
1308 RooPlot* frame = evar->frame(lo,hi,nbins) ;
1309 _fitParData->plotOn(frame) ;
1310
1311 delete evar ;
1312 return frame ;
1313}
1314
1315
1316
1317////////////////////////////////////////////////////////////////////////////////
1318/// Create a RooPlot of the pull distribution for the given
1319/// parameter. The range lo-hi is plotted in nbins. If fitGauss is
1320/// set, an unbinned ML fit of the distribution to a Gaussian p.d.f
1321/// is performed. The fit result is overlaid on the returned RooPlot
1322/// and a box with the fitted mean and sigma is added.
1323
1325{
1326 if (_canAddFitResults) {
1327 calcPulls() ;
1329 }
1330
1331
1332 TString name(param.GetName()), title(param.GetTitle()) ;
1333 name.Append("pull") ; title.Append(" Pull") ;
1334 RooRealVar pvar(name,title,lo,hi) ;
1335 pvar.setBins(nbins) ;
1336
1337 RooPlot* frame = pvar.frame() ;
1338 _fitParData->plotOn(frame) ;
1339
1340 if (fitGauss) {
1341 RooRealVar pullMean("pullMean","Mean of pull",0,lo,hi) ;
1342 RooRealVar pullSigma("pullSigma","Width of pull",1,0,5) ;
1343 RooGenericPdf pullGauss("pullGauss","Gaussian of pull",
1344 "exp(-0.5*(@0-@1)*(@0-@1)/(@2*@2))",
1345 RooArgSet(pvar,pullMean,pullSigma)) ;
1346 pullGauss.fitTo(*_fitParData,"mh") ;
1347 pullGauss.plotOn(frame) ;
1348 pullGauss.paramOn(frame,_fitParData) ;
1349 }
1350
1351 return frame ;
1352}
1353
1354
1355////////////////////////////////////////////////////////////////////////////////
1356/// If one of the TObject we have a referenced to is deleted, remove the
1357/// reference.
1358
1360{
1364 if (_ngenVar == obj) _ngenVar = nullptr;
1365
1367 if (_fitParData == obj) _fitParData = nullptr;
1368
1370 if (_genParData == obj) _genParData = nullptr;
1371}
1372
#define coutI(a)
Definition: RooMsgService.h:31
#define oocoutW(o, a)
Definition: RooMsgService.h:46
#define oocoutE(o, a)
Definition: RooMsgService.h:47
#define oocoutI(o, a)
Definition: RooMsgService.h:44
#define coutE(a)
Definition: RooMsgService.h:34
#define ooccoutI(o, a)
Definition: RooMsgService.h:51
#define ooccoutP(o, a)
Definition: RooMsgService.h:52
#define oocoutP(o, a)
Definition: RooMsgService.h:45
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:363
float type_of_call hi(const int &, const int &)
char * Form(const char *fmt,...)
#define snprintf
Definition: civetweb.c:1540
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Definition: RooAbsArg.h:194
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
Definition: RooAbsArg.h:75
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Definition: RooAbsArg.cxx:533
Int_t getSize() const
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
void setAttribAll(const Text_t *name, Bool_t value=kTRUE)
Set given attribute in each element of the collection by calling each elements setAttribute() functio...
TIterator * createIterator(Bool_t dir=kIterForward) const
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:37
virtual void RecursiveRemove(TObject *obj)
If one of the TObject we have a referenced to is deleted, remove the reference.
virtual Bool_t changeObservableName(const char *from, const char *to)
Definition: RooAbsData.cxx:265
virtual void reset()
Definition: RooAbsData.cxx:292
virtual Double_t sumEntries() const =0
virtual Int_t numEntries() const
Definition: RooAbsData.cxx:285
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), 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
Calls RooPlot* plotOn(RooPlot* frame, const RooLinkedList& cmdList) const ;.
Definition: RooAbsData.cxx:531
virtual void attach(const RooArgSet &params)
Interface to attach given parameters to object in this context.
virtual RooDataSet * generate(Double_t nEvents=0, Bool_t skipInit=kFALSE, Bool_t extendedMode=kFALSE)
Generate the specified number of events with nEvents>0 and and return a dataset containing the genera...
virtual void setProtoDataOrder(Int_t *lut)
Set the traversal order of prototype data to that in the lookup tables passed as argument.
RooAbsMCStudyModule is a base class for add-on modules to RooMCStudy that can perform additional calc...
Bool_t doInitializeInstance(RooMCStudy &)
Store reference to RooMCStudy object that this module relates to and call internal module initializat...
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
virtual RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t verbose=kFALSE) const
Interface function to create a generator context from a p.d.f.
Definition: RooAbsPdf.cxx:1666
virtual RooFitResult * fitTo(RooAbsData &data, const RooCmdArg &arg1=RooCmdArg::none(), 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())
Fit PDF to given dataset.
Definition: RooAbsPdf.cxx:1081
virtual RooDataHist * generateBinned(const RooArgSet &whatVars, Double_t nEvents, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none())
As RooAbsPdf::generateBinned(const RooArgSet&, const RooCmdArg&,const RooCmdArg&, const RooCmdArg&,...
Definition: RooAbsPdf.h:105
virtual RooPlot * paramOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), 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())
Add a box with parameter values (and errors) to the specified frame.
Definition: RooAbsPdf.cxx:2704
Int_t * randomizeProtoOrder(Int_t nProto, Int_t nGen, Bool_t resample=kFALSE) const
Return lookup table with randomized access order for prototype events, given nProto prototype data ev...
Definition: RooAbsPdf.cxx:2003
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events from this p.d.f for use in extended likelihood calculations.
Definition: RooAbsPdf.cxx:2855
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), 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 RooCmdArg &arg9=RooCmdArg::none(), const RooCmdArg &arg10=RooCmdArg::none()) const
Helper calling plotOn(RooPlot*, RooLinkedList&) const.
Definition: RooAbsPdf.h:119
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,...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
RooAbsArg * createFundamental(const char *newname=0) const
Create a RooRealVar fundamental object with our properties.
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
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:27
RooLinkedList & subArgs()
Definition: RooCmdArg.h:46
virtual TObject * Clone(const char *newName=0) const
Make a clone of an object using the Streamer facility.
Definition: RooCmdArg.h:51
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
Definition: RooCmdConfig.h:27
RooDataSet is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:40
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:31
virtual const RooArgSet * get(Int_t index) const
Return RooArgSet with coordinates of event 'index'.
Definition: RooDataSet.cxx:995
virtual RooAbsArg * addColumn(RooAbsArg &var, Bool_t adjustRange=kTRUE)
Add a column with the values of the given (function) argument to this dataset.
Bool_t write(const char *filename) const
Write the contents of this dataset to an ASCII file with the specified name.
virtual void add(const RooArgSet &row, Double_t weight=1.0, Double_t weightError=0)
Add a data point, with its coordinates specified in the 'data' argset, to the data set.
static RooDataSet * read(const char *filename, const RooArgList &variables, const char *opts="", const char *commonPath="", const char *indexCatName=0)
Read given list of ascii files, and construct a data set, using the given ArgList as structure defini...
Bool_t merge(RooDataSet *data1, RooDataSet *data2=0, RooDataSet *data3=0, RooDataSet *data4=0, RooDataSet *data5=0, RooDataSet *data6=0)
RooErrorVar is an auxilary class that represents the error of a RooRealVar as a seperate object.
Definition: RooErrorVar.h:28
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Definition: RooFitResult.h:40
Double_t minNll() const
Definition: RooFitResult.h:98
const RooArgList & floatParsFinal() const
Definition: RooFitResult.h:110
Int_t status() const
Definition: RooFitResult.h:77
RooGenericPdf is a concrete implementation of a probability density function, which takes a RooArgLis...
Definition: RooGenericPdf.h:25
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
Int_t GetSize() const
Definition: RooLinkedList.h:60
TObject * FindObject(const char *name) const
Return pointer to obejct with given name.
TObject * At(Int_t index) const
Return object stored in sequential position given by index.
void Delete(Option_t *o=0)
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
virtual void RecursiveRemove(TObject *obj)
If one of the TObject we have a referenced to is deleted, remove the reference.
virtual void Add(TObject *arg)
Definition: RooLinkedList.h:62
RooMCStudy is a help class to facilitate Monte Carlo studies such as 'goodness-of-fit' studies,...
Definition: RooMCStudy.h:32
RooAbsData * _genSample
Definition: RooMCStudy.h:111
RooArgSet _projDeps
Definition: RooMCStudy.h:117
const RooArgSet * fitParams(Int_t sampleNum) const
Return an argset with the fit parameters for the given sample number.
Definition: RooMCStudy.cxx:969
RooPlot * plotParamOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), 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())
Plot the distribution of fitted values of a parameter.
void calcPulls()
Calculate the pulls for all fit parameters in the fit results data set, and add them to that dataset.
Definition: RooMCStudy.cxx:900
RooPlot * plotPull(const RooRealVar &param, 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())
Plot the distribution of pull values for the specified parameter on a newly created frame.
RooPlot * plotError(const RooRealVar &param, const RooCmdArg &arg1=RooCmdArg::none(), 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())
Plot the distribution of the fit errors for the specified parameter on a newly created frame.
Bool_t addFitResult(const RooFitResult &fr)
Utility function to add fit result from external fit to this RooMCStudy and process its results throu...
Definition: RooMCStudy.cxx:866
Bool_t run(Bool_t generate, Bool_t fit, Int_t nSamples, Int_t nEvtPerSample, Bool_t keepGenData, const char *asciiFilePat)
Run engine method.
Definition: RooMCStudy.cxx:452
Bool_t _extendedGen
Definition: RooMCStudy.h:136
RooPlot * plotParam(const RooRealVar &param, const RooCmdArg &arg1=RooCmdArg::none(), 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())
Plot the distribution of the fitted value of the given parameter on a newly created frame.
Bool_t _silence
Definition: RooMCStudy.h:144
RooArgSet _dependents
Definition: RooMCStudy.h:122
RooMCStudy(const RooAbsPdf &model, const RooArgSet &observables, const RooCmdArg &arg1=RooCmdArg::none(), 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())
Construct Monte Carlo Study Manager.
Definition: RooMCStudy.cxx:99
std::list< RooAbsMCStudyModule * > _modList
Definition: RooMCStudy.h:146
RooAbsGenContext * _constrGenContext
Definition: RooMCStudy.h:120
RooFitResult * refit(RooAbsData *genSample=0)
Redo fit on 'current' toy sample, or if genSample is not NULL do fit on given sample instead.
Definition: RooMCStudy.cxx:785
RooPlot * plotNLL(const RooCmdArg &arg1=RooCmdArg::none(), 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())
Plot the distribution of the -log(L) values on a newly created frame.
TList _fitResList
Definition: RooMCStudy.h:131
RooDataSet * _genParData
Definition: RooMCStudy.h:132
Bool_t fitSample(RooAbsData *genSample)
Internal method.
Definition: RooMCStudy.cxx:812
const RooDataSet * _genProtoData
Definition: RooMCStudy.h:116
const RooFitResult * fitResult(Int_t sampleNum) const
Return the RooFitResult object of the fit to given sample.
Definition: RooMCStudy.cxx:985
Bool_t _perExptGenParams
Definition: RooMCStudy.h:143
RooAbsGenContext * _genContext
Definition: RooMCStudy.h:113
Bool_t _randProto
Definition: RooMCStudy.h:139
RooAbsPdf * _constrPdf
Definition: RooMCStudy.h:119
RooArgSet * _fitInitParams
Definition: RooMCStudy.h:125
Bool_t _canAddFitResults
Definition: RooMCStudy.h:141
RooPlot * makeFrameAndPlotCmd(const RooRealVar &param, RooLinkedList &cmdList, Bool_t symRange=kFALSE) const
Internal function.
virtual void RecursiveRemove(TObject *obj)
If one of the TObject we have a referenced to is deleted, remove the reference.
RooAbsData * genData(Int_t sampleNum) const
Return the given generated dataset.
RooArgSet * _genInitParams
Definition: RooMCStudy.h:114
Bool_t _binGenData
Definition: RooMCStudy.h:137
RooAbsPdf * _genModel
Definition: RooMCStudy.h:112
Double_t _nExpGen
Definition: RooMCStudy.h:138
const RooDataSet & fitParDataSet()
Return a RooDataSet the resulting fit parameters of each toy cycle.
Definition: RooMCStudy.cxx:949
RooLinkedList _fitOptList
Definition: RooMCStudy.h:135
Bool_t generate(Int_t nSamples, Int_t nEvtPerSample=0, Bool_t keepGenData=kFALSE, const char *asciiFilePat=0)
Generate 'nSamples' samples of 'nEvtPerSample' events.
Definition: RooMCStudy.cxx:668
RooArgSet _allDependents
Definition: RooMCStudy.h:123
virtual ~RooMCStudy()
Definition: RooMCStudy.cxx:408
RooArgSet * _fitParams
Definition: RooMCStudy.h:126
void resetFitParams()
Reset all fit parameters to the initial model parameters at the time of the RooMCStudy constructor.
Definition: RooMCStudy.cxx:724
RooArgSet * _genParams
Definition: RooMCStudy.h:115
Bool_t _verboseGen
Definition: RooMCStudy.h:142
RooAbsPdf * _fitModel
Definition: RooMCStudy.h:124
Bool_t generateAndFit(Int_t nSamples, Int_t nEvtPerSample=0, Bool_t keepGenData=kFALSE, const char *asciiFilePat=0)
Generate and fit 'nSamples' samples of 'nEvtPerSample' events.
Definition: RooMCStudy.cxx:646
Bool_t fit(Int_t nSamples, const char *asciiFilePat)
Fit 'nSamples' datasets, which are read from ASCII files.
Definition: RooMCStudy.cxx:685
RooRealVar * _ngenVar
Definition: RooMCStudy.h:128
TList _genDataList
Definition: RooMCStudy.h:130
void addModule(RooAbsMCStudyModule &module)
Insert given RooMCStudy add-on module to the processing chain of this MCStudy object.
Definition: RooMCStudy.cxx:431
RooFitResult * doFit(RooAbsData *genSample)
Internal function. Performs actual fit according to specifications.
Definition: RooMCStudy.cxx:734
RooRealVar * _nllVar
Definition: RooMCStudy.h:127
TString _fitOptions
Definition: RooMCStudy.h:134
RooDataSet * _fitParData
Definition: RooMCStudy.h:133
static RooMsgService & instance()
Return reference to singleton instance.
void setGlobalKillBelow(RooFit::MsgLevel level)
RooFit::MsgLevel globalKillBelow() const
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:41
RooProdPdf is an efficient implementation of a product of PDFs of the form.
Definition: RooProdPdf.h:31
Class RooPullVar represents the pull of measurement w.r.t to true value using the measurement value a...
Definition: RooPullVar.h:25
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Definition: RooRandom.cxx:54
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
void setBins(Int_t nBins, const char *name=0)
Definition: RooRealVar.h:77
RooErrorVar * errorVar() const
Return a RooAbsRealLValue representing the error associated with this variable.
Definition: RooRealVar.cxx:239
virtual void setVal(Double_t value)
Set value of variable to 'value'.
Definition: RooRealVar.cxx:204
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Definition: TCollection.h:182
Iterator abstract base class.
Definition: TIterator.h:30
virtual TObject * Next()=0
A doubly linked list.
Definition: TList.h:44
virtual void Add(TObject *obj)
Definition: TList.h:87
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:354
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
Definition: TList.cxx:760
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
Definition: TList.cxx:718
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
Definition: TList.cxx:467
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
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 Int_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
Definition: TRandom.cxx:383
RooCmdArg Constrain(const RooArgSet &params)
@ Generation
Definition: RooGlobalFunc.h:57
@ InputArguments
Definition: RooGlobalFunc.h:58
RooCmdArg ExternalConstraints(const RooArgSet &constraintPdfs)
RooCmdArg Save(Bool_t flag=kTRUE)
RooCmdArg PrintLevel(Int_t code)
RooCmdArg FitOptions(const char *opts)
RooCmdArg Range(const char *rangeName, Bool_t adjustNorm=kTRUE)
RooCmdArg ConditionalObservables(const RooArgSet &set)
RooCmdArg AutoSymRange(const RooAbsData &data, Double_t marginFactor=0.1)
RooCmdArg AutoRange(const RooAbsData &data, Double_t marginFactor=0.1)
RooCmdArg Bins(Int_t nbin)
RooCmdArg Minos(Bool_t flag=kTRUE)
static constexpr double pc
STL namespace.