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