#include "RooFit.h"
#include "Riostream.h"
#include "Riostream.h"
#include <iomanip>
#include <fstream>
#include "TClass.h"
#include "RooArgList.h"
#include "RooStreamParser.h"
#include "RooFormula.h"
#include "RooAbsRealLValue.h"
#include "RooAbsCategoryLValue.h"
#include "RooStringVar.h"
#include "RooTrace.h"
#include "RooMsgService.h"
using namespace std;
ClassImp(RooArgList)
;
RooArgList::RooArgList() :
RooAbsCollection()
{
TRACE_CREATE
}
RooArgList::RooArgList(const RooArgSet& set) :
RooAbsCollection(set.GetName())
{
add(set) ;
TRACE_CREATE
}
RooArgList::RooArgList(const char *name) :
RooAbsCollection(name)
{
TRACE_CREATE
}
RooArgList::RooArgList(const RooAbsArg& var1,
const char *name) :
RooAbsCollection(name)
{
add(var1);
TRACE_CREATE
}
RooArgList::RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
const char *name) :
RooAbsCollection(name)
{
add(var1); add(var2);
TRACE_CREATE
}
RooArgList::RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
const RooAbsArg& var3,
const char *name) :
RooAbsCollection(name)
{
add(var1); add(var2); add(var3);
TRACE_CREATE
}
RooArgList::RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
const RooAbsArg& var3, const RooAbsArg& var4,
const char *name) :
RooAbsCollection(name)
{
add(var1); add(var2); add(var3); add(var4);
TRACE_CREATE
}
RooArgList::RooArgList(const RooAbsArg& var1,
const RooAbsArg& var2, const RooAbsArg& var3,
const RooAbsArg& var4, const RooAbsArg& var5,
const char *name) :
RooAbsCollection(name)
{
add(var1); add(var2); add(var3); add(var4); add(var5);
TRACE_CREATE
}
RooArgList::RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
const RooAbsArg& var3, const RooAbsArg& var4,
const RooAbsArg& var5, const RooAbsArg& var6,
const char *name) :
RooAbsCollection(name)
{
add(var1); add(var2); add(var3); add(var4); add(var5); add(var6);
TRACE_CREATE
}
RooArgList::RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
const RooAbsArg& var3, const RooAbsArg& var4,
const RooAbsArg& var5, const RooAbsArg& var6,
const RooAbsArg& var7,
const char *name) :
RooAbsCollection(name)
{
add(var1); add(var2); add(var3); add(var4); add(var5); add(var6); add(var7) ;
TRACE_CREATE
}
RooArgList::RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
const RooAbsArg& var3, const RooAbsArg& var4,
const RooAbsArg& var5, const RooAbsArg& var6,
const RooAbsArg& var7, const RooAbsArg& var8,
const char *name) :
RooAbsCollection(name)
{
add(var1); add(var2); add(var3); add(var4); add(var5); add(var6); add(var7) ;add(var8) ;
TRACE_CREATE
}
RooArgList::RooArgList(const RooAbsArg& var1, const RooAbsArg& var2,
const RooAbsArg& var3, const RooAbsArg& var4,
const RooAbsArg& var5, const RooAbsArg& var6,
const RooAbsArg& var7, const RooAbsArg& var8,
const RooAbsArg& var9, const char *name) :
RooAbsCollection(name)
{
add(var1); add(var2); add(var3); add(var4); add(var5); add(var6); add(var7); add(var8); add(var9);
TRACE_CREATE
}
RooArgList::RooArgList(const TCollection& tcoll, const char* name) :
RooAbsCollection(name)
{
TIterator* iter = tcoll.MakeIterator() ;
TObject* obj ;
while((obj=iter->Next())) {
if (!dynamic_cast<RooAbsArg*>(obj)) {
coutW(InputArguments) << "RooArgList::RooArgList(TCollection) element " << obj->GetName()
<< " is not a RooAbsArg, ignored" << endl ;
continue ;
}
add(*(RooAbsArg*)obj) ;
}
delete iter ;
TRACE_CREATE
}
RooArgList::RooArgList(const RooArgList& other, const char *name)
: RooAbsCollection(other,name)
{
TRACE_CREATE
}
RooArgList::~RooArgList()
{
TRACE_DESTROY
}
RooAbsArg& RooArgList::operator[](Int_t idx) const
{
RooAbsArg* arg = at(idx) ;
if (!arg) {
coutE(InputArguments) << "RooArgList::operator[](" << GetName() << ") ERROR: index "
<< idx << " out of range (0," << getSize() << ")" << endl ;
RooErrorHandler::softAbort() ;
}
return *arg ;
}
void RooArgList::writeToStream(ostream& os, Bool_t compact)
{
if (!compact) {
coutE(InputArguments) << "RooArgList::writeToStream(" << GetName() << ") non-compact mode not supported" << endl ;
return ;
}
TIterator *iterat= createIterator();
RooAbsArg *next = 0;
while((0 != (next= (RooAbsArg*)iterat->Next()))) {
next->writeToStream(os,kTRUE) ;
os << " " ;
}
delete iterat;
os << endl ;
}
Bool_t RooArgList::readFromStream(istream& is, Bool_t compact, Bool_t verbose)
{
if (!compact) {
coutE(InputArguments) << "RooArgList::readFromStream(" << GetName() << ") non-compact mode not supported" << endl ;
return kTRUE ;
}
TIterator *iterat= createIterator();
RooStreamParser parser(is) ;
RooAbsArg *next = 0;
while((0 != (next= (RooAbsArg*)iterat->Next()))) {
if (!next->getAttribute("Dynamic")) {
if (next->readFromStream(is,kTRUE,verbose)) {
parser.zapToEnd() ;
delete iterat ;
return kTRUE ;
}
} else {
}
}
if (!parser.atEOL()) {
TString rest = parser.readLine() ;
if (verbose) {
coutW(InputArguments) << "RooArgSet::readFromStream(" << GetName()
<< "): ignoring extra characters at end of line: '" << rest << "'" << endl ;
}
}
delete iterat;
return kFALSE ;
}