69using std::istream, std::ostream, std::ifstream, std::ofstream, std::endl;
71#if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
79#ifndef USEMEMPOOLFORARGSET
85RooArgSet::MemPool* RooArgSet::memPool() {
86 RooSentinel::activate();
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);
182 if (var1 && !collection.
contains(*var1)) {
185 add(collection,
true) ;
220 coutW(InputArguments) <<
"RooArgSet::RooArgSet(TCollection) element " << obj->
GetName()
221 <<
" is not a RooAbsArg, ignored" << endl ;
266 coutE(InputArguments) <<
"RooArgSet::operator[](" <<
GetName() <<
") ERROR: no element named " <<
name <<
" in set" << endl ;
267 throw std::invalid_argument((
TString(
"No element named '") +
name +
"' in set " +
GetName()).Data());
285 coutE(InputArguments) <<
"RooArgSet::checkForDup: ERROR argument with name " << var.
GetName() <<
" is already in this set" << endl;
306 ofstream ofs(fileName) ;
308 coutE(InputArguments) <<
"RooArgSet::writeToFile(" <<
GetName() <<
") error opening file " << fileName << endl ;
322 ifstream ifs(fileName) ;
324 coutE(InputArguments) <<
"RooArgSet::readFromFile(" <<
GetName() <<
") error opening file " << fileName << endl ;
348 if (section && section[0] !=
'\0')
349 os <<
'[' << section <<
']' <<
'\n';
352 for (
const auto next :
_list) {
353 next->writeToStream(os,
true);
358 for (
const auto next :
_list) {
359 os << next->GetName() <<
" = " ;
360 next->writeToStream(os,
false) ;
413 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
") compact mode not supported" << endl ;
424 bool anyCondTrue[100] ;
425 bool condStack[100] ;
426 bool lastLineWasElse=false ;
427 Int_t condStackLevel=0 ;
432 if (section) sectionHdr.
Append(section) ;
434 bool inSection(section?
false:
true) ;
436 bool reprocessToken = false ;
439 if (is.eof() || is.fail() || parser.
atEOF()) {
444 if (!reprocessToken) {
447 reprocessToken = false ;
456 if (parser.
atEOL()) {
457 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName()
458 <<
"): no filename found after include statement" << endl ;
464 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): cannot open include file " <<
filename << endl ;
467 coutI(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): processing include file "
469 if (
readFromStream(incfs,compact,flagReadAtt,inSection?
nullptr:section,verbose))
return true ;
474 if (*token.
Data()==
'[') {
476 const char* last = token.
Data() + token.
Length() -1 ;
501 if (!form.
ok())
return true ;
504 bool status = form.
eval()?
true:false ;
505 if (lastLineWasElse) {
506 anyCondTrue[condStackLevel] |= status ;
507 lastLineWasElse=false ;
510 anyCondTrue[condStackLevel] = status ;
512 condStack[condStackLevel] = status ;
515 cxcoutD(Eval) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): conditional expression " << expr <<
" = "
516 << (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(
nullptr,
",") ;
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.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
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.
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.
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)