64#if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
72#ifndef USEMEMPOOLFORARGSET
105void* RooArgSet::operator
new (
size_t bytes)
110 return memPool()->allocate(bytes);
119void* RooArgSet::operator
new (
size_t bytes,
void* ptr)
noexcept
121 return ::operator
new (bytes, ptr);
128void RooArgSet::operator
delete (
void* ptr)
131 if (memPool()->deallocate(ptr))
134 std::cerr << __func__ <<
" " << ptr <<
" is not in any of the pools." << std::endl;
137 ::operator
delete(ptr);
176 if (var1 && !collection.
contains(*var1)) {
214 while((obj=iter->
Next())) {
216 coutW(InputArguments) <<
"RooArgSet::RooArgSet(TCollection) element " << obj->
GetName()
217 <<
" is not a RooAbsArg, ignored" << endl ;
309 coutE(InputArguments) <<
"RooArgSet::operator[](" <<
GetName() <<
") ERROR: no element named " <<
name <<
" in set" << endl ;
310 throw std::invalid_argument((
TString(
"No element named '") +
name +
"' in set " +
GetName()).Data());
328 coutE(InputArguments) <<
"RooArgSet::checkForDup: ERROR argument with name " << var.
GetName() <<
" is already in this set" << endl;
349 ofstream ofs(fileName) ;
351 coutE(InputArguments) <<
"RooArgSet::writeToFile(" <<
GetName() <<
") error opening file " << fileName << endl ;
365 ifstream ifs(fileName) ;
367 coutE(InputArguments) <<
"RooArgSet::readFromFile(" <<
GetName() <<
") error opening file " << fileName << endl ;
391 if (section && section[0] !=
'\0')
392 os <<
'[' << section <<
']' <<
'\n';
395 for (
const auto next :
_list) {
396 next->writeToStream(os,
true);
401 for (
const auto next :
_list) {
402 os << next->GetName() <<
" = " ;
403 next->writeToStream(os,
kFALSE) ;
456 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
") compact mode not supported" << endl ;
470 Int_t condStackLevel=0 ;
475 if (section) sectionHdr.
Append(section) ;
482 if (is.eof() || is.fail() || parser.
atEOF()) {
487 if (!reprocessToken) {
499 if (parser.
atEOL()) {
500 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName()
501 <<
"): no filename found after include statement" << endl ;
505 ifstream incfs(filename) ;
507 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): cannot open include file " << filename << endl ;
510 coutI(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): processing include file "
511 << filename << endl ;
517 if (*token.
Data()==
'[') {
519 const char* last = token.
Data() + token.
Length() -1 ;
548 if (lastLineWasElse) {
549 anyCondTrue[condStackLevel] |= status ;
553 anyCondTrue[condStackLevel] = status ;
555 condStack[condStackLevel] = status ;
557 if (verbose)
cxcoutD(Eval) <<
"RooArgSet::readFromStream(" <<
GetName()
558 <<
"): conditional expression " << expr <<
" = "
559 << (condStack[condStackLevel]?
"true":
"false") << endl ;
565 if (condStackLevel==0) {
566 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): unmatched 'else'" << endl ;
569 if (parser.
atEOL()) {
571 condStack[condStackLevel] = !anyCondTrue[condStackLevel] ;
578 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): syntax error: 'else " << token <<
"'" << endl ;
581 if (anyCondTrue[condStackLevel]) {
583 condStack[condStackLevel] =
kFALSE ;
588 reprocessToken =
kTRUE ;
589 lastLineWasElse=
kTRUE ;
598 if (condStackLevel==0) {
599 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): unmatched 'endif'" << endl ;
609 if (condStack[condStackLevel]) {
614 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): >> " << message << endl ;
621 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): USER ABORT" << endl ;
632 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName()
633 <<
"): missing '=' sign: " << arg << endl ;
641 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): argument "
642 << token <<
" not in list, ignored" << endl ;
652 if (condStackLevel!=0) {
653 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): missing 'endif'" << endl ;
664 strlcpy(buf,rangeSpec,1024) ;
665 char* token = strtok(buf,
",") ;
689 token = strtok(0,
",") ;
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
Memory pool for RooArgSet and RooDataSet.
void teardown()
Set pool to teardown mode (at program end).
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)=0
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
Bool_t contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
const char * GetName() const
Returns name of object.
TIterator * createIterator(Bool_t 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...
virtual Bool_t inRange(const char *name) const
Check if current value is inside range with given name.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet()
Default constructor.
~RooArgSet() override
Destructor.
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Shortcut for readFromStream(std::istream&, Bool_t, const char*, const char*, Bool_t),...
Bool_t readFromFile(const char *fileName, const char *flagReadAtt=0, const char *section=0, Bool_t verbose=kFALSE)
Read contents of the argset from specified file.
Bool_t isInRange(const char *rangeSpec)
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
void writeToFile(const char *fileName) const
Write contents of the argset to specified file.
static MemPool * memPool()
virtual void writeToStream(std::ostream &os, Bool_t compact, const char *section=0) const
Write the contents of the argset in ASCII form to given stream.
MemPoolForRooSets< RooArgSet, 10 *600 > MemPool
void processArg(const RooAbsArg &var)
RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add clone of specified element to an owning set.
Bool_t checkForDup(const RooAbsArg &arg, Bool_t silent) const
Check if element with var's name is already in set.
RooAbsArg & operator[](const TString &str) const
Get reference to an element using its name.
Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to an owning set.
static void activate()
Install atexit handler that calls CleanupRooFitAtExit() on program termination.
Bool_t atEOL()
If true, parser is at end of line in stream.
void setPunctuation(const TString &punct)
Change list of characters interpreted as punctuation.
void zapToEnd(Bool_t inclContLines=kFALSE)
Eat all characters up to and including then end of the current line.
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.
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...
Collection abstract base class.
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const =0
Iterator abstract base class.
virtual TObject * Next()=0
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
const char * Data() const
TString & Append(const char *cs)