Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TEntryList.h
Go to the documentation of this file.
1// @(#)root/tree:$Id$
2// Author: Anna Kreshuk 27/10/2006
3
4/*************************************************************************
5 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TEntryList
13#define ROOT_TEntryList
14
15#include "TNamed.h"
16
17class TTree;
18class TDirectory;
19class TObjArray;
20class TString;
21
22class TList;
23class TCollection;
24
25class TEntryList: public TNamed
26{
27 private:
28 TEntryList& operator=(const TEntryList&); // Not implemented
29
30 protected:
31 TList *fLists; ///< a list of underlying entry lists for each tree of a chain
32 TEntryList *fCurrent; ///<! currently filled entry list
33
34 Int_t fNBlocks; ///< number of TEntryListBlocks
35 TObjArray *fBlocks; ///< blocks with indices of passing events (TEntryListBlocks)
36 Long64_t fN; ///< number of entries in the list
37 Long64_t fEntriesToProcess; ///< used on proof to set the number of entries to process in a packet
38 TString fTreeName; ///< name of the tree
39 TString fFileName; ///< name of the file, where the tree is
40 ULong_t fStringHash; ///<! Hash value of a string of treename and filename
41 Int_t fTreeNumber; ///<! the index of the tree in the chain (used when the entry
42 ///< list is used as input (TTree::SetEntryList())
43
44 Long64_t fLastIndexQueried; ///<! used to optimize GetEntry() function from a loop
45 Long64_t fLastIndexReturned; ///<! used to optimize GetEntry() function from a loop
46 bool fShift; ///<! true when some sub-lists don't correspond to trees
47 ///< (when the entry list is used as input in TChain)
48 TDirectory *fDirectory; ///<! Pointer to directory holding this tree
49 bool fReapply; ///< If true, TTree::Draw will 'reapply' the original cut
50
51 void GetFileName(const char *filename, TString &fn, bool * = nullptr);
52
53 public:
54 enum {kBlockSize = 64000}; //number of entries in each block (not the physical size).
55
57 TEntryList(const char *name, const char *title);
58 TEntryList(const char *name, const char *title, const TTree *tree);
59 TEntryList(const char *name, const char *title, const char *treename, const char *filename);
60 TEntryList(const TTree *tree);
61 TEntryList(const TEntryList& elist);
62 ~TEntryList() override;
63
64 virtual void Add(const TEntryList *elist);
65 void AddSubList(TEntryList *elist);
66 virtual Int_t Contains(Long64_t entry, TTree *tree = nullptr);
68 virtual bool Enter(Long64_t entry, TTree *tree = nullptr);
69 virtual bool Enter(Long64_t localentry, const char *treename, const char *filename);
70 void EnterRange(Long64_t start, Long64_t end, TTree *tree = nullptr, UInt_t step = 1U);
71 virtual TEntryList *GetCurrentList() const { return fCurrent; };
72 virtual TEntryList *GetEntryList(const char *treename, const char *filename, Option_t *opt="");
73 virtual Long64_t GetEntry(Long64_t index);
74 virtual Long64_t GetEntryAndTree(Long64_t index, Int_t &treenum);
76 virtual TList *GetLists() const { return fLists; }
77 virtual TDirectory *GetDirectory() const { return fDirectory; }
78 virtual Long64_t GetN() const { return fN; }
79 virtual const char *GetTreeName() const { return fTreeName.Data(); }
80 virtual const char *GetFileName() const { return fFileName.Data(); }
81 virtual Int_t GetTreeNumber() const { return fTreeNumber; }
82 virtual bool GetReapplyCut() const { return fReapply; };
83
84 bool IsValid() const
85 {
86 if ((fLists || fBlocks)) return true;
87 return false;
88 }
89
90 virtual Int_t Merge(TCollection *list);
91
92 virtual Long64_t Next();
93 virtual void OptimizeStorage();
94 virtual Int_t RelocatePaths(const char *newloc, const char *oldloc = nullptr);
95 virtual bool Remove(Long64_t entry, TTree *tree = nullptr);
96 virtual void Reset();
97 virtual Int_t ScanPaths(TList *roots, bool notify = true);
98
99 void Print(const Option_t* option = "") const override;
100 virtual void SetDirectory(TDirectory *dir);
101 virtual void SetEntriesToProcess(Long64_t nen) { fEntriesToProcess = nen; }
102 virtual void SetShift(bool shift) { fShift = shift; };
103 virtual void SetTree(const TTree *tree);
104 virtual void SetTree(const char *treename, const char *filename);
105 virtual void SetTreeName(const char *treename){ fTreeName = treename; };
106 virtual void SetFileName(const char *filename){ fFileName = filename; };
107 virtual void SetTreeNumber(Int_t index) { fTreeNumber=index; }
108 virtual void SetReapplyCut(bool apply = false) {fReapply = apply;}; // *TOGGLE* *GETTER=GetReapplyCut
109 virtual void Subtract(const TEntryList *elist);
110
111 static Int_t Relocate(const char *fn,
112 const char *newroot, const char *oldroot = nullptr, const char *enlnm = nullptr);
113 static Int_t Scan(const char *fn, TList *roots);
114
115// Preventing warnings with -Weffc++ in GCC since the overloading of the || operator was a design choice.
116#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
117#pragma GCC diagnostic push
118#pragma GCC diagnostic ignored "-Weffc++"
119#endif
120 friend TEntryList operator||(TEntryList& elist1, TEntryList& elist2);
121#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
122#pragma GCC diagnostic pop
123#endif
124
125 ClassDefOverride(TEntryList, 2); //A list of entries in a TTree
126};
127#endif
start
Definition Rotated.cxx:223
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
const char Option_t
Option string (const char).
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
char name[80]
Definition TGX11.cxx:148
Collection abstract base class.
Definition TCollection.h:65
Describe directory structure in memory.
Definition TDirectory.h:45
bool fReapply
If true, TTree::Draw will 'reapply' the original cut.
Definition TEntryList.h:49
Long64_t fLastIndexQueried
! used to optimize GetEntry() function from a loop
Definition TEntryList.h:44
Long64_t fEntriesToProcess
used on proof to set the number of entries to process in a packet
Definition TEntryList.h:37
virtual Int_t GetTreeNumber() const
Definition TEntryList.h:81
TString fFileName
name of the file, where the tree is
Definition TEntryList.h:39
virtual TList * GetLists() const
Definition TEntryList.h:76
virtual Int_t RelocatePaths(const char *newloc, const char *oldloc=nullptr)
TEntryList(const TEntryList &elist)
Int_t fTreeNumber
!
Definition TEntryList.h:41
virtual Int_t ScanPaths(TList *roots, bool notify=true)
virtual void SetShift(bool shift)
Definition TEntryList.h:102
virtual Long64_t GetEntriesToProcess() const
Definition TEntryList.h:75
TDirectory * fDirectory
! Pointer to directory holding this tree
Definition TEntryList.h:48
virtual Int_t Merge(TCollection *list)
virtual void SetEntriesToProcess(Long64_t nen)
Definition TEntryList.h:101
virtual TDirectory * GetDirectory() const
Definition TEntryList.h:77
TObjArray * fBlocks
blocks with indices of passing events (TEntryListBlocks)
Definition TEntryList.h:35
TEntryList & operator=(const TEntryList &)
virtual Int_t Contains(Long64_t entry, TTree *tree=nullptr)
virtual void OptimizeStorage()
TEntryList(const char *name, const char *title, const TTree *tree)
virtual bool Enter(Long64_t entry, TTree *tree=nullptr)
virtual const char * GetFileName() const
Definition TEntryList.h:80
TEntryList(const char *name, const char *title, const char *treename, const char *filename)
virtual bool Remove(Long64_t entry, TTree *tree=nullptr)
static Int_t Relocate(const char *fn, const char *newroot, const char *oldroot=nullptr, const char *enlnm=nullptr)
virtual void DirectoryAutoAdd(TDirectory *)
virtual Long64_t GetEntry(Long64_t index)
static Int_t Scan(const char *fn, TList *roots)
Long64_t fN
number of entries in the list
Definition TEntryList.h:36
virtual void SetTree(const char *treename, const char *filename)
virtual void SetTree(const TTree *tree)
virtual void SetReapplyCut(bool apply=false)
Definition TEntryList.h:108
virtual void SetTreeNumber(Int_t index)
Definition TEntryList.h:107
Long64_t fLastIndexReturned
! used to optimize GetEntry() function from a loop
Definition TEntryList.h:45
TEntryList(const char *name, const char *title)
virtual Long64_t Next()
void EnterRange(Long64_t start, Long64_t end, TTree *tree=nullptr, UInt_t step=1U)
virtual TEntryList * GetCurrentList() const
Definition TEntryList.h:71
virtual void SetTreeName(const char *treename)
Definition TEntryList.h:105
virtual void Subtract(const TEntryList *elist)
bool IsValid() const
Definition TEntryList.h:84
Int_t fNBlocks
number of TEntryListBlocks
Definition TEntryList.h:34
virtual void SetFileName(const char *filename)
Definition TEntryList.h:106
TEntryList(const TTree *tree)
virtual void SetDirectory(TDirectory *dir)
virtual const char * GetTreeName() const
Definition TEntryList.h:79
virtual bool GetReapplyCut() const
Definition TEntryList.h:82
virtual void Add(const TEntryList *elist)
TEntryList * fCurrent
! currently filled entry list
Definition TEntryList.h:32
bool fShift
!
Definition TEntryList.h:46
virtual TEntryList * GetEntryList(const char *treename, const char *filename, Option_t *opt="")
void Print(const Option_t *option="") const override
virtual bool Enter(Long64_t localentry, const char *treename, const char *filename)
ULong_t fStringHash
! Hash value of a string of treename and filename
Definition TEntryList.h:40
TList * fLists
a list of underlying entry lists for each tree of a chain
Definition TEntryList.h:31
void GetFileName(const char *filename, TString &fn, bool *=nullptr)
~TEntryList() override
TString fTreeName
name of the tree
Definition TEntryList.h:38
void AddSubList(TEntryList *elist)
virtual Long64_t GetEntryAndTree(Long64_t index, Int_t &treenum)
virtual void Reset()
friend TEntryList operator||(TEntryList &elist1, TEntryList &elist2)
virtual Long64_t GetN() const
Definition TEntryList.h:78
A doubly linked list.
Definition TList.h:38
TNamed()
Definition TNamed.h:38
An array of TObjects.
Definition TObjArray.h:31
Basic string class.
Definition TString.h:138
A TTree represents a columnar dataset.
Definition TTree.h:89
TCanvas * roots()
Definition roots.C:1