Logo ROOT  
Reference Guide
RooArgSet.cxx
Go to the documentation of this file.
1/***************************************************************************** * Project: RooFit *
2 * Package: RooFitCore *
3 * @(#)root/roofitcore:$Id$
4 * Authors: *
5 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
6 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
7 * *
8 * Copyright (c) 2000-2005, Regents of the University of California *
9 * and Stanford University. All rights reserved. *
10 * *
11 * Redistribution and use in source and binary forms, *
12 * with or without modification, are permitted according to the terms *
13 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
14 *****************************************************************************/
15
16//////////////////////////////////////////////////////////////////////////////
17/// \class RooArgSet
18/// RooArgSet is a container object that can hold multiple RooAbsArg objects.
19/// The container has set semantics which means that:
20///
21/// - Every object it contains must have a unique name returned by GetName().
22///
23/// - Contained objects are not ordered, although the set can be traversed
24/// using an iterator returned by createIterator(). The iterator does not
25/// necessarily follow the object insertion order.
26///
27/// - Objects can be retrieved by name only, and not by index.
28///
29///
30/// Ownership of contents
31/// -------------------------
32/// Unowned objects are inserted with the add() method. Owned objects
33/// are added with addOwned() or addClone(). A RooArgSet either owns all
34/// of it contents, or none, which is determined by the first `add`
35/// call. Once an ownership status is selected, inappropriate `add` calls
36/// will return error status. Clearing the list via removeAll() resets the
37/// ownership status. Arguments supplied in the constructor are always added
38/// as unowned elements.
39///
40///
41/// Uniquely identifying RooArgSet objects
42/// ---------------------------------------
43///
44/// \warning Before v6.28, it was ensured that no RooArgSet objects on the heap
45/// were located at an address that had already been used for a RooArgSet before.
46/// With v6.28, this is not guaranteed anymore. Hence, if your code uses pointer
47/// comparisons to uniquely identify RooArgSet instances, please consider using
48/// the new `RooArgSet::uniqueId()`.
49
50#include "RooArgSet.h"
51
52#include "TClass.h"
53#include "RooStreamParser.h"
54#include "RooFormula.h"
55#include "RooAbsRealLValue.h"
57#include "RooStringVar.h"
58#include "RooTrace.h"
59#include "RooArgList.h"
60#include "RooSentinel.h"
61#include "RooMsgService.h"
62#include "RooConstVar.h"
63#include "strlcpy.h"
64
65#include <iostream>
66#include <fstream>
67#include <iomanip>
68#include <stdexcept>
69
70using namespace std ;
71
72#if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
73char* operator+( streampos&, char* );
74#endif
75
77
78
79
80#ifndef USEMEMPOOLFORARGSET
82#else
83
84#include "MemPoolForRooSets.h"
85
86RooArgSet::MemPool* RooArgSet::memPool() {
88 static auto * memPool = new RooArgSet::MemPool();
89 return memPool;
90}
91
92////////////////////////////////////////////////////////////////////////////////
93/// Clear memory pool on exit to avoid reported memory leaks
94
96{
97 auto pool = memPool();
98 memPool()->teardown();
99
100 //Here, the pool might have to leak if RooArgSets are still alive.
101 if (pool->empty())
102 delete pool;
103}
104
105
106////////////////////////////////////////////////////////////////////////////////
107/// Overloaded new operator guarantees that all RooArgSets allocated with new
108/// have a unique address, a property that is exploited in several places
109/// in roofit to quickly index contents on normalization set pointers.
110/// The memory pool only allocates space for the class itself. The elements
111/// stored in the set are stored outside the pool.
112
113void* RooArgSet::operator new (size_t bytes)
114{
115 // To make sure that derived classes don't use this operator
116 if (bytes != sizeof(RooArgSet)) {
117 return ::operator new(bytes);
118 }
119
120 return memPool()->allocate(bytes);
121}
122
123
124////////////////////////////////////////////////////////////////////////////////
125/// Overloaded new operator with placement does not guarante that all
126/// RooArgSets allocated with new have a unique address, but uses the global
127/// operator.
128
129void* RooArgSet::operator new (size_t bytes, void* ptr) noexcept
130{
131 return ::operator new (bytes, ptr);
132}
133
134
135////////////////////////////////////////////////////////////////////////////////
136/// Memory is owned by pool, we need to do nothing to release it
137
138void RooArgSet::operator delete (void* ptr)
139{
140 // Decrease use count in pool that ptr is on
141 if (memPool()->deallocate(ptr))
142 return;
143
144 // Not part of any pool; use global op delete:
145 ::operator delete(ptr);
146}
147
148#endif
149
150
151////////////////////////////////////////////////////////////////////////////////
152/// Default constructor
153
156{
158}
159
160
161////////////////////////////////////////////////////////////////////////////////
162/// Constructor from a RooArgList. If the list contains multiple
163/// objects with the same name, only the first is store in the set.
164/// Warning messages will be printed for dropped items.
166 RooAbsCollection(coll.GetName())
167{
168 add(coll,true) ; // verbose to catch duplicate errors
170}
171
172
173////////////////////////////////////////////////////////////////////////////////
174/// Constructor from a RooArgSet / RooArgList and a pointer to another RooFit object.
175///
176/// \param[in] collection Collection of RooFit objects to be added. If a list contains multiple
177/// objects with the same name, only the first is stored in the set.
178/// Warning messages will be printed for dropped items.
179/// \param[in] var1 Further object to be added. If it is already in `collection`,
180/// nothing happens, and the warning message is suppressed.
181RooArgSet::RooArgSet(const RooAbsCollection& collection, const RooAbsArg* var1) :
182 RooAbsCollection(collection.GetName())
183{
184 if (var1 && !collection.contains(*var1)) {
185 add(*var1,true) ;
186 }
187 add(collection,true) ; // verbose to catch duplicate errors
189}
190
191
192////////////////////////////////////////////////////////////////////////////////
193/// Empty set constructor.
196{
198}
199
200
201////////////////////////////////////////////////////////////////////////////////
202/// Construct a set from two existing sets. The new set will not own its
203/// contents.
204RooArgSet::RooArgSet(const RooArgSet& set1, const RooArgSet& set2, const char *name) : RooAbsCollection(name)
205{
206 add(set1) ;
207 add(set2) ;
209}
210
211
212////////////////////////////////////////////////////////////////////////////////
213/// Constructor from a root TCollection. Elements in the collection that
214/// do not inherit from RooAbsArg will be skipped. A warning message
215/// will be printed for every skipped item.
216
217RooArgSet::RooArgSet(const TCollection& tcoll, const char* name) :
219{
220 TIterator* iter = tcoll.MakeIterator() ;
221 TObject* obj ;
222 while((obj=iter->Next())) {
223 if (!dynamic_cast<RooAbsArg*>(obj)) {
224 coutW(InputArguments) << "RooArgSet::RooArgSet(TCollection) element " << obj->GetName()
225 << " is not a RooAbsArg, ignored" << endl ;
226 continue ;
227 }
228 add(*(RooAbsArg*)obj) ;
229 }
230 delete iter ;
232}
233
234
235////////////////////////////////////////////////////////////////////////////////
236/// Copy constructor. Note that a copy of a set is always non-owning,
237/// even if the source set owns its contents. To create an owning copy of
238/// a set (owning or not), use the snapshot() method.
239RooArgSet::RooArgSet(const RooArgSet& other, const char *name)
240 : RooAbsCollection(other,name)
241{
243}
244
245
246////////////////////////////////////////////////////////////////////////////////
247/// Destructor
248
250{
252}
253
254
255////////////////////////////////////////////////////////////////////////////////
256
257////////////////////////////////////////////////////////////////////////////////
258/// Get reference to an element using its name. Named element must exist in set.
259/// \throws invalid_argument if an element with the given name is not in the set.
260///
261/// Note that since most RooFit objects use an assignment operator that copies
262/// values, an expression like
263/// ```
264/// mySet["x"] = y;
265/// ```
266/// will not replace the element "x", it just assigns the values of y.
268{
269 RooAbsArg* arg = find(name) ;
270 if (!arg) {
271 coutE(InputArguments) << "RooArgSet::operator[](" << GetName() << ") ERROR: no element named " << name << " in set" << endl ;
272 throw std::invalid_argument((TString("No element named '") + name + "' in set " + GetName()).Data());
273 }
274 return *arg ;
275}
276
277
278
279////////////////////////////////////////////////////////////////////////////////
280/// Check if element with var's name is already in set
281
282bool RooArgSet::checkForDup(const RooAbsArg& var, bool silent) const
283{
284 RooAbsArg *other = find(var);
285 if (other) {
286 if (other != &var) {
287 if (!silent) {
288 // print a warning if this variable is not the same one we
289 // already have
290 coutE(InputArguments) << "RooArgSet::checkForDup: ERROR argument with name " << var.GetName() << " is already in this set" << endl;
291 }
292 }
293 // don't add duplicates
294 return true;
295 }
296 return false ;
297}
298
299
300
301
302
303
304
305////////////////////////////////////////////////////////////////////////////////
306/// Write contents of the argset to specified file.
307/// See writeToStream() for details
308
309void RooArgSet::writeToFile(const char* fileName) const
310{
311 ofstream ofs(fileName) ;
312 if (ofs.fail()) {
313 coutE(InputArguments) << "RooArgSet::writeToFile(" << GetName() << ") error opening file " << fileName << endl ;
314 return ;
315 }
316 writeToStream(ofs,false) ;
317}
318
319
320
321////////////////////////////////////////////////////////////////////////////////
322/// Read contents of the argset from specified file.
323/// See readFromStream() for details
324
325bool RooArgSet::readFromFile(const char* fileName, const char* flagReadAtt, const char* section, bool verbose)
326{
327 ifstream ifs(fileName) ;
328 if (ifs.fail()) {
329 coutE(InputArguments) << "RooArgSet::readFromFile(" << GetName() << ") error opening file " << fileName << endl ;
330 return true ;
331 }
332 return readFromStream(ifs,false,flagReadAtt,section,verbose) ;
333}
334
335
336
337
338////////////////////////////////////////////////////////////////////////////////
339/// Write the contents of the argset in ASCII form to given stream.
340///
341/// A line is written for each element contained in the form
342/// `<argName> = <argValue>`
343///
344/// The `<argValue>` part of each element is written by the arguments'
345/// writeToStream() function.
346/// \param os The stream to write to.
347/// \param compact Write only the bare values, separated by ' '.
348/// \note In compact mode, the stream cannot be read back into a RooArgSet,
349/// but only into a RooArgList, because the variable names are lost.
350/// \param section If non-null, add a section header like `[<section>]`.
351void RooArgSet::writeToStream(ostream& os, bool compact, const char* section) const
352{
353 if (section && section[0] != '\0')
354 os << '[' << section << ']' << '\n';
355
356 if (compact) {
357 for (const auto next : _list) {
358 next->writeToStream(os, true);
359 os << " ";
360 }
361 os << endl;
362 } else {
363 for (const auto next : _list) {
364 os << next->GetName() << " = " ;
365 next->writeToStream(os,false) ;
366 os << endl ;
367 }
368 }
369}
370
371
372
373
374////////////////////////////////////////////////////////////////////////////////
375/// Read the contents of the argset in ASCII form from given stream.
376///
377/// The stream is read to end-of-file and each line is assumed to be
378/// of the form
379/// \code
380/// <argName> = <argValue>
381/// \endcode
382/// Lines starting with argNames not matching any element in the list
383/// will be ignored with a warning message. In addition limited C++ style
384/// preprocessing and flow control is provided. The following constructions
385/// are recognized:
386/// \code
387/// include "include.file"
388/// \endcode
389/// Include given file, recursive inclusion OK
390/// \code
391/// if (<boolean_expression>)
392/// <name> = <value>
393/// ....
394/// else if (<boolean_expression>)
395/// ....
396/// else
397/// ....
398/// endif
399/// \endcode
400///
401/// All expressions are evaluated by RooFormula, and may involve any of
402/// the sets variables.
403/// \code
404/// echo <Message>
405/// \endcode
406/// Print console message while reading from stream
407/// \code
408/// abort
409/// \endcode
410/// Force termination of read sequence with error status
411///
412/// The value of each argument is read by the arguments readFromStream
413/// function.
414
415bool RooArgSet::readFromStream(istream& is, bool compact, const char* flagReadAtt, const char* section, bool verbose)
416{
417 if (compact) {
418 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName() << ") compact mode not supported" << endl ;
419 return true ;
420 }
421
422 RooStreamParser parser(is) ;
423 parser.setPunctuation("=") ;
424 TString token ;
425 bool retVal(false) ;
426
427 // Conditional stack and related state variables
428 // coverity[UNINIT]
429 bool anyCondTrue[100] ;
430 bool condStack[100] ;
431 bool lastLineWasElse=false ;
432 Int_t condStackLevel=0 ;
433 condStack[0]=true ;
434
435 // Prepare section processing
436 TString sectionHdr("[") ;
437 if (section) sectionHdr.Append(section) ;
438 sectionHdr.Append("]") ;
439 bool inSection(section?false:true) ;
440
441 bool reprocessToken = false ;
442 while (1) {
443
444 if (is.eof() || is.fail() || parser.atEOF()) {
445 break ;
446 }
447
448 // Read next token until memEnd of file
449 if (!reprocessToken) {
450 token = parser.readToken() ;
451 }
452 reprocessToken = false ;
453
454 // Skip empty lines
455 if (token.IsNull()) {
456 continue ;
457 }
458
459 // Process include directives
460 if (!token.CompareTo("include")) {
461 if (parser.atEOL()) {
462 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName()
463 << "): no filename found after include statement" << endl ;
464 return true ;
465 }
466 TString filename = parser.readLine() ;
467 ifstream incfs(filename) ;
468 if (!incfs.good()) {
469 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName() << "): cannot open include file " << filename << endl ;
470 return true ;
471 }
472 coutI(InputArguments) << "RooArgSet::readFromStream(" << GetName() << "): processing include file "
473 << filename << endl ;
474 if (readFromStream(incfs,compact,flagReadAtt,inSection?0:section,verbose)) return true ;
475 continue ;
476 }
477
478 // Process section headers if requested
479 if (*token.Data()=='[') {
480 TString hdr(token) ;
481 const char* last = token.Data() + token.Length() -1 ;
482 if (*last != ']') {
483 hdr.Append(" ") ;
484 hdr.Append(parser.readLine()) ;
485 }
486 // parser.putBackToken(token) ;
487 // token = parser.readLine() ;
488 if (section) {
489 inSection = !sectionHdr.CompareTo(hdr) ;
490 }
491 continue ;
492 }
493
494 // If section is specified, ignore all data outside specified section
495 if (!inSection) {
496 parser.zapToEnd(true) ;
497 continue ;
498 }
499
500 // Conditional statement evaluation
501 if (!token.CompareTo("if")) {
502
503 // Extract conditional expressions and check validity
504 TString expr = parser.readLine() ;
505 RooFormula form(expr,expr,*this) ;
506 if (!form.ok()) return true ;
507
508 // Evaluate expression
509 bool status = form.eval()?true:false ;
510 if (lastLineWasElse) {
511 anyCondTrue[condStackLevel] |= status ;
512 lastLineWasElse=false ;
513 } else {
514 condStackLevel++ ;
515 anyCondTrue[condStackLevel] = status ;
516 }
517 condStack[condStackLevel] = status ;
518
519 if (verbose) cxcoutD(Eval) << "RooArgSet::readFromStream(" << GetName()
520 << "): conditional expression " << expr << " = "
521 << (condStack[condStackLevel]?"true":"false") << endl ;
522 continue ; // go to next line
523 }
524
525 if (!token.CompareTo("else")) {
526 // Must have seen an if statement before
527 if (condStackLevel==0) {
528 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName() << "): unmatched 'else'" << endl ;
529 }
530
531 if (parser.atEOL()) {
532 // simple else: process if nothing else was true
533 condStack[condStackLevel] = !anyCondTrue[condStackLevel] ;
534 parser.zapToEnd(false) ;
535 continue ;
536 } else {
537 // if anything follows it should be 'if'
538 token = parser.readToken() ;
539 if (token.CompareTo("if")) {
540 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName() << "): syntax error: 'else " << token << "'" << endl ;
541 return true ;
542 } else {
543 if (anyCondTrue[condStackLevel]) {
544 // No need for further checking, true conditional already processed
545 condStack[condStackLevel] = false ;
546 parser.zapToEnd(false) ;
547 continue ;
548 } else {
549 // Process as normal 'if' no true conditional was encountered
550 reprocessToken = true ;
551 lastLineWasElse=true ;
552 continue ;
553 }
554 }
555 }
556 }
557
558 if (!token.CompareTo("endif")) {
559 // Must have seen an if statement before
560 if (condStackLevel==0) {
561 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName() << "): unmatched 'endif'" << endl ;
562 return true ;
563 }
564
565 // Decrease stack by one
566 condStackLevel-- ;
567 continue ;
568 }
569
570 // If current conditional is true
571 if (condStack[condStackLevel]) {
572
573 // Process echo statements
574 if (!token.CompareTo("echo")) {
575 TString message = parser.readLine() ;
576 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName() << "): >> " << message << endl ;
577 continue ;
578 }
579
580 // Process abort statements
581 if (!token.CompareTo("abort")) {
582 TString message = parser.readLine() ;
583 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName() << "): USER ABORT" << endl ;
584 return true ;
585 }
586
587 // Interpret the rest as <arg> = <value_expr>
588 RooAbsArg *arg ;
589
590 if ((arg = find(token)) && !arg->getAttribute("Dynamic")) {
591 if (parser.expectToken("=",true)) {
592 parser.zapToEnd(true) ;
593 retVal=true ;
594 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName()
595 << "): missing '=' sign: " << arg << endl ;
596 continue ;
597 }
598 bool argRet = arg->readFromStream(is,false,verbose) ;
599 if (!argRet && flagReadAtt) arg->setAttribute(flagReadAtt,true) ;
600 retVal |= argRet ;
601 } else {
602 if (verbose) {
603 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName() << "): argument "
604 << token << " not in list, ignored" << endl ;
605 }
606 parser.zapToEnd(true) ;
607 }
608 } else {
609 parser.readLine() ;
610 }
611 }
612
613 // Did we fully unwind the conditional stack?
614 if (condStackLevel!=0) {
615 coutE(InputArguments) << "RooArgSet::readFromStream(" << GetName() << "): missing 'endif'" << endl ;
616 return true ;
617 }
618
619 return retVal ;
620}
621
622
623bool RooArgSet::isInRange(const char* rangeSpec)
624{
625 char buf[1024] ;
626 strlcpy(buf,rangeSpec,1024) ;
627 char* token = strtok(buf,",") ;
628
629 TIterator* iter = createIterator() ;
630
631 while(token) {
632
633 bool accept=true ;
634 iter->Reset() ;
635 RooAbsArg* arg ;
636 while((arg=(RooAbsArg*)iter->Next())) {
637 RooAbsRealLValue* lvarg = dynamic_cast<RooAbsRealLValue*>(arg) ;
638 if (lvarg) {
639 if (!lvarg->inRange(token)) {
640 accept=false ;
641 break ;
642 }
643 }
644 // WVE MUST HANDLE RooAbsCategoryLValue ranges as well
645 }
646 if (accept) {
647 delete iter ;
648 return true ;
649 }
650
651 token = strtok(0,",") ;
652 }
653
654 delete iter ;
655 return false ;
656}
657
658
#define coutI(a)
Definition: RooMsgService.h:34
#define cxcoutD(a)
Definition: RooMsgService.h:85
#define coutW(a)
Definition: RooMsgService.h:36
#define coutE(a)
Definition: RooMsgService.h:37
#define TRACE_DESTROY
Definition: RooTrace.h:24
#define TRACE_CREATE
Definition: RooTrace.h:23
#define ClassImp(name)
Definition: Rtypes.h:375
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t bytes
char name[80]
Definition: TGX11.cxx:110
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
Definition: TString.cxx:1499
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:77
virtual bool readFromStream(std::istream &is, bool compact, bool verbose=false)=0
bool getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
Definition: RooAbsArg.cxx:305
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
Definition: RooAbsArg.cxx:282
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
bool contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
const char * GetName() const override
Returns name of object.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Storage_t _list
Actual object storage.
TIterator * createIterator(bool dir=kIterForward) const
TIterator-style iteration over contained elements.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
bool inRange(const char *name) const override
Check if current value is inside range with given name.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
bool isInRange(const char *rangeSpec)
Definition: RooArgSet.cxx:623
bool checkForDup(const RooAbsArg &arg, bool silent) const
Check if element with var's name is already in set.
Definition: RooArgSet.cxx:282
RooArgSet()
Default constructor.
Definition: RooArgSet.cxx:154
~RooArgSet() override
Destructor.
Definition: RooArgSet.cxx:249
virtual void writeToStream(std::ostream &os, bool compact, const char *section=0) const
Write the contents of the argset in ASCII form to given stream.
Definition: RooArgSet.cxx:351
void writeToFile(const char *fileName) const
Write contents of the argset to specified file.
Definition: RooArgSet.cxx:309
static void cleanup()
Definition: RooArgSet.cxx:81
virtual bool readFromStream(std::istream &is, bool compact, bool verbose=false)
Shortcut for readFromStream(std::istream&, bool, const char*, const char*, bool), setting flagReadAtt...
Definition: RooArgSet.h:160
void processArg(const RooAbsArg &arg)
Definition: RooArgSet.h:209
bool readFromFile(const char *fileName, const char *flagReadAtt=0, const char *section=0, bool verbose=false)
Read contents of the argset from specified file.
Definition: RooArgSet.cxx:325
RooAbsArg & operator[](const TString &str) const
Get reference to an element using its name.
Definition: RooArgSet.cxx:267
RooFormula internally uses ROOT's TFormula to compute user-defined expressions of RooAbsArgs.
Definition: RooFormula.h:33
double eval(const RooArgSet *nset=0) const
Evalute all parameters/observables, and then evaluate formula.
Definition: RooFormula.cxx:432
bool ok() const
Definition: RooFormula.h:58
static void activate()
Install atexit handler that calls CleanupRooFitAtExit() on program termination.
Definition: RooSentinel.cxx:54
void setPunctuation(const TString &punct)
Change list of characters interpreted as punctuation.
bool expectToken(const TString &expected, bool zapOnError=false)
Read the next token and return true if it is identical to the given 'expected' token.
bool atEOL()
If true, parser is at end of line in stream.
TString readLine()
Read an entire line from the stream and return as TString This method recognizes the use of '\' in th...
TString readToken()
Read one token separated by any of the know punctuation characters This function recognizes and handl...
void zapToEnd(bool inclContLines=false)
Eat all characters up to and including then end of the current line.
Collection abstract base class.
Definition: TCollection.h:65
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const =0
Iterator abstract base class.
Definition: TIterator.h:30
virtual void Reset()=0
virtual TObject * Next()=0
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:359
Basic string class.
Definition: TString.h:136
Ssiz_t Length() const
Definition: TString.h:410
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition: TString.cxx:442
const char * Data() const
Definition: TString.h:369
Bool_t IsNull() const
Definition: TString.h:407
TString & Append(const char *cs)
Definition: TString.h:564
RooConstVar & RooConst(double val)
@ InputArguments
Definition: RooGlobalFunc.h:64