61 #if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3) 71 #define POOLSIZE 1048576 85 std::list<POOLDATA>::iterator iter = _memPoolList.begin() ;
86 while(iter!=_memPoolList.end()) {
91 _memPoolList.clear() ;
104 void* RooArgSet::operator
new (
size_t bytes)
108 if (!_poolBegin || _poolCur+(
sizeof(
RooArgSet)) >= _poolEnd) {
117 if (_memPoolList.size()>3) {
121 for (std::list<POOLDATA>::iterator poolIter = _memPoolList.begin() ; poolIter!=_memPoolList.end() ; ++poolIter) {
124 if ((*(
Int_t*)(poolIter->_base))==0) {
125 oocxcoutD((
TObject*)0,
Caching) <<
"RooArgSet::operator new(), pruning empty memory pool " << (
void*)(poolIter->_base) << endl ;
127 toFree = poolIter->_base ;
128 _memPoolList.erase(poolIter) ;
140 _poolBegin = (
char*)mem ;
142 _poolCur = _poolBegin+
sizeof(
Int_t) ;
146 *((
Int_t*)_poolBegin)=0 ;
150 _memPoolList.push_back(p) ;
155 char* ptr = _poolCur ;
159 (*((
Int_t*)_poolBegin))++ ;
171 void* RooArgSet::operator
new (
size_t bytes,
void* ptr) noexcept
173 return ::operator
new (bytes, ptr);
180 void RooArgSet::operator
delete (
void* ptr)
183 for (std::list<POOLDATA>::iterator poolIter = _memPoolList.begin() ; poolIter!=_memPoolList.end() ; ++poolIter) {
184 if ((
char*)ptr > (
char*)poolIter->_base && (
char*)ptr < (
char*)poolIter->_base +
POOLSIZE) {
185 (*(
Int_t*)(poolIter->_base))-- ;
190 ::operator
delete(ptr);
229 if (var1 && !list.
contains(*var1)) {
405 while((obj=iter->
Next())) {
406 if (!dynamic_cast<RooAbsArg*>(obj)) {
408 <<
" is not a RooAbsArg, ignored" << endl ;
512 coutE(
InputArguments) <<
"RooArgSet::checkForDup: ERROR argument with name " << var.
GetName() <<
" is already in this set" << endl;
531 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getRealValue(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
536 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getRealValue(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsReal" << endl ;
552 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setRealValue(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
557 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setRealValue(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsRealLValue" << endl ;
574 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getCatLabel(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
579 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getCatLabel(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsCategory" << endl ;
595 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setCatLabel(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
600 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setCatLabel(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsCategory" << endl ;
617 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getCatLabel(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
622 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getCatLabel(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsCategory" << endl ;
638 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setCatLabel(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
643 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setCatLabel(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsCategory" << endl ;
660 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getStringValue(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
665 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::getStringValue(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsString" << endl ;
681 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setStringValue(" <<
GetName() <<
") ERROR no object with name '" << name <<
"' found" << endl ;
686 if (verbose)
coutE(
InputArguments) <<
"RooArgSet::setStringValue(" <<
GetName() <<
") ERROR object '" << name <<
"' is not of type RooAbsString" << endl ;
701 ofstream ofs(fileName) ;
717 ifstream ifs(fileName) ;
747 os << next->
GetName() <<
" = " ;
814 Int_t condStackLevel=0 ;
818 TString sectionHdr(
"[") ;
819 if (section) sectionHdr.Append(section) ;
820 sectionHdr.Append(
"]") ;
826 if (is.eof() || is.fail() || parser.
atEOF()) {
831 if (!reprocessToken) {
837 if (token.IsNull()) {
842 if (!token.CompareTo(
"include")) {
843 if (parser.
atEOL()) {
845 <<
"): no filename found after include statement" << endl ;
848 TString filename = parser.
readLine() ;
849 ifstream incfs(filename) ;
855 << filename << endl ;
861 if (*token.Data()==
'[') {
863 const char* last = token.Data() + token.Length() -1 ;
871 inSection = !sectionHdr.CompareTo(hdr) ;
883 if (!token.CompareTo(
"if")) {
888 if (!form.
ok())
return kTRUE ;
892 if (lastLineWasElse) {
893 anyCondTrue[condStackLevel] |= status ;
897 anyCondTrue[condStackLevel] = status ;
899 condStack[condStackLevel] = status ;
902 <<
"): conditional expression " << expr <<
" = " 903 << (condStack[condStackLevel]?
"true":
"false") << endl ;
907 if (!token.CompareTo(
"else")) {
909 if (condStackLevel==0) {
913 if (parser.
atEOL()) {
915 condStack[condStackLevel] = !anyCondTrue[condStackLevel] ;
921 if (token.CompareTo(
"if")) {
925 if (anyCondTrue[condStackLevel]) {
927 condStack[condStackLevel] =
kFALSE ;
932 reprocessToken =
kTRUE ;
933 lastLineWasElse=
kTRUE ;
940 if (!token.CompareTo(
"endif")) {
942 if (condStackLevel==0) {
953 if (condStack[condStackLevel]) {
956 if (!token.CompareTo(
"echo")) {
957 TString message = parser.
readLine() ;
963 if (!token.CompareTo(
"abort")) {
964 TString message = parser.
readLine() ;
977 <<
"): missing '=' sign: " << arg << endl ;
981 if (!argRet && flagReadAtt) arg->
setAttribute(flagReadAtt,kTRUE) ;
986 << token <<
" not in list, ignored" << endl ;
996 if (condStackLevel!=0) {
1008 strlcpy(buf,rangeSpec,1024) ;
1009 char* token = strtok(buf,
",") ;
1033 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
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)
if on multiple lines(like in C++). **The " * configuration fragment. * * The "import myobject continue
Parses the configuration file.
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