81 #if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
82 char* operator+( streampos&,
char* );
89 #ifndef USEMEMPOOLFORDATASET
90 void RooDataSet::cleanup() {}
95 RooDataSet::MemPool* RooDataSet::memPool() {
96 RooSentinel::activate();
97 static auto * memPool =
new RooDataSet::MemPool();
101 void RooDataSet::cleanup() {
102 auto pool = memPool();
118 void* RooDataSet::operator
new (
size_t bytes)
121 assert(
sizeof(RooDataSet) == bytes);
123 return memPool()->allocate(bytes);
131 void RooDataSet::operator
delete (
void* ptr)
134 if (memPool()->deallocate(ptr))
137 std::cerr << __func__ <<
" " << ptr <<
" is not in any of the pools." << std::endl;
140 ::operator
delete(ptr);
149 RooDataSet::RooDataSet() : _wgtVar(0)
195 RooDataSet::RooDataSet(
const char* name,
const char* title,
const RooArgSet& vars,
const RooCmdArg& arg1,
const RooCmdArg& arg2,
const RooCmdArg& arg3,
196 const RooCmdArg& arg4,
const RooCmdArg& arg5,
const RooCmdArg& arg6,
const RooCmdArg& arg7,
const RooCmdArg& arg8) :
197 RooAbsData(name,title,RooArgSet(vars,(RooAbsArg*)RooCmdConfig::decodeObjOnTheFly(
"RooDataSet::RooDataSet",
"IndexCat",0,0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)))
200 RooCmdConfig pc(Form(
"RooDataSet::ctor(%s)",GetName())) ;
201 pc.defineInt(
"ownLinked",
"OwnLinked",0) ;
202 pc.defineObject(
"impTree",
"ImportTree",0) ;
203 pc.defineObject(
"impData",
"ImportData",0) ;
204 pc.defineObject(
"indexCat",
"IndexCat",0) ;
205 pc.defineObject(
"impSliceData",
"ImportDataSlice",0,0,kTRUE) ;
206 pc.defineString(
"impSliceState",
"ImportDataSlice",0,
"",kTRUE) ;
207 pc.defineObject(
"lnkSliceData",
"LinkDataSlice",0,0,kTRUE) ;
208 pc.defineString(
"lnkSliceState",
"LinkDataSlice",0,
"",kTRUE) ;
209 pc.defineString(
"cutSpec",
"CutSpec",0,
"") ;
210 pc.defineObject(
"cutVar",
"CutVar",0) ;
211 pc.defineString(
"cutRange",
"CutRange",0,
"") ;
212 pc.defineString(
"wgtVarName",
"WeightVarName",0,
"") ;
213 pc.defineInt(
"newWeight1",
"WeightVarName",0,0) ;
214 pc.defineString(
"fname",
"ImportFromFile",0,
"") ;
215 pc.defineString(
"tname",
"ImportFromFile",1,
"") ;
216 pc.defineObject(
"wgtVar",
"WeightVar",0) ;
217 pc.defineInt(
"newWeight2",
"WeightVar",0,0) ;
218 pc.defineObject(
"dummy1",
"ImportDataSliceMany",0) ;
219 pc.defineObject(
"dummy2",
"LinkDataSliceMany",0) ;
220 pc.defineSet(
"errorSet",
"StoreError",0) ;
221 pc.defineSet(
"asymErrSet",
"StoreAsymError",0) ;
222 pc.defineMutex(
"ImportTree",
"ImportData",
"ImportDataSlice",
"LinkDataSlice",
"ImportFromFile") ;
223 pc.defineMutex(
"CutSpec",
"CutVar") ;
224 pc.defineMutex(
"WeightVarName",
"WeightVar") ;
225 pc.defineDependency(
"ImportDataSlice",
"IndexCat") ;
226 pc.defineDependency(
"LinkDataSlice",
"IndexCat") ;
227 pc.defineDependency(
"OwnLinked",
"LinkDataSlice") ;
231 l.Add((TObject*)&arg1) ; l.Add((TObject*)&arg2) ;
232 l.Add((TObject*)&arg3) ; l.Add((TObject*)&arg4) ;
233 l.Add((TObject*)&arg5) ; l.Add((TObject*)&arg6) ;
234 l.Add((TObject*)&arg7) ; l.Add((TObject*)&arg8) ;
244 TTree* impTree =
static_cast<TTree*
>(pc.getObject(
"impTree")) ;
245 RooDataSet* impData =
static_cast<RooDataSet*
>(pc.getObject(
"impData")) ;
246 RooFormulaVar* cutVar =
static_cast<RooFormulaVar*
>(pc.getObject(
"cutVar")) ;
247 const char* cutSpec = pc.getString(
"cutSpec",
"",kTRUE) ;
248 const char* cutRange = pc.getString(
"cutRange",
"",kTRUE) ;
249 const char* wgtVarName = pc.getString(
"wgtVarName",
"",kTRUE) ;
250 RooRealVar* wgtVar =
static_cast<RooRealVar*
>(pc.getObject(
"wgtVar")) ;
251 const char* impSliceNames = pc.getString(
"impSliceState",
"",kTRUE) ;
252 const RooLinkedList& impSliceData = pc.getObjectList(
"impSliceData") ;
253 const char* lnkSliceNames = pc.getString(
"lnkSliceState",
"",kTRUE) ;
254 const RooLinkedList& lnkSliceData = pc.getObjectList(
"lnkSliceData") ;
255 RooCategory* indexCat =
static_cast<RooCategory*
>(pc.getObject(
"indexCat")) ;
256 RooArgSet* errorSet = pc.getSet(
"errorSet") ;
257 RooArgSet* asymErrorSet = pc.getSet(
"asymErrSet") ;
258 const char* fname = pc.getString(
"fname") ;
259 const char* tname = pc.getString(
"tname") ;
260 Int_t ownLinked = pc.getInt(
"ownLinked") ;
261 Int_t newWeight = pc.getInt(
"newWeight1") + pc.getInt(
"newWeight2") ;
267 map<string,RooAbsData*> hmap ;
270 strlcpy(tmp, lnkSliceNames, 64000);
271 char *token = strtok(tmp,
",");
272 TIterator *hiter = lnkSliceData.MakeIterator();
274 hmap[token] = (RooAbsData *)hiter->Next();
275 token = strtok(0,
",");
283 wgtVarName = wgtVar->GetName() ;
286 appendToDir(
this,kTRUE) ;
291 map<string,RooAbsDataStore*> storeMap ;
292 RooCategory* icat = (RooCategory*) (indexCat ? _vars.find(indexCat->GetName()) : 0 ) ;
294 throw std::string(
"RooDataSet::RooDataSet() ERROR in constructor, cannot find index category") ;
296 for (map<string,RooAbsData*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
298 if (indexCat && !indexCat->lookupType(hiter->first.c_str())) {
299 indexCat->defineType(hiter->first.c_str()) ;
300 coutI(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") defining state \"" << hiter->first <<
"\" in index category " << indexCat->GetName() << endl ;
302 if (icat && !icat->lookupType(hiter->first.c_str())) {
303 icat->defineType(hiter->first.c_str()) ;
305 icat->setLabel(hiter->first.c_str()) ;
306 storeMap[icat->getLabel()]=hiter->second->store() ;
310 addOwnedComponent(hiter->first.c_str(),*hiter->second) ;
315 _dstore =
new RooCompositeDataStore(name,title,_vars,*icat,storeMap) ;
320 wgtVarName = wgtVar->GetName() ;
324 if (!wgtVar && !wgtVarName && impData && impData->_wgtVar) {
325 _wgtVar = (RooRealVar*) impData->_wgtVar->createFundamental() ;
326 _vars.addOwned(*_wgtVar) ;
327 wgtVarName = _wgtVar->GetName() ;
331 RooTreeDataStore* tstore(0) ;
332 RooVectorDataStore* vstore(0) ;
334 if (defaultStorageType==Tree) {
335 tstore =
new RooTreeDataStore(name,title,_vars,wgtVarName) ;
337 }
else if (defaultStorageType==Vector) {
338 if (wgtVarName && newWeight) {
339 RooAbsArg* wgttmp = _vars.find(wgtVarName) ;
341 wgttmp->setAttribute(
"NewWeight") ;
344 vstore =
new RooVectorDataStore(name,title,_vars,wgtVarName) ;
352 map<string,RooDataSet*> hmap ;
355 strlcpy(tmp,impSliceNames,100000) ;
356 char* token = strtok(tmp,
",") ;
357 TIterator* hiter = impSliceData.MakeIterator() ;
359 hmap[token] = (RooDataSet*) hiter->Next() ;
360 token = strtok(0,
",") ;
367 RooArgSet* intErrorSet = (RooArgSet*) _vars.selectCommon(*errorSet) ;
368 intErrorSet->setAttribAll(
"StoreError") ;
369 TIterator* iter = intErrorSet->createIterator() ;
371 while((arg=(RooAbsArg*)iter->Next())) {
372 arg->attachToStore(*_dstore) ;
378 RooArgSet* intAsymErrorSet = (RooArgSet*) _vars.selectCommon(*asymErrorSet) ;
379 intAsymErrorSet->setAttribAll(
"StoreAsymError") ;
380 TIterator* iter = intAsymErrorSet->createIterator() ;
382 while((arg=(RooAbsArg*)iter->Next())) {
383 arg->attachToStore(*_dstore) ;
386 delete intAsymErrorSet ;
391 wgtVarName = wgtVar->GetName() ;
395 appendToDir(
this,kTRUE) ;
398 if (wgtVarName && *wgtVarName) {
400 initialize(wgtVarName) ;
403 if (impData && impData->_wgtVar && vars.find(impData->_wgtVar->GetName())) {
406 initialize(impData->_wgtVar->GetName()) ;
408 }
else if (indexCat) {
410 RooDataSet* firstDS = hmap.begin()->second ;
411 if (firstDS->_wgtVar && vars.find(firstDS->_wgtVar->GetName())) {
412 initialize(firstDS->_wgtVar->GetName()) ;
422 if (cutSpec && *cutSpec) {
428 RooCategory* icat = (RooCategory*) _vars.find(indexCat->GetName()) ;
429 for (map<string,RooDataSet*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
431 if (!indexCat->lookupType(hiter->first.c_str())) {
432 indexCat->defineType(hiter->first.c_str()) ;
433 coutI(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") defining state \"" << hiter->first <<
"\" in index category " << indexCat->GetName() << endl ;
435 if (!icat->lookupType(hiter->first.c_str())) {
436 icat->defineType(hiter->first.c_str()) ;
438 icat->setLabel(hiter->first.c_str()) ;
440 RooFormulaVar cutVarTmp(cutSpec,cutSpec,hiter->second->_vars) ;
441 _dstore->loadValues(hiter->second->store(),&cutVarTmp,cutRange) ;
444 }
else if (impData) {
447 RooFormulaVar cutVarTmp(cutSpec,cutSpec,impData->_vars) ;
448 _dstore->loadValues(impData->store(),&cutVarTmp,cutRange);
449 }
else if (impTree) {
452 RooFormulaVar cutVarTmp(cutSpec,cutSpec,_vars) ;
454 tstore->loadValues(impTree,&cutVarTmp,cutRange);
456 RooTreeDataStore tmpstore(name,title,_vars,wgtVarName) ;
457 tmpstore.loadValues(impTree,&cutVarTmp,cutRange) ;
458 _dstore->append(tmpstore) ;
460 }
else if (fname && strlen(fname)) {
463 TFile *f = TFile::Open(fname) ;
465 coutE(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") ERROR file '" << fname <<
"' cannot be opened or does not exist" << endl ;
466 throw string(Form(
"RooDataSet::ctor(%s) ERROR file %s cannot be opened or does not exist",GetName(),fname)) ;
468 TTree* t =
dynamic_cast<TTree*
>(f->Get(tname)) ;
470 coutE(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") ERROR file '" << fname <<
"' does not contain a TTree named '" << tname <<
"'" << endl ;
471 throw string(Form(
"RooDataSet::ctor(%s) ERROR file %s does not contain a TTree named %s",GetName(),fname,tname)) ;
473 RooFormulaVar cutVarTmp(cutSpec,cutSpec,_vars) ;
475 tstore->loadValues(t,&cutVarTmp,cutRange);
477 RooTreeDataStore tmpstore(name,title,_vars,wgtVarName) ;
478 tmpstore.loadValues(t,&cutVarTmp,cutRange) ;
479 _dstore->append(tmpstore) ;
492 RooCategory* icat = (RooCategory*) _vars.find(indexCat->GetName()) ;
493 for (map<string,RooDataSet*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
495 if (!indexCat->lookupType(hiter->first.c_str())) {
496 indexCat->defineType(hiter->first.c_str()) ;
497 coutI(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") defining state \"" << hiter->first <<
"\" in index category " << indexCat->GetName() << endl ;
499 if (!icat->lookupType(hiter->first.c_str())) {
500 icat->defineType(hiter->first.c_str()) ;
502 icat->setLabel(hiter->first.c_str()) ;
503 _dstore->loadValues(hiter->second->store(),cutVar,cutRange) ;
507 }
else if (impData) {
509 _dstore->loadValues(impData->store(),cutVar,cutRange);
510 }
else if (impTree) {
513 tstore->loadValues(impTree,cutVar,cutRange);
515 RooTreeDataStore tmpstore(name,title,_vars,wgtVarName) ;
516 tmpstore.loadValues(impTree,cutVar,cutRange) ;
517 _dstore->append(tmpstore) ;
519 }
else if (fname && strlen(fname)) {
521 TFile *f = TFile::Open(fname) ;
523 coutE(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") ERROR file '" << fname <<
"' cannot be opened or does not exist" << endl ;
524 throw string(Form(
"RooDataSet::ctor(%s) ERROR file %s cannot be opened or does not exist",GetName(),fname)) ;
526 TTree* t =
dynamic_cast<TTree*
>(f->Get(tname)) ;
528 coutE(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") ERROR file '" << fname <<
"' does not contain a TTree named '" << tname <<
"'" << endl ;
529 throw string(Form(
"RooDataSet::ctor(%s) ERROR file %s does not contain a TTree named %s",GetName(),fname,tname)) ;
532 tstore->loadValues(t,cutVar,cutRange);
534 RooTreeDataStore tmpstore(name,title,_vars,wgtVarName) ;
535 tmpstore.loadValues(t,cutVar,cutRange) ;
536 _dstore->append(tmpstore) ;
547 RooCategory* icat = (RooCategory*) _vars.find(indexCat->GetName()) ;
548 for (map<string,RooDataSet*>::iterator hiter = hmap.begin() ; hiter!=hmap.end() ; ++hiter) {
550 if (!indexCat->lookupType(hiter->first.c_str())) {
551 indexCat->defineType(hiter->first.c_str()) ;
552 coutI(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") defining state \"" << hiter->first <<
"\" in index category " << indexCat->GetName() << endl ;
554 if (!icat->lookupType(hiter->first.c_str())) {
555 icat->defineType(hiter->first.c_str()) ;
557 icat->setLabel(hiter->first.c_str()) ;
559 _dstore->loadValues(hiter->second->store(),0,cutRange) ;
563 }
else if (impData) {
565 _dstore->loadValues(impData->store(),0,cutRange);
567 }
else if (impTree || (fname && strlen(fname))) {
569 std::unique_ptr<TFile> file;
571 if (impTree ==
nullptr) {
572 file.reset(TFile::Open(fname));
574 coutE(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") ERROR file '" << fname <<
"' cannot be opened or does not exist" << endl ;
575 throw std::invalid_argument(Form(
"RooDataSet::ctor(%s) ERROR file %s cannot be opened or does not exist",GetName(),fname)) ;
578 file->GetObject(tname, impTree);
580 coutE(InputArguments) <<
"RooDataSet::ctor(" << GetName() <<
") ERROR file '" << fname <<
"' does not contain a TTree named '" << tname <<
"'" << endl ;
581 throw std::invalid_argument(Form(
"RooDataSet::ctor(%s) ERROR file %s does not contain a TTree named %s",GetName(),fname,tname)) ;
586 tstore->loadValues(impTree,0,cutRange);
588 RooTreeDataStore tmpstore(name,title,_vars,wgtVarName) ;
589 tmpstore.loadValues(impTree,0,cutRange) ;
590 _dstore->append(tmpstore) ;
605 RooDataSet::RooDataSet(
const char *name,
const char *title,
const RooArgSet& vars,
const char* wgtVarName) :
606 RooAbsData(name,title,vars)
609 _dstore = (defaultStorageType==Tree) ? ((RooAbsDataStore*)
new RooTreeDataStore(name,title,_vars,wgtVarName)) :
610 ((RooAbsDataStore*)
new RooVectorDataStore(name,title,_vars,wgtVarName)) ;
612 appendToDir(
this,kTRUE) ;
613 initialize(wgtVarName) ;
637 RooDataSet::RooDataSet(
const char *name,
const char *title, RooDataSet *dset,
638 const RooArgSet& vars,
const char *cuts,
const char* wgtVarName) :
639 RooAbsData(name,title,vars)
642 _dstore =
new RooTreeDataStore(name,title,_vars,*dset->_dstore,cuts,wgtVarName) ;
644 appendToDir(
this,kTRUE) ;
648 initialize(wgtVarName) ;
650 if (dset->_wgtVar && vars.find(dset->_wgtVar->GetName())) {
652 initialize(dset->_wgtVar->GetName()) ;
678 RooDataSet::RooDataSet(
const char *name,
const char *title, RooDataSet *dset,
679 const RooArgSet& vars,
const RooFormulaVar& cutVar,
const char* wgtVarName) :
680 RooAbsData(name,title,vars)
683 _dstore =
new RooTreeDataStore(name,title,_vars,*dset->_dstore,cutVar,wgtVarName) ;
685 appendToDir(
this,kTRUE) ;
689 initialize(wgtVarName) ;
691 if (dset->_wgtVar && vars.find(dset->_wgtVar->GetName())) {
693 initialize(dset->_wgtVar->GetName()) ;
718 RooDataSet::RooDataSet(
const char *name,
const char *title, TTree *intree,
719 const RooArgSet& vars,
const RooFormulaVar& cutVar,
const char* wgtVarName) :
720 RooAbsData(name,title,vars)
723 RooTreeDataStore* tstore =
new RooTreeDataStore(name,title,_vars,*intree,cutVar,wgtVarName) ;
726 if (defaultStorageType==Tree) {
728 }
else if (defaultStorageType==Vector) {
729 RooVectorDataStore* vstore =
new RooVectorDataStore(name,title,_vars,wgtVarName) ;
731 _dstore->append(*tstore) ;
737 appendToDir(
this,kTRUE) ;
738 initialize(wgtVarName) ;
760 RooDataSet::RooDataSet(
const char *name,
const char *title, TTree *intree,
761 const RooArgSet& vars,
const char *selExpr,
const char* wgtVarName) :
762 RooAbsData(name,title,vars)
765 RooTreeDataStore* tstore =
new RooTreeDataStore(name,title,_vars,*intree,selExpr,wgtVarName) ;
768 if (defaultStorageType==Tree) {
770 }
else if (defaultStorageType==Vector) {
771 RooVectorDataStore* vstore =
new RooVectorDataStore(name,title,_vars,wgtVarName) ;
773 _dstore->append(*tstore) ;
779 appendToDir(
this,kTRUE) ;
781 initialize(wgtVarName) ;
790 RooDataSet::RooDataSet(RooDataSet
const & other,
const char* newname) :
791 RooAbsData(other,newname), RooDirItem()
793 appendToDir(
this,kTRUE) ;
794 initialize(other._wgtVar?other._wgtVar->GetName():0) ;
801 RooDataSet::RooDataSet(
const char *name,
const char *title, RooDataSet *dset,
802 const RooArgSet& vars,
const RooFormulaVar* cutVar,
const char* cutRange,
803 Int_t nStart, Int_t nStop, Bool_t copyCache,
const char* wgtVarName) :
804 RooAbsData(name,title,vars)
807 (defaultStorageType == Tree)
808 ? ((RooAbsDataStore *)
new RooTreeDataStore(name, title, *dset->_dstore, _vars, cutVar, cutRange, nStart, nStop,
809 copyCache, wgtVarName))
815 ((RooAbsDataStore *)
new RooVectorDataStore(name, title, *dset->_dstore, _vars, cutVar, cutRange, nStart,
816 nStop, copyCache, wgtVarName)));
818 _cachedVars.add(_dstore->cachedVars());
820 appendToDir(
this, kTRUE);
821 initialize(dset->_wgtVar ? dset->_wgtVar->GetName() : 0);
830 RooArgSet RooDataSet::addWgtVar(
const RooArgSet& origVars,
const RooAbsArg* wgtVar)
832 RooArgSet tmp(origVars) ;
833 if (wgtVar) tmp.add(*wgtVar) ;
842 RooAbsData* RooDataSet::cacheClone(
const RooAbsArg* newCacheOwner,
const RooArgSet* newCacheVars,
const char* newName)
844 RooDataSet* dset =
new RooDataSet(newName?newName:GetName(),GetTitle(),
this,_vars,(RooFormulaVar*)0,0,0,2000000000,kTRUE,_wgtVar?_wgtVar->GetName():0) ;
847 RooArgSet* selCacheVars = (RooArgSet*) newCacheVars->selectCommon(dset->_cachedVars) ;
848 dset->attachCache(newCacheOwner, *selCacheVars) ;
849 delete selCacheVars ;
860 RooAbsData* RooDataSet::emptyClone(
const char* newName,
const char* newTitle,
const RooArgSet* vars,
const char* wgtVarName)
const
864 RooRealVar* tmpWgtVar = _wgtVar ;
865 if (wgtVarName && vars && !_wgtVar) {
866 tmpWgtVar = (RooRealVar*) vars->find(wgtVarName) ;
871 if (_wgtVar && !vars2.find(_wgtVar->GetName())) {
872 vars2.add(*_wgtVar) ;
878 RooDataSet* dset =
new RooDataSet(newName?newName:GetName(),newTitle?newTitle:GetTitle(),vars2,tmpWgtVar?tmpWgtVar->GetName():0) ;
889 void RooDataSet::initialize(
const char* wgtVarName)
891 _varsNoWgt.removeAll() ;
892 _varsNoWgt.add(_vars) ;
895 RooAbsArg* wgt = _varsNoWgt.find(wgtVarName) ;
897 coutW(DataHandling) <<
"RooDataSet::RooDataSet(" << GetName() <<
") WARNING: designated weight variable "
898 << wgtVarName <<
" not found in set of variables, no weighting will be assigned" << endl ;
899 }
else if (!dynamic_cast<RooRealVar*>(wgt)) {
900 coutW(DataHandling) <<
"RooDataSet::RooDataSet(" << GetName() <<
") WARNING: designated weight variable "
901 << wgtVarName <<
" is not of type RooRealVar, no weighting will be assigned" << endl ;
903 _varsNoWgt.remove(*wgt) ;
904 _wgtVar = (RooRealVar*) wgt ;
914 RooAbsData* RooDataSet::reduceEng(
const RooArgSet& varSubset,
const RooFormulaVar* cutVar,
const char* cutRange,
915 Int_t nStart, Int_t nStop, Bool_t copyCache)
921 RooArgSet tmp(varSubset) ;
925 RooDataSet* ret =
new RooDataSet(GetName(), GetTitle(),
this, tmp, cutVar, cutRange, nStart, nStop, copyCache,_wgtVar?_wgtVar->GetName():0) ;
940 RooDataSet::~RooDataSet()
942 removeFromDir(
this) ;
951 RooDataHist* RooDataSet::binnedClone(
const char* newName,
const char* newTitle)
const
953 TString title, name ;
957 name = Form(
"%s_binned",GetName()) ;
962 title = Form(
"%s_binned",GetTitle()) ;
965 return new RooDataHist(name,title,*
get(),*
this) ;
973 Double_t RooDataSet::weight()
const
975 return store()->weight() ;
983 Double_t RooDataSet::weightSquared()
const
985 return store()->weight()*store()->weight() ;
993 RooSpan<const double> RooDataSet::getWeightBatch(std::size_t first, std::size_t last)
const {
994 return _dstore->getWeightBatch(first, last);
1000 void RooDataSet::weightError(Double_t& lo, Double_t& hi, ErrorType etype)
const
1002 store()->weightError(lo,hi,etype) ;
1009 Double_t RooDataSet::weightError(ErrorType etype)
const
1011 return store()->weightError(etype) ;
1019 const RooArgSet* RooDataSet::get(Int_t index)
const
1021 const RooArgSet* ret = RooAbsData::get(index) ;
1022 return ret ? &_varsNoWgt : 0 ;
1028 Double_t RooDataSet::sumEntries()
const
1030 return store()->sumEntries() ;
1035 if (!isWeighted()) {
1036 return numEntries() ;
1040 Double_t sumw(0), carry(0);
1042 for (i=0 ; i<numEntries() ; i++) {
1044 Double_t y = weight() - carry;
1045 Double_t t = sumw + y;
1046 carry = (t - sumw) - y;
1058 Double_t RooDataSet::sumEntries(
const char* cutSpec,
const char* cutRange)
const
1061 RooFormula* select = 0 ;
1062 if (cutSpec && strlen(cutSpec) > 0) {
1063 select =
new RooFormula(
"select",cutSpec,*
get()) ;
1067 if (!select && !cutRange && !isWeighted()) {
1068 return numEntries() ;
1072 Double_t sumw(0), carry(0);
1074 for (i=0 ; i<numEntries() ; i++) {
1076 if (select && select->eval()==0.) continue ;
1077 if (cutRange && !_vars.allInRange(cutRange))
continue ;
1078 Double_t y = weight() - carry;
1079 Double_t t = sumw + y;
1080 carry = (t - sumw) - y;
1084 if (select)
delete select ;
1095 Bool_t RooDataSet::isWeighted()
const
1097 return store()->isWeighted() ;
1105 Bool_t RooDataSet::isNonPoissonWeighted()
const
1108 if (!_wgtVar)
return kFALSE ;
1111 for (
int i=0 ; i<numEntries() ; i++) {
1113 if (fabs(weight()-Int_t(weight()))>1e-10)
return kTRUE ;
1116 if (sumEntries()<numEntries())
return kTRUE ;
1127 const RooArgSet* RooDataSet::get()
const
1129 return &_varsNoWgt ;
1145 void RooDataSet::add(
const RooArgSet& data, Double_t wgt, Double_t wgtError)
1149 const double oldW = _wgtVar ? _wgtVar->getVal() : 0.;
1154 _wgtVar->setVal(wgt) ;
1156 _wgtVar->setError(wgtError) ;
1158 }
else if ((wgt != 1. || wgtError != 0.) && _errorMsgCount < 5) {
1159 ccoutE(DataHandling) <<
"An event weight/error was passed but no weight variable was defined"
1160 <<
" in the dataset '" << GetName() <<
"'. The weight will be ignored." << std::endl;
1164 if (_wgtVar && _doWeightErrorCheck
1166 && fabs(wgt*wgt - wgtError)/wgtError > 1.E-15
1167 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreError")) {
1168 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" << GetName()
1169 <<
"', but the weight variable '" << _wgtVar->GetName()
1170 <<
"' does not store errors. Check `StoreError` in the RooDataSet constructor." << std::endl;
1178 _wgtVar->setVal(oldW);
1179 _wgtVar->removeError();
1197 void RooDataSet::add(
const RooArgSet& indata, Double_t inweight, Double_t weightErrorLo, Double_t weightErrorHi)
1201 const double oldW = _wgtVar ? _wgtVar->getVal() : 0.;
1203 _varsNoWgt = indata;
1205 _wgtVar->setVal(inweight) ;
1206 _wgtVar->setAsymError(weightErrorLo,weightErrorHi) ;
1207 }
else if (inweight != 1. && _errorMsgCount < 5) {
1208 ccoutE(DataHandling) <<
"An event weight was given but no weight variable was defined"
1209 <<
" in the dataset '" << GetName() <<
"'. The weight will be ignored." << std::endl;
1213 if (_wgtVar && _doWeightErrorCheck
1214 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreAsymError")) {
1215 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" << GetName()
1216 <<
"', but the weight variable '" << _wgtVar->GetName()
1217 <<
"' does not store errors. Check `StoreAsymError` in the RooDataSet constructor." << std::endl;
1225 _wgtVar->setVal(oldW);
1226 _wgtVar->removeAsymError();
1247 void RooDataSet::addFast(
const RooArgSet& data, Double_t wgt, Double_t wgtError)
1251 const double oldW = _wgtVar ? _wgtVar->getVal() : 0.;
1253 _varsNoWgt.assignFast(data,_dstore->dirtyProp());
1255 _wgtVar->setVal(wgt) ;
1257 _wgtVar->setError(wgtError) ;
1259 }
else if (wgt != 1. && _errorMsgCount < 5) {
1260 ccoutE(DataHandling) <<
"An event weight was given but no weight variable was defined"
1261 <<
" in the dataset '" << GetName() <<
"'. The weight will be ignored." << std::endl;
1267 if (_wgtVar && _doWeightErrorCheck
1268 && wgtError != 0. && wgtError != wgt*wgt
1269 && _errorMsgCount < 5 && !_wgtVar->getAttribute(
"StoreError")) {
1270 coutE(DataHandling) <<
"An event weight error was passed to the RooDataSet '" << GetName()
1271 <<
"', but the weight variable '" << _wgtVar->GetName()
1272 <<
"' does not store errors. Check `StoreError` in the RooDataSet constructor." << std::endl;
1275 if (_wgtVar && _doWeightErrorCheck) {
1276 _doWeightErrorCheck =
false;
1280 _wgtVar->setVal(oldW);
1281 _wgtVar->removeError();
1289 Bool_t RooDataSet::merge(RooDataSet* data1, RooDataSet* data2, RooDataSet* data3,
1290 RooDataSet* data4, RooDataSet* data5, RooDataSet* data6)
1293 list<RooDataSet*> dsetList ;
1294 if (data1) dsetList.push_back(data1) ;
1295 if (data2) dsetList.push_back(data2) ;
1296 if (data3) dsetList.push_back(data3) ;
1297 if (data4) dsetList.push_back(data4) ;
1298 if (data5) dsetList.push_back(data5) ;
1299 if (data6) dsetList.push_back(data6) ;
1300 return merge(dsetList) ;
1311 Bool_t RooDataSet::merge(list<RooDataSet*>dsetList)
1316 for (list<RooDataSet*>::iterator iter = dsetList.begin() ; iter != dsetList.end() ; ++iter) {
1317 if (numEntries()!=(*iter)->numEntries()) {
1318 coutE(InputArguments) <<
"RooDataSet::merge(" << GetName() <<
") ERROR: datasets have different size" << endl ;
1324 list<RooAbsDataStore*> dstoreList ;
1325 for (list<RooDataSet*>::iterator iter = dsetList.begin() ; iter != dsetList.end() ; ++iter) {
1326 _vars.addClone((*iter)->_vars,kTRUE) ;
1327 dstoreList.push_back((*iter)->store()) ;
1331 RooAbsDataStore* mergedStore = _dstore->merge(_vars,dstoreList) ;
1332 mergedStore->SetName(_dstore->GetName()) ;
1333 mergedStore->SetTitle(_dstore->GetTitle()) ;
1337 _dstore = mergedStore ;
1339 initialize(_wgtVar?_wgtVar->GetName():0) ;
1349 void RooDataSet::append(RooDataSet& data)
1352 _dstore->append(*data._dstore) ;
1364 RooAbsArg* RooDataSet::addColumn(RooAbsArg& var, Bool_t adjustRange)
1367 RooAbsArg* ret = _dstore->addColumn(var,adjustRange) ;
1368 _vars.addOwned(*ret) ;
1369 initialize(_wgtVar?_wgtVar->GetName():0) ;
1381 RooArgSet* RooDataSet::addColumns(
const RooArgList& varList)
1384 RooArgSet* ret = _dstore->addColumns(varList) ;
1385 _vars.addOwned(*ret) ;
1386 initialize(_wgtVar?_wgtVar->GetName():0) ;
1400 TH2F* RooDataSet::createHistogram(
const RooAbsRealLValue& var1,
const RooAbsRealLValue& var2,
const char* cuts,
const char *name)
const
1403 return createHistogram(var1, var2, var1.getBins(), var2.getBins(), cuts, name);
1416 TH2F* RooDataSet::createHistogram(
const RooAbsRealLValue& var1,
const RooAbsRealLValue& var2,
1417 Int_t nx, Int_t ny,
const char* cuts,
const char *name)
const
1420 static Int_t counter(0) ;
1422 Bool_t ownPlotVarX(kFALSE) ;
1424 RooAbsReal* plotVarX= (RooAbsReal*)_vars.find(var1.GetName());
1427 if (!var1.dependsOn(_vars)) {
1428 coutE(InputArguments) << GetName() <<
"::createHistogram: Argument " << var1.GetName()
1429 <<
" is not in dataset and is also not dependent on data set" << endl ;
1434 plotVarX = (RooAbsReal*) var1.Clone() ;
1435 ownPlotVarX = kTRUE ;
1438 plotVarX->redirectServers(const_cast<RooArgSet&>(_vars)) ;
1441 Bool_t ownPlotVarY(kFALSE) ;
1443 RooAbsReal* plotVarY= (RooAbsReal*)_vars.find(var2.GetName());
1446 if (!var2.dependsOn(_vars)) {
1447 coutE(InputArguments) << GetName() <<
"::createHistogram: Argument " << var2.GetName()
1448 <<
" is not in dataset and is also not dependent on data set" << endl ;
1453 plotVarY = (RooAbsReal*) var2.Clone() ;
1454 ownPlotVarY = kTRUE ;
1457 plotVarY->redirectServers(const_cast<RooArgSet&>(_vars)) ;
1461 RooFormula* select = 0;
1462 if(0 != cuts && strlen(cuts)) {
1463 select=
new RooFormula(cuts,cuts,_vars);
1464 if (!select || !select->ok()) {
1470 TString histName(name);
1471 histName.Prepend(
"_");
1472 histName.Prepend(fName);
1473 histName.Append(
"_") ;
1474 histName.Append(Form(
"%08x",counter++)) ;
1477 TH2F* histogram=
new TH2F(histName.Data(),
"Events", nx, var1.getMin(), var1.getMax(),
1478 ny, var2.getMin(), var2.getMax());
1480 coutE(DataHandling) << fName <<
"::createHistogram: unable to create a new histogram" << endl;
1485 Int_t nevent= numEntries() ;
1486 for(Int_t i=0; i < nevent; ++i)
1490 if (select && select->eval()==0)
continue ;
1491 histogram->Fill(plotVarX->getVal(), plotVarY->getVal(),weight()) ;
1494 if (ownPlotVarX)
delete plotVarX ;
1495 if (ownPlotVarY)
delete plotVarY ;
1496 if (select)
delete select ;
1526 RooPlot* RooDataSet::plotOnXY(RooPlot* frame,
const RooCmdArg& arg1,
const RooCmdArg& arg2,
1527 const RooCmdArg& arg3,
const RooCmdArg& arg4,
1528 const RooCmdArg& arg5,
const RooCmdArg& arg6,
1529 const RooCmdArg& arg7,
const RooCmdArg& arg8)
const
1533 RooLinkedList argList ;
1534 argList.Add((TObject*)&arg1) ; argList.Add((TObject*)&arg2) ;
1535 argList.Add((TObject*)&arg3) ; argList.Add((TObject*)&arg4) ;
1536 argList.Add((TObject*)&arg5) ; argList.Add((TObject*)&arg6) ;
1537 argList.Add((TObject*)&arg7) ; argList.Add((TObject*)&arg8) ;
1540 RooCmdConfig pc(Form(
"RooDataSet::plotOnXY(%s)",GetName())) ;
1541 pc.defineString(
"drawOption",
"DrawOption",0,
"P") ;
1542 pc.defineString(
"histName",
"Name",0,
"") ;
1543 pc.defineInt(
"lineColor",
"LineColor",0,-999) ;
1544 pc.defineInt(
"lineStyle",
"LineStyle",0,-999) ;
1545 pc.defineInt(
"lineWidth",
"LineWidth",0,-999) ;
1546 pc.defineInt(
"markerColor",
"MarkerColor",0,-999) ;
1547 pc.defineInt(
"markerStyle",
"MarkerStyle",0,8) ;
1548 pc.defineDouble(
"markerSize",
"MarkerSize",0,-999) ;
1549 pc.defineInt(
"fillColor",
"FillColor",0,-999) ;
1550 pc.defineInt(
"fillStyle",
"FillStyle",0,-999) ;
1551 pc.defineInt(
"histInvisible",
"Invisible",0,0) ;
1552 pc.defineDouble(
"scaleFactor",
"Rescale",0,1.) ;
1553 pc.defineObject(
"xvar",
"XVar",0,0) ;
1554 pc.defineObject(
"yvar",
"YVar",0,0) ;
1558 pc.process(argList) ;
1559 if (!pc.ok(kTRUE)) {
1564 const char* drawOptions = pc.getString(
"drawOption") ;
1565 Int_t histInvisible = pc.getInt(
"histInvisible") ;
1566 const char* histName = pc.getString(
"histName",0,kTRUE) ;
1567 Double_t scaleFactor = pc.getDouble(
"scaleFactor") ;
1569 RooRealVar* xvar = (RooRealVar*) _vars.find(frame->getPlotVar()->GetName()) ;
1572 RooRealVar* yvar = (RooRealVar*)(pc.getObject(
"yvar")) ;
1575 if (!_wgtVar && !yvar) {
1576 coutE(InputArguments) <<
"RooDataSet::plotOnXY(" << GetName() <<
") ERROR: no YVar() argument specified and dataset is not weighted" << endl ;
1580 RooRealVar* dataY = yvar ? (RooRealVar*) _vars.find(yvar->GetName()) : 0 ;
1581 if (yvar && !dataY) {
1582 coutE(InputArguments) <<
"RooDataSet::plotOnXY(" << GetName() <<
") ERROR on YVar() argument, dataset does not contain a variable named " << yvar->GetName() << endl ;
1588 RooHist* graph =
new RooHist ;
1590 graph->SetName(histName) ;
1592 graph->SetName(Form(
"hxy_%s",GetName())) ;
1595 for (
int i=0 ; i<numEntries() ; i++) {
1597 Double_t x = xvar->getVal() ;
1598 Double_t exlo = xvar->getErrorLo() ;
1599 Double_t exhi = xvar->getErrorHi() ;
1600 Double_t y,eylo,eyhi ;
1603 weightError(eylo,eyhi) ;
1605 y = dataY->getVal() ;
1606 eylo = dataY->getErrorLo() ;
1607 eyhi = dataY->getErrorHi() ;
1609 graph->addBinWithXYError(x,y,-1*exlo,exhi,-1*eylo,eyhi,scaleFactor) ;
1613 Int_t lineColor = pc.getInt(
"lineColor") ;
1614 Int_t lineStyle = pc.getInt(
"lineStyle") ;
1615 Int_t lineWidth = pc.getInt(
"lineWidth") ;
1616 Int_t markerColor = pc.getInt(
"markerColor") ;
1617 Int_t markerStyle = pc.getInt(
"markerStyle") ;
1618 Size_t markerSize = pc.getDouble(
"markerSize") ;
1619 Int_t fillColor = pc.getInt(
"fillColor") ;
1620 Int_t fillStyle = pc.getInt(
"fillStyle") ;
1622 if (lineColor!=-999) graph->SetLineColor(lineColor) ;
1623 if (lineStyle!=-999) graph->SetLineStyle(lineStyle) ;
1624 if (lineWidth!=-999) graph->SetLineWidth(lineWidth) ;
1625 if (markerColor!=-999) graph->SetMarkerColor(markerColor) ;
1626 if (markerStyle!=-999) graph->SetMarkerStyle(markerStyle) ;
1627 if (markerSize!=-999) graph->SetMarkerSize(markerSize) ;
1628 if (fillColor!=-999) graph->SetFillColor(fillColor) ;
1629 if (fillStyle!=-999) graph->SetFillStyle(fillStyle) ;
1632 frame->addPlotable(graph,drawOptions,histInvisible) ;
1688 RooDataSet *RooDataSet::read(
const char *fileList,
const RooArgList &varList,
1689 const char *verbOpt,
const char* commonPath,
1690 const char* indexCatName) {
1692 RooArgList variables(varList) ;
1695 Bool_t ownIsBlind(kTRUE) ;
1696 RooAbsArg* blindState = variables.find(
"blindState") ;
1698 blindState =
new RooCategory(
"blindState",
"Blinding State") ;
1699 variables.add(*blindState) ;
1701 ownIsBlind = kFALSE ;
1702 if (blindState->IsA()!=RooCategory::Class()) {
1703 oocoutE((TObject*)0,DataHandling) <<
"RooDataSet::read: ERROR: variable list already contains"
1704 <<
"a non-RooCategory blindState member" << endl ;
1707 oocoutW((TObject*)0,DataHandling) <<
"RooDataSet::read: WARNING: recycling existing "
1708 <<
"blindState category in variable list" << endl ;
1710 RooCategory* blindCat = (RooCategory*) blindState ;
1713 blindCat->setAttribute(
"Dynamic") ;
1714 blindCat->defineType(
"Normal",0) ;
1715 blindCat->defineType(
"Blind",1) ;
1718 TString opts= verbOpt;
1720 Bool_t verbose= !opts.Contains(
"q");
1721 Bool_t debug= opts.Contains(
"d");
1723 RooDataSet *data=
new RooDataSet(
"dataset", fileList, variables);
1724 if (ownIsBlind) { variables.remove(*blindState) ;
delete blindState ; }
1726 oocoutE((TObject*)0,DataHandling) <<
"RooDataSet::read: unable to create a new dataset"
1732 blindCat = (RooCategory*) data->_vars.find(
"blindState") ;
1735 RooCategory *indexCat = 0;
1739 tmp = data->_vars.find(indexCatName) ;
1741 oocoutE((TObject*)0,DataHandling) <<
"RooDataSet::read: no index category named "
1742 << indexCatName <<
" in supplied variable list" << endl ;
1745 if (tmp->IsA()!=RooCategory::Class()) {
1746 oocoutE((TObject*)0,DataHandling) <<
"RooDataSet::read: variable " << indexCatName
1747 <<
" is not a RooCategory" << endl ;
1750 indexCat = (RooCategory*)tmp ;
1753 indexCat->setAttribute(
"Dynamic") ;
1757 Int_t outOfRange(0) ;
1760 char fileList2[64000];
1761 strlcpy(fileList2, fileList, 64000);
1764 char *filename = strtok(fileList2,
", ") ;
1765 Int_t fileSeqNum(0) ;
1771 char *catname = strchr(filename,
':') ;
1778 const RooCatType* type = indexCat->lookupType(catname,kFALSE) ;
1781 indexCat->setIndex(type->getVal()) ;
1784 indexCat->defineType(catname,fileSeqNum) ;
1785 indexCat->setIndex(fileSeqNum) ;
1789 char newLabel[128] ;
1790 snprintf(newLabel,128,
"file%03d",fileSeqNum) ;
1791 if (indexCat->defineType(newLabel,fileSeqNum)) {
1792 oocoutE((TObject*)0,DataHandling) <<
"RooDataSet::read: Error, cannot register automatic type name " << newLabel
1793 <<
" in index category " << indexCat->GetName() << endl ;
1797 indexCat->setIndex(fileSeqNum) ;
1801 oocoutI((TObject*)0,DataHandling) <<
"RooDataSet::read: reading file " << filename << endl ;
1804 TString fullName(commonPath) ;
1805 fullName.Append(filename) ;
1806 ifstream file(fullName) ;
1809 oocoutW((TObject*)0,DataHandling) <<
"RooDataSet::read: unable to open '"
1810 << filename <<
"', skipping" << endl;
1815 Bool_t haveBlindString(
false) ;
1817 while(file.good() && !file.eof()) {
1819 if(debug) oocxcoutD((TObject*)0,DataHandling) <<
"reading line " << line << endl;
1822 if (file.peek() ==
'#')
1824 if(debug) oocxcoutD((TObject*)0,DataHandling) <<
"skipping comment on line " << line << endl;
1832 Bool_t readError = variables.readFromStream(file,kTRUE,verbose) ;
1833 data->_vars = variables ;
1837 if(file.eof())
break ;
1839 oocoutE((TObject*)0,DataHandling) <<
"RooDataSet::read(static): read error at line " << line << endl ;
1847 blindCat->setIndex(haveBlindString) ;
1855 filename = strtok(0,
" ,") ;
1861 RooCategory* origIndexCat = (RooCategory*) variables.find(indexCatName) ;
1862 for (
const auto type : *indexCat) {
1863 origIndexCat->defineType(type->GetName(), type->getVal());
1866 oocoutI((TObject*)0,DataHandling) <<
"RooDataSet::read: read " << data->numEntries()
1867 <<
" events (ignored " << outOfRange <<
" out of range events)" << endl;
1880 Bool_t RooDataSet::write(
const char* filename)
const
1883 ofstream ofs(filename) ;
1885 coutE(DataHandling) <<
"RooDataSet::write(" << GetName() <<
") cannot create file " << filename << endl ;
1890 coutI(DataHandling) <<
"RooDataSet::write(" << GetName() <<
") writing ASCII file " << filename << endl ;
1900 Bool_t RooDataSet::write(ostream & ofs)
const {
1903 for (Int_t i=0; i<numEntries(); ++i) {
1904 get(i)->writeToStream(ofs,kTRUE);
1908 coutW(DataHandling) <<
"RooDataSet::write(" << GetName() <<
"): WARNING error(s) have occured in writing" << endl ;
1921 void RooDataSet::printMultiline(ostream& os, Int_t contents, Bool_t verbose, TString indent)
const
1924 RooAbsData::printMultiline(os,contents,verbose,indent) ;
1926 os << indent <<
" Dataset variable \"" << _wgtVar->GetName() <<
"\" is interpreted as the event weight" << endl ;
1934 void RooDataSet::printValue(ostream& os)
const
1936 os << numEntries() <<
" entries" ;
1938 os <<
" (" << sumEntries() <<
" weighted)" ;
1947 void RooDataSet::printArgs(ostream& os)
const
1950 TIterator* iter = _varsNoWgt.createIterator() ;
1952 Bool_t first(kTRUE) ;
1953 while((arg=(RooAbsArg*)iter->Next())) {
1959 os << arg->GetName() ;
1962 os <<
",weight:" << _wgtVar->GetName() ;
1973 void RooDataSet::SetName(
const char *name)
1975 if (_dir) _dir->GetList()->Remove(
this);
1976 TNamed::SetName(name) ;
1977 if (_dir) _dir->GetList()->Add(
this);
1984 void RooDataSet::SetNameTitle(
const char *name,
const char* title)
1986 if (_dir) _dir->GetList()->Remove(
this);
1987 TNamed::SetNameTitle(name,title) ;
1988 if (_dir) _dir->GetList()->Add(
this);
1995 void RooDataSet::Streamer(TBuffer &R__b)
1997 if (R__b.IsReading()) {
2000 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
2005 R__b.ReadClassBuffer(RooDataSet::Class(),
this,R__v,R__s,R__c);
2015 UInt_t R__s1, R__c1;
2016 Version_t R__v1 = R__b.ReadVersion(&R__s1, &R__c1);
if (R__v1) { }
2018 RooAbsData::Streamer(R__b);
2019 TTree* X_tree(0) ; R__b >> X_tree;
2020 RooArgSet X_truth ; X_truth.Streamer(R__b);
2021 TString X_blindString ; X_blindString.Streamer(R__b);
2022 R__b.CheckByteCount(R__s1, R__c1, RooTreeData::Class());
2026 _dstore =
new RooTreeDataStore(X_tree,_vars) ;
2027 _dstore->SetName(GetName()) ;
2028 _dstore->SetTitle(GetTitle()) ;
2029 _dstore->checkInit() ;
2032 RooDirItem::Streamer(R__b);
2033 _varsNoWgt.Streamer(R__b);
2035 R__b.CheckByteCount(R__s, R__c, RooDataSet::IsA());
2040 R__b.WriteClassBuffer(RooDataSet::Class(),
this);
2049 void RooDataSet::convertToTreeStore()
2051 if (storageType != RooAbsData::Tree) {
2052 RooTreeDataStore *newStore =
new RooTreeDataStore(GetName(), GetTitle(), _vars, *_dstore,
nullptr, _wgtVar ? _wgtVar->GetName() :
nullptr);
2055 storageType = RooAbsData::Tree;