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