69using std::istream, std::ostream, std::ifstream, std::ofstream, std::endl;
108 if (var1 && !collection.
contains(*var1)) {
111 add(collection,
true) ;
146 coutW(InputArguments) <<
"RooArgSet::RooArgSet(TCollection) element " << obj->
GetName()
147 <<
" is not a RooAbsArg, ignored" << endl ;
192 coutE(InputArguments) <<
"RooArgSet::operator[](" <<
GetName() <<
") ERROR: no element named " <<
name <<
" in set" << endl ;
193 throw std::invalid_argument((
TString(
"No element named '") +
name +
"' in set " +
GetName()).Data());
211 coutE(InputArguments) <<
"RooArgSet::checkForDup: ERROR argument with name " << var.
GetName() <<
" is already in this set" << endl;
232 ofstream ofs(fileName) ;
234 coutE(InputArguments) <<
"RooArgSet::writeToFile(" <<
GetName() <<
") error opening file " << fileName << endl ;
248 ifstream ifs(fileName) ;
250 coutE(InputArguments) <<
"RooArgSet::readFromFile(" <<
GetName() <<
") error opening file " << fileName << endl ;
274 if (section && section[0] !=
'\0')
275 os <<
'[' << section <<
']' <<
'\n';
278 for (
const auto next :
_list) {
279 next->writeToStream(os,
true);
284 for (
const auto next :
_list) {
285 os << next->GetName() <<
" = " ;
286 next->writeToStream(os,
false) ;
339 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
") compact mode not supported" << endl ;
350 bool anyCondTrue[100] ;
351 bool condStack[100] ;
352 bool lastLineWasElse=false ;
353 Int_t condStackLevel=0 ;
358 if (section) sectionHdr.
Append(section) ;
360 bool inSection(section?
false:
true) ;
362 bool reprocessToken = false ;
365 if (is.eof() || is.fail() || parser.
atEOF()) {
370 if (!reprocessToken) {
373 reprocessToken = false ;
382 if (parser.
atEOL()) {
383 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName()
384 <<
"): no filename found after include statement" << endl ;
390 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): cannot open include file " <<
filename << endl ;
393 coutI(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): processing include file "
395 if (
readFromStream(incfs,compact,flagReadAtt,inSection?
nullptr:section,verbose))
return true ;
400 if (*token.
Data()==
'[') {
402 const char* last = token.
Data() + token.
Length() -1 ;
427 if (!form.
ok())
return true ;
430 bool status = form.
eval()?
true:false ;
431 if (lastLineWasElse) {
432 anyCondTrue[condStackLevel] |= status ;
433 lastLineWasElse=false ;
436 anyCondTrue[condStackLevel] = status ;
438 condStack[condStackLevel] = status ;
441 cxcoutD(Eval) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): conditional expression " << expr <<
" = "
442 << (condStack[condStackLevel] ?
"true" :
"false") << endl;
449 if (condStackLevel==0) {
450 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): unmatched 'else'" << endl ;
453 if (parser.
atEOL()) {
455 condStack[condStackLevel] = !anyCondTrue[condStackLevel] ;
462 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): syntax error: 'else " << token <<
"'" << endl ;
465 if (anyCondTrue[condStackLevel]) {
467 condStack[condStackLevel] = false ;
472 reprocessToken = true ;
473 lastLineWasElse=true ;
482 if (condStackLevel==0) {
483 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): unmatched 'endif'" << endl ;
493 if (condStack[condStackLevel]) {
498 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): >> " << message << endl ;
505 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): USER ABORT" << endl ;
516 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName()
517 <<
"): missing '=' sign: " << arg << endl ;
521 if (!argRet && flagReadAtt) arg->
setAttribute(flagReadAtt,
true) ;
525 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): argument "
526 << token <<
" not in list, ignored" << endl ;
536 if (condStackLevel!=0) {
537 coutE(InputArguments) <<
"RooArgSet::readFromStream(" <<
GetName() <<
"): missing 'endif'" << endl ;
548 strlcpy(buf,rangeSpec,1024) ;
549 char* token = strtok(buf,
",") ;
554 for (
auto * lvarg : dynamic_range_cast<RooAbsRealLValue*>(*
this)) {
556 if (!lvarg->inRange(token)) {
567 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
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)