64 ClassImp(RooTreeDataStore);
67 Int_t RooTreeDataStore::_defTreeBufSize = 10*1024*1024;
73 RooTreeDataStore::RooTreeDataStore() :
91 RooTreeDataStore::RooTreeDataStore(TTree* t,
const RooArgSet& vars,
const char* wgtVarName) :
92 RooAbsDataStore(
"blah",
"blah",varsNoWeight(vars,wgtVarName)),
98 _wgtVar(weightVar(vars,wgtVarName)),
108 RooTreeDataStore::RooTreeDataStore(
const char* name,
const char* title,
const RooArgSet& vars,
const char* wgtVarName) :
109 RooAbsDataStore(name,title,varsNoWeight(vars,wgtVarName)),
115 _wgtVar(weightVar(vars,wgtVarName)),
129 RooTreeDataStore::RooTreeDataStore(
const char* name,
const char* title,
const RooArgSet& vars, TTree& t,
const RooFormulaVar& select,
const char* wgtVarName) :
130 RooAbsDataStore(name,title,varsNoWeight(vars,wgtVarName)),
136 _wgtVar(weightVar(vars,wgtVarName)),
143 loadValues(&t,&select) ;
150 RooTreeDataStore::RooTreeDataStore(
const char* name,
const char* title,
const RooArgSet& vars, TTree& t,
const char* selExpr,
const char* wgtVarName) :
151 RooAbsDataStore(name,title,varsNoWeight(vars,wgtVarName)),
157 _wgtVar(weightVar(vars,wgtVarName)),
165 if (selExpr && *selExpr) {
167 RooFormulaVar select(selExpr,selExpr,_vars) ;
168 loadValues(&t,&select);
178 RooTreeDataStore::RooTreeDataStore(
const char* name,
const char* title,
const RooArgSet& vars,
const RooAbsDataStore& tds,
const RooFormulaVar& select,
const char* wgtVarName) :
179 RooAbsDataStore(name,title,varsNoWeight(vars,wgtVarName)),
185 _wgtVar(weightVar(vars,wgtVarName)),
192 loadValues(&tds,&select) ;
199 RooTreeDataStore::RooTreeDataStore(
const char* name,
const char* title,
const RooArgSet& vars,
const RooAbsDataStore& ads,
const char* selExpr,
const char* wgtVarName) :
200 RooAbsDataStore(name,title,varsNoWeight(vars,wgtVarName)),
206 _wgtVar(weightVar(vars,wgtVarName)),
214 if (selExpr && *selExpr) {
216 RooFormulaVar select(selExpr,selExpr,_vars) ;
217 loadValues(&ads,&select);
228 RooTreeDataStore::RooTreeDataStore(
const char *name,
const char *title, RooAbsDataStore& tds,
229 const RooArgSet& vars,
const RooFormulaVar* cutVar,
const char* cutRange,
230 Int_t nStart, Int_t nStop, Bool_t ,
const char* wgtVarName) :
231 RooAbsDataStore(name,title,varsNoWeight(vars,wgtVarName)), _defCtor(kFALSE),
233 _wgtVar(weightVar(vars,wgtVarName)),
244 createTree(makeTreeName().c_str(), title);
247 RooFormulaVar* cloneVar = 0;
249 cloneVar = (RooFormulaVar*) cutVar->cloneTree() ;
250 cloneVar->attachDataStore(tds) ;
256 attachCache(0,((RooTreeDataStore&)tds)._cachedVars) ;
259 _cacheTree->CopyEntries(((RooTreeDataStore&)tds)._cacheTree) ;
262 loadValues(&tds,cloneVar,cutRange,nStart,nStop);
264 if (cloneVar)
delete cloneVar ;
273 RooArgSet RooTreeDataStore::varsNoWeight(
const RooArgSet& allVars,
const char* wgtName)
275 RooArgSet ret(allVars) ;
277 RooAbsArg* wgt = allVars.find(wgtName) ;
279 ret.remove(*wgt,kTRUE,kTRUE) ;
291 RooRealVar* RooTreeDataStore::weightVar(
const RooArgSet& allVars,
const char* wgtName)
294 RooRealVar* wgt =
dynamic_cast<RooRealVar*
>(allVars.find(wgtName)) ;
307 void RooTreeDataStore::attachCache(
const RooAbsArg* newOwner,
const RooArgSet& cachedVarsIn)
310 _cachedVars.removeAll() ;
311 TIterator* iter = cachedVarsIn.createIterator() ;
313 while((0 != (var= (RooAbsArg*)iter->Next()))) {
314 var->attachToTree(*_cacheTree,_defTreeBufSize) ;
315 _cachedVars.add(*var) ;
318 _cacheOwner = newOwner ;
329 RooTreeDataStore::RooTreeDataStore(
const RooTreeDataStore& other,
const char* newname) :
330 RooAbsDataStore(other,newname),
334 _varsww(other._varsww),
335 _wgtVar(other._wgtVar),
336 _extWgtArray(other._extWgtArray),
337 _extWgtErrLoArray(other._extWgtErrLoArray),
338 _extWgtErrHiArray(other._extWgtErrHiArray),
339 _extSumW2Array(other._extSumW2Array),
340 _curWgt(other._curWgt),
341 _curWgtErrLo(other._curWgtErrLo),
342 _curWgtErrHi(other._curWgtErrHi),
343 _curWgtErr(other._curWgtErr)
352 RooTreeDataStore::RooTreeDataStore(
const RooTreeDataStore& other,
const RooArgSet& vars,
const char* newname) :
353 RooAbsDataStore(other,varsNoWeight(vars,other._wgtVar?other._wgtVar->GetName():0),newname),
358 _wgtVar(other._wgtVar?weightVar(vars,other._wgtVar->GetName()):0),
359 _extWgtArray(other._extWgtArray),
360 _extWgtErrLoArray(other._extWgtErrLoArray),
361 _extWgtErrHiArray(other._extWgtErrHiArray),
362 _extSumW2Array(other._extSumW2Array),
363 _curWgt(other._curWgt),
364 _curWgtErrLo(other._curWgtErrLo),
365 _curWgtErrHi(other._curWgtErrHi),
366 _curWgtErr(other._curWgtErr)
378 RooTreeDataStore::~RooTreeDataStore()
394 void RooTreeDataStore::initialize()
397 createTree(makeTreeName().c_str(), GetTitle());
400 for (
auto var : _varsww) {
401 var->attachToTree(*_tree,_defTreeBufSize) ;
413 void RooTreeDataStore::createTree(
const char* name,
const char* title)
416 _tree =
new TTree(name,title);
417 _tree->ResetBit(kCanDelete);
418 _tree->ResetBit(kMustCleanup);
419 _tree->SetDirectory(
nullptr);
422 TString pwd(gDirectory->GetPath()) ;
423 TString memDir(gROOT->GetName()) ;
424 memDir.Append(
":/") ;
425 Bool_t notInMemNow= (pwd!=memDir) ;
430 gDirectory->cd(memDir) ;
434 _cacheTree =
new TTree((std::string(name) +
"_cacheTree").c_str(), title);
435 _cacheTree->SetDirectory(0) ;
436 gDirectory->RecursiveRemove(_cacheTree) ;
440 gDirectory->cd(pwd) ;
455 void RooTreeDataStore::loadValues(
const TTree *t,
const RooFormulaVar* select,
const char* , Int_t , Int_t )
461 TString pwd(gDirectory->GetPath()) ;
462 TString memDir(gROOT->GetName()) ;
463 memDir.Append(
":/") ;
464 Bool_t notInMemNow= (pwd!=memDir) ;
467 gDirectory->cd(memDir) ;
471 if (dynamic_cast<const TChain*>(t)) {
472 tClone = (TTree*) t->Clone() ;
474 tClone = ((TTree*)t)->CloneTree() ;
478 tClone->SetDirectory(0) ;
481 gDirectory->cd(pwd) ;
485 RooArgSet *sourceArgSet = (RooArgSet*) _varsww.snapshot(kFALSE) ;
488 for (
const auto var : *sourceArgSet) {
489 if (!tClone->GetBranch(var->GetName())) {
490 coutE(InputArguments) <<
"Didn't find a branch in Tree '" << tClone->GetName()
491 <<
"' to read variable '" << var->GetName() <<
"' from."
492 <<
"\n\tNote: Name the RooFit variable the same as the branch." << std::endl;
497 for (
const auto sourceArg : *sourceArgSet) {
498 sourceArg->attachToTree(*tClone,_defTreeBufSize) ;
502 RooFormulaVar* selectClone(0) ;
504 selectClone = (RooFormulaVar*) select->cloneTree() ;
505 selectClone->recursiveRedirectServers(*sourceArgSet) ;
506 selectClone->setOperMode(RooAbsArg::ADirty,kTRUE) ;
510 Int_t numInvalid(0) ;
511 Int_t nevent= (Int_t)tClone->GetEntries();
512 for(Int_t i=0; i < nevent; ++i) {
513 Int_t entryNumber=tClone->GetEntryNumber(i);
514 if (entryNumber<0)
break;
515 tClone->GetEntry(entryNumber,1);
518 Bool_t allOK(kTRUE) ;
519 for (
unsigned int j=0; j < sourceArgSet->size(); ++j) {
520 auto destArg = _varsww[j];
521 const auto sourceArg = (*sourceArgSet)[j];
523 destArg->copyCache(sourceArg) ;
524 sourceArg->copyCache(destArg) ;
525 if (!destArg->isValid()) {
533 if (!allOK || (selectClone && selectClone->getVal()==0)) {
541 coutI(Eval) <<
"RooTreeDataStore::loadValues(" << GetName() <<
") Ignored " << numInvalid <<
" out of range events" << endl ;
544 SetTitle(t->GetTitle());
546 delete sourceArgSet ;
561 void RooTreeDataStore::loadValues(
const RooAbsDataStore *ads,
const RooFormulaVar* select,
562 const char* rangeName, Int_t nStart, Int_t nStop)
565 RooFormulaVar* selectClone(0) ;
567 selectClone = (RooFormulaVar*) select->cloneTree() ;
568 selectClone->recursiveRedirectServers(*ads->get()) ;
569 selectClone->setOperMode(RooAbsArg::ADirty,kTRUE) ;
576 Int_t nevent = nStop < ads->numEntries() ? nStop : ads->numEntries() ;
578 Bool_t isTDS =
dynamic_cast<const RooTreeDataStore*
>(ads) ;
580 ((RooTreeDataStore*)(ads))->resetBuffers() ;
583 std::vector<std::string> ranges;
585 ranges = RooHelpers::tokenise(rangeName,
",");
588 for(Int_t i=nStart; i < nevent ; ++i) {
592 if (selectClone && selectClone->getVal()==0) {
598 _varsww.assignValueOnly(((RooTreeDataStore*)ads)->_varsww) ;
600 _varsww.assignValueOnly(*ads->get()) ;
604 bool allValid =
true;
605 for (
const auto arg : _varsww) {
606 allValid = arg->isValid() && (ranges.empty() || std::any_of(ranges.begin(), ranges.end(),
607 [arg](
const std::string& range){
return arg->inRange(range.c_str());}) );
616 _cachedVars = ((RooTreeDataStore*)ads)->_cachedVars ;
621 ((RooTreeDataStore*)(ads))->restoreAlternateBuffers() ;
625 SetTitle(ads->GetTitle());
634 Bool_t RooTreeDataStore::valid()
const
645 Int_t RooTreeDataStore::fill()
647 return _tree->Fill() ;
657 const RooArgSet* RooTreeDataStore::get(Int_t index)
const
661 Int_t ret = ((RooTreeDataStore*)
this)->GetEntry(index, 1) ;
667 for (
auto var : _vars) {
668 var->setValueDirty();
671 for (
auto var : _cachedVars) {
672 var->setValueDirty();
673 var->clearValueDirty();
681 _curWgt = _extWgtArray[index] ;
682 _curWgtErrLo = _extWgtErrLoArray[index] ;
683 _curWgtErrHi = _extWgtErrHiArray[index] ;
684 _curWgtErr = sqrt(_extSumW2Array[index]) ;
686 }
else if (_wgtVar) {
689 _curWgt = _wgtVar->getVal() ;
690 _curWgtErrLo = _wgtVar->getAsymErrorLo() ;
691 _curWgtErrHi = _wgtVar->getAsymErrorHi() ;
692 _curWgtErr = _wgtVar->hasAsymError() ? ((_wgtVar->getAsymErrorHi() - _wgtVar->getAsymErrorLo())/2) : _wgtVar->getError() ;
712 Double_t RooTreeDataStore::weight(Int_t index)
const
723 Double_t RooTreeDataStore::weight()
const
731 Double_t RooTreeDataStore::weightError(RooAbsData::ErrorType etype)
const
739 weightError(lo,hi,etype) ;
742 }
else if (_wgtVar) {
745 if (_wgtVar->hasAsymError()) {
746 return ( _wgtVar->getAsymErrorHi() - _wgtVar->getAsymErrorLo() ) / 2 ;
748 return _wgtVar->getError() ;
763 void RooTreeDataStore::weightError(Double_t& lo, Double_t& hi, RooAbsData::ErrorType etype)
const
770 case RooAbsData::Auto:
771 throw string(Form(
"RooDataHist::weightError(%s) error type Auto not allowed here",GetName())) ;
774 case RooAbsData::Expected:
775 throw string(Form(
"RooDataHist::weightError(%s) error type Expected not allowed here",GetName())) ;
778 case RooAbsData::Poisson:
780 if (_curWgtErrLo>=0) {
788 RooHistError::instance().getPoissonInterval(Int_t(weight()+0.5),ym,yp,1) ;
793 case RooAbsData::SumW2:
798 case RooAbsData::None:
804 }
else if (_wgtVar) {
807 if (_wgtVar->hasAsymError()) {
808 hi = _wgtVar->getAsymErrorHi() ;
809 lo = _wgtVar->getAsymErrorLo() ;
811 hi = _wgtVar->getError() ;
812 lo = _wgtVar->getError() ;
828 Bool_t RooTreeDataStore::changeObservableName(
const char* from,
const char* to)
831 RooAbsArg* var = _vars.find(from) ;
835 coutE(InputArguments) <<
"RooTreeDataStore::changeObservableName(" << GetName() <<
" no observable " << from <<
" in this dataset" << endl ;
840 TString oldBranchName = var->cleanBranchName() ;
844 if (_tree->GetBranch(oldBranchName.Data())) {
847 _tree->GetBranch(oldBranchName.Data())->SetName(var->cleanBranchName().Data()) ;
850 if (_tree->GetBranch(Form(
"%s_err",oldBranchName.Data()))) {
851 _tree->GetBranch(Form(
"%s_err",oldBranchName.Data()))->SetName(Form(
"%s_err",var->cleanBranchName().Data())) ;
853 if (_tree->GetBranch(Form(
"%s_aerr_lo",oldBranchName.Data()))) {
854 _tree->GetBranch(Form(
"%s_aerr_lo",oldBranchName.Data()))->SetName(Form(
"%s_aerr_lo",var->cleanBranchName().Data())) ;
856 if (_tree->GetBranch(Form(
"%s_aerr_hi",oldBranchName.Data()))) {
857 _tree->GetBranch(Form(
"%s_aerr_hi",oldBranchName.Data()))->SetName(Form(
"%s_aerr_hi",var->cleanBranchName().Data())) ;
863 if (_tree->GetBranch(Form(
"%s_idx",oldBranchName.Data()))) {
864 _tree->GetBranch(Form(
"%s_idx",oldBranchName.Data()))->SetName(Form(
"%s_idx",var->cleanBranchName().Data())) ;
866 if (_tree->GetBranch(Form(
"%s_lbl",oldBranchName.Data()))) {
867 _tree->GetBranch(Form(
"%s_lbl",oldBranchName.Data()))->SetName(Form(
"%s_lb",var->cleanBranchName().Data())) ;
898 RooAbsArg* RooTreeDataStore::addColumn(RooAbsArg& newVar, Bool_t adjustRange)
903 RooAbsArg* valHolder= newVar.createFundamental();
905 if(!valHolder->isFundamental()) {
906 coutE(InputArguments) << GetName() <<
"::addColumn: holder argument is not fundamental: \""
907 << valHolder->GetName() <<
"\"" << endl;
915 RooAbsArg* newVarClone = newVar.cloneTree() ;
916 newVarClone->recursiveRedirectServers(_vars,kFALSE) ;
919 ((RooAbsArg*)valHolder)->attachToTree(*_tree,_defTreeBufSize) ;
920 _vars.add(*valHolder) ;
921 _varsww.add(*valHolder) ;
925 for (
int i=0 ; i<GetEntries() ; i++) {
928 newVarClone->syncCache(&_vars) ;
929 valHolder->copyCache(newVarClone) ;
930 valHolder->fillTreeBranch(*_tree) ;
934 restoreAlternateBuffers() ;
958 RooArgSet* RooTreeDataStore::addColumns(
const RooArgList& varList)
960 TIterator* vIter = varList.createIterator() ;
967 RooArgSet* holderSet =
new RooArgSet ;
973 while((var=(RooAbsArg*)vIter->Next())) {
975 RooAbsArg* valHolder= var->createFundamental();
976 holderSet->add(*valHolder) ;
979 if(!valHolder->isFundamental()) {
980 coutE(InputArguments) << GetName() <<
"::addColumn: holder argument is not fundamental: \""
981 << valHolder->GetName() <<
"\"" << endl;
986 RooArgSet* newVarCloneList = (RooArgSet*) RooArgSet(*var).snapshot() ;
987 if (!newVarCloneList) {
988 coutE(InputArguments) <<
"RooTreeDataStore::RooTreeData(" << GetName()
989 <<
") Couldn't deep-clone variable " << var->GetName() <<
", abort." << endl ;
992 RooAbsArg* newVarClone = newVarCloneList->find(var->GetName()) ;
993 newVarClone->recursiveRedirectServers(_vars,kFALSE) ;
994 newVarClone->recursiveRedirectServers(*holderSet,kFALSE) ;
996 cloneSetList.Add(newVarCloneList) ;
997 cloneSet.add(*newVarClone) ;
1000 ((RooAbsArg*)valHolder)->attachToTree(*_tree,_defTreeBufSize) ;
1001 _vars.addOwned(*valHolder) ;
1006 TIterator* cIter = cloneSet.createIterator() ;
1007 TIterator* hIter = holderSet->createIterator() ;
1008 RooAbsArg *cloneArg, *holder ;
1010 for (
int i=0 ; i<GetEntries() ; i++) {
1015 while((cloneArg=(RooAbsArg*)cIter->Next())) {
1016 holder = (RooAbsArg*)hIter->Next() ;
1018 cloneArg->syncCache(&_vars) ;
1019 holder->copyCache(cloneArg) ;
1020 holder->fillTreeBranch(*_tree) ;
1025 restoreAlternateBuffers() ;
1030 cloneSetList.Delete() ;
1043 RooAbsDataStore* RooTreeDataStore::merge(
const RooArgSet& allVars, list<RooAbsDataStore*> dstoreList)
1045 RooTreeDataStore* mergedStore =
new RooTreeDataStore(
"merged",
"merged",allVars) ;
1047 Int_t nevt = dstoreList.front()->numEntries() ;
1048 for (
int i=0 ; i<nevt ; i++) {
1051 mergedStore->_vars = *
get(i) ;
1054 for (list<RooAbsDataStore*>::iterator iter = dstoreList.begin() ; iter!=dstoreList.end() ; ++iter) {
1055 const RooArgSet* partSet = (*iter)->get(i) ;
1056 mergedStore->_vars = *partSet ;
1059 mergedStore->fill() ;
1061 return mergedStore ;
1070 void RooTreeDataStore::append(RooAbsDataStore& other)
1072 Int_t nevt = other.numEntries() ;
1073 for (
int i=0 ; i<nevt ; i++) {
1074 _vars = *other.get(i) ;
1076 _wgtVar->setVal(other.weight()) ;
1086 Double_t RooTreeDataStore::sumEntries()
const
1090 Double_t sum(0), carry(0);
1091 Int_t nevt = numEntries() ;
1092 for (
int i=0 ; i<nevt ; i++) {
1095 Double_t y = _wgtVar->getVal() - carry;
1096 Double_t t = sum + y;
1097 carry = (t - sum) - y;
1102 }
else if (_extWgtArray) {
1104 Double_t sum(0) , carry(0);
1105 Int_t nevt = numEntries() ;
1106 for (
int i=0 ; i<nevt ; i++) {
1108 Double_t y = _extWgtArray[i] - carry;
1109 Double_t t = sum + y;
1110 carry = (t - sum) - y;
1117 return numEntries() ;
1127 Int_t RooTreeDataStore::numEntries()
const
1129 return _tree->GetEntries() ;
1136 void RooTreeDataStore::reset()
1151 void RooTreeDataStore::cacheArgs(
const RooAbsArg* owner, RooArgSet& newVarSet,
const RooArgSet* nset, Bool_t )
1155 _cacheOwner = owner ;
1157 RooArgSet* constExprVarSet = (RooArgSet*) newVarSet.selectByAttrib(
"ConstantExpression",kTRUE) ;
1158 TIterator *iter = constExprVarSet->createIterator() ;
1161 Bool_t doTreeFill = (_cachedVars.getSize()==0) ;
1163 while ((arg=(RooAbsArg*)iter->Next())) {
1165 arg->attachToTree(*_cacheTree,_defTreeBufSize) ;
1167 _cachedVars.add(*arg) ;
1174 for (
int i=0 ; i<GetEntries() ; i++) {
1179 while ((arg=(RooAbsArg*)iter->Next())) {
1180 arg->setValueDirty() ;
1181 arg->syncCache(nset) ;
1183 arg->fillTreeBranch(*_cacheTree) ;
1188 _cacheTree->Fill() ;
1196 delete constExprVarSet ;
1206 void RooTreeDataStore::setArgStatus(
const RooArgSet& set, Bool_t active)
1208 TIterator* iter = set.createIterator() ;
1210 while ((arg=(RooAbsArg*)iter->Next())) {
1211 RooAbsArg* depArg = _vars.find(arg->GetName()) ;
1213 coutE(InputArguments) <<
"RooTreeDataStore::setArgStatus(" << GetName()
1214 <<
") dataset doesn't contain variable " << arg->GetName() << endl ;
1217 depArg->setTreeBranchStatus(*_tree,active) ;
1228 void RooTreeDataStore::resetCache()
1231 _cachedVars.removeAll() ;
1236 createTree(makeTreeName().c_str(), GetTitle());
1246 void RooTreeDataStore::attachBuffers(
const RooArgSet& extObs)
1248 _attachedBuffers.removeAll() ;
1249 for (
const auto arg : _varsww) {
1250 RooAbsArg* extArg = extObs.find(arg->GetName()) ;
1252 if (arg->getAttribute(
"StoreError")) {
1253 extArg->setAttribute(
"StoreError") ;
1255 if (arg->getAttribute(
"StoreAsymError")) {
1256 extArg->setAttribute(
"StoreAsymError") ;
1258 extArg->attachToTree(*_tree) ;
1259 _attachedBuffers.add(*extArg) ;
1268 void RooTreeDataStore::resetBuffers()
1270 RooFIter iter = _varsww.fwdIterator() ;
1272 while((arg=iter.next())) {
1273 arg->attachToTree(*_tree) ;
1281 void RooTreeDataStore::restoreAlternateBuffers()
1283 RooFIter iter = _attachedBuffers.fwdIterator() ;
1285 while((arg=iter.next())) {
1286 arg->attachToTree(*_tree) ;
1294 void RooTreeDataStore::checkInit()
const
1297 const_cast<RooTreeDataStore*
>(
this)->initialize() ;
1309 Stat_t RooTreeDataStore::GetEntries()
const
1311 return _tree->GetEntries() ;
1318 void RooTreeDataStore::Reset(Option_t* option)
1320 _tree->Reset(option) ;
1327 Int_t RooTreeDataStore::Fill()
1329 return _tree->Fill() ;
1336 Int_t RooTreeDataStore::GetEntry(Int_t entry, Int_t getall)
1338 Int_t ret1 = _tree->GetEntry(entry,getall) ;
1339 if (!ret1)
return 0 ;
1340 _cacheTree->GetEntry(entry,getall) ;
1347 void RooTreeDataStore::Draw(Option_t* option)
1349 _tree->Draw(option) ;
1355 void RooTreeDataStore::Streamer(TBuffer &R__b)
1357 if (R__b.IsReading()) {
1359 const Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1361 R__b.ReadClassBuffer(RooTreeDataStore::Class(),
this, R__v, R__s, R__c);
1366 TFile* parent =
dynamic_cast<TFile*
>(R__b.GetParent());
1368 parent->GetObject(makeTreeName().c_str(), _tree);
1375 TTree* tmpTree = _tree;
1380 auto tmpDir = _tree->GetDirectory();
1381 TFile* parent =
dynamic_cast<TFile*
>(R__b.GetParent());
1384 _tree->SetDirectory(parent);
1385 _tree->FlushBaskets(
false);
1386 parent->WriteObject(_tree, makeTreeName().c_str());
1387 _tree->SetDirectory(tmpDir);
1391 R__b.WriteClassBuffer(RooTreeDataStore::Class(),
this);
1399 std::string RooTreeDataStore::makeTreeName()
const {
1400 std::string title = GetTitle();
1401 std::replace(title.begin(), title.end(),
' ',
'_');
1402 std::replace(title.begin(), title.end(),
'-',
'_');
1403 return std::string(
"RooTreeDataStore_") + GetName() +
"_" + title;