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