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