71#if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
79#ifndef USEMEMPOOLFORARGSET
85RooArgSet::MemPool* RooArgSet::memPool() {
87 static auto * memPool =
new RooArgSet::MemPool();
96 auto pool = memPool();
97 memPool()->teardown();
112void* RooArgSet::operator
new (
size_t bytes)
116 return ::operator
new(
bytes);
119 return memPool()->allocate(
bytes);
128void* RooArgSet::operator
new (
size_t bytes,
void* ptr)
noexcept
130 return ::operator
new (
bytes, ptr);
137void RooArgSet::operator
delete (
void* ptr)
140 if (memPool()->deallocate(ptr))
144 ::operator
delete(ptr);
183 if (var1 && !collection.
contains(*var1)) {
186 add(collection,
true) ;
221 coutW(InputArguments) <<
"RooArgSet::RooArgSet(TCollection) element " << obj->
GetName()
222 <<
" is not a RooAbsArg, ignored" << endl ;
267 coutE(InputArguments) <<
"RooArgSet::operator[](" <<
GetName() <<
") ERROR: no element named " <<
name <<
" in set" << endl ;
268 throw std::invalid_argument((
TString(
"No element named '") +
name +
"' in set " +
GetName()).Data());
286 coutE(InputArguments) <<
"RooArgSet::checkForDup: ERROR argument with name " << var.
GetName() <<
" is already in this set" << endl;
307 ofstream ofs(fileName) ;
309 coutE(InputArguments) <<
"RooArgSet::writeToFile(" <<
GetName() <<
") error opening file " << fileName << endl ;
323 ifstream ifs(fileName) ;
325 coutE(InputArguments) <<
"RooArgSet::readFromFile(" <<
GetName() <<
") error opening file " << fileName << endl ;
349 if (section && section[0] !=
'\0')
350 os <<
'[' << section <<
']' <<
'\n';
353 for (
const auto next :
_list) {
354 next->writeToStream(os,
true);
359 for (
const auto next :
_list) {
360 os << next->GetName() <<
" = " ;
361 next->writeToStream(os,
false) ;
414 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
") compact mode not supported" << endl ;
425 bool anyCondTrue[100] ;
426 bool condStack[100] ;
427 bool lastLineWasElse=false ;
428 Int_t condStackLevel=0 ;
433 if (section) sectionHdr.
Append(section) ;
435 bool inSection(section?
false:
true) ;
437 bool reprocessToken = false ;
440 if (is.eof() || is.fail() || parser.
atEOF()) {
445 if (!reprocessToken) {
448 reprocessToken = false ;
457 if (parser.
atEOL()) {
458 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName()
459 <<
"): no filename found after include statement" << endl ;
465 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): cannot open include file " <<
filename << endl ;
468 coutI(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): processing include file "
470 if (
readFromStream(incfs,compact,flagReadAtt,inSection?0:section,verbose))
return true ;
475 if (*token.
Data()==
'[') {
477 const char* last = token.
Data() + token.
Length() -1 ;
502 if (!form.
ok())
return true ;
505 bool status = form.
eval()?
true:false ;
506 if (lastLineWasElse) {
507 anyCondTrue[condStackLevel] |= status ;
508 lastLineWasElse=false ;
511 anyCondTrue[condStackLevel] = status ;
513 condStack[condStackLevel] = status ;
515 if (verbose)
cxcoutD(Eval) <<
"RooArgSet::readFromStream(" <<
GetName()
516 <<
"): conditional expression " << expr <<
" = "
517 << (condStack[condStackLevel]?
"true":
"false") << endl ;
523 if (condStackLevel==0) {
524 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): unmatched 'else'" << endl ;
527 if (parser.
atEOL()) {
529 condStack[condStackLevel] = !anyCondTrue[condStackLevel] ;
536 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): syntax error: 'else " << token <<
"'" << endl ;
539 if (anyCondTrue[condStackLevel]) {
541 condStack[condStackLevel] = false ;
546 reprocessToken = true ;
547 lastLineWasElse=true ;
556 if (condStackLevel==0) {
557 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): unmatched 'endif'" << endl ;
567 if (condStack[condStackLevel]) {
572 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): >> " << message << endl ;
579 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): USER ABORT" << endl ;
590 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName()
591 <<
"): missing '=' sign: " << arg << endl ;
595 if (!argRet && flagReadAtt) arg->
setAttribute(flagReadAtt,
true) ;
599 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): argument "
600 << token <<
" not in list, ignored" << endl ;
610 if (condStackLevel!=0) {
611 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): missing 'endif'" << endl ;
622 strlcpy(buf,rangeSpec,1024) ;
623 char* token = strtok(buf,
",") ;
628 for (
auto * lvarg : dynamic_range_cast<RooAbsRealLValue*>(*
this)) {
630 if (!lvarg->inRange(token)) {
641 token = strtok(0,
",") ;
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
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
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.
void setAttribute(const Text_t *name, bool value=true)
Set (default) or clear a named boolean attribute of this object.
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.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
bool isInRange(const char *rangeSpec)
bool checkForDup(const RooAbsArg &arg, bool silent) const
Check if element with var's name is already in set.
RooArgSet()
Default constructor.
~RooArgSet() override
Destructor.
void writeToFile(const char *fileName) const
Write contents of the argset to specified file.
bool readFromFile(const char *fileName, const char *flagReadAtt=nullptr, const char *section=nullptr, bool verbose=false)
Read contents of the argset from specified file.
virtual bool readFromStream(std::istream &is, bool compact, bool verbose=false)
Shortcut for readFromStream(std::istream&, bool, const char*, const char*, bool), setting flagReadAtt...
void processArg(const RooAbsArg &arg)
RooAbsArg & operator[](const TString &str) const
Get reference to an element using its name.
virtual void writeToStream(std::ostream &os, bool compact, const char *section=nullptr) const
Write the contents of the argset in ASCII form to given stream.
static void activate()
Install atexit handler that calls CleanupRooFitAtExit() on program termination.
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.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
const char * Data() const
TString & Append(const char *cs)
RooConstVar & RooConst(double val)