Logo ROOT   6.18/05
Reference Guide
RooRealVar.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 RooRealVar.cxx
19\class RooRealVar
20\ingroup Roofitcore
21
22RooRealVar represents a fundamental (non-derived) real valued object
23
24This class also holds an (asymmetic) error, a default range and
25a optionally series of alternate named ranges.
26**/
27
28
29#include "RooFit.h"
30#include "Riostream.h"
31#include "RooTrace.h"
32
33#include <math.h>
34#include "TObjString.h"
35#include "TTree.h"
36#include "RooRealVar.h"
37#include "RooStreamParser.h"
38#include "RooErrorVar.h"
39#include "RooRangeBinning.h"
40#include "RooCmdConfig.h"
41#include "RooMsgService.h"
42#include "RooParamBinning.h"
43#include "RooVectorDataStore.h"
44
45
46using namespace std;
47
49;
50
54RooRealVarSharedProperties RooRealVar::_nullProp("00000000-0000-0000-0000-000000000000") ;
55
56
57////////////////////////////////////////////////////////////////////////////////
58/// Default constructor
59
60RooRealVar::RooRealVar() : _error(0), _asymErrLo(0), _asymErrHi(0), _binning(0), _sharedProp(0)
61{
63 _fast = kTRUE ;
65}
66
67
68////////////////////////////////////////////////////////////////////////////////
69/// Constructor with value and unit
70
71RooRealVar::RooRealVar(const char *name, const char *title,
72 Double_t value, const char *unit) :
73 RooAbsRealLValue(name, title, unit), _error(-1), _asymErrLo(1), _asymErrHi(-1), _sharedProp(0)
74{
75 // _instanceList.registerInstance(this) ;
76 _binning = new RooUniformBinning(-1,1,100) ;
77 _value = value ;
78 _fast = kTRUE ;
82}
83
84
85////////////////////////////////////////////////////////////////////////////////
86/// Constructor with range and unit. Initial value is center of range
87
88RooRealVar::RooRealVar(const char *name, const char *title,
89 Double_t minValue, Double_t maxValue,
90 const char *unit) :
91 RooAbsRealLValue(name, title, unit), _error(-1), _asymErrLo(1), _asymErrHi(-1), _sharedProp(0)
92{
93 _binning = new RooUniformBinning(minValue,maxValue,100) ;
94 _fast = kTRUE ;
95
96 if (RooNumber::isInfinite(minValue)) {
97 if (RooNumber::isInfinite(maxValue)) {
98 // [-inf,inf]
99 _value = 0 ;
100 } else {
101 // [-inf,X]
102 _value= maxValue ;
103 }
104 } else {
105 if (RooNumber::isInfinite(maxValue)) {
106 // [X,inf]
107 _value = minValue ;
108 } else {
109 // [X,X]
110 _value= 0.5*(minValue + maxValue);
111 }
112 }
113
114 // setPlotRange(minValue,maxValue) ;
115 setRange(minValue,maxValue) ;
117}
118
119
120////////////////////////////////////////////////////////////////////////////////
121/// Constructor with value, range and unit
122
123RooRealVar::RooRealVar(const char *name, const char *title,
124 Double_t value, Double_t minValue, Double_t maxValue,
125 const char *unit) :
126 RooAbsRealLValue(name, title, unit), _error(-1), _asymErrLo(1), _asymErrHi(-1), _sharedProp(0)
127{
128 _fast = kTRUE ;
129 _binning = new RooUniformBinning(minValue,maxValue,100) ;
130 setRange(minValue,maxValue) ;
131
132 Double_t clipValue ;
133 inRange(value,0,&clipValue) ;
134 _value = clipValue ;
135
137}
138
139
140////////////////////////////////////////////////////////////////////////////////
141/// Copy Constructor
142
143RooRealVar::RooRealVar(const RooRealVar& other, const char* name) :
144 RooAbsRealLValue(other,name),
145 _error(other._error),
146 _asymErrLo(other._asymErrLo),
147 _asymErrHi(other._asymErrHi)
148{
150 if (other._binning) {
151 _binning = other._binning->clone() ;
152 _binning->insertHook(*this) ;
153 }
154 _fast = kTRUE ;
155
156 //cout << "RooRealVar::cctor(this = " << this << " name = " << GetName() << ", other = " << &other << ")" << endl ;
157
158 RooAbsBinning* ab ;
160 while((ab=(RooAbsBinning*)iter->Next())) {
161 RooAbsBinning* abc = ab->clone() ;
162 //cout << "cloning binning " << ab << " into " << abc << endl ;
164 abc->insertHook(*this) ;
165 }
166 delete iter ;
167
169
170}
171
172/// Assign the values of another RooRealVar to this instance.
175
176 _error = other._error;
177 _asymErrLo = other._asymErrLo;
178 _asymErrHi = other._asymErrHi;
179
180 delete _binning;
181 _binning = nullptr;
182 if (other._binning) {
183 _binning = other._binning->clone() ;
184 _binning->insertHook(*this) ;
185 }
186
188 RooAbsBinning* ab ;
189 std::unique_ptr<TIterator> iter(other._altNonSharedBinning.MakeIterator());
190 while((ab=(RooAbsBinning*)iter->Next())) {
191 RooAbsBinning* abc = ab->clone() ;
193 abc->insertHook(*this) ;
194 }
195
197
198 return *this;
199}
200
201
202
203////////////////////////////////////////////////////////////////////////////////
204/// Destructor
205
207{
208 delete _binning ;
210
211 if (_sharedProp) {
213 }
214
216}
217
218
219////////////////////////////////////////////////////////////////////////////////
220/// Return value of variable
221
223{
224 return _value ;
225}
226
227
228
229////////////////////////////////////////////////////////////////////////////////
230/// Set value of variable to 'value'. If 'value' is outside
231/// range of object, clip value into range
232
234{
235 Double_t clipValue ;
236 inRange(value,0,&clipValue) ;
237
238 if (clipValue != _value) {
239 setValueDirty() ;
240 _value = clipValue;
241 }
242}
243
244
245
246////////////////////////////////////////////////////////////////////////////////
247/// Set value of variable to 'value'. If 'value' is outside
248/// range named 'rangeName' of object, clip value into that range
249
250void RooRealVar::setVal(Double_t value, const char* rangeName)
251{
252 Double_t clipValue ;
253 inRange(value,rangeName,&clipValue) ;
254
255 if (clipValue != _value) {
256 setValueDirty() ;
257 _value = clipValue;
258 }
259}
260
261
262
263////////////////////////////////////////////////////////////////////////////////
264/// Return a RooAbsRealLValue representing the error associated
265/// with this variable. The callers takes ownership of the
266/// return object
267
269{
270 TString name(GetName()), title(GetTitle()) ;
271 name.Append("err") ;
272 title.Append(" Error") ;
273
274 return new RooErrorVar(name,title,*this) ;
275}
276
277
278
279////////////////////////////////////////////////////////////////////////////////
280/// Returns true if variable has a binning with 'name'
281
283{
285}
286
287
288
289////////////////////////////////////////////////////////////////////////////////
290/// Return binning definition with name. If binning with 'name' is not found it is created
291/// on the fly as a clone of the default binning if createOnTheFly is true, otherwise
292/// a reference to the default binning is returned. If verbose is true a message
293/// is printed if a binning is created on the fly.
294
295const RooAbsBinning& RooRealVar::getBinning(const char* name, Bool_t verbose, Bool_t createOnTheFly) const
296{
297 return const_cast<RooRealVar*>(this)->getBinning(name, verbose, createOnTheFly) ;
298}
299
300
301
302////////////////////////////////////////////////////////////////////////////////
303/// Return binning definition with name. If binning with 'name' is not found it is created
304/// on the fly as a clone of the default binning if createOnTheFly is true, otherwise
305/// a reference to the default binning is returned. If verbose is true a message
306/// is printed if a binning is created on the fly.
307
309{
310 // Return default (normalization) binning and range if no name is specified
311 if (name==0) {
312 return *_binning ;
313 }
314
315 // Check if non-shared binning with this name has been created already
317 if (binning) {
318 return *binning ;
319 }
320
321 // Check if binning with this name has been created already
323 if (binning) {
324 return *binning ;
325 }
326
327
328 // Return default binning if requested binning doesn't exist
329 if (!createOnTheFly) {
330 return *_binning ;
331 }
332
333 // Create a new RooRangeBinning with this name with default range
334 binning = new RooRangeBinning(getMin(),getMax(),name) ;
335 if (verbose) {
336 coutI(Eval) << "RooRealVar::getBinning(" << GetName() << ") new range named '"
337 << name << "' created with default bounds" << endl ;
338 }
339 sharedProp()->_altBinning.Add(binning) ;
340
341 return *binning ;
342}
343
344////////////////////////////////////////////////////////////////////////////////
345/// Get a list of all binning names. An empty name implies the default binning and
346/// a NULL pointer should be passed to getBinning in this case.
347
348std::list<std::string> RooRealVar::getBinningNames() const
349{
350 std::list<std::string> binningNames;
351 if (_binning) {
352 binningNames.push_back("");
353 }
354
356 const RooAbsArg* binning = 0;
357 while((binning = iter.next())) {
358 const char* name = binning->GetName();
359 binningNames.push_back(string(name));
360 }
362 binning = 0;
363 while((binning = iter.next())) {
364 const char* name = binning->GetName();
365 binningNames.push_back(string(name));
366 }
367 return binningNames;
368}
369
370////////////////////////////////////////////////////////////////////////////////
371/// Add given binning under name 'name' with this variable. If name is null
372/// the binning is installed as the default binning
373
374void RooRealVar::setBinning(const RooAbsBinning& binning, const char* name)
375{
376 // Process insert hooks required for parameterized binnings
377 if (!name) {
378 RooAbsBinning* newBinning = binning.clone() ;
379 if (_binning) {
380 _binning->removeHook(*this) ;
381 delete _binning ;
382 }
383 newBinning->insertHook(*this) ;
384 _binning = newBinning ;
385 } else {
386
387 RooLinkedList* altBinning = binning.isShareable() ? &(sharedProp()->_altBinning) : &_altNonSharedBinning ;
388
389 RooAbsBinning* newBinning = binning.clone() ;
390
391 // Remove any old binning with this name
392 RooAbsBinning* oldBinning = (RooAbsBinning*) altBinning->FindObject(name) ;
393 if (oldBinning) {
394 altBinning->Remove(oldBinning) ;
395 oldBinning->removeHook(*this) ;
396 delete oldBinning ;
397 }
398
399 // Insert new binning in list of alternative binnings
400 newBinning->SetName(name) ;
401 newBinning->SetTitle(name) ;
402 newBinning->insertHook(*this) ;
403 altBinning->Add(newBinning) ;
404
405 }
406
407
408}
409
410
411
412////////////////////////////////////////////////////////////////////////////////
413/// Set minimum of name range to given value. If name is null
414/// minimum of default range is set
415
416void RooRealVar::setMin(const char* name, Double_t value)
417{
418 // Set new minimum of fit range
420
421 // Check if new limit is consistent
422 if (value >= getMax()) {
423 coutW(InputArguments) << "RooRealVar::setMin(" << GetName()
424 << "): Proposed new fit min. larger than max., setting min. to max." << endl ;
425 binning.setMin(getMax()) ;
426 } else {
427 binning.setMin(value) ;
428 }
429
430 // Clip current value in window if it fell out
431 if (!name) {
432 Double_t clipValue ;
433 if (!inRange(_value,0,&clipValue)) {
434 setVal(clipValue) ;
435 }
436 }
437
438 setShapeDirty() ;
439}
440
441
442////////////////////////////////////////////////////////////////////////////////
443/// Set maximum of name range to given value. If name is null
444/// maximum of default range is set
445
446void RooRealVar::setMax(const char* name, Double_t value)
447{
448 // Set new maximum of fit range
450
451 // Check if new limit is consistent
452 if (value < getMin()) {
453 coutW(InputArguments) << "RooRealVar::setMax(" << GetName()
454 << "): Proposed new fit max. smaller than min., setting max. to min." << endl ;
455 binning.setMax(getMin()) ;
456 } else {
457 binning.setMax(value) ;
458 }
459
460 // Clip current value in window if it fell out
461 if (!name) {
462 Double_t clipValue ;
463 if (!inRange(_value,0,&clipValue)) {
464 setVal(clipValue) ;
465 }
466 }
467
468 setShapeDirty() ;
469}
470
471
472////////////////////////////////////////////////////////////////////////////////
473/// Set range named 'name to [min,max]. If name is null
474/// range of default range is adjusted. If no range with
475/// 'name' exists it is created on the fly
476
477void RooRealVar::setRange(const char* name, Double_t min, Double_t max)
478{
480
481 // Set new fit range
483
484 // Check if new limit is consistent
485 if (min>max) {
486 coutW(InputArguments) << "RooRealVar::setRange(" << GetName()
487 << "): Proposed new fit max. smaller than min., setting max. to min." << endl ;
488 binning.setRange(min,min) ;
489 } else {
490 binning.setRange(min,max) ;
491 }
492
493 if (!exists) {
494 coutI(Eval) << "RooRealVar::setRange(" << GetName()
495 << ") new range named '" << name << "' created with bounds ["
496 << min << "," << max << "]" << endl ;
497 }
498
499 setShapeDirty() ;
500}
501
502
503
504////////////////////////////////////////////////////////////////////////////////
505/// Create or modify a parameterized range named 'name' that has external functions
506/// min and max parameterizing its boundaries.
507
508void RooRealVar::setRange(const char* name, RooAbsReal& min, RooAbsReal& max)
509{
510 RooParamBinning pb(min,max,100) ;
511 setBinning(pb,name) ;
512}
513
514
515
516////////////////////////////////////////////////////////////////////////////////
517/// Read object contents from given stream
518
520{
521 TString token,errorPrefix("RooRealVar::readFromStream(") ;
522 errorPrefix.Append(GetName()) ;
523 errorPrefix.Append(")") ;
524 RooStreamParser parser(is,errorPrefix) ;
525 Double_t value(0) ;
526
527 if (compact) {
528 // Compact mode: Read single token
529 if (parser.readDouble(value,verbose)) return kTRUE ;
530 if (isValidReal(value,verbose)) {
531 setVal(value) ;
532 return kFALSE ;
533 } else {
534 return kTRUE ;
535 }
536
537 } else {
538 // Extended mode: Read multiple tokens on a single line
539 Bool_t haveValue(kFALSE) ;
540 Bool_t haveConstant(kFALSE) ;
541 removeError() ;
543
544 Bool_t reprocessToken = kFALSE ;
545 while(1) {
546 if (parser.atEOL() || parser.atEOF()) break ;
547
548 if (!reprocessToken) {
549 token=parser.readToken() ;
550 }
551 reprocessToken = kFALSE ;
552
553 if (!token.CompareTo("+")) {
554
555 // Expect +/- as 3-token sequence
556 if (parser.expectToken("/",kTRUE) ||
557 parser.expectToken("-",kTRUE)) {
558 break ;
559 }
560
561 // Next token is error or asymmetric error, check if first char of token is a '('
562 TString tmp = parser.readToken() ;
563 if (tmp.CompareTo("(")) {
564 // Symmetric error, convert token do double
565
566 Double_t error ;
567 parser.convertToDouble(tmp,error) ;
568 setError(error) ;
569
570 } else {
571 // Have error
572 Double_t asymErrLo=0., asymErrHi=0.;
573 if (parser.readDouble(asymErrLo,kTRUE) ||
574 parser.expectToken(",",kTRUE) ||
575 parser.readDouble(asymErrHi,kTRUE) ||
576 parser.expectToken(")",kTRUE)) break ;
577 setAsymError(asymErrLo,asymErrHi) ;
578 }
579
580 } else if (!token.CompareTo("C")) {
581
582 // Set constant
584 haveConstant = kTRUE ;
585
586 } else if (!token.CompareTo("P")) {
587
588 // Next tokens are plot limits
589 Double_t plotMin(0), plotMax(0) ;
590 Int_t plotBins(0) ;
591 if (parser.expectToken("(",kTRUE) ||
592 parser.readDouble(plotMin,kTRUE) ||
593 parser.expectToken("-",kTRUE) ||
594 parser.readDouble(plotMax,kTRUE) ||
595 parser.expectToken(":",kTRUE) ||
596 parser.readInteger(plotBins,kTRUE) ||
597 parser.expectToken(")",kTRUE)) break ;
598// setPlotRange(plotMin,plotMax) ;
599 coutW(Eval) << "RooRealVar::readFromStrem(" << GetName()
600 << ") WARNING: plot range deprecated, removed P(...) token" << endl ;
601
602 } else if (!token.CompareTo("F")) {
603
604 // Next tokens are fit limits
605 Double_t fitMin, fitMax ;
606 Int_t fitBins ;
607 if (parser.expectToken("(",kTRUE) ||
608 parser.readDouble(fitMin,kTRUE) ||
609 parser.expectToken("-",kTRUE) ||
610 parser.readDouble(fitMax,kTRUE) ||
611 parser.expectToken(":",kTRUE) ||
612 parser.readInteger(fitBins,kTRUE) ||
613 parser.expectToken(")",kTRUE)) break ;
614 //setBins(fitBins) ;
615 //setRange(fitMin,fitMax) ;
616 coutW(Eval) << "RooRealVar::readFromStream(" << GetName()
617 << ") WARNING: F(lo-hi:bins) token deprecated, use L(lo-hi) B(bins)" << endl ;
618 if (!haveConstant) setConstant(kFALSE) ;
619
620 } else if (!token.CompareTo("L")) {
621
622 // Next tokens are fit limits
623 Double_t fitMin = 0.0, fitMax = 0.0;
624// Int_t fitBins ;
625 if (parser.expectToken("(",kTRUE) ||
626 parser.readDouble(fitMin,kTRUE) ||
627 parser.expectToken("-",kTRUE) ||
628 parser.readDouble(fitMax,kTRUE) ||
629 parser.expectToken(")",kTRUE)) break ;
630 setRange(fitMin,fitMax) ;
631 if (!haveConstant) setConstant(kFALSE) ;
632
633 } else if (!token.CompareTo("B")) {
634
635 // Next tokens are fit limits
636 Int_t fitBins = 0;
637 if (parser.expectToken("(",kTRUE) ||
638 parser.readInteger(fitBins,kTRUE) ||
639 parser.expectToken(")",kTRUE)) break ;
640 setBins(fitBins) ;
641
642 } else {
643 // Token is value
644 if (parser.convertToDouble(token,value)) { parser.zapToEnd() ; break ; }
645 haveValue = kTRUE ;
646 // Defer value assignment to end
647 }
648 }
649 if (haveValue) setVal(value) ;
650 return kFALSE ;
651 }
652}
653
654
655////////////////////////////////////////////////////////////////////////////////
656/// Write object contents to given stream
657
658void RooRealVar::writeToStream(ostream& os, Bool_t compact) const
659{
660 if (compact) {
661 // Write value only
662 os << getVal() ;
663 } else {
664
665 // Write value with error (if not zero)
666 if (_printScientific) {
667 char fmtVal[16], fmtErr[16] ;
668 snprintf(fmtVal,16,"%%.%de",_printSigDigits) ;
669 snprintf(fmtErr,16,"%%.%de",(_printSigDigits+1)/2) ;
670 if (_value>=0) os << " " ;
671 os << Form(fmtVal,_value) ;
672
673 if (hasAsymError()) {
674 os << " +/- (" << Form(fmtErr,getAsymErrorLo())
675 << ", " << Form(fmtErr,getAsymErrorHi()) << ")" ;
676 } else if (hasError()) {
677 os << " +/- " << Form(fmtErr,getError()) ;
678 }
679
680 os << " " ;
681 } else {
682 TString* tmp = format(_printSigDigits,"EFA") ;
683 os << tmp->Data() << " " ;
684 delete tmp ;
685 }
686
687 // Append limits if not constants
688 if (isConstant()) {
689 os << "C " ;
690 }
691
692 // Append fit limits
693 os << "L(" ;
694 if(hasMin()) {
695 os << getMin();
696 }
697 else {
698 os << "-INF";
699 }
700 if(hasMax()) {
701 os << " - " << getMax() ;
702 }
703 else {
704 os << " - +INF";
705 }
706 os << ") " ;
707
708 if (getBins()!=100) {
709 os << "B(" << getBins() << ") " ;
710 }
711
712 // Add comment with unit, if unit exists
713 if (!_unit.IsNull())
714 os << "// [" << getUnit() << "]" ;
715 }
716}
717
718
719
720////////////////////////////////////////////////////////////////////////////////
721/// Print value of variable
722
723void RooRealVar::printValue(ostream& os) const
724{
725 os << getVal() ;
726
727 if(hasError() && !hasAsymError()) {
728 os << " +/- " << getError() ;
729 } else if (hasAsymError()) {
730 os << " +/- (" << getAsymErrorLo() << "," << getAsymErrorHi() << ")" ;
731 }
732
733}
734
735
736////////////////////////////////////////////////////////////////////////////////
737/// Print extras of variable: (asymmetric) error, constant flag, limits and binning
738
739void RooRealVar::printExtras(ostream& os) const
740{
741 // Append limits if not constants
742 if (isConstant()) {
743 os << "C " ;
744 }
745
746 // Append fit limits
747 os << " L(" ;
748 if(hasMin()) {
749 os << getMin();
750 }
751 else {
752 os << "-INF";
753 }
754 if(hasMax()) {
755 os << " - " << getMax() ;
756 }
757 else {
758 os << " - +INF";
759 }
760 os << ") " ;
761
762 if (getBins()!=100) {
763 os << "B(" << getBins() << ") " ;
764 }
765
766 // Add comment with unit, if unit exists
767 if (!_unit.IsNull())
768 os << "// [" << getUnit() << "]" ;
769
770// cout << " _value = " << &_value << " _error = " << &_error ;
771
772
773}
774
775
776////////////////////////////////////////////////////////////////////////////////
777/// Mapping of Print() option string to RooPrintable contents specifications
778
780{
781 if (opt && TString(opt)=="I") {
782 return kName|kClassName|kValue ;
783 }
785}
786
787
788////////////////////////////////////////////////////////////////////////////////
789/// Detailed printing interface
790
791void RooRealVar::printMultiline(ostream& os, Int_t contents, Bool_t verbose, TString indent) const
792{
794 os << indent << "--- RooRealVar ---" << endl;
795 TString unit(_unit);
796 if(!unit.IsNull()) unit.Prepend(' ');
797 os << indent << " Error = " << getError() << unit << endl;
798}
799
800
801
802////////////////////////////////////////////////////////////////////////////////
803/// Format contents of RooRealVar for pretty printing on RooPlot
804/// parameter boxes. This function processes the named arguments
805/// taken by paramOn() and translates them to an option string
806/// parsed by RooRealVar::format(Int_t sigDigits, const char *options)
807
808TString* RooRealVar::format(const RooCmdArg& formatArg) const
809{
810 RooCmdArg tmp(formatArg) ;
812
813 RooCmdConfig pc(Form("RooRealVar::format(%s)",GetName())) ;
814 pc.defineString("what","FormatArgs",0,"") ;
815 pc.defineInt("autop","FormatArgs::AutoPrecision",0,2) ;
816 pc.defineInt("fixedp","FormatArgs::FixedPrecision",0,2) ;
817 pc.defineInt("tlatex","FormatArgs::TLatexStyle",0,0) ;
818 pc.defineInt("latex","FormatArgs::LatexStyle",0,0) ;
819 pc.defineInt("latext","FormatArgs::LatexTableStyle",0,0) ;
820 pc.defineInt("verbn","FormatArgs::VerbatimName",0,0) ;
821 pc.defineMutex("FormatArgs::TLatexStyle","FormatArgs::LatexStyle","FormatArgs::LatexTableStyle") ;
822 pc.defineMutex("FormatArgs::AutoPrecision","FormatArgs::FixedPrecision") ;
823
824 // Process & check varargs
825 pc.process(tmp) ;
826 if (!pc.ok(kTRUE)) {
827 return 0 ;
828 }
829
830 // Extract values from named arguments
831 TString options ;
832 options = pc.getString("what") ;
833
834 if (pc.getInt("tlatex")) {
835 options += "L" ;
836 } else if (pc.getInt("latex")) {
837 options += "X" ;
838 } else if (pc.getInt("latext")) {
839 options += "Y" ;
840 }
841
842 if (pc.getInt("verbn")) options += "V" ;
843 Int_t sigDigits = 2 ;
844 if (pc.hasProcessed("FormatArgs::AutoPrecision")) {
845 options += "P" ;
846 sigDigits = pc.getInt("autop") ;
847 } else if (pc.hasProcessed("FormatArgs::FixedPrecision")) {
848 options += "F" ;
849 sigDigits = pc.getInt("fixedp") ;
850 }
851
852 return format(sigDigits,options) ;
853}
854
855
856
857
858////////////////////////////////////////////////////////////////////////////////
859/// Format numeric value of RooRealVar and its error in a variety of ways
860///
861/// To control what is shown use the following options
862/// N = show name
863/// H = hide value
864/// E = show error
865/// A = show asymmetric error instead of parabolic error (if available)
866/// U = show unit
867///
868/// To control how it is shown use these options
869/// L = TLatex mode
870/// X = Latex mode
871/// Y = Latex table mode ( '=' replaced by '&' )
872/// V = Make name \\verbatim in Latex mode
873/// P = use error to control shown precision
874/// F = force fixed precision
875///
876
877TString *RooRealVar::format(Int_t sigDigits, const char *options) const
878{
879 //cout << "format = " << options << endl ;
880
881 // parse the options string
882 TString opts(options);
883 opts.ToLower();
884 Bool_t showName= opts.Contains("n");
885 Bool_t hideValue= opts.Contains("h");
886 Bool_t showError= opts.Contains("e");
887 Bool_t showUnit= opts.Contains("u");
888 Bool_t tlatexMode= opts.Contains("l");
889 Bool_t latexMode= opts.Contains("x");
890 Bool_t latexTableMode = opts.Contains("y") ;
891 Bool_t latexVerbatimName = opts.Contains("v") ;
892
893 if (latexTableMode) latexMode = kTRUE ;
894 Bool_t asymError= opts.Contains("a") ;
895 Bool_t useErrorForPrecision= (((showError && hasError(kFALSE) && !isConstant()) || opts.Contains("p")) && !opts.Contains("f")) ;
896 // calculate the precision to use
897 if(sigDigits < 1) sigDigits= 1;
898 Int_t leadingDigitVal = 0;
899 if (useErrorForPrecision) {
900 leadingDigitVal = (Int_t)floor(log10(fabs(_error+1e-10)));
901 if (_value==0&&_error==0) leadingDigitVal=0 ;
902 } else {
903 leadingDigitVal = (Int_t)floor(log10(fabs(_value+1e-10)));
904 if (_value==0) leadingDigitVal=0 ;
905 }
906 Int_t leadingDigitErr= (Int_t)floor(log10(fabs(_error+1e-10)));
907 Int_t whereVal= leadingDigitVal - sigDigits + 1;
908 Int_t whereErr= leadingDigitErr - sigDigits + 1;
909 char fmtVal[16], fmtErr[16];
910
911 if (_value<0) whereVal -= 1 ;
912 snprintf(fmtVal,16,"%%.%df", whereVal < 0 ? -whereVal : 0);
913 snprintf(fmtErr,16,"%%.%df", whereErr < 0 ? -whereErr : 0);
914 TString *text= new TString();
915 if(latexMode) text->Append("$");
916 // begin the string with "<name> = " if requested
917 if(showName) {
918 if (latexTableMode && latexVerbatimName) {
919 text->Append("\\verb+") ;
920 }
921 text->Append(getPlotLabel());
922 if (latexVerbatimName) text->Append("+") ;
923
924 if (!latexTableMode) {
925 text->Append(" = ");
926 } else {
927 text->Append(" $ & $ ");
928 }
929 }
930
931 // Add leading space if value is positive
932 if (_value>=0) text->Append(" ") ;
933
934 // append our value if requested
935 char buffer[256];
936 if(!hideValue) {
937 chopAt(_value, whereVal);
938 snprintf(buffer, 256,fmtVal, _value);
939 text->Append(buffer);
940 }
941
942 // append our error if requested and this variable is not constant
943 if(hasError(kFALSE) && showError && !(asymError && hasAsymError(kFALSE))) {
944 if(tlatexMode) {
945 text->Append(" #pm ");
946 }
947 else if(latexMode) {
948 text->Append("\\pm ");
949 }
950 else {
951 text->Append(" +/- ");
952 }
953 snprintf(buffer, 256,fmtErr, getError());
954 text->Append(buffer);
955 }
956
957 if (asymError && hasAsymError() && showError) {
958 if(tlatexMode) {
959 text->Append(" #pm ");
960 text->Append("_{") ;
961 snprintf(buffer, 256,fmtErr, getAsymErrorLo());
962 text->Append(buffer);
963 text->Append("}^{+") ;
964 snprintf(buffer, 256,fmtErr, getAsymErrorHi());
965 text->Append(buffer);
966 text->Append("}") ;
967 }
968 else if(latexMode) {
969 text->Append("\\pm ");
970 text->Append("_{") ;
971 snprintf(buffer, 256,fmtErr, getAsymErrorLo());
972 text->Append(buffer);
973 text->Append("}^{+") ;
974 snprintf(buffer, 256,fmtErr, getAsymErrorHi());
975 text->Append(buffer);
976 text->Append("}") ;
977 }
978 else {
979 text->Append(" +/- ");
980 text->Append(" (") ;
981 snprintf(buffer, 256, fmtErr, getAsymErrorLo());
982 text->Append(buffer);
983 text->Append(", ") ;
984 snprintf(buffer, 256, fmtErr, getAsymErrorHi());
985 text->Append(buffer);
986 text->Append(")") ;
987 }
988
989 }
990
991 // append our units if requested
992 if(!_unit.IsNull() && showUnit) {
993 text->Append(' ');
994 text->Append(_unit);
995 }
996 if(latexMode) text->Append("$");
997 return text;
998}
999
1000
1001
1002////////////////////////////////////////////////////////////////////////////////
1003/// Utility to calculate number of decimals to show
1004/// based on magnitude of error
1005
1007{
1008 Double_t scale= pow(10.0,where);
1009 Int_t trunc= (Int_t)floor(what/scale + 0.5);
1010 return (Double_t)trunc*scale;
1011}
1012
1013
1014
1015////////////////////////////////////////////////////////////////////////////////
1016/// Overload RooAbsReal::attachToTree to also attach
1017/// branches for errors and/or asymmetric errors
1018/// attribute StoreError and/or StoreAsymError are set
1019
1021{
1022 // Follow usual procedure for value
1023
1024 if (getAttribute("StoreError") || getAttribute("StoreAsymError") || vstore.isFullReal(this) ) {
1025
1027 rfv->setBuffer(this,&_value) ;
1028
1029 // Attach/create additional branch for error
1030 if (getAttribute("StoreError") || vstore.hasError(this) ) {
1031 rfv->setErrorBuffer(&_error) ;
1032 }
1033
1034 // Attach/create additional branches for asymmetric error
1035 if (getAttribute("StoreAsymError") || vstore.hasAsymError(this)) {
1037 }
1038
1039 } else {
1040
1042
1043 }
1044}
1045
1046
1047
1048////////////////////////////////////////////////////////////////////////////////
1049/// Overload RooAbsReal::attachToTree to also attach
1050/// branches for errors and/or asymmetric errors
1051/// attribute StoreError and/or StoreAsymError are set
1052
1054{
1055 // Follow usual procedure for value
1056 RooAbsReal::attachToTree(t,bufSize) ;
1057// cout << "RooRealVar::attachToTree(" << this << ") name = " << GetName()
1058// << " StoreError = " << (getAttribute("StoreError")?"T":"F") << endl ;
1059
1060 // Attach/create additional branch for error
1061 if (getAttribute("StoreError")) {
1062 TString errName(GetName()) ;
1063 errName.Append("_err") ;
1064 TBranch* branch = t.GetBranch(errName) ;
1065 if (branch) {
1066 t.SetBranchAddress(errName,&_error) ;
1067 } else {
1068 TString format2(errName);
1069 format2.Append("/D");
1070 t.Branch(errName, &_error, (const Text_t*)format2, bufSize);
1071 }
1072 }
1073
1074 // Attach/create additional branches for asymmetric error
1075 if (getAttribute("StoreAsymError")) {
1076 TString loName(GetName()) ;
1077 loName.Append("_aerr_lo") ;
1078 TBranch* lobranch = t.GetBranch(loName) ;
1079 if (lobranch) {
1080 t.SetBranchAddress(loName,&_asymErrLo) ;
1081 } else {
1082 TString format2(loName);
1083 format2.Append("/D");
1084 t.Branch(loName, &_asymErrLo, (const Text_t*)format2, bufSize);
1085 }
1086
1087 TString hiName(GetName()) ;
1088 hiName.Append("_aerr_hi") ;
1089 TBranch* hibranch = t.GetBranch(hiName) ;
1090 if (hibranch) {
1091 t.SetBranchAddress(hiName,&_asymErrHi) ;
1092 } else {
1093 TString format2(hiName);
1094 format2.Append("/D");
1095 t.Branch(hiName, &_asymErrHi, (const Text_t*)format2, bufSize);
1096 }
1097 }
1098}
1099
1100
1101////////////////////////////////////////////////////////////////////////////////
1102/// Overload RooAbsReal::fillTreeBranch to also
1103/// fill tree branches with (asymmetric) errors
1104/// if requested.
1105
1107{
1108 // First determine if branch is taken
1109 TString cleanName(cleanBranchName()) ;
1110 TBranch* valBranch = t.GetBranch(cleanName) ;
1111 if (!valBranch) {
1112 coutE(Eval) << "RooAbsReal::fillTreeBranch(" << GetName() << ") ERROR: not attached to tree" << endl ;
1113 assert(0) ;
1114 }
1115 valBranch->Fill() ;
1116
1117 if (getAttribute("StoreError")) {
1118 TString errName(GetName()) ;
1119 errName.Append("_err") ;
1120 TBranch* errBranch = t.GetBranch(errName) ;
1121 if (errBranch) errBranch->Fill() ;
1122 }
1123
1124 if (getAttribute("StoreAsymError")) {
1125 TString loName(GetName()) ;
1126 loName.Append("_aerr_lo") ;
1127 TBranch* loBranch = t.GetBranch(loName) ;
1128 if (loBranch) loBranch->Fill() ;
1129
1130 TString hiName(GetName()) ;
1131 hiName.Append("_aerr_hi") ;
1132 TBranch* hiBranch = t.GetBranch(hiName) ;
1133 if (hiBranch) hiBranch->Fill() ;
1134 }
1135}
1136
1137
1138
1139////////////////////////////////////////////////////////////////////////////////
1140/// Copy the cached value of another RooAbsArg to our cache
1141/// Warning: This function copies the cached values of source,
1142/// it is the callers responsibility to make sure the cache is clean
1143
1144void RooRealVar::copyCache(const RooAbsArg* source, Bool_t valueOnly, Bool_t setValDirty)
1145{
1146 // Follow usual procedure for valueklog
1147 RooAbsReal::copyCache(source,valueOnly,setValDirty) ;
1148
1149 if (valueOnly) return ;
1150
1151 // Copy error too, if source has one
1152 RooRealVar* other = dynamic_cast<RooRealVar*>(const_cast<RooAbsArg*>(source)) ;
1153 if (other) {
1154 // Copy additional error value
1155 _error = other->_error ;
1156 _asymErrLo = other->_asymErrLo ;
1157 _asymErrHi = other->_asymErrHi ;
1158 }
1159}
1160
1161
1162
1163////////////////////////////////////////////////////////////////////////////////
1164/// Stream an object of class RooRealVar.
1165
1166void RooRealVar::Streamer(TBuffer &R__b)
1167{
1168 UInt_t R__s, R__c;
1169 if (R__b.IsReading()) {
1170
1171 Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
1172 RooAbsRealLValue::Streamer(R__b);
1173 if (R__v==1) {
1174 coutI(Eval) << "RooRealVar::Streamer(" << GetName() << ") converting version 1 data format" << endl ;
1175 Double_t fitMin, fitMax ;
1176 Int_t fitBins ;
1177 R__b >> fitMin;
1178 R__b >> fitMax;
1179 R__b >> fitBins;
1180 _binning = new RooUniformBinning(fitMin,fitMax,fitBins) ;
1181 }
1182 R__b >> _error;
1183 R__b >> _asymErrLo;
1184 R__b >> _asymErrHi;
1185 if (R__v>=2) {
1186 R__b >> _binning;
1187 }
1188 if (R__v==3) {
1189 R__b >> _sharedProp ;
1191 }
1192 if (R__v>=4) {
1194 tmpSharedProp->Streamer(R__b) ;
1195 if (!(_nullProp==*tmpSharedProp)) {
1197 } else {
1198 delete tmpSharedProp ;
1199 _sharedProp = 0 ;
1200 }
1201 }
1202
1203 R__b.CheckByteCount(R__s, R__c, RooRealVar::IsA());
1204
1205 } else {
1206
1207 R__c = R__b.WriteVersion(RooRealVar::IsA(), kTRUE);
1208 RooAbsRealLValue::Streamer(R__b);
1209 R__b << _error;
1210 R__b << _asymErrLo;
1211 R__b << _asymErrHi;
1212 R__b << _binning;
1213 if (_sharedProp) {
1214 _sharedProp->Streamer(R__b) ;
1215 } else {
1216 _nullProp.Streamer(R__b) ;
1217 }
1218 R__b.SetByteCount(R__c, kTRUE);
1219
1220 }
1221}
1222
1223
1224
1225////////////////////////////////////////////////////////////////////////////////
1226/// No longer used?
1227
1229{
1230 if (_sharedProp) {
1232 _sharedProp = 0 ;
1233 }
1234}
1235
1236
1237////////////////////////////////////////////////////////////////////////////////
1238/// If true, contents of RooRealVars will be printed in scientific notation
1239
1241{
1242 _printScientific = flag ;
1243}
1244
1245
1246////////////////////////////////////////////////////////////////////////////////
1247/// Set number of digits to show when printing RooRealVars
1248
1250{
1251 _printSigDigits = ndig>1?ndig:1 ;
1252}
#define e(i)
Definition: RSha256.hxx:103
#define coutI(a)
Definition: RooMsgService.h:31
#define coutW(a)
Definition: RooMsgService.h:33
#define coutE(a)
Definition: RooMsgService.h:34
#define TRACE_DESTROY
Definition: RooTrace.h:23
#define TRACE_CREATE
Definition: RooTrace.h:22
int Int_t
Definition: RtypesCore.h:41
char Text_t
Definition: RtypesCore.h:58
short Version_t
Definition: RtypesCore.h:61
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:365
static void indent(ostringstream &buf, int indent_level)
char name[80]
Definition: TGX11.cxx:109
double pow(double, double)
double log10(double)
double floor(double)
char * Form(const char *fmt,...)
#define snprintf
Definition: civetweb.c:1540
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:70
Bool_t _fast
Definition: RooAbsArg.h:620
TString cleanBranchName() const
Construct a mangled name from the actual name that is free of any math symbols that might be interpre...
Definition: RooAbsArg.cxx:1831
void setShapeDirty() const
Definition: RooAbsArg.h:487
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
Definition: RooAbsArg.cxx:279
Bool_t isConstant() const
Definition: RooAbsArg.h:311
void setValueDirty() const
Definition: RooAbsArg.h:486
RooAbsBinning is the abstract base class for RooRealVar binning definitions This class defines the in...
Definition: RooAbsBinning.h:26
virtual void removeHook(RooAbsRealLValue &) const
Definition: RooAbsBinning.h:98
virtual RooAbsBinning * clone(const char *name=0) const =0
virtual Bool_t isShareable() const
Definition: RooAbsBinning.h:91
virtual void insertHook(RooAbsRealLValue &) const
Definition: RooAbsBinning.h:95
virtual void setMin(Double_t xlo)
Definition: RooAbsBinning.h:51
virtual void setMax(Double_t xhi)
Definition: RooAbsBinning.h:55
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
Bool_t hasMax(const char *name=0) const
Check if variable has an upper bound.
virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const
Check if given value is valid.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
virtual Bool_t inRange(const char *name) const
Check if current value is inside range with given name.
virtual Int_t getBins(const char *name=0) const
Get number of bins of currently defined range.
RooAbsRealLValue & operator=(const RooAbsRealLValue &)=default
void setConstant(Bool_t value=kTRUE)
Bool_t hasMin(const char *name=0) const
Check if variable has a lower bound.
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)
Copy the cached value of another RooAbsArg to our cache.
virtual void attachToVStore(RooVectorDataStore &vstore)
TString _unit
Definition: RooAbsReal.h:409
Double_t _value
Definition: RooAbsReal.h:408
virtual void attachToTree(TTree &t, Int_t bufSize=32000)
Attach object to a branch of given TTree.
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition: RooAbsReal.h:81
const char * getPlotLabel() const
Get the label associated with the variable.
Definition: RooAbsReal.cxx:398
const Text_t * getUnit() const
Definition: RooAbsReal.h:101
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:27
void setProcessRecArgs(Bool_t flag, Bool_t prefix=kTRUE)
Definition: RooCmdArg.h:40
Class RooCmdConfig is a configurable parser for RooCmdArg named arguments.
Definition: RooCmdConfig.h:27
RooErrorVar is an auxilary class that represents the error of a RooRealVar as a seperate object.
Definition: RooErrorVar.h:28
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:36
TObject * FindObject(const char *name) const
Return pointer to obejct with given name.
RooFIter fwdIterator() const
Create a one-time-use forward iterator for this list.
TIterator * MakeIterator(Bool_t forward=kTRUE) const
Create a TIterator for this list.
void Delete(Option_t *o=0)
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
virtual void Add(TObject *arg)
Definition: RooLinkedList.h:63
void Clear(Option_t *o=0)
Remove all elements from collection.
virtual Bool_t Remove(TObject *arg)
Remove object from collection.
static Int_t isInfinite(Double_t x)
Return true if x is infinite by RooNumBer internal specification.
Definition: RooNumber.cxx:58
Class RooParamBinning is an implementation of RooAbsBinning that constructs a binning with a range de...
RooRangeBinning is binning/range definition that only defines a range but no binning.
Class RooRealVarSharedProperties is an implementation of RooSharedProperties that stores the properti...
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:36
Double_t getAsymErrorLo() const
Definition: RooRealVar.h:58
static RooSharedPropertiesList _sharedPropList
Definition: RooRealVar.h:158
RooRealVarSharedProperties * sharedProp() const
Definition: RooRealVar.h:149
static void printSigDigits(Int_t ndig=5)
Set number of digits to show when printing RooRealVars.
Double_t _error
Definition: RooRealVar.h:143
Bool_t hasBinning(const char *name) const
Returns true if variable has a binning with 'name'.
Definition: RooRealVar.cxx:282
Bool_t hasAsymError(Bool_t allowZero=kTRUE) const
Definition: RooRealVar.h:60
virtual void printValue(std::ostream &os) const
Print value of variable.
Definition: RooRealVar.cxx:723
static void printScientific(Bool_t flag=kFALSE)
If true, contents of RooRealVars will be printed in scientific notation.
Double_t _asymErrHi
Definition: RooRealVar.h:145
virtual Int_t defaultPrintContents(Option_t *opt) const
Mapping of Print() option string to RooPrintable contents specifications.
Definition: RooRealVar.cxx:779
void setMin(const char *name, Double_t value)
Set minimum of name range to given value.
Definition: RooRealVar.cxx:416
RooAbsBinning * _binning
Definition: RooRealVar.h:146
void setBins(Int_t nBins, const char *name=0)
Definition: RooRealVar.h:78
virtual void writeToStream(std::ostream &os, Bool_t compact) const
Write object contents to given stream.
Definition: RooRealVar.cxx:658
void removeAsymError()
Definition: RooRealVar.h:61
RooLinkedList _altNonSharedBinning
Definition: RooRealVar.h:147
void setError(Double_t value)
Definition: RooRealVar.h:56
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Detailed printing interface.
Definition: RooRealVar.cxx:791
virtual void printExtras(std::ostream &os) const
Print extras of variable: (asymmetric) error, constant flag, limits and binning.
Definition: RooRealVar.cxx:739
Double_t chopAt(Double_t what, Int_t where) const
Utility to calculate number of decimals to show based on magnitude of error.
static Int_t _printSigDigits
Definition: RooRealVar.h:127
void setRange(const char *name, Double_t min, Double_t max)
Set range named 'name to [min,max].
Definition: RooRealVar.cxx:477
std::list< std::string > getBinningNames() const
Get a list of all binning names.
Definition: RooRealVar.cxx:348
virtual void attachToVStore(RooVectorDataStore &vstore)
Overload RooAbsReal::attachToTree to also attach branches for errors and/or asymmetric errors attribu...
void removeRange(const char *name=0)
Definition: RooRealVar.h:90
Double_t getAsymErrorHi() const
Definition: RooRealVar.h:59
void setMax(const char *name, Double_t value)
Set maximum of name range to given value.
Definition: RooRealVar.cxx:446
static RooRealVarSharedProperties _nullProp
Definition: RooRealVar.h:159
virtual Double_t getValV(const RooArgSet *nset=0) const
Return value of variable.
Definition: RooRealVar.cxx:222
void setAsymError(Double_t lo, Double_t hi)
Definition: RooRealVar.h:62
RooRealVarSharedProperties * _sharedProp
Definition: RooRealVar.h:160
void deleteSharedProperties()
No longer used?
virtual void fillTreeBranch(TTree &t)
Overload RooAbsReal::fillTreeBranch to also fill tree branches with (asymmetric) errors if requested.
Bool_t hasError(Bool_t allowZero=kTRUE) const
Definition: RooRealVar.h:55
virtual ~RooRealVar()
Destructor.
Definition: RooRealVar.cxx:206
Double_t _asymErrLo
Definition: RooRealVar.h:144
RooErrorVar * errorVar() const
Return a RooAbsRealLValue representing the error associated with this variable.
Definition: RooRealVar.cxx:268
Double_t getError() const
Definition: RooRealVar.h:54
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)
Copy the cached value of another RooAbsArg to our cache Warning: This function copies the cached valu...
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Read object contents from given stream.
Definition: RooRealVar.cxx:519
static Bool_t _printScientific
Definition: RooRealVar.h:126
TString * format(const RooCmdArg &formatArg) const
Format contents of RooRealVar for pretty printing on RooPlot parameter boxes.
Definition: RooRealVar.cxx:808
const RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const
Return binning definition with name.
Definition: RooRealVar.cxx:295
RooRealVar()
Default constructor.
Definition: RooRealVar.cxx:60
virtual void attachToTree(TTree &t, Int_t bufSize=32000)
Overload RooAbsReal::attachToTree to also attach branches for errors and/or asymmetric errors attribu...
void removeError()
Definition: RooRealVar.h:57
void setBinning(const RooAbsBinning &binning, const char *name=0)
Add given binning under name 'name' with this variable.
Definition: RooRealVar.cxx:374
virtual void setVal(Double_t value)
Set value of variable to 'value'.
Definition: RooRealVar.cxx:233
RooRealVar & operator=(const RooRealVar &other)
Assign the values of another RooRealVar to this instance.
Definition: RooRealVar.cxx:173
Class RooSharedPropertiesList maintains the properties of RooRealVars and RooCategories that are clon...
void unregisterProperties(RooSharedProperties *)
Decrease reference count of property.
RooSharedProperties * registerProperties(RooSharedProperties *, Bool_t canDeleteIncoming=kTRUE)
Register property into list and take ownership.
Bool_t atEOL()
If true, parser is at end of line in stream.
Bool_t readInteger(Int_t &value, Bool_t zapOnError=kFALSE)
Read a token and convert it to an Int_t.
Bool_t readDouble(Double_t &value, Bool_t zapOnError=kFALSE)
Read the next token and convert it to a Double_t.
Bool_t convertToDouble(const TString &token, Double_t &value)
Convert given string to a double. Return true if the conversion fails.
void zapToEnd(Bool_t inclContLines=kFALSE)
Eat all characters up to and including then end of the current line.
Bool_t expectToken(const TString &expected, Bool_t zapOnError=kFALSE)
Read the next token and return kTRUE if it is identical to the given 'expected' token.
TString readToken()
Read one token separated by any of the know punctuation characters This function recognizes and handl...
RooUniformBinning is an implementation of RooAbsBinning that provides a uniform binning in 'n' bins b...
void setAsymErrorBuffer(Double_t *newBufL, Double_t *newBufH)
void setBuffer(RooAbsReal *real, Double_t *newBuf)
RooVectorDataStore is the abstract base class for data collection that use a TTree as internal storag...
Bool_t hasAsymError(RooAbsReal *real)
Bool_t isFullReal(RooAbsReal *real)
RealFullVector * addRealFull(RooAbsReal *real)
Bool_t hasError(RooAbsReal *real)
A TTree is a list of TBranches.
Definition: TBranch.h:65
Int_t Fill()
Definition: TBranch.h:174
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Bool_t IsReading() const
Definition: TBuffer.h:85
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
Iterator abstract base class.
Definition: TIterator.h:30
virtual TObject * Next()=0
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition: TObject.cxx:321
Basic string class.
Definition: TString.h:131
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition: TString.cxx:418
const char * Data() const
Definition: TString.h:364
TString & Prepend(const char *cs)
Definition: TString.h:656
Bool_t IsNull() const
Definition: TString.h:402
TString & Append(const char *cs)
Definition: TString.h:559
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
A TTree represents a columnar dataset.
Definition: TTree.h:71
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
Definition: TTree.cxx:5075
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
Definition: TTree.cxx:8049
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
Definition: TTree.cxx:1741
TText * text
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
@ InputArguments
Definition: RooGlobalFunc.h:58
static constexpr double pc