59 #if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3) 69 #define POOLSIZE 1048576 83 std::list<POOLDATA>::iterator iter = _memPoolList.begin() ;
84 while(iter!=_memPoolList.end()) {
89 _memPoolList.clear() ;
102 void* RooArgSet::operator
new (
size_t bytes)
106 if (!_poolBegin || _poolCur+(
sizeof(
RooArgSet)) >= _poolEnd) {
115 if (_memPoolList.size()>3) {
119 for (std::list<POOLDATA>::iterator poolIter = _memPoolList.begin() ; poolIter!=_memPoolList.end() ; ++poolIter) {
122 if ((*(
Int_t*)(poolIter->_base))==0) {
123 oocxcoutD((
TObject*)0,
Caching) <<
"RooArgSet::operator new(), pruning empty memory pool " << (
void*)(poolIter->_base) << endl ;
125 toFree = poolIter->_base ;
126 _memPoolList.erase(poolIter) ;
139 _poolBegin = (
char*)mem ;
141 _poolCur = _poolBegin+
sizeof(
Int_t) ;
145 *((
Int_t*)_poolBegin)=0 ;
149 _memPoolList.push_back(p) ;
154 char* ptr = _poolCur ;
158 (*((
Int_t*)_poolBegin))++ ;
170 void* RooArgSet::operator
new (
size_t bytes,
void* ptr) noexcept
172 return ::operator
new (bytes, ptr);
179 void RooArgSet::operator
delete (
void* ptr)
182 for (std::list<POOLDATA>::iterator poolIter = _memPoolList.begin() ; poolIter!=_memPoolList.end() ; ++poolIter) {
183 if ((
char*)ptr > (
char*)poolIter->_base && (
char*)ptr < (
char*)poolIter->_base +
POOLSIZE) {
184 (*(
Int_t*)(poolIter->_base))-- ;
189 ::operator
delete(ptr);
228 if (var1 && !list.
contains(*var1)) {
404 while((obj=iter->
Next())) {
405 if (!dynamic_cast<RooAbsArg*>(obj)) {
407 <<
" is not a RooAbsArg, ignored" << endl ;
511 coutE(
InputArguments) <<
"RooArgSet::checkForDup: ERROR argument with name " << var.
GetName() <<
" is already in this set" << endl;
530 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getRealValue(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
535 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getRealValue(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsReal" << endl ;
551 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setRealValue(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
556 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setRealValue(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsRealLValue" << endl ;
573 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getCatLabel(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
578 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getCatLabel(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsCategory" << endl ;
594 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setCatLabel(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
599 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setCatLabel(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsCategory" << endl ;
616 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getCatLabel(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
621 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getCatLabel(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsCategory" << endl ;
637 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setCatLabel(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
642 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setCatLabel(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsCategory" << endl ;
659 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getStringValue(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
664 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getStringValue(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsString" << endl ;
680 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setStringValue(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
685 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setStringValue(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsString" << endl ;
700 ofstream ofs(fileName) ;
716 ifstream ifs(fileName) ;
746 os << next->
GetName() <<
" = " ;
813 Int_t condStackLevel=0 ;
817 TString sectionHdr(
"[") ;
818 if (section) sectionHdr.Append(section) ;
819 sectionHdr.Append(
"]") ;
825 if (is.eof() || is.fail() || parser.
atEOF()) {
830 if (!reprocessToken) {
836 if (token.IsNull()) {
841 if (!token.CompareTo(
"include")) {
842 if (parser.
atEOL()) {
844 <<
"): no filename found after include statement" << endl ;
847 TString filename = parser.
readLine() ;
848 ifstream incfs(filename) ;
854 << filename << endl ;
860 if (*token.Data()==
'[') {
862 const char* last = token.Data() + token.Length() -1 ;
870 inSection = !sectionHdr.CompareTo(hdr) ;
882 if (!token.CompareTo(
"if")) {
887 if (!form.
ok())
return kTRUE ;
891 if (lastLineWasElse) {
892 anyCondTrue[condStackLevel] |= status ;
896 anyCondTrue[condStackLevel] = status ;
898 condStack[condStackLevel] = status ;
901 <<
"): conditional expression " << expr <<
" = " 902 << (condStack[condStackLevel]?
"true":
"false") << endl ;
906 if (!token.CompareTo(
"else")) {
908 if (condStackLevel==0) {
912 if (parser.
atEOL()) {
914 condStack[condStackLevel] = !anyCondTrue[condStackLevel] ;
920 if (token.CompareTo(
"if")) {
924 if (anyCondTrue[condStackLevel]) {
926 condStack[condStackLevel] =
kFALSE ;
931 reprocessToken =
kTRUE ;
932 lastLineWasElse=
kTRUE ;
939 if (!token.CompareTo(
"endif")) {
941 if (condStackLevel==0) {
952 if (condStack[condStackLevel]) {
955 if (!token.CompareTo(
"echo")) {
956 TString message = parser.
readLine() ;
962 if (!token.CompareTo(
"abort")) {
963 TString message = parser.
readLine() ;
976 <<
"): missing '=' sign: " << arg << endl ;
980 if (!argRet && flagReadAtt) arg->
setAttribute(flagReadAtt,kTRUE) ;
985 << token <<
" not in list, ignored" << endl ;
995 if (condStackLevel!=0) {
1007 strlcpy(buf,rangeSpec,1024) ;
1008 char* token = strtok(buf,
",") ;
1032 token = strtok(0,
",") ;
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
virtual const char * GetName() const
Returns name of object.
TIterator * createIterator(Bool_t dir=kIterForward) const
Int_t getCatIndex(const char *name, Int_t defVal=0, Bool_t verbose=kFALSE) const
Get index value of a RooAbsCategory stored in set with given name.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
const char * getStringValue(const char *name, const char *defVal="", Bool_t verbose=kFALSE) const
Get string value of a RooAbsString stored in set with given name.
Bool_t setRealValue(const char *name, Double_t newVal=0, Bool_t verbose=kFALSE)
Set value of a RooAbsRealLValye stored in set with given name to newVal No error messages are printed...
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooAbsArg & operator[](const char *name) const
Array operator.
Double_t getVal(const RooArgSet *set=0) const
static const UInt_t kObjectAllocMemValue
virtual void setVal(const char *newVal)
Set value to given TString.
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)=0
static std::list< POOLDATA > _memPoolList
virtual Int_t getIndex() const
Return index number of current state.
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)=0
Bool_t checkForDup(const RooAbsArg &arg, Bool_t silent) const
Check if element with var's name is already in set.
Iterator abstract base class.
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.
Bool_t isInRange(const char *rangeSpec)
static char * _poolEnd
Next free slot in memory pool.
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
RooAbsCategoryLValue is the common abstract base class for objects that represent a discrete value th...
virtual void addClone(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling addOwned() for each element in the source...
virtual Bool_t readFromStream(std::istream &is, Bool_t compact, Bool_t verbose=kFALSE)
Bool_t getAttribute(const Text_t *name) const
Check if a named attribute is set. By default, all attributes are unset.
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const =0
TString readToken()
Read one token separated by any of the know punctuation characters This function recognizes and handl...
void writeToFile(const char *fileName) const
Write contents of the argset to specified file.
Collection abstract base class.
void zapToEnd(Bool_t inclContLines=kFALSE)
Eat all characters up to and including then end of the current line.
virtual Bool_t addOwned(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling addOwned() for each element in the source...
static char * _poolCur
Start of memory pool.
virtual const char * getLabel() const
Return label string of current state.
TString readLine()
Read an entire line from the stream and return as TString This method recognizes the use of '\' in th...
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.
virtual void setVal(Double_t value)=0
virtual void writeToStream(std::ostream &os, Bool_t compact) const =0
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.
static void activate()
Install atexit handler that calls CleanupRooFitAtExit() on program termination.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Bool_t setStringValue(const char *name, const char *newVal="", Bool_t verbose=kFALSE)
Set string value of a RooStringVar stored in set with given name to newVal.
static void destroySpecial(const char *name)
static void cleanup()
Clear memoery pool on exit to avoid reported memory leaks.
void setPunctuation(const TString &punct)
Change list of characters interpreted as punctuation.
Bool_t setCatIndex(const char *name, Int_t newVal=0, Bool_t verbose=kFALSE)
Set index value of a RooAbsCategoryLValue stored in set with given name to newVal.
virtual Bool_t inRange(const char *name) const
Check if current value is inside range with given name.
virtual const char * getVal() const
Return value of object. Calculated if dirty, otherwise cached value is returned.
const char * GetName() const
Returns name of object.
static void createSpecial(const char *name, int size)
Mother of all ROOT objects.
RooAbsString is the common abstract base class for objects that represent a string value...
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects...
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
const char * getCatLabel(const char *name, const char *defVal="", Bool_t verbose=kFALSE) const
Get state name of a RooAbsCategory stored in set with given name.
Bool_t setCatLabel(const char *name, const char *newVal="", Bool_t verbose=kFALSE)
Set state name of a RooAbsCategoryLValue stored in set with given name to newVal. ...
Double_t getRealValue(const char *name, Double_t defVal=0, Bool_t verbose=kFALSE) const
Get value of a RooAbsReal stored in set with given name.
virtual TObject * Next()=0
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
RooArgSet()
Default constructor.
Bool_t contains(const RooAbsArg &var) const
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
virtual const char * GetName() const
Returns name of object.
RooStringVar implements a string values RooAbsArg.
Bool_t atEOL()
If true, parser is at end of line in stream.
virtual ~RooArgSet()
Destructor.
virtual Bool_t setIndex(Int_t index, Bool_t printError=kTRUE)=0