diff --git a/test/stressEntryList.cxx b/test/stressEntryList.cxx index 8fd7fb38285d9..c9039d2ed650c 100644 --- a/test/stressEntryList.cxx +++ b/test/stressEntryList.cxx @@ -35,7 +35,6 @@ // *******************Deleting the data files**************************** // ********************************************************************** -#include #include #include #include @@ -52,7 +51,6 @@ #include "TFile.h" #include "TSystem.h" #include "TError.h" -#include "snprintf.h" Int_t stressEntryList(Int_t nentries = 10000, Int_t nfiles = 10); void MakeTrees(Int_t nentries, Int_t nfiles); @@ -219,8 +217,10 @@ Bool_t Test2() TCut cut1("cut1", "x>0"); TCut cut2("cut2", "y<0.1 && y>-0.1"); TEntryList *elist1 = new TEntryList("elist1", "elist1"); - chain->Draw(">>elist1", cut1, "entrylist"); TEntryList *elist2 = new TEntryList("elist2", "elist2"); + elist1->SetDirectory(gDirectory); + elist2->SetDirectory(gDirectory); + chain->Draw(">>elist1", cut1, "entrylist"); chain->Draw(">>elist2", cut2, "entrylist"); //add those 2 lists (1+2) @@ -229,6 +229,7 @@ Bool_t Test2() elistsum->Add(elist2); TEntryList *elistcheck = new TEntryList("elistcheck", "elistcheck"); + elistcheck->SetDirectory(gDirectory); chain->Draw(">>elistcheck", cut1 || cut2, "entrylist"); Int_t n=elistcheck->GetN(); @@ -264,6 +265,7 @@ Bool_t Test2() //add by using "+" in TTree::Draw TEntryList *elistsum3 = new TEntryList("elistsum3", "elistsum3"); + elistsum3->SetDirectory(gDirectory); chain->Draw(">>elistsum3", cut1, "entrylist"); chain->Draw(">>+elistsum3", cut2, "entrylist"); wrongentries3 = 0; @@ -282,6 +284,7 @@ Bool_t Test2() elistsum->Subtract(elist2); n = elistsum->GetN(); TEntryList *elistcheck2 = new TEntryList("elistcheck2","elistcheck2"); + elistcheck2->SetDirectory(gDirectory); chain->Draw(">>elistcheck2", cut1 && !cut2, "entrylist"); wrongentries4 = 0; diff --git a/tree/tree/inc/TEntryList.h b/tree/tree/inc/TEntryList.h index 7152e9f7225ed..b6f1312bd5740 100644 --- a/tree/tree/inc/TEntryList.h +++ b/tree/tree/inc/TEntryList.h @@ -28,27 +28,27 @@ class TEntryList: public TNamed TEntryList& operator=(const TEntryList&); // Not implemented protected: - TList *fLists; ///< a list of underlying entry lists for each tree of a chain - TEntryList *fCurrent; ///Append(this); - - fLastIndexQueried = -1; - fLastIndexReturned = 0; - fShift = false; + if (fDirectory) + fDirectory->Append(this); } //////////////////////////////////////////////////////////////////////////////// /// constructor with name and title, which also sets the tree -TEntryList::TEntryList(const char *name, const char *title, const TTree *tree):TNamed(name, title) +TEntryList::TEntryList(const char *name, const char *title, const TTree *tree) : TNamed(name, title) { - fLists = nullptr; - fCurrent = nullptr; - fBlocks = nullptr; - fN = 0; - fNBlocks = 0; - fTreeNumber = -1; TEntryList::SetTree(tree); - fReapply = false; fDirectory = gDirectory; - if (fDirectory) fDirectory->Append(this); - - fLastIndexQueried = -1; - fLastIndexReturned = 0; - fShift = false; + if (fDirectory) + fDirectory->Append(this); } //////////////////////////////////////////////////////////////////////////////// /// c-tor with name and title, which also sets the treename and the filename -TEntryList::TEntryList(const char *name, const char *title, const char *treename, const char *filename) : TNamed(name, title),fEntriesToProcess(0) +TEntryList::TEntryList(const char *name, const char *title, const char *treename, const char *filename) + : TNamed(name, title) { - fLists = nullptr; - fCurrent = nullptr; - fBlocks = nullptr; - fNBlocks = 0; - fN = 0; SetTree(treename, filename); - fTreeNumber = -1; - fReapply = false; fDirectory = gDirectory; - if (fDirectory) fDirectory->Append(this); - - fLastIndexQueried = -1; - fLastIndexReturned = 0; - fShift = false; + if (fDirectory) + fDirectory->Append(this); } //////////////////////////////////////////////////////////////////////////////// /// c-tor, which sets the tree -TEntryList::TEntryList(const TTree *tree) : fEntriesToProcess(0) +TEntryList::TEntryList(const TTree *tree) { - fLists = nullptr; - fCurrent = nullptr; - fBlocks = nullptr; - fNBlocks = 0; - fN = 0; - SetTree(tree); - fTreeNumber = -1; - fReapply = false; fDirectory = gDirectory; - if (fDirectory) fDirectory->Append(this); - - fLastIndexQueried = -1; - fLastIndexReturned = 0; - fShift = false; + if (fDirectory) + fDirectory->Append(this); } //////////////////////////////////////////////////////////////////////////////// /// copy c-tor -TEntryList::TEntryList(const TEntryList &elist) : TNamed(elist) +TEntryList::TEntryList(const TEntryList &elist) + : TNamed(elist), + fNBlocks(elist.fNBlocks), + fN(elist.fN), + fEntriesToProcess(elist.fEntriesToProcess), + fTreeName(elist.fTreeName), + fFileName(elist.fFileName), + fStringHash(elist.fStringHash), + fTreeNumber(elist.fTreeNumber), + fShift(elist.fShift), + fReapply(elist.fReapply) { - fNBlocks = elist.fNBlocks; - fTreeName = elist.fTreeName; - fFileName = elist.fFileName; - fStringHash = elist.fStringHash; - fTreeNumber = elist.fTreeNumber; - fLastIndexQueried = -1; - fLastIndexReturned = 0; - fN = elist.fN; - fShift = elist.fShift; - fLists = nullptr; - fBlocks = nullptr; - fReapply = elist.fReapply; - fCurrent = nullptr; - fEntriesToProcess = elist.fEntriesToProcess; if (elist.fLists){ fLists = new TList(); TEntryList *el1 = nullptr; @@ -320,8 +255,6 @@ TEntryList::TEntryList(const TEntryList &elist) : TNamed(elist) } fCurrent = this; } - fDirectory = nullptr; - } //////////////////////////////////////////////////////////////////////////////// diff --git a/tree/treeplayer/src/TTreeTableInterface.cxx b/tree/treeplayer/src/TTreeTableInterface.cxx index 74ae4839c3191..dd946b96f9b03 100644 --- a/tree/treeplayer/src/TTreeTableInterface.cxx +++ b/tree/treeplayer/src/TTreeTableInterface.cxx @@ -200,6 +200,7 @@ void TTreeTableInterface::SyncFormulas() void TTreeTableInterface::InitEntries() { TEntryList *entrylist = new TEntryList(fTree); + entrylist->SetDirectory(fTree->GetDirectory()); UInt_t ui = 0; Int_t i = 0;