72 Error(
"TChainIndex",
"Cannot create a TChainIndex." 73 " The Tree passed as an argument is not a TChain");
83 for (i = 0; i < chain->
GetNtrees(); i++) {
105 if (!index || index->
IsZombie() || index->
GetN() == 0) {
108 Error(
"TChainIndex",
"Error creating a tree index on a tree in the chain");
114 Error(
"TChainIndex",
"The underlying TTree must have a TTreeIndex but has a %s.",
125 if(
fEntries[i].GetMaxIndexValPair() >
fEntries[i+1].GetMinIndexValPair() ) {
128 Error(
"TChainIndex",
"The indices in files of this chain aren't sorted.");
142 Error(
"Append",
"The given index is not a TTreeIndex but a %s",
148 entry.SetMinMaxFrom(ti_index);
155 if(
fEntries[i].GetMaxIndexValPair() >
fEntries[i+1].GetMinIndexValPair() ) {
158 Error(
"Append",
"The indices in files of this chain aren't sorted.");
169 for (
unsigned int i = 0; i <
fEntries.size(); i++) {
200 Warning(
"GetSubTreeIndex",
"No subindices in the chain. The chain is probably empty");
201 return make_pair(static_cast<TVirtualIndex*>(0), 0);
206 if( indexValue <
fEntries[0].GetMinIndexValPair() ) {
207 Warning(
"GetSubTreeIndex",
"The index value is less than the smallest index values in subtrees");
208 return make_pair(static_cast<TVirtualIndex*>(0), 0);
212 for (
unsigned int i = 0; i <
fEntries.size() - 1; i++) {
213 if( indexValue <
fEntries[i+1].GetMinIndexValPair() ) {
219 if( indexValue >
fEntries[treeNo].GetMaxIndexValPair() ) {
220 return make_pair(static_cast<TVirtualIndex*>(0), 0);
227 return make_pair(static_cast<TVirtualIndex*>(index), treeNo);
229 index =
fEntries[treeNo].fTreeIndex;
231 Warning(
"GetSubTreeIndex",
"The tree has no index and the chain index" 232 " doesn't store an index for that tree");
233 return make_pair(static_cast<TVirtualIndex*>(0), 0);
236 fTree->GetTree()->SetTreeIndex(index);
237 return make_pair(static_cast<TVirtualIndex*>(index), treeNo);
249 if (
fEntries[treeNo].fTreeIndex == index) {
251 fTree->GetTree()->SetTreeIndex(0);
260 if (!parent)
return -3;
268 Long64_t pentry = parent->GetReadEntry();
269 if (pentry >=
fTree->GetEntries())
return -2;
284 return fTree->GetEntryNumberWithIndex(majorv,minorv);
292 std::pair<TVirtualIndex*, Int_t> indexAndNumber =
GetSubTreeIndex(major, minor);
293 if (!indexAndNumber.first) {
298 Long64_t rv = indexAndNumber.first->GetEntryNumberWithBestIndex(major, minor);
312 std::pair<TVirtualIndex*, Int_t> indexAndNumber =
GetSubTreeIndex(major, minor);
313 if (!indexAndNumber.first) {
318 Long64_t rv = indexAndNumber.first->GetEntryNumberWithIndex(major, minor);
virtual const char * GetName() const
Returns name of object.
TVirtualIndex * fTreeIndex
Abstract interface for Tree Index.
virtual Long64_t GetN() const
virtual Long64_t GetEntryNumberFriend(const TTree *parent)
See TTreeIndex::GetEntryNumberFriend for description.
std::pair< Long64_t, Long64_t > IndexValPair_t
virtual ~TChainIndex()
The destructor.
virtual void SetTree(const TTree *T)
See TTreeIndex::SetTree.
void SetMinMaxFrom(const TTreeIndex *index)
A Tree Index with majorname and minorname.
Long64_t * GetTreeOffset() const
virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const
See TTreeIndex::GetEntryNumberWithBestIndex for details.
virtual void SetTreeIndex(TVirtualIndex *index)
The current TreeIndex is replaced by the new index.
virtual Int_t BuildIndex(const char *majorname, const char *minorname="0")
Build a Tree Index (default is TTreeIndex).
virtual Long64_t LoadTree(Long64_t entry)
Find the tree which contains entry, and set it as the current tree.
Long64_t fMinIndexValMinor
virtual TTree * GetTree() const
virtual Long64_t * GetIndexValuesMinor() const
Long64_t fMaxIndexValMinor
virtual TTreeFormula * GetMinorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the minorname in parent tree T...
virtual TVirtualIndex * GetTreeIndex() const
virtual Long64_t * GetIndexValues() const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TFile * GetCurrentFile() const
Return pointer to the current file.
virtual Long64_t GetN() const =0
virtual void Append(const TVirtualIndex *, Bool_t delaySort=kFALSE)
Add an index to this chain.
std::vector< TChainIndexEntry > fEntries
Pointer to minor TreeFormula in Parent tree (if any)
TTreeFormula * fMajorFormulaParent
void ReleaseSubTreeIndex(TVirtualIndex *index, Int_t treeNo) const
Releases the tree index got using GetSubTreeIndex.
virtual TTreeFormula * GetMajorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the majorname in parent tree T...
Helper class to prevent infinite recursion in the usage of TTree Friends.
virtual TTree * GetTree() const
TChainIndex()
Default constructor for TChainIndex.
void DeleteIndices()
Delete all the indices which were built by this object.
A chain is a collection of files containing TTree objects.
virtual const char * GetMinorName() const =0
std::pair< TVirtualIndex *, Int_t > GetSubTreeIndex(Long64_t major, Long64_t minor) const
Returns a TVirtualIndex for a tree which holds the entry with the specified major and minor values an...
virtual const char * GetMajorName() const =0
virtual void UpdateFormulaLeaves(const TTree *parent)
Updates the parent formulae.
TTreeFormula * fMinorFormulaParent
Pointer to major TreeFormula in Parent tree (if any)
A TTree object has a header with a name and a title.
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const
Returns the entry number with given index values.
Holds a description of indices of trees in the chain.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.