69using std::istream, std::ostream, std::ifstream, std::ofstream, std::endl;
75#ifndef USEMEMPOOLFORARGSET
81RooArgSet::MemPool* RooArgSet::memPool() {
82 RooSentinel::activate();
83 static auto * memPool =
new RooArgSet::MemPool();
92 auto pool = memPool();
93 memPool()->teardown();
108void* RooArgSet::operator
new (
size_t bytes)
112 return ::operator
new(
bytes);
115 return memPool()->allocate(
bytes);
124void* RooArgSet::operator
new (
size_t bytes,
void* ptr)
noexcept
126 return ::operator
new (
bytes, ptr);
133void RooArgSet::operator
delete (
void* ptr)
136 if (memPool()->deallocate(ptr))
140 ::operator
delete(ptr);
178 if (var1 && !collection.
contains(*var1)) {
181 add(collection,
true) ;
216 coutW(InputArguments) <<
"RooArgSet::RooArgSet(TCollection) element " << obj->
GetName()
217 <<
" is not a RooAbsArg, ignored" << endl ;
262 coutE(InputArguments) <<
"RooArgSet::operator[](" <<
GetName() <<
") ERROR: no element named " <<
name <<
" in set" << endl ;
263 throw std::invalid_argument((
TString(
"No element named '") +
name +
"' in set " +
GetName()).Data());
281 coutE(InputArguments) <<
"RooArgSet::checkForDup: ERROR argument with name " << var.
GetName() <<
" is already in this set" << endl;
302 ofstream ofs(fileName) ;
304 coutE(InputArguments) <<
"RooArgSet::writeToFile(" <<
GetName() <<
") error opening file " << fileName << endl ;
318 ifstream ifs(fileName) ;
320 coutE(InputArguments) <<
"RooArgSet::readFromFile(" <<
GetName() <<
") error opening file " << fileName << endl ;
344 if (section && section[0] !=
'\0')
345 os <<
'[' << section <<
']' <<
'\n';
348 for (
const auto next :
_list) {
349 next->writeToStream(os,
true);
354 for (
const auto next :
_list) {
355 os << next->GetName() <<
" = " ;
356 next->writeToStream(os,
false) ;
409 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
") compact mode not supported" << endl ;
420 bool anyCondTrue[100] ;
421 bool condStack[100] ;
422 bool lastLineWasElse=false ;
423 Int_t condStackLevel=0 ;
428 if (section) sectionHdr.
Append(section) ;
430 bool inSection(section?
false:
true) ;
432 bool reprocessToken = false ;
435 if (is.eof() || is.fail() || parser.
atEOF()) {
440 if (!reprocessToken) {
443 reprocessToken = false ;
452 if (parser.
atEOL()) {
453 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName()
454 <<
"): no filename found after include statement" << endl ;
460 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): cannot open include file " <<
filename << endl ;
463 coutI(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): processing include file "
465 if (
readFromStream(incfs,compact,flagReadAtt,inSection?
nullptr:section,verbose))
return true ;
470 if (*token.
Data()==
'[') {
472 const char* last = token.
Data() + token.
Length() -1 ;
497 if (!form.
ok())
return true ;
500 bool status = form.
eval()?
true:false ;
501 if (lastLineWasElse) {
502 anyCondTrue[condStackLevel] |= status ;
503 lastLineWasElse=false ;
506 anyCondTrue[condStackLevel] = status ;
508 condStack[condStackLevel] = status ;
511 cxcoutD(Eval) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): conditional expression " << expr <<
" = "
512 << (condStack[condStackLevel] ?
"true" :
"false") << endl;
519 if (condStackLevel==0) {
520 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): unmatched 'else'" << endl ;
523 if (parser.
atEOL()) {
525 condStack[condStackLevel] = !anyCondTrue[condStackLevel] ;
532 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): syntax error: 'else " << token <<
"'" << endl ;
535 if (anyCondTrue[condStackLevel]) {
537 condStack[condStackLevel] = false ;
542 reprocessToken = true ;
543 lastLineWasElse=true ;
552 if (condStackLevel==0) {
553 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): unmatched 'endif'" << endl ;
563 if (condStack[condStackLevel]) {
568 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): >> " << message << endl ;
575 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): USER ABORT" << endl ;
586 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName()
587 <<
"): missing '=' sign: " << arg << endl ;
591 if (!argRet && flagReadAtt) arg->
setAttribute(flagReadAtt,
true) ;
595 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): argument "
596 << token <<
" not in list, ignored" << endl ;
606 if (condStackLevel!=0) {
607 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): missing 'endif'" << endl ;
618 strlcpy(buf,rangeSpec,1024) ;
619 char* token = strtok(buf,
",") ;
624 for (
auto * lvarg : dynamic_range_cast<RooAbsRealLValue*>(*
this)) {
626 if (!lvarg->inRange(token)) {
637 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
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)