Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooAbsRealLValue.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 RooAbsRealLValue.cxx
19\class RooAbsRealLValue
20\ingroup Roofitcore
21
22Abstract base class for objects that represent a
23real value that may appear on the left hand side of an equation ('lvalue').
24Each implementation must provide a setVal() member to allow direct modification
25of the value. RooAbsRealLValue may be derived, but its functional relation
26to other RooAbsArg must be invertible
27
28This class has methods that export the defined range of the lvalue,
29but doesn't hold its values because these limits may be derived
30from limits of client object. The range serve as integration
31range when interpreted as a observable and a boundaries when
32interpreted as a parameter.
33**/
34
35#include "RooAbsRealLValue.h"
36
37#include "RooStreamParser.h"
38#include "RooRandom.h"
39#include "RooPlot.h"
40#include "RooArgList.h"
41#include "RooAbsBinning.h"
42#include "RooBinning.h"
43#include "RooNumber.h"
44#include "RooUniformBinning.h"
45#include "RooCmdConfig.h"
46#include "RooAbsData.h"
47#include "RooRealVar.h"
48#include "RooMsgService.h"
49
50#include "ROOT/StringUtils.hxx"
51
52#include "TH1.h"
53#include "TH2.h"
54#include "TH3.h"
55
56#include <cmath>
57
58using std::endl, std::istream, std::ostream;
59
61
62////////////////////////////////////////////////////////////////////////////////
63/// Constructor
64
65RooAbsRealLValue::RooAbsRealLValue(const char *name, const char *title, const char *unit) :
66 RooAbsReal(name, title, 0, 0, unit)
67{
68}
69
70
71
72////////////////////////////////////////////////////////////////////////////////
73/// Copy constructor
74
76 RooAbsReal(other,name), RooAbsLValue(other)
77{
78}
79
80////////////////////////////////////////////////////////////////////////////////
81/// Return true if the input value is within our fit range. Otherwise, return
82/// false and write a clipped value into clippedValPtr if it is non-zero.
83///
84/// Implements the following check to see if the value x is in the range [a, b]:
85/// check if `[x - eps * x, x + eps * x]` overlaps with `[a, b]`, where the
86/// parameter `eps` is defined as:
87/// ```
88/// std::max(RooNumber::rangeEpsRel() * std::abs(x), RooNumber::rangeEpsAbs())
89/// ```
90/// By default, RooNumber::rangeEpsRel() and RooNumber::rangeEpsRel() are set to zero.
91/// You can change them with RooNumber::setRangeEpsRel(double) and RooNumber::setRangeEpsAbs(double),
92/// but this should be only done if there is no other solution.
93bool RooAbsRealLValue::inRange(double value, const char* rangeName, double* clippedValPtr) const
94{
95 // double range = getMax() - getMin() ; // ok for +/-INFINITY
96 double clippedValue(value);
97 bool isInRange(true) ;
98
99 const RooAbsBinning& binning = getBinning(rangeName) ;
100 double min = binning.lowBound() ;
101 double max = binning.highBound() ;
102
103 const double epsilon = std::max(RooNumber::rangeEpsRel() * std::abs(value), RooNumber::rangeEpsAbs());
104
105 // test this value against our upper fit limit
106 if(!RooNumber::isInfinite(max) && value > (max+epsilon)) {
107 clippedValue = max;
108 isInRange = false ;
109 }
110 // test this value against our lower fit limit
111 if(!RooNumber::isInfinite(min) && value < min-epsilon) {
112 clippedValue = min ;
113 isInRange = false ;
114 }
115
116 if (clippedValPtr) *clippedValPtr=clippedValue ;
117
118 return isInRange ;
119}
120
121
122////////////////////////////////////////////////////////////////////////////////
123/// Vectorized version of RooAbsRealLValue::inRange(double, const char*, double*).
124void RooAbsRealLValue::inRange(std::span<const double> values, std::string const& rangeName, std::vector<bool>& out) const {
125 if(rangeName.empty()) {
126 return;
127 }
128
129 const RooAbsBinning& binning = getBinning(rangeName.c_str()) ;
130 const double min = binning.lowBound() ;
131 const double max = binning.highBound() ;
132
133 const bool infiniteMin = RooNumber::isInfinite(min);
134 const bool infiniteMax = RooNumber::isInfinite(max);
135
136 const double epsRel = RooNumber::rangeEpsRel();
137 const double epsAbs = RooNumber::rangeEpsAbs();
138
139 for(std::size_t i = 0; i < values.size(); ++i) {
140 const double eps = std::max(epsRel * std::abs(values[i]), epsAbs);
141 out[i] = out[i] && ((infiniteMax | (values[i] <= (max+eps))) && (infiniteMin | (values[i] >= (min-eps))));
142 }
143
144}
145
146
147////////////////////////////////////////////////////////////////////////////////
148/// Check if given value is valid
149
150bool RooAbsRealLValue::isValidReal(double value, bool verbose) const
151{
152 if (!inRange(value,nullptr)) {
153 if (verbose) {
154 coutI(InputArguments) << "RooRealVar::isValid(" << GetName() << "): value " << value << " out of range ("
155 << getMin() << " - " << getMax() << ")" << endl;
156 }
157 return false ;
158 }
159 return true ;
160}
161
162
163
164////////////////////////////////////////////////////////////////////////////////
165/// Read object contents from given stream
166
167bool RooAbsRealLValue::readFromStream(istream& /*is*/, bool /*compact*/, bool /*verbose*/)
168{
169 return true ;
170}
171
172
173
174////////////////////////////////////////////////////////////////////////////////
175/// Write object contents to given stream
176
177void RooAbsRealLValue::writeToStream(ostream& /*os*/, bool /*compact*/) const
178{
179}
180
181
182
183////////////////////////////////////////////////////////////////////////////////
184/// Assignment operator from a double
185
187{
188 double clipValue ;
189 // Clip
190 inRange(newValue,nullptr,&clipValue) ;
191 setVal(clipValue) ;
192
193 return *this ;
194}
195
196
197////////////////////////////////////////////////////////////////////////////////
198/// Create a new RooPlot on the heap with a drawing frame initialized for this
199/// object, but no plot contents. Use x.frame() as the first argument to a
200/// y.plotOn(...) method, for example. The caller is responsible for deleting
201/// the returned object.
202///
203/// <table>
204/// <tr><th> Optional arguments <th>
205/// <tr><td> Range(double lo, double hi) <td> Make plot frame for the specified range
206/// <tr><td> Range(const char* name) <td> Make plot frame for range with the specified name
207/// <tr><td> Bins(Int_t nbins) <td> Set default binning for datasets to specified number of bins
208/// <tr><td> AutoRange(const RooAbsData& data, double margin) <td> Specifies range so that all points in given data set fit
209/// inside the range with given margin.
210/// <tr><td> AutoSymRange(const RooAbsData& data, double margin) <td> Specifies range so that all points in given data set fit
211/// inside the range and center of range coincides with mean of distribution in given dataset.
212/// <tr><td> Name(const char* name) <td> Give specified name to RooPlot object
213/// <tr><td> Title(const char* title) <td> Give specified title to RooPlot object
214/// </table>
215///
216RooPlot* RooAbsRealLValue::frame(const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3, const RooCmdArg& arg4,
217 const RooCmdArg& arg5, const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8) const
218{
219 RooLinkedList cmdList ;
220 cmdList.Add(const_cast<RooCmdArg*>(&arg1)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg2)) ;
221 cmdList.Add(const_cast<RooCmdArg*>(&arg3)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg4)) ;
222 cmdList.Add(const_cast<RooCmdArg*>(&arg5)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg6)) ;
223 cmdList.Add(const_cast<RooCmdArg*>(&arg7)) ; cmdList.Add(const_cast<RooCmdArg*>(&arg8)) ;
224
225 return frame(cmdList) ;
226}
227
228
229
230////////////////////////////////////////////////////////////////////////////////
231/// Back-end function for named argument frame() method
232
234{
235 // Define configuration for this method
236 RooCmdConfig pc("RooAbsRealLValue::frame(" + std::string(GetName()) + ")");
237 pc.defineDouble("min","Range",0,getMin()) ;
238 pc.defineDouble("max","Range",1,getMax()) ;
239 pc.defineInt("nbins","Bins",0,getBins()) ;
240 pc.defineString("rangeName","RangeWithName",0,"") ;
241 pc.defineString("name","Name",0,"") ;
242 pc.defineString("title","Title",0,"") ;
243 pc.defineMutex("Range","RangeWithName","AutoRange") ;
244 pc.defineObject("rangeData","AutoRange",0,nullptr) ;
245 pc.defineDouble("rangeMargin","AutoRange",0,0.1) ;
246 pc.defineInt("rangeSym","AutoRange",0,0) ;
247
248 // Process & check varargs
249 pc.process(cmdList) ;
250 if (!pc.ok(true)) {
251 return nullptr ;
252 }
253
254 // Extract values from named arguments
255 double xmin(getMin());
256 double xmax(getMax());
257 if (pc.hasProcessed("Range")) {
258 xmin = pc.getDouble("min") ;
259 xmax = pc.getDouble("max") ;
260 if (xmin==xmax) {
261 xmin = getMin() ;
262 xmax = getMax() ;
263 }
264 } else if (pc.hasProcessed("RangeWithName")) {
265 const char* rangeName=pc.getString("rangeName",nullptr,true) ;
266 xmin = getMin(rangeName) ;
267 xmax = getMax(rangeName) ;
268 } else if (pc.hasProcessed("AutoRange")) {
269 auto rangeData = static_cast<RooAbsData*>(pc.getObject("rangeData")) ;
270 const bool error = rangeData->getRange(*this,xmin,xmax);
271 if (error) {
272 xmin = getMin();
273 xmax = getMax();
274 }
275 if (pc.getInt("rangeSym")==0) {
276 // Regular mode: range is from xmin to xmax with given extra margin
277 double margin = pc.getDouble("rangeMargin")*(xmax-xmin) ;
278 xmin -= margin ;
279 xmax += margin ;
280 if (xmin<getMin()) xmin = getMin() ;
281 if (xmin>getMax()) xmax = getMax() ;
282 } else {
283 // Symmetric mode: range is centered at mean of distribution with enough width to include
284 // both lowest and highest point with margin
285 double dmean = rangeData->moment(const_cast<RooRealVar &>(static_cast<RooRealVar const&>(*this)),1) ;
286 double ddelta = ((xmax-dmean)>(dmean-xmin)?(xmax-dmean):(dmean-xmin))*(1+pc.getDouble("rangeMargin")) ;
287 xmin = dmean-ddelta ;
288 xmax = dmean+ddelta ;
289 if (xmin<getMin()) xmin = getMin() ;
290 if (xmin>getMax()) xmax = getMax() ;
291 }
292 } else {
293 xmin = getMin() ;
294 xmax = getMax() ;
295 }
296
297 Int_t nbins = pc.getInt("nbins") ;
298 const char* name = pc.getString("name",nullptr,true) ;
299 const char* title = pc.getString("title",nullptr,true) ;
300
301 RooPlot* theFrame = new RooPlot(*this,xmin,xmax,nbins) ;
302
303 if (name) {
304 theFrame->SetName(name) ;
305 }
306 if (title) {
307 theFrame->SetTitle(title) ;
308 }
309
310 return theFrame ;
311}
312
313
314
315////////////////////////////////////////////////////////////////////////////////
316/// Create a new RooPlot on the heap with a drawing frame initialized for this
317/// object, but no plot contents. Use x.frame() as the first argument to a
318/// y.plotOn(...) method, for example. The caller is responsible for deleting
319/// the returned object.
320
321RooPlot *RooAbsRealLValue::frame(double xlo, double xhi, Int_t nbins) const
322{
323 return new RooPlot(*this,xlo,xhi,nbins);
324}
325
326
327
328////////////////////////////////////////////////////////////////////////////////
329/// Create a new RooPlot on the heap with a drawing frame initialized for this
330/// object, but no plot contents. Use x.frame() as the first argument to a
331/// y.plotOn(...) method, for example. The caller is responsible for deleting
332/// the returned object.
333
334RooPlot *RooAbsRealLValue::frame(double xlo, double xhi) const
335{
336 return new RooPlot(*this,xlo,xhi,getBins());
337}
338
339
340
341////////////////////////////////////////////////////////////////////////////////
342/// Create a new RooPlot on the heap with a drawing frame initialized for this
343/// object, but no plot contents. Use x.frame() as the first argument to a
344/// y.plotOn(...) method, for example. The caller is responsible for deleting
345/// the returned object.
346///
347/// The current fit range may not be open ended or empty.
348
350{
351 // Plot range of variable may not be infinite or empty
352 if (getMin()==getMax()) {
353 coutE(InputArguments) << "RooAbsRealLValue::frame(" << GetName() << ") ERROR: empty fit range, must specify plot range" << endl ;
354 return nullptr ;
355 }
357 coutE(InputArguments) << "RooAbsRealLValue::frame(" << GetName() << ") ERROR: open ended fit range, must specify plot range" << endl ;
358 return nullptr ;
359 }
360
361 return new RooPlot(*this,getMin(),getMax(),nbins);
362}
363
364
365
366////////////////////////////////////////////////////////////////////////////////
367/// Create a new RooPlot on the heap with a drawing frame initialized for this
368/// object, but no plot contents. Use x.frame() as the first argument to a
369/// y.plotOn(...) method, for example. The caller is responsible for deleting
370/// the returned object.
371///
372/// The current fit range may not be open ended or empty.
373
375{
376 // Plot range of variable may not be infinite or empty
377 if (getMin()==getMax()) {
378 coutE(InputArguments) << "RooAbsRealLValue::frame(" << GetName() << ") ERROR: empty fit range, must specify plot range" << endl ;
379 return nullptr ;
380 }
382 coutE(InputArguments) << "RooAbsRealLValue::frame(" << GetName() << ") ERROR: open ended fit range, must specify plot range" << endl ;
383 return nullptr ;
384 }
385
386 return new RooPlot(*this,getMin(),getMax(),getBins());
387}
388
389
390
391////////////////////////////////////////////////////////////////////////////////
392/// Copy cache of another RooAbsArg to our cache
393
394void RooAbsRealLValue::copyCache(const RooAbsArg* source, bool valueOnly, bool setValDirty)
395{
396 RooAbsReal::copyCache(source,valueOnly,setValDirty) ;
397 setVal(_value) ; // force back-propagation
398}
399
400
401////////////////////////////////////////////////////////////////////////////////
402/// Structure printing
403
404void RooAbsRealLValue::printMultiline(ostream& os, Int_t contents, bool verbose, TString indent) const
405{
406 RooAbsReal::printMultiline(os,contents,verbose,indent);
407 os << indent << "--- RooAbsRealLValue ---" << endl;
408 TString unit(_unit);
409 if(!unit.IsNull()) unit.Prepend(' ');
410 os << indent << " Fit range is [ ";
411 if(hasMin()) {
412 os << getMin() << unit << " , ";
413 }
414 else {
415 os << "-INF , ";
416 }
417 if(hasMax()) {
418 os << getMax() << unit << " ]" << endl;
419 }
420 else {
421 os << "+INF ]" << endl;
422 }
423}
424
425
426
427////////////////////////////////////////////////////////////////////////////////
428/// Set a new value sampled from a uniform distribution over the fit range.
429/// Prints a warning and does nothing if the fit range is not finite.
430
431void RooAbsRealLValue::randomize(const char* rangeName)
432{
433 RooAbsBinning& binning = getBinning(rangeName) ;
434 double min = binning.lowBound() ;
435 double max = binning.highBound() ;
436
438 setValFast(min + RooRandom::uniform()*(max-min));
439 }
440 else {
441 coutE(Generation) << fName << "::" << ClassName() << ":randomize: fails with unbounded fit range" << endl;
442 }
443}
444
445
446
447////////////////////////////////////////////////////////////////////////////////
448/// Set value to center of bin 'ibin' of binning 'rangeName' (or of
449/// default binning if no range is specified)
450
451void RooAbsRealLValue::setBin(Int_t ibin, const char* rangeName)
452{
453 // Check range of plot bin index
454 if (ibin<0 || ibin>=numBins(rangeName)) {
455 coutE(InputArguments) << "RooAbsRealLValue::setBin(" << GetName() << ") ERROR: bin index " << ibin
456 << " is out of range (0," << getBins(rangeName)-1 << ")" << endl ;
457 return ;
458 }
459
460 // Set value to center of requested bin
461 setValFast(getBinning(rangeName).binCenter(ibin)) ;
462}
463
464
465
466////////////////////////////////////////////////////////////////////////////////
467/// Set value to center of bin 'ibin' of binning 'binning'
468
470{
471 // Set value to center of requested bin
472 setValFast(binning.binCenter(ibin)) ;
473}
474
475
476
477////////////////////////////////////////////////////////////////////////////////
478/// Set a new value sampled from a uniform distribution over the fit range.
479/// Prints a warning and does nothing if the fit range is not finite.
480
482{
483 double range= binning.highBound() - binning.lowBound() ;
484 setVal(binning.lowBound() + RooRandom::uniform()*range);
485}
486
487
488
489////////////////////////////////////////////////////////////////////////////////
490/// Check if fit range is usable as plot range, i.e. it is neither
491/// open ended, nor empty
492
494{
495 return (hasMin() && hasMax() && (getMin()!=getMax())) ;
496}
497
498
499
500////////////////////////////////////////////////////////////////////////////////
501/// Check if current value is inside range with given name. Multiple comma-separated
502/// ranges can be passed. In this case, it will be checked if the value is in any of
503/// these ranges.
504///
505/// Implements the following check to see if the value x is in the range [a, b]:
506/// check if `[x - eps * x, x + eps * x]` overlaps with `[a, b]`, where the
507/// parameter `eps` is defined as:
508/// ```
509/// std::max(RooNumber::rangeEpsRel() * std::abs(x), RooNumber::rangeEpsAbs())
510/// ```
511/// By default, RooNumber::rangeEpsRel() and RooNumber::rangeEpsRel() are set to zero.
512/// You can change them with RooNumber::setRangeEpsRel(double) and RooNumber::setRangeEpsAbs(double),
513/// but this should be only done if there is no other solution.
514bool RooAbsRealLValue::inRange(const char* name) const
515{
516 const double val = getVal() ;
517 const double epsilon = std::max(RooNumber::rangeEpsRel() * std::abs(val), RooNumber::rangeEpsAbs());
518 if (!name || name[0] == '\0') {
519 const auto minMax = getRange(nullptr);
520 return minMax.first - epsilon <= val && val <= minMax.second + epsilon;
521 }
522
523 const auto& ranges = ROOT::Split(name, ",");
524 return std::any_of(ranges.begin(), ranges.end(), [val,epsilon,this](const std::string& range){
525 const auto minMax = this->getRange(range.c_str());
526 return minMax.first - epsilon <= val && val <= minMax.second + epsilon;
527 });
528}
529
530
531
532////////////////////////////////////////////////////////////////////////////////
533
534TH1* RooAbsRealLValue::createHistogram(const char *name, const RooCmdArg& arg1, const RooCmdArg& arg2,
535 const RooCmdArg& arg3, const RooCmdArg& arg4, const RooCmdArg& arg5,
536 const RooCmdArg& arg6, const RooCmdArg& arg7, const RooCmdArg& arg8) const
537
538 // Create an empty ROOT histogram TH1,TH2 or TH3 suitabe to store information represent by the RooAbsRealLValue
539 //
540 // This function accepts the following arguments
541 //
542 // name -- Name of the ROOT histogram
543 //
544 // Binning(const char* name) -- Apply binning with given name to x axis of histogram
545 // Binning(RooAbsBinning& binning) -- Apply specified binning to x axis of histogram
546 // Binning(int_t nbins) -- Apply specified binning to x axis of histogram
547 // Binning(int_t nbins, double lo, double hi) -- Apply specified binning to x axis of histogram
548 // ConditionalObservables(const RooArgSet& set) -- Do not normalized PDF over following observables when projecting PDF into histogram
549 //
550 // YVar(const RooAbsRealLValue& var,...) -- Observable to be mapped on y axis of ROOT histogram
551 // ZVar(const RooAbsRealLValue& var,...) -- Observable to be mapped on z axis of ROOT histogram
552 //
553 // The YVar() and ZVar() arguments can be supplied with optional Binning() arguments to control the binning of the Y and Z axes, e.g.
554 // createHistogram("histo",x,Binning(-1,1,20), YVar(y,Binning(-1,1,30)), ZVar(z,Binning("zbinning")))
555 //
556 // The caller takes ownership of the returned histogram
557{
559 l.Add((TObject*)&arg1) ; l.Add((TObject*)&arg2) ;
560 l.Add((TObject*)&arg3) ; l.Add((TObject*)&arg4) ;
561 l.Add((TObject*)&arg5) ; l.Add((TObject*)&arg6) ;
562 l.Add((TObject*)&arg7) ; l.Add((TObject*)&arg8) ;
563
564 return createHistogram(name,l) ;
565}
566
567
568
569////////////////////////////////////////////////////////////////////////////////
570/// Create empty 1,2 or 3D histogram
571/// Arguments recognized
572///
573/// YVar() -- RooRealVar defining Y dimension with optional range/binning
574/// ZVar() -- RooRealVar defining Z dimension with optional range/binning
575/// AxisLabel() -- Vertical axis label
576/// Binning() -- Range/Binning specification of X axis
577
578TH1* RooAbsRealLValue::createHistogram(const char *name, const RooLinkedList& cmdList) const
579{
580 // Define configuration for this method
581 RooCmdConfig pc("RooAbsRealLValue::createHistogram(" + std::string(GetName()) + ")");
582
583 pc.defineObject("xbinning","Binning",0,nullptr) ;
584 pc.defineString("xbinningName","BinningName",0,"") ;
585 pc.defineInt("nxbins","BinningSpec",0) ;
586 pc.defineDouble("xlo","BinningSpec",0,0) ;
587 pc.defineDouble("xhi","BinningSpec",1,0) ;
588
589 pc.defineObject("yvar","YVar",0,nullptr) ;
590 pc.defineObject("ybinning","YVar::Binning",0,nullptr) ;
591 pc.defineString("ybinningName","YVar::BinningName",0,"") ;
592 pc.defineInt("nybins","YVar::BinningSpec",0) ;
593 pc.defineDouble("ylo","YVar::BinningSpec",0,0) ;
594 pc.defineDouble("yhi","YVar::BinningSpec",1,0) ;
595
596 pc.defineObject("zvar","ZVar",0,nullptr) ;
597 pc.defineObject("zbinning","ZVar::Binning",0,nullptr) ;
598 pc.defineString("zbinningName","ZVar::BinningName",0,"") ;
599 pc.defineInt("nzbins","ZVar::BinningSpec",0) ;
600 pc.defineDouble("zlo","ZVar::BinningSpec",0,0) ;
601 pc.defineDouble("zhi","ZVar::BinningSpec",1,0) ;
602
603 pc.defineString("axisLabel","AxisLabel",0,"Events") ;
604
605 pc.defineDependency("ZVar","YVar") ;
606
607 // Process & check varargs
608 pc.process(cmdList) ;
609 if (!pc.ok(true)) {
610 return nullptr ;
611 }
612
613 // Initialize arrays for call to implementation version of createHistogram
614 const char* axisLabel = pc.getString("axisLabel") ;
615 const RooAbsBinning* binning[3] ;
616 bool ownBinning[3] = { false, false, false } ;
617 RooArgList vars ;
618
619 // Prepare X dimension
620 vars.add(*this) ;
621 if (pc.hasProcessed("Binning")) {
622 binning[0] = static_cast<RooAbsBinning*>(pc.getObject("xbinning")) ;
623 } else if (pc.hasProcessed("BinningName")) {
624 binning[0] = &getBinning(pc.getString("xbinningName",nullptr,true)) ;
625 } else if (pc.hasProcessed("BinningSpec")) {
626 double xlo = pc.getDouble("xlo") ;
627 double xhi = pc.getDouble("xhi") ;
628 binning[0] = new RooUniformBinning((xlo==xhi)?getMin():xlo,(xlo==xhi)?getMax():xhi,pc.getInt("nxbins")) ;
629 ownBinning[0] = true ;
630 } else {
631 binning[0] = &getBinning() ;
632 }
633
634 if (pc.hasProcessed("YVar")) {
635 RooAbsRealLValue& yvar = *static_cast<RooAbsRealLValue*>(pc.getObject("yvar")) ;
636 vars.add(yvar) ;
637 if (pc.hasProcessed("YVar::Binning")) {
638 binning[1] = static_cast<RooAbsBinning*>(pc.getObject("ybinning")) ;
639 } else if (pc.hasProcessed("YVar::BinningName")) {
640 binning[1] = &yvar.getBinning(pc.getString("ybinningName",nullptr,true)) ;
641 } else if (pc.hasProcessed("YVar::BinningSpec")) {
642 double ylo = pc.getDouble("ylo") ;
643 double yhi = pc.getDouble("yhi") ;
644 binning[1] = new RooUniformBinning((ylo==yhi)?yvar.getMin():ylo,(ylo==yhi)?yvar.getMax():yhi,pc.getInt("nybins")) ;
645 ownBinning[1] = true ;
646 } else {
647 binning[1] = &yvar.getBinning() ;
648 }
649 }
650
651 if (pc.hasProcessed("ZVar")) {
652 RooAbsRealLValue& zvar = *static_cast<RooAbsRealLValue*>(pc.getObject("zvar")) ;
653 vars.add(zvar) ;
654 if (pc.hasProcessed("ZVar::Binning")) {
655 binning[2] = static_cast<RooAbsBinning*>(pc.getObject("zbinning")) ;
656 } else if (pc.hasProcessed("ZVar::BinningName")) {
657 binning[2] = &zvar.getBinning(pc.getString("zbinningName",nullptr,true)) ;
658 } else if (pc.hasProcessed("ZVar::BinningSpec")) {
659 double zlo = pc.getDouble("zlo") ;
660 double zhi = pc.getDouble("zhi") ;
661 binning[2] = new RooUniformBinning((zlo==zhi)?zvar.getMin():zlo,(zlo==zhi)?zvar.getMax():zhi,pc.getInt("nzbins")) ;
662 ownBinning[2] = true ;
663 } else {
664 binning[2] = &zvar.getBinning() ;
665 }
666 }
667
668
669 TH1* ret = createHistogram(name, vars, axisLabel, binning) ;
670
671 if (ownBinning[0]) delete binning[0] ;
672 if (ownBinning[1]) delete binning[1] ;
673 if (ownBinning[2]) delete binning[2] ;
674
675 return ret ;
676}
677
678
679
680////////////////////////////////////////////////////////////////////////////////
681/// Create an empty 1D-histogram with appropriate scale and labels for this variable.
682/// This method uses the default plot range which can be changed using the
683/// setPlotMin(),setPlotMax() methods, and the default binning which can be
684/// changed with setPlotBins(). The caller takes ownership of the returned
685/// object and is responsible for deleting it.
686
687TH1F *RooAbsRealLValue::createHistogram(const char *name, const char *yAxisLabel) const
688{
689 // Check if the fit range is usable as plot range
690 if (!fitRangeOKForPlotting()) {
691 coutE(InputArguments) << "RooAbsRealLValue::createHistogram(" << GetName()
692 << ") ERROR: fit range empty or open ended, must explicitly specify range" << endl ;
693 return nullptr ;
694 }
695
696 RooArgList list(*this) ;
697 double xlo = getMin() ;
698 double xhi = getMax() ;
699 Int_t nbins = getBins() ;
700
701 // coverity[ARRAY_VS_SINGLETON]
702 return static_cast<TH1F*>(createHistogram(name, list, yAxisLabel, &xlo, &xhi, &nbins));
703}
704
705
706
707////////////////////////////////////////////////////////////////////////////////
708/// Create an empty 1D-histogram with appropriate scale and labels for this variable.
709/// This method uses the default plot range which can be changed using the
710/// setPlotMin(),setPlotMax() methods, and the default binning which can be
711/// changed with setPlotBins(). The caller takes ownership of the returned
712/// object and is responsible for deleting it.
713
714TH1F *RooAbsRealLValue::createHistogram(const char *name, const char *yAxisLabel, double xlo, double xhi, Int_t nBins) const
715{
716 RooArgList list(*this) ;
717
718 // coverity[ARRAY_VS_SINGLETON]
719 return static_cast<TH1F*>(createHistogram(name, list, yAxisLabel, &xlo, &xhi, &nBins));
720}
721
722
723
724////////////////////////////////////////////////////////////////////////////////
725/// Create an empty 1D-histogram with appropriate scale and labels for this variable.
726
727TH1F *RooAbsRealLValue::createHistogram(const char *name, const char *yAxisLabel, const RooAbsBinning& bins) const
728{
729 RooArgList list(*this) ;
730 const RooAbsBinning* pbins = &bins ;
731
732 // coverity[ARRAY_VS_SINGLETON]
733 return static_cast<TH1F*>(createHistogram(name, list, yAxisLabel, &pbins));
734}
735
736
737
738////////////////////////////////////////////////////////////////////////////////
739/// Create an empty 2D-histogram with appropriate scale and labels for this variable (x)
740/// and the specified y variable. This method uses the default plot ranges for x and y which
741/// can be changed using the setPlotMin(),setPlotMax() methods, and the default binning which
742/// can be changed with setPlotBins(). The caller takes ownership of the returned object
743/// and is responsible for deleting it.
744
745TH2F *RooAbsRealLValue::createHistogram(const char *name, const RooAbsRealLValue &yvar, const char *zAxisLabel,
746 double* xlo, double* xhi, Int_t* nBins) const
747{
748 if ((!xlo && xhi) || (xlo && !xhi)) {
749 coutE(InputArguments) << "RooAbsRealLValue::createHistogram(" << GetName()
750 << ") ERROR must specify either no range, or both limits" << endl ;
751 return nullptr ;
752 }
753
754 double xlo_fit[2] ;
755 double xhi_fit[2] ;
756 Int_t nbins_fit[2] ;
757
758 double *xlo2 = xlo;
759 double *xhi2 = xhi;
760 Int_t *nBins2 = nBins;
761
762 if (!xlo2) {
763
764 if (!fitRangeOKForPlotting()) {
765 coutE(InputArguments) << "RooAbsRealLValue::createHistogram(" << GetName()
766 << ") ERROR: fit range empty or open ended, must explicitly specify range" << endl ;
767 return nullptr ;
768 }
769 if (!yvar.fitRangeOKForPlotting()) {
770 coutE(InputArguments) << "RooAbsRealLValue::createHistogram(" << GetName()
771 << ") ERROR: fit range of " << yvar.GetName() << " empty or open ended, must explicitly specify range" << endl ;
772 return nullptr ;
773 }
774
775 xlo_fit[0] = getMin() ;
776 xhi_fit[0] = getMax() ;
777
778 xlo_fit[1] = yvar.getMin() ;
779 xhi_fit[1] = yvar.getMax() ;
780
781 xlo2 = xlo_fit ;
782 xhi2 = xhi_fit ;
783 }
784
785 if (!nBins2) {
786 nbins_fit[0] = getBins() ;
787 nbins_fit[1] = yvar.getBins() ;
788 nBins2 = nbins_fit ;
789 }
790
791
792 RooArgList list(*this,yvar) ;
793 // coverity[OVERRUN_STATIC]
794 return static_cast<TH2F*>(createHistogram(name, list, zAxisLabel, xlo2, xhi2, nBins2));
795}
796
797
798
799////////////////////////////////////////////////////////////////////////////////
800/// Create an empty 2D-histogram with appropriate scale and labels for this variable (x)
801/// and the specified y variable.
802
804 const char *zAxisLabel, const RooAbsBinning** bins) const
805{
806 RooArgList list(*this,yvar) ;
807 return static_cast<TH2F*>(createHistogram(name, list, zAxisLabel, bins));
808}
809
810
811
812////////////////////////////////////////////////////////////////////////////////
813/// Create an empty 3D-histogram with appropriate scale and labels for this variable (x)
814/// and the specified y,z variables. This method uses the default plot ranges for x,y,z which
815/// can be changed using the setPlotMin(),setPlotMax() methods, and the default binning which
816/// can be changed with setPlotBins(). The caller takes ownership of the returned object
817/// and is responsible for deleting it.
818
820 const char *tAxisLabel, double* xlo, double* xhi, Int_t* nBins) const
821{
822 if ((!xlo && xhi) || (xlo && !xhi)) {
823 coutE(InputArguments) << "RooAbsRealLValue::createHistogram(" << GetName()
824 << ") ERROR must specify either no range, or both limits" << endl ;
825 return nullptr ;
826 }
827
828 double xlo_fit[3] ;
829 double xhi_fit[3] ;
830 Int_t nbins_fit[3] ;
831
832 double *xlo2 = xlo;
833 double *xhi2 = xhi;
834 Int_t* nBins2 = nBins;
835 if (!xlo2) {
836
837 if (!fitRangeOKForPlotting()) {
838 coutE(InputArguments) << "RooAbsRealLValue::createHistogram(" << GetName()
839 << ") ERROR: fit range empty or open ended, must explicitly specify range" << endl ;
840 return nullptr ;
841 }
842 if (!yvar.fitRangeOKForPlotting()) {
843 coutE(InputArguments) << "RooAbsRealLValue::createHistogram(" << GetName()
844 << ") ERROR: fit range of " << yvar.GetName() << " empty or open ended, must explicitly specify range" << endl ;
845 return nullptr ;
846 }
847 if (!zvar.fitRangeOKForPlotting()) {
848 coutE(InputArguments) << "RooAbsRealLValue::createHistogram(" << GetName()
849 << ") ERROR: fit range of " << zvar.GetName() << " empty or open ended, must explicitly specify range" << endl ;
850 return nullptr ;
851 }
852
853 xlo_fit[0] = getMin() ;
854 xhi_fit[0] = getMax() ;
855
856 xlo_fit[1] = yvar.getMin() ;
857 xhi_fit[1] = yvar.getMax() ;
858
859 xlo_fit[2] = zvar.getMin() ;
860 xhi_fit[2] = zvar.getMax() ;
861
862 xlo2 = xlo_fit ;
863 xhi2 = xhi_fit ;
864 }
865
866 if (!nBins2) {
867 nbins_fit[0] = getBins() ;
868 nbins_fit[1] = yvar.getBins() ;
869 nbins_fit[2] = zvar.getBins() ;
870 nBins2 = nbins_fit ;
871 }
872
873 RooArgList list(*this,yvar,zvar) ;
874 return static_cast<TH3F*>(createHistogram(name, list, tAxisLabel, xlo2, xhi2, nBins2));
875}
876
877
879 const char* tAxisLabel, const RooAbsBinning** bins) const
880{
881 // Create an empty 3D-histogram with appropriate scale and labels for this variable (x)
882 // and the specified y,z variables.
883
884 RooArgList list(*this,yvar,zvar) ;
885 return static_cast<TH3F*>(createHistogram(name, list, tAxisLabel, bins));
886}
887
888
889
890
891////////////////////////////////////////////////////////////////////////////////
892/// Create 1-, 2- or 3-d ROOT histogram with labels taken
893/// from the variables in 'vars' and the with range and binning
894/// specified in xlo,xhi and nBins. The dimensions of the arrays xlo,xhi,
895/// nBins should match the number of objects in vars.
896
897TH1 *RooAbsRealLValue::createHistogram(const char *name, RooArgList &vars, const char *tAxisLabel,
898 double* xlo, double* xhi, Int_t* nBins)
899{
900 const RooAbsBinning* bin[3] ;
901 Int_t ndim = vars.size() ;
902 bin[0] = new RooUniformBinning(xlo[0],xhi[0],nBins[0]) ;
903 bin[1] = (ndim>1) ? new RooUniformBinning(xlo[1],xhi[1],nBins[1]) : nullptr ;
904 bin[2] = (ndim>2) ? new RooUniformBinning(xlo[2],xhi[2],nBins[2]) : nullptr ;
905
906 TH1* ret = createHistogram(name,vars,tAxisLabel,bin) ;
907
908 if (bin[0]) delete bin[0] ;
909 if (bin[1]) delete bin[1] ;
910 if (bin[2]) delete bin[2] ;
911 return ret ;
912}
913
914
915
916////////////////////////////////////////////////////////////////////////////////
917/// Create a 1,2, or 3D-histogram with appropriate scale and labels.
918/// Binning and ranges are taken from the variables themselves and can be changed by
919/// calling their setPlotMin/Max() and setPlotBins() methods. A histogram can be filled
920/// using RooAbsReal::fillHistogram() or RooTreeData::fillHistogram().
921/// The caller takes ownership of the returned object and is responsible for deleting it.
922
923TH1 *RooAbsRealLValue::createHistogram(const char *name, RooArgList &vars, const char *tAxisLabel, const RooAbsBinning** bins)
924{
925 // Check that we have 1-3 vars
926 Int_t dim= vars.size();
927 if(dim < 1 || dim > 3) {
928 oocoutE(nullptr,InputArguments) << "RooAbsReal::createHistogram: dimension not supported: " << dim << endl;
929 return nullptr;
930 }
931
932 // Check that all variables are AbsReals and prepare a name of the form <name>_<var1>_...
933 TString histName(name);
934 histName.Append("_");
935 const RooAbsRealLValue *xyz[3];
936
937 Int_t index;
938 for(index= 0; index < dim; index++) {
939 const RooAbsArg *arg= vars.at(index);
940 xyz[index]= dynamic_cast<const RooAbsRealLValue*>(arg);
941 if(!xyz[index]) {
942 oocoutE(nullptr,InputArguments) << "RooAbsRealLValue::createHistogram: variable is not real lvalue: " << arg->GetName() << endl;
943 return nullptr;
944 }
945 histName.Append("_");
946 histName.Append(arg->GetName());
947 }
948 TString histTitle(histName);
949 histTitle.Prepend("Histogram of ");
950
951 // Create the histogram
952 TH1 *histogram = nullptr;
953 switch(dim) {
954 case 1:
955 if (bins[0]->isUniform()) {
956 histogram= new TH1F(histName.Data(), histTitle.Data(),
957 bins[0]->numBins(),bins[0]->lowBound(),bins[0]->highBound());
958 } else {
959 histogram= new TH1F(histName.Data(), histTitle.Data(),
960 bins[0]->numBins(),bins[0]->array());
961 }
962 break;
963 case 2:
964 if (bins[0]->isUniform() && bins[1]->isUniform()) {
965 histogram= new TH2F(histName.Data(), histTitle.Data(),
966 bins[0]->numBins(),bins[0]->lowBound(),bins[0]->highBound(),
967 bins[1]->numBins(),bins[1]->lowBound(),bins[1]->highBound());
968 } else {
969 histogram= new TH2F(histName.Data(), histTitle.Data(),
970 bins[0]->numBins(),bins[0]->array(),
971 bins[1]->numBins(),bins[1]->array());
972 }
973 break;
974 case 3:
975 if (bins[0]->isUniform() && bins[1]->isUniform() && bins[2]->isUniform()) {
976 histogram= new TH3F(histName.Data(), histTitle.Data(),
977 bins[0]->numBins(),bins[0]->lowBound(),bins[0]->highBound(),
978 bins[1]->numBins(),bins[1]->lowBound(),bins[1]->highBound(),
979 bins[2]->numBins(),bins[2]->lowBound(),bins[2]->highBound()) ;
980 } else {
981 histogram= new TH3F(histName.Data(), histTitle.Data(),
982 bins[0]->numBins(),bins[0]->array(),
983 bins[1]->numBins(),bins[1]->array(),
984 bins[2]->numBins(),bins[2]->array()) ;
985 }
986 break;
987 }
988 if(!histogram) {
989 oocoutE(nullptr,InputArguments) << "RooAbsReal::createHistogram: unable to create a new histogram" << endl;
990 return nullptr;
991 }
992
993 // Set the histogram coordinate axis labels from the titles of each variable, adding units if necessary.
994 for(index= 0; index < dim; index++) {
995 TString axisTitle(xyz[index]->getTitle(true));
996 switch(index) {
997 case 0:
998 histogram->SetXTitle(axisTitle.Data());
999 break;
1000 case 1:
1001 histogram->SetYTitle(axisTitle.Data());
1002 break;
1003 case 2:
1004 histogram->SetZTitle(axisTitle.Data());
1005 break;
1006 default:
1007 assert(0);
1008 break;
1009 }
1010 }
1011
1012 // Set the t-axis title if given one
1013 if((nullptr != tAxisLabel) && (0 != strlen(tAxisLabel))) {
1014 TString axisTitle(tAxisLabel);
1015 axisTitle.Append(" / ( ");
1016 for(Int_t index2= 0; index2 < dim; index2++) {
1017 double delta= bins[index2]->averageBinWidth() ; // xyz[index2]->getBins();
1018 if(index2 > 0) axisTitle.Append(" x ");
1019 axisTitle.Append(Form("%g",delta));
1020 if(strlen(xyz[index2]->getUnit())) {
1021 axisTitle.Append(" ");
1022 axisTitle.Append(xyz[index2]->getUnit());
1023 }
1024 }
1025 axisTitle.Append(" )");
1026 switch(dim) {
1027 case 1:
1028 histogram->SetYTitle(axisTitle.Data());
1029 break;
1030 case 2:
1031 histogram->SetZTitle(axisTitle.Data());
1032 break;
1033 case 3:
1034 // not supported in TH1
1035 break;
1036 default:
1037 assert(0);
1038 break;
1039 }
1040 }
1041
1042 return histogram;
1043}
1044
1045
1047{
1048 // Interface function to indicate that this lvalue
1049 // has a unit or constant jacobian terms with respect to
1050 // the observable passed as argument. This default implementation
1051 // always returns true (i.e. jacobian is constant)
1052 return true ;
1053}
1054
1055
1057{
1058 std::stringstream errStream;
1059 errStream << "Attempting to integrate the " << ClassName() << " \"" << GetName()
1060 << "\", but integrating a RooAbsRealLValue is not allowed!";
1061 const std::string errString = errStream.str();
1062 coutE(InputArguments) << errString << std::endl;
1063 throw std::runtime_error(errString);
1064}
#define coutI(a)
#define oocoutE(o, a)
#define coutE(a)
#define ClassImp(name)
Definition Rtypes.h:382
static void indent(ostringstream &buf, int indent_level)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110
float xmin
float xmax
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
Abstract base class for RooRealVar binning definitions.
virtual double binCenter(Int_t bin) const =0
Int_t numBins() const
Return number of bins.
virtual double averageBinWidth() const =0
virtual double highBound() const =0
virtual double lowBound() const =0
virtual double * array() const =0
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t::size_type size() const
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
bool getRange(const RooAbsRealLValue &var, double &lowest, double &highest, double marginFrac=0.0, bool symMode=false) const
Fill Doubles 'lowest' and 'highest' with the lowest and highest value of observable 'var' in this dat...
Abstract base class for objects that are lvalues, i.e.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Int_t numBins(const char *rangeName=nullptr) const override
virtual Int_t getBins(const char *name=nullptr) const
Get number of bins of currently defined range.
RooFit::OwningPtr< RooAbsReal > createIntegral(const RooArgSet &iset, const RooArgSet *nset=nullptr, const RooNumIntConfig *cfg=nullptr, const char *rangeName=nullptr) const override
Create an object that represents the integral of the function over one or more observables listed in ...
virtual void setValFast(double value)
RooPlot * frame(const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
bool isValidReal(double value, bool printError=false) const override
Check if given value is valid.
virtual const RooAbsBinning & getBinning(const char *name=nullptr, bool verbose=true, bool createOnTheFly=false) const =0
Retrieve binning configuration with given name or default binning.
TH1 * createHistogram(const char *name, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
virtual bool isJacobianOK(const RooArgSet &depList) const
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
RooPlot * frame() const
Create a new RooPlot on the heap with a drawing frame initialized for this object,...
bool hasMax(const char *name=nullptr) const
Check if variable has an upper bound.
void copyCache(const RooAbsArg *source, bool valueOnly=false, bool setValDirty=true) override
Copy cache of another RooAbsArg to our cache.
bool fitRangeOKForPlotting() const
Check if fit range is usable as plot range, i.e.
void setBin(Int_t ibin, const char *rangeName=nullptr) override
Set value to center of bin 'ibin' of binning 'rangeName' (or of default binning if no range is specif...
void writeToStream(std::ostream &os, bool compact) const override
Write object contents to given stream.
void randomize(const char *rangeName=nullptr) override
Set a new value sampled from a uniform distribution over the fit range.
virtual void setVal(double value)=0
Set the current value of the object. Needs to be overridden by implementations.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
bool readFromStream(std::istream &is, bool compact, bool verbose=false) override
Read object contents from given stream.
bool inRange(const char *name) const override
Check if current value is inside range with given name.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Structure printing.
std::pair< double, double > getRange(const char *name=nullptr) const
Get low and high bound of the variable.
virtual RooAbsArg & operator=(double newValue)
Assignment operator from a double.
bool hasMin(const char *name=nullptr) const
Check if variable has a lower bound.
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:103
TString _unit
Unit for objects value.
Definition RooAbsReal.h:536
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Structure printing.
void copyCache(const RooAbsArg *source, bool valueOnly=false, bool setValDirty=true) override
Copy the cached value of another RooAbsArg to our cache.
double _value
Cache for current value of object.
Definition RooAbsReal.h:535
TString getTitle(bool appendUnit=false) const
Return this variable's title string.
const Text_t * getUnit() const
Definition RooAbsReal.h:145
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Definition RooArgList.h:110
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Named container for two doubles, two integers two object points and three string pointers that can be...
Definition RooCmdArg.h:26
Configurable parser for RooCmdArg named arguments.
void defineMutex(const char *head, Args_t &&... tail)
Define arguments where any pair is mutually exclusive.
bool process(const RooCmdArg &arg)
Process given RooCmdArg.
bool hasProcessed(const char *cmdName) const
Return true if RooCmdArg with name 'cmdName' has been processed.
double getDouble(const char *name, double defaultValue=0.0) const
Return double property registered with name 'name'.
void defineDependency(const char *refArgName, const char *neededArgName)
Define that processing argument name refArgName requires processing of argument named neededArgName t...
bool defineDouble(const char *name, const char *argName, int doubleNum, double defValue=0.0)
Define double property name 'name' mapped to double in slot 'doubleNum' in RooCmdArg with name argNam...
bool ok(bool verbose) const
Return true of parsing was successful.
bool defineObject(const char *name, const char *argName, int setNum, const TObject *obj=nullptr, bool isArray=false)
Define TObject property name 'name' mapped to object in slot 'setNum' in RooCmdArg with name argName ...
const char * getString(const char *name, const char *defaultValue="", bool convEmptyToNull=false) const
Return string property registered with name 'name'.
bool defineString(const char *name, const char *argName, int stringNum, const char *defValue="", bool appendMode=false)
Define double property name 'name' mapped to double in slot 'stringNum' in RooCmdArg with name argNam...
bool defineInt(const char *name, const char *argName, int intNum, int defValue=0)
Define integer property name 'name' mapped to integer in slot 'intNum' in RooCmdArg with name argName...
int getInt(const char *name, int defaultValue=0) const
Return integer property registered with name 'name'.
TObject * getObject(const char *name, TObject *obj=nullptr) const
Return TObject property registered with name 'name'.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
virtual void Add(TObject *arg)
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
static double rangeEpsRel()
Get the relative epsilon that is used by range checks in RooFit, e.g., in RooAbsRealLValue::inRange()...
Definition RooNumber.h:34
static double rangeEpsAbs()
Get the absolute epsilon that is used by range checks in RooFit, e.g., in RooAbsRealLValue::inRange()...
Definition RooNumber.h:41
static constexpr int isInfinite(double x)
Return true if x is infinite by RooNumber internal specification.
Definition RooNumber.h:27
Plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:43
void SetName(const char *name) override
Set the name of the RooPlot to 'name'.
Definition RooPlot.cxx:1181
void SetTitle(const char *name) override
Set the title of the RooPlot to 'title'.
Definition RooPlot.cxx:1203
static double uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
Definition RooRandom.cxx:78
Variable that can be changed from the outside.
Definition RooRealVar.h:37
Implementation of RooAbsBinning that provides a uniform binning in 'n' bins between the range end poi...
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:623
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
virtual void SetXTitle(const char *title)
Definition TH1.h:420
virtual void SetZTitle(const char *title)
Definition TH1.h:422
virtual void SetYTitle(const char *title)
Definition TH1.h:421
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:308
3-D histogram with a float per channel (see TH1 documentation)
Definition TH3.h:318
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
TString fName
Definition TNamed.h:32
Mother of all ROOT objects.
Definition TObject.h:41
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:225
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
TString & Prepend(const char *cs)
Definition TString.h:673
Bool_t IsNull() const
Definition TString.h:414
TString & Append(const char *cs)
Definition TString.h:572
std::vector< std::string > Split(std::string_view str, std::string_view delims, bool skipEmpty=false)
Splits a string at each character in delims.
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
Definition Config.h:35
TLine l
Definition textangle.C:4