// RooAbsDataStore is the abstract base class for data collection that
// use a TTree as internal storage mechanism
// END_HTML
#include "RooFit.h"
#include "RooMsgService.h"
#include "RooAbsDataStore.h"
#include "Riostream.h"
#include <iomanip>
#include "TClass.h"
using namespace std ;
ClassImp(RooAbsDataStore)
;
RooAbsDataStore::RooAbsDataStore()
{
_iterator = _vars.createIterator() ;
_cacheIter = _cachedVars.createIterator() ;
_doDirtyProp = kTRUE ;
}
RooAbsDataStore::RooAbsDataStore(const char* name, const char* title, const RooArgSet& vars) :
TNamed(name,title)
{
_vars.add(vars) ;
_iterator = _vars.createIterator() ;
_cacheIter = _cachedVars.createIterator() ;
_doDirtyProp = kTRUE ;
}
RooAbsDataStore::RooAbsDataStore(const RooAbsDataStore& other, const char* newname) : TNamed(other), RooPrintable(other)
{
if (newname) {
SetName(newname) ;
}
_vars.add(other._vars) ;
_iterator = _vars.createIterator() ;
_cacheIter = _cachedVars.createIterator() ;
_doDirtyProp = other._doDirtyProp ;
}
RooAbsDataStore::RooAbsDataStore(const RooAbsDataStore& other, const RooArgSet& vars, const char* newname) : TNamed(other), RooPrintable(other)
{
if (newname) {
SetName(newname) ;
}
_vars.add(vars) ;
_iterator = _vars.createIterator() ;
_cacheIter = _cachedVars.createIterator() ;
_doDirtyProp = other._doDirtyProp ;
}
RooAbsDataStore::~RooAbsDataStore()
{
delete _iterator ;
delete _cacheIter ;
}
Bool_t RooAbsDataStore::valid() const
{
return kTRUE ;
}
void RooAbsDataStore::printName(ostream& os) const
{
os << GetName() ;
}
void RooAbsDataStore::printTitle(ostream& os) const
{
os << GetTitle() ;
}
void RooAbsDataStore::printClassName(ostream& os) const
{
os << IsA()->GetName() ;
}
void RooAbsDataStore::printValue(ostream& os) const
{
os << numEntries() << " entries" ;
}
void RooAbsDataStore::printArgs(ostream& os) const
{
os << "[" ;
_iterator->Reset() ;
RooAbsArg* arg ;
Bool_t first(kTRUE) ;
while((arg=(RooAbsArg*)_iterator->Next())) {
if (first) {
first=kFALSE ;
} else {
os << "," ;
}
os << arg->GetName() ;
}
os << "]" ;
}
Int_t RooAbsDataStore::defaultPrintContents(Option_t* ) const
{
return kName|kClassName|kArgs|kValue ;
}
void RooAbsDataStore::printMultiline(ostream& os, Int_t , Bool_t verbose, TString indent) const
{
os << indent << "DataStore " << GetName() << " (" << GetTitle() << ")" << endl ;
os << indent << " Contains " << numEntries() << " entries" << endl;
if (!verbose) {
os << indent << " Observables " << _vars << endl ;
} else {
os << indent << " Observables: " << endl ;
_vars.printStream(os,kName|kValue|kExtras|kTitle,kVerbose,indent+" ") ;
}
if(verbose) {
if (_cachedVars.getSize()>0) {
os << indent << " Caches " << _cachedVars << endl ;
}
}
}