{ //=========Macro generated from canvas: c/c //========= (Tue Jan 23 16:58:56 2007) by ROOT version5.15/01 TCanvas *c = new TCanvas("c", "c",213,172,460,253); c->Range(0,0,1,1); c->SetBorderSize(2); c->SetFrameFillColor(0); TPaveText *pt = new TPaveText(0.00518135,0.810811,0.507772,0.989189,"br"); pt->SetFillColor(19); pt->SetTextColor(4); TText *text = pt->AddText("TEntryList for a TTree"); pt->Draw(); pt = new TPaveText(0.0387597,0.483696,0.307494,0.657609,"br"); pt->SetFillColor(19); text = pt->AddText("TEntryList"); pt->Draw(); pt = new TPaveText(0.0363636,0.107527,0.306494,0.489247,"br"); pt->SetFillColor(19); pt->SetTextFont(42); text = pt->AddText("fBlocks"); text = pt->AddText("fLists = 0"); pt->Draw(); pt = new TPaveText(0.338501,0.23913,0.627907,0.375,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); text = pt->AddText("Info on entries 0-63999"); pt->Draw(); pt = new TPaveText(0.643411,0.23913,0.989664,0.375,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); text = pt->AddText("entries 64000-127999"); pt->Draw(); pt = new TPaveText(0.423773,0.423913,0.870801,0.576087,"br"); pt->SetFillColor(19); text = pt->AddText("TObjArray of TEntryListBlock objects"); pt->Draw(); TArrow *arrow = new TArrow(0.277202,0.356757,0.418605,0.505435,0.05,">"); arrow->SetFillColor(1); arrow->SetFillStyle(1001); arrow->Draw(); return c; }
{ //=========Macro generated from canvas: c/c //========= (Mon Jan 22 19:00:21 2007) by ROOT version5.15/01 TCanvas *c = new TCanvas("c", "c",172,104,447,249); c->Range(0,0,1,1); c->SetBorderSize(2); c->SetFrameFillColor(0); TPaveText *pt = new TPaveText(0.0026738,0.790055,0.417112,0.994475,"br"); pt->SetFillColor(19); pt->SetTextColor(4); TText *text = pt->AddText("TEntryList for a TChain"); pt->Draw(); pt = new TPaveText(0.00802139,0.541436,0.294118,0.701657,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); pt->SetTextFont(42); text = pt->AddText("TEntryList"); pt->Draw(); pt = new TPaveText(0.0106952,0.237569,0.294118,0.546961,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); pt->SetTextFont(42); text = pt->AddText("fBlocks = 0"); text = pt->AddText("fLists"); pt->Draw(); pt = new TPaveText(0.483957,0.607735,0.68984,0.773481,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); pt->SetTextFont(42); text = pt->AddText("TChain"); pt->Draw(); pt = new TPaveText(0.347594,0.475138,0.494652,0.596685,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); pt->SetTextFont(42); text = pt->AddText("TTree_1"); pt->Draw(); pt = new TPaveText(0.508021,0.475138,0.660428,0.59116,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); pt->SetTextFont(42); text = pt->AddText("TTree_2"); pt->Draw(); pt = new TPaveText(0.673797,0.469613,0.826203,0.59116,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); pt->SetTextFont(42); text = pt->AddText("TTree_3"); pt->Draw(); pt = new TPaveText(0.251337,0.0331492,0.483957,0.165746,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); text = pt->AddText("TEntryList for TTree_1"); pt->Draw(); pt = new TPaveText(0.491979,0.038674,0.729947,0.171271,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); text = pt->AddText("TEntryList for TTree_2"); pt->Draw(); pt = new TPaveText(0.737968,0.038674,0.97861,0.171271,"br"); pt->SetBorderSize(1); pt->SetFillColor(19); text = pt->AddText("TEntryList for TTree_3"); pt->Draw(); pt = new TPaveText(0.410667,0.21978,0.816,0.395604,"br"); pt->SetFillColor(19); text = pt->AddText("TList of TEntryList* objects"); pt->Draw(); TArrow *arrow = new TArrow(0.224,0.296703,0.4,0.296703,0.05,">"); arrow->SetFillColor(1); arrow->SetFillStyle(1001); arrow->Draw(); return c; }
tree->Draw(">>elist", "x<0 && y>0", "entrylist"); TEntryList *elist = (TEntryList*)gDirectory->Get("elist");
void loopChain() { TFile *fe = TFile::Open("myelist.root"); TEntryList *myelist = (TEntryList*)fe->Get("myelist"); TChain *ch = new TChain("ntuple"); ch->Add("hsimple.root"); ch->Add("hsimple2.root"); Long64_t listEntries = myelist->GetN(); Long64_t chainEntries = ch->GetEntries(); Int_t treenum = 0; ch->SetEntryList(myelist); for (entry=start;entry < end;entry++) { entryNumber = treechain->GetEntryNumber(entry); if (entryNumber < 0) break; localEntry = fTree->LoadTree(entryNumber); if (localEntry < 0) break; // then either call branch->GetEntry(localEntry); // or entryNumber->GetEntry(entryNumber); // In the later case the LoadTree is then somewhat redudant. } }When using the TEntryList interface directly, you can get the 'tree number' and entry in the current tree (i.e. value similar to the return value of LoadTree) from calling TEntryList::GetEntryAndTree:
Long64_t treeEntry = myelist->GetEntryAndTree(el,treenum);to obtain the entry number within the chain you need to add to it the value of
treeEntry+ch->GetTreeOffset()[treenum]such that the loop in the previous example can also be written as:
for (Long64_t el = 0; el < listEntries; el++) { Long64_t treeEntry = myelist->GetEntryAndTree(el,treenum); Long64_t chainEntry = treeEntry+ch->GetTreeOffset()[treenum]; printf("el=%lld, treeEntry=%lld, chainEntry=%lld, treenum=%d\n", el, treeEntry, chainEntry, treenum); ch->LoadTree(chainEntry); // this also returns treeEntry needed_branch->GetEntry(treeEntry); }
virtual | ~TEntryList() |
void | TObject::AbstractMethod(const char* method) const |
virtual void | Add(const TEntryList* elist) |
virtual void | TObject::AppendPad(Option_t* option = "") |
virtual void | TObject::Browse(TBrowser* b) |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TNamed::Clear(Option_t* option = "") |
virtual TObject* | TNamed::Clone(const char* newname = "") const |
virtual Int_t | TNamed::Compare(const TObject* obj) const |
virtual Int_t | Contains(Long64_t entry, TTree* tree = 0) |
virtual void | TNamed::Copy(TObject& named) const |
virtual void | TObject::Delete(Option_t* option = "")MENU |
virtual void | DirectoryAutoAdd(TDirectory*) |
virtual Int_t | TObject::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TObject::Draw(Option_t* option = "") |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TObject::Dump() constMENU |
virtual Bool_t | Enter(Long64_t entry, TTree* tree = 0) |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual void | TNamed::FillBuffer(char*& buffer) |
virtual TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
virtual TEntryList* | GetCurrentList() const |
virtual TDirectory* | GetDirectory() const |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
virtual Long64_t | GetEntriesToProcess() const |
virtual Long64_t | GetEntry(Int_t index) |
virtual Long64_t | GetEntryAndTree(Int_t index, Int_t& treenum) |
virtual TEntryList* | GetEntryList(const char* treename, const char* filename, Option_t* opt = "") |
virtual const char* | GetFileName() const |
virtual const char* | TObject::GetIconName() const |
virtual TList* | GetLists() const |
virtual Long64_t | GetN() const |
virtual const char* | TNamed::GetName() const |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
virtual Bool_t | GetReapplyCut() const |
virtual const char* | TNamed::GetTitle() const |
virtual const char* | GetTreeName() const |
virtual Int_t | GetTreeNumber() const |
virtual UInt_t | TObject::GetUniqueID() const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
virtual ULong_t | TNamed::Hash() const |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TObject::IsFolder() const |
Bool_t | TObject::IsOnHeap() const |
virtual Bool_t | TNamed::IsSortable() const |
Bool_t | TObject::IsZombie() const |
virtual void | TNamed::ls(Option_t* option = "") const |
void | TObject::MayNotUse(const char* method) const |
virtual Int_t | Merge(TCollection* list) |
virtual Long64_t | Next() |
virtual Bool_t | TObject::Notify() |
void | TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const |
void | TObject::operator delete(void* ptr) |
void | TObject::operator delete(void* ptr, void* vp) |
void | TObject::operator delete[](void* ptr) |
void | TObject::operator delete[](void* ptr, void* vp) |
void* | TObject::operator new(size_t sz) |
void* | TObject::operator new(size_t sz, void* vp) |
void* | TObject::operator new[](size_t sz) |
void* | TObject::operator new[](size_t sz, void* vp) |
virtual void | OptimizeStorage() |
virtual void | TObject::Paint(Option_t* option = "") |
virtual void | TObject::Pop() |
virtual void | Print(const Option_t* option = "") const |
virtual Int_t | TObject::Read(const char* name) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
static Int_t | Relocate(const char* fn, const char* newroot, const char* oldroot = 0, const char* enlnm = 0) |
virtual Int_t | RelocatePaths(const char* newloc, const char* oldloc = 0) |
virtual Bool_t | Remove(Long64_t entry, TTree* tree = 0) |
virtual void | Reset() |
void | TObject::ResetBit(UInt_t f) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | TObject::SavePrimitive(ostream& out, Option_t* option = "") |
static Int_t | Scan(const char* fn, TList* roots) |
virtual Int_t | ScanPaths(TList* roots, Bool_t notify = kTRUE) |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
virtual void | SetDirectory(TDirectory* dir) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
virtual void | SetEntriesToProcess(Long64_t nen) |
virtual void | SetFileName(const char* filename) |
virtual void | TNamed::SetName(const char* name)MENU |
virtual void | TNamed::SetNameTitle(const char* name, const char* title) |
static void | TObject::SetObjectStat(Bool_t stat) |
virtual void | SetReapplyCut(Bool_t apply = kFALSE)TOGGLE GETTER |
virtual void | SetShift(Bool_t shift) |
virtual void | TNamed::SetTitle(const char* title = "")MENU |
virtual void | SetTree(const TTree* tree) |
virtual void | SetTree(const char* treename, const char* filename) |
virtual void | SetTreeName(const char* treename) |
virtual void | SetTreeNumber(Int_t index) |
virtual void | TObject::SetUniqueID(UInt_t uid) |
virtual void | ShowMembers(TMemberInspector& insp) const |
virtual Int_t | TNamed::Sizeof() const |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
virtual void | Subtract(const TEntryList* elist) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
TEntryList() | |
TEntryList(const TTree* tree) | |
TEntryList(const TEntryList& elist) | |
TEntryList(const char* name, const char* title) | |
TEntryList(const char* name, const char* title, const TTree* tree) | |
TEntryList(const char* name, const char* title, const char* treename, const char* filename) | |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
virtual void | TObject::UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
void | GetFileName(const char* filename, TString& fn, Bool_t* = 0) |
void | TObject::MakeZombie() |
TEntryList& | operator=(const TEntryList&) |
static TObject::<anonymous> | TObject::kBitMask | |
static TEntryList::<anonymous> | kBlockSize | |
static TObject::EStatusBits | TObject::kCanDelete | |
static TObject::EStatusBits | TObject::kCannotPick | |
static TObject::EStatusBits | TObject::kHasUUID | |
static TObject::EStatusBits | TObject::kInvalidObject | |
static TObject::<anonymous> | TObject::kIsOnHeap | |
static TObject::EStatusBits | TObject::kIsReferenced | |
static TObject::EStatusBits | TObject::kMustCleanup | |
static TObject::EStatusBits | TObject::kNoContextMenu | |
static TObject::<anonymous> | TObject::kNotDeleted | |
static TObject::EStatusBits | TObject::kObjInCanvas | |
static TObject::<anonymous> | TObject::kOverwrite | |
static TObject::<anonymous> | TObject::kSingleKey | |
static TObject::<anonymous> | TObject::kWriteDelete | |
static TObject::<anonymous> | TObject::kZombie |
TObjArray* | fBlocks | blocks with indices of passing events (TEntryListBlocks) |
TEntryList* | fCurrent | ! currently filled entry list |
TDirectory* | fDirectory | ! Pointer to directory holding this tree |
Long64_t | fEntriesToProcess | used on proof to set the number of entries to process in a packet |
TString | fFileName | name of the file, where the tree is |
Long64_t | fLastIndexQueried | ! used to optimize GetEntry() function from a loop |
Long64_t | fLastIndexReturned | ! used to optimize GetEntry() function from a loop |
TList* | fLists | a list of underlying entry lists for each tree of a chain |
Long64_t | fN | number of entries in the list |
Int_t | fNBlocks | number of TEntryListBlocks |
TString | TNamed::fName | object identifier |
Bool_t | fReapply | If true, TTree::Draw will 'reapply' the original cut |
Bool_t | fShift | ! true when some sub-lists don't correspond to trees |
ULong_t | fStringHash | ! Hash value of a string of treename and filename |
TString | TNamed::fTitle | object title |
TString | fTreeName | name of the tree |
Int_t | fTreeNumber | ! the index of the tree in the chain (used when the entry |
constructor with name and title, which also sets the tree
c-tor with name and title, which also sets the treename and the filename
When tree = 0, returns from the current list When tree != 0, finds the list, corresponding to this tree When tree is a chain, the entry is assumed to be global index and the local entry is recomputed from the treeoffset information of the chain
Called by TKey and others to automatically add us to a directory when we are read from a file.
Add entry #entry to the list When tree = 0, adds to the current list When tree != 0, finds the list, corresponding to this tree When tree is a chain, the entry is assumed to be global index and the local entry is recomputed from the treeoffset information of the chain
Remove entry #entry from the list When tree = 0, removes from the current list When tree != 0, finds the list, corresponding to this tree When tree is a chain, the entry is assumed to be global index and the local entry is recomputed from the treeoffset information of the chain
return the number of the entry #index of this TEntryList in the TTree or TChain See also Next().
To be able to re-localize the entry-list we identify the file by just the name and the anchor, i.e. we drop protocol, host, options, ... The result in the form 'file#anchor' (or 'file', if no anchor is present) is saved in 'fn'. The function optionally (is 'local' is defined) checks file locality (i.e. protocol 'file://') returning the result in '*local' .
return the entry list, correspoding to treename and filename
By default, the filename is first tried as is, and then, if the corresponding list
is not found, the filename is expanded to the absolute path, and compared again.
To avoid it, use option "ne"
return the next non-zero entry index (next after fLastIndexQueried) this function is faster than GetEntry()
Checks if the array representation is more economical and if so, switches to it
Print this list option = "" - default - print the name of the tree and file option = "all" - print all the entry numbers
If a list for a tree with such name and filename exists, sets it as the current sublist If not, creates this list and sets it as the current sublist ! the filename is taken as provided, no extensions to full path or url !
If a list for a tree with such name and filename exists, sets it as the current sublist If not, creates this list and sets it as the current sublist The name of the file, where the tree is, is taken as tree->GetTree()->GetCurrentFile()->GetName(), and then expanded either to the absolute path, or to full url. If, for some reason, you want to provide the filename in a different format, use SetTree(const char *treename, const char *filename), where the filename is taken "as is".
remove all the entries of this entry list, that are contained in elist
Relocate the file paths. If 'oldroot' is defined, replace 'oldroot' with 'newroot' in all file names, i.e. <oldroot>/re/st/of/the/path will become <newroot>/re/st/of/the/path . If 'oldroot' is null, the new path will be just <newroot>/path . Relocation is mandatory to use the entry-list with the same dataset at a different location (i.e. on a different cluster, machine or disks).
Relocate entry list 'enlnm' in file 'fn' replacing 'oldroot' with 'newroot' in filenames. If 'enlnm' is null or '*' all entry lists in the file are relocated. Relocation is mandatory to use the entry-list with the same dataset at a different location (i.e. on a different cluster, machine or disks). This function can be called as many times as need to reach the desired result. The existing 'locations' can be checked qith TEntryList::Scan .
Scan the paths to find the common roots. If 'roots' is defined, add the found roots to the list as TObjStrings. Return the number of roots found.
Scan TEntryList in 'fn' to find the common parts of paths. If 'roots' is defined, add the found roots to the list as TObjStrings. Return the number of common root paths found.
Custom streamer for class TEntryList to handle the different interpretation of fFileName between version 1 and >1 .