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