Logo ROOT  
Reference Guide
TTreeIndex.cxx
Go to the documentation of this file.
1// @(#)root/tree:$Id$
2// Author: Rene Brun 05/07/2004
3
4/*************************************************************************
5 * Copyright (C) 1995-2004, 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/** \class TTreeIndex
13A Tree Index with majorname and minorname.
14*/
15
16#include "TTreeIndex.h"
17
18#include "TTreeFormula.h"
19#include "TTree.h"
20#include "TBuffer.h"
21#include "TMath.h"
22
24
25
26struct IndexSortComparator {
27
28 IndexSortComparator(Long64_t *major, Long64_t *minor)
29 : fValMajor(major), fValMinor(minor)
30 {}
31
32 template<typename Index>
33 bool operator()(Index i1, Index i2) {
34 if( *(fValMajor + i1) == *(fValMajor + i2) )
35 return *(fValMinor + i1) < *(fValMinor + i2);
36 else
37 return *(fValMajor + i1) < *(fValMajor + i2);
38 }
39
40 // pointers to the start of index values tables keeping uppder 64bit and lower 64bit
41 // of combined indexed 128bit value
42 Long64_t *fValMajor, *fValMinor;
43};
44
45
46////////////////////////////////////////////////////////////////////////////////
47/// Default constructor for TTreeIndex
48
50{
51 fTree = 0;
52 fN = 0;
53 fIndexValues = 0;
55 fIndex = 0;
56 fMajorFormula = 0;
57 fMinorFormula = 0;
60}
61
62////////////////////////////////////////////////////////////////////////////////
63/// Normal constructor for TTreeIndex
64///
65/// Build an index table using the leaves of Tree T with major & minor names
66/// The index is built with the expressions given in "majorname" and "minorname".
67///
68/// a Long64_t array fIndexValues is built with:
69///
70/// - major = the value of majorname converted to an integer
71/// - minor = the value of minorname converted to an integer
72/// - fIndexValues[i] = major<<31 + minor
73///
74/// This array is sorted. The sorted fIndex[i] contains the serial number
75/// in the Tree corresponding to the pair "major,minor" in fIndexvalues[i].
76///
77/// Once the index is computed, one can retrieve one entry via
78/// ~~~{.cpp}
79/// T->GetEntryWithIndex(majornumber, minornumber)
80/// ~~~
81/// Example:
82/// ~~~{.cpp}
83/// tree.BuildIndex("Run","Event"); //creates an index using leaves Run and Event
84/// tree.GetEntryWithIndex(1234,56789); // reads entry corresponding to
85/// // Run=1234 and Event=56789
86/// ~~~
87/// Note that majorname and minorname may be expressions using original
88/// Tree variables eg: "run-90000", "event +3*xx". However the result
89/// must be integer.
90///
91/// In case an expression is specified, the equivalent expression must be computed
92/// when calling GetEntryWithIndex.
93///
94/// To build an index with only majorname, specify minorname="0" (default)
95///
96/// ## TreeIndex and Friend Trees
97///
98/// Assuming a parent Tree T and a friend Tree TF, the following cases are supported:
99/// - CASE 1: T->GetEntry(entry) is called
100/// In this case, the serial number entry is used to retrieve
101/// the data in both Trees.
102/// - CASE 2: T->GetEntry(entry) is called, TF has a TreeIndex
103/// the expressions given in major/minorname of TF are used
104/// to compute the value pair major,minor with the data in T.
105/// TF->GetEntryWithIndex(major,minor) is then called (tricky case!)
106/// - CASE 3: T->GetEntryWithIndex(major,minor) is called.
107/// It is assumed that both T and TF have a TreeIndex built using
108/// the same major and minor name.
109///
110/// ## Saving the TreeIndex
111///
112/// Once the index is built, it can be saved with the TTree object
113/// with tree.Write(); (if the file has been open in "update" mode).
114///
115/// The most convenient place to create the index is at the end of
116/// the filling process just before saving the Tree header.
117/// If a previous index was computed, it is redefined by this new call.
118///
119/// Note that this function can also be applied to a TChain.
120///
121/// The return value is the number of entries in the Index (< 0 indicates failure)
122///
123/// It is possible to play with different TreeIndex in the same Tree.
124/// see comments in TTree::SetTreeIndex.
125
126TTreeIndex::TTreeIndex(const TTree *T, const char *majorname, const char *minorname)
127 : TVirtualIndex()
128{
129 fTree = (TTree*)T;
130 fN = 0;
131 fIndexValues = 0;
133 fIndex = 0;
134 fMajorFormula = 0;
135 fMinorFormula = 0;
138 fMajorName = majorname;
139 fMinorName = minorname;
140 if (!T) return;
141 fN = T->GetEntries();
142 if (fN <= 0) {
143 MakeZombie();
144 Error("TreeIndex","Cannot build a TreeIndex with a Tree having no entries");
145 return;
146 }
147
150 if (!fMajorFormula || !fMinorFormula) {
151 MakeZombie();
152 Error("TreeIndex","Cannot build the index with major=%s, minor=%s",fMajorName.Data(), fMinorName.Data());
153 return;
154 }
155 if ((fMajorFormula->GetNdim() != 1) || (fMinorFormula->GetNdim() != 1)) {
156 MakeZombie();
157 Error("TreeIndex","Cannot build the index with major=%s, minor=%s",fMajorName.Data(), fMinorName.Data());
158 return;
159 }
160 // accessing array elements should be OK
161 //if ((fMajorFormula->GetMultiplicity() != 0) || (fMinorFormula->GetMultiplicity() != 0)) {
162 // MakeZombie();
163 // Error("TreeIndex","Cannot build the index with major=%s, minor=%s that cannot be arrays",fMajorName.Data(), fMinorName.Data());
164 // return;
165 //}
166
167 Long64_t *tmp_major = new Long64_t[fN];
168 Long64_t *tmp_minor = new Long64_t[fN];
169 Long64_t i;
170 Long64_t oldEntry = fTree->GetReadEntry();
171 Int_t current = -1;
172 for (i=0;i<fN;i++) {
173 Long64_t centry = fTree->LoadTree(i);
174 if (centry < 0) break;
175 if (fTree->GetTreeNumber() != current) {
176 current = fTree->GetTreeNumber();
179 }
180 tmp_major[i] = (Long64_t) fMajorFormula->EvalInstance<LongDouble_t>();
181 tmp_minor[i] = (Long64_t) fMinorFormula->EvalInstance<LongDouble_t>();
182 }
183 fIndex = new Long64_t[fN];
184 for(i = 0; i < fN; i++) { fIndex[i] = i; }
185 std::sort(fIndex, fIndex + fN, IndexSortComparator(tmp_major, tmp_minor) );
186 //TMath::Sort(fN,w,fIndex,0);
187 fIndexValues = new Long64_t[fN];
189 for (i=0;i<fN;i++) {
190 fIndexValues[i] = tmp_major[fIndex[i]];
191 fIndexValuesMinor[i] = tmp_minor[fIndex[i]];
192 }
193
194 delete [] tmp_major;
195 delete [] tmp_minor;
196 fTree->LoadTree(oldEntry);
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Destructor.
201
203{
204 if (fTree && fTree->GetTreeIndex() == this) fTree->SetTreeIndex(0);
205 delete [] fIndexValues; fIndexValues = 0;
207 delete [] fIndex; fIndex = 0;
208 delete fMajorFormula; fMajorFormula = 0;
209 delete fMinorFormula; fMinorFormula = 0;
212}
213
214////////////////////////////////////////////////////////////////////////////////
215/// Append 'add' to this index. Entry 0 in add will become entry n+1 in this.
216/// If delaySort is true, do not sort the value, then you must call
217/// Append(0,kFALSE);
218
219void TTreeIndex::Append(const TVirtualIndex *add, Bool_t delaySort )
220{
221
222 if (add && add->GetN()) {
223 // Create new buffer (if needed)
224
225 const TTreeIndex *ti_add = dynamic_cast<const TTreeIndex*>(add);
226 if (ti_add == 0) {
227 Error("Append","Can only Append a TTreeIndex to a TTreeIndex but got a %s",
228 add->IsA()->GetName());
229 }
230
231 Long64_t oldn = fN;
232 fN += add->GetN();
233
234 Long64_t *oldIndex = fIndex;
235 Long64_t *oldValues = GetIndexValues();
236 Long64_t *oldValues2 = GetIndexValuesMinor();
237
238 fIndex = new Long64_t[fN];
239 fIndexValues = new Long64_t[fN];
241
242 // Copy data
243 Long_t size = sizeof(Long64_t) * oldn;
244 Long_t add_size = sizeof(Long64_t) * add->GetN();
245
246 memcpy(fIndex,oldIndex, size);
247 memcpy(fIndexValues,oldValues, size);
248 memcpy(fIndexValuesMinor,oldValues2, size);
249
250 Long64_t *addIndex = ti_add->GetIndex();
251 Long64_t *addValues = ti_add->GetIndexValues();
252 Long64_t *addValues2 = ti_add->GetIndexValuesMinor();
253
254 memcpy(fIndex + oldn, addIndex, add_size);
255 memcpy(fIndexValues + oldn, addValues, add_size);
256 memcpy(fIndexValuesMinor + oldn, addValues2, add_size);
257 for(Int_t i = 0; i < add->GetN(); i++) {
258 fIndex[oldn + i] += oldn;
259 }
260
261 delete [] oldIndex;
262 delete [] oldValues;
263 delete [] oldValues2;
264 }
265
266 // Sort.
267 if (!delaySort) {
268 Long64_t *addValues = GetIndexValues();
269 Long64_t *addValues2 = GetIndexValuesMinor();
270 Long64_t *ind = fIndex;
271 Long64_t *conv = new Long64_t[fN];
272
273 for(Long64_t i = 0; i < fN; i++) { conv[i] = i; }
274 std::sort(conv, conv+fN, IndexSortComparator(addValues, addValues2) );
275 //Long64_t *w = fIndexValues;
276 //TMath::Sort(fN,w,conv,0);
277
278 fIndex = new Long64_t[fN];
279 fIndexValues = new Long64_t[fN];
281
282 for (Int_t i=0;i<fN;i++) {
283 fIndex[i] = ind[conv[i]];
284 fIndexValues[i] = addValues[conv[i]];
285 fIndexValuesMinor[i] = addValues2[conv[i]];
286 }
287 delete [] addValues;
288 delete [] addValues2;
289 delete [] ind;
290 delete [] conv;
291 }
292}
293
294
295
296////////////////////////////////////////////////////////////////////////////////
297/// conversion from old 64bit indexes
298/// return true if index was converted
299
301{
302 if( !fIndexValuesMinor && fN ) {
304 for(int i=0; i<fN; i++) {
305 fIndexValuesMinor[i] = (fIndexValues[i] & 0x7fffffff);
306 fIndexValues[i] >>= 31;
307 }
308 return true;
309 }
310 return false;
311}
312
313
314
315////////////////////////////////////////////////////////////////////////////////
316/// Returns the entry number in this (friend) Tree corresponding to entry in
317/// the master Tree 'parent'.
318/// In case this (friend) Tree and 'master' do not share an index with the same
319/// major and minor name, the entry serial number in the (friend) tree
320/// and in the master Tree are assumed to be the same
321
323{
324 if (!parent) return -3;
325 GetMajorFormulaParent(parent);
326 GetMinorFormulaParent(parent);
327 if (!fMajorFormulaParent || !fMinorFormulaParent) return -1;
329 // The Tree Index in the friend has a pair majorname,minorname
330 // not available in the parent Tree T.
331 // if the friend Tree has less entries than the parent, this is an error
332 Long64_t pentry = parent->GetReadEntry();
333 if (pentry >= fTree->GetEntries()) return -2;
334 // otherwise we ignore the Tree Index and return the entry number
335 // in the parent Tree.
336 return pentry;
337 }
338
339 // majorname, minorname exist in the parent Tree
340 // we find the current values pair majorv,minorv in the parent Tree
343 Long64_t majorv = (Long64_t)majord;
344 Long64_t minorv = (Long64_t)minord;
345 // we check if this pair exist in the index.
346 // if yes, we return the corresponding entry number
347 // if not the function returns -1
348 return fTree->GetEntryNumberWithIndex(majorv,minorv);
349}
350
351
352////////////////////////////////////////////////////////////////////////////////
353/// find position where major|minor values are in the IndexValues tables
354/// this is the index in IndexValues table, not entry# !
355/// use lower_bound STD algorithm.
356
358{
359 Long64_t mid, step, pos = 0, count = fN;
360 // find lower bound using bisection
361 while( count > 0 ) {
362 step = count / 2;
363 mid = pos + step;
364 // check if *mid < major|minor
365 if( fIndexValues[mid] < major
366 || ( fIndexValues[mid] == major && fIndexValuesMinor[mid] < minor ) ) {
367 pos = mid+1;
368 count -= step + 1;
369 } else
370 count = step;
371 }
372 return pos;
373}
374
375
376////////////////////////////////////////////////////////////////////////////////
377/// Return entry number corresponding to major and minor number.
378/// Note that this function returns only the entry number, not the data
379/// To read the data corresponding to an entry number, use TTree::GetEntryWithIndex
380/// the BuildIndex function has created a table of Double_t* of sorted values
381/// corresponding to val = major<<31 + minor;
382/// The function performs binary search in this sorted table.
383/// If it finds a pair that maches val, it returns directly the
384/// index in the table.
385/// If an entry corresponding to major and minor is not found, the function
386/// returns the index of the major,minor pair immediatly lower than the
387/// requested value, ie it will return -1 if the pair is lower than
388/// the first entry in the index.
389///
390/// See also GetEntryNumberWithIndex
391
393{
394 if (fN == 0) return -1;
395
396 Long64_t pos = FindValues(major, minor);
397 if( pos < fN && fIndexValues[pos] == major && fIndexValuesMinor[pos] == minor )
398 return fIndex[pos];
399 if( --pos < 0 )
400 return -1;
401 return fIndex[pos];
402}
403
404
405////////////////////////////////////////////////////////////////////////////////
406/// Return entry number corresponding to major and minor number.
407/// Note that this function returns only the entry number, not the data
408/// To read the data corresponding to an entry number, use TTree::GetEntryWithIndex
409/// the BuildIndex function has created a table of Double_t* of sorted values
410/// corresponding to val = major<<31 + minor;
411/// The function performs binary search in this sorted table.
412/// If it finds a pair that maches val, it returns directly the
413/// index in the table, otherwise it returns -1.
414///
415/// See also GetEntryNumberWithBestIndex
416
418{
419 if (fN == 0) return -1;
420
421 Long64_t pos = FindValues(major, minor);
422 if( pos < fN && fIndexValues[pos] == major && fIndexValuesMinor[pos] == minor )
423 return fIndex[pos];
424 return -1;
425}
426
427
428////////////////////////////////////////////////////////////////////////////////
429
431{
432 return fIndexValuesMinor;
433}
434
435
436
437////////////////////////////////////////////////////////////////////////////////
438/// Return a pointer to the TreeFormula corresponding to the majorname.
439
441{
442 if (!fMajorFormula) {
445 }
446 return fMajorFormula;
447}
448
449////////////////////////////////////////////////////////////////////////////////
450/// Return a pointer to the TreeFormula corresponding to the minorname.
451
453{
454 if (!fMinorFormula) {
457 }
458 return fMinorFormula;
459}
460
461////////////////////////////////////////////////////////////////////////////////
462/// Return a pointer to the TreeFormula corresponding to the majorname in parent tree.
463
465{
466 if (!fMajorFormulaParent) {
467 // Prevent TTreeFormula from finding any of the branches in our TTree even if it
468 // is a friend of the parent TTree.
470 fMajorFormulaParent = new TTreeFormula("MajorP",fMajorName.Data(),const_cast<TTree*>(parent));
472 }
473 if (fMajorFormulaParent->GetTree() != parent) {
474 fMajorFormulaParent->SetTree(const_cast<TTree*>(parent));
476 }
477 return fMajorFormulaParent;
478}
479
480////////////////////////////////////////////////////////////////////////////////
481/// Return a pointer to the TreeFormula corresponding to the minorname in parent tree.
482
484{
485 if (!fMinorFormulaParent) {
486 // Prevent TTreeFormula from finding any of the branches in our TTree even if it
487 // is a friend of the parent TTree.
489 fMinorFormulaParent = new TTreeFormula("MinorP",fMinorName.Data(),const_cast<TTree*>(parent));
491 }
492 if (fMinorFormulaParent->GetTree() != parent) {
493 fMinorFormulaParent->SetTree(const_cast<TTree*>(parent));
495 }
496 return fMinorFormulaParent;
497}
498
499////////////////////////////////////////////////////////////////////////////////
500/// Return kTRUE if index can be applied to the TTree
501
503{
504 auto *majorFormula = GetMajorFormulaParent(parent);
505 auto *minorFormula = GetMinorFormulaParent(parent);
506 if ((majorFormula == nullptr || majorFormula->GetNdim() == 0) ||
507 (minorFormula == nullptr || minorFormula->GetNdim() == 0))
508 return kFALSE;
509 return kTRUE;
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Print the table with : serial number, majorname, minorname.
514/// - if option = "10" print only the first 10 entries
515/// - if option = "100" print only the first 100 entries
516/// - if option = "1000" print only the first 1000 entries
517
518void TTreeIndex::Print(Option_t * option) const
519{
520 TString opt = option;
521 Bool_t printEntry = kFALSE;
522 Long64_t n = fN;
523 if (opt.Contains("10")) n = 10;
524 if (opt.Contains("100")) n = 100;
525 if (opt.Contains("1000")) n = 1000;
526 if (opt.Contains("all")) {
527 printEntry = kTRUE;
528 }
529
530 if (printEntry) {
531 Printf("\n*****************************************************************");
532 Printf("* Index of Tree: %s/%s",fTree->GetName(),fTree->GetTitle());
533 Printf("*****************************************************************");
534 Printf("%8s : %16s : %16s : %16s","serial",fMajorName.Data(),fMinorName.Data(),"entry number");
535 Printf("*****************************************************************");
536 for (Long64_t i=0;i<n;i++) {
537 Printf("%8lld : %8lld : %8lld : %8lld",
538 i, fIndexValues[i], GetIndexValuesMinor()[i], fIndex[i]);
539 }
540
541 } else {
542 Printf("\n**********************************************");
543 Printf("* Index of Tree: %s/%s",fTree->GetName(),fTree->GetTitle());
544 Printf("**********************************************");
545 Printf("%8s : %16s : %16s","serial",fMajorName.Data(),fMinorName.Data());
546 Printf("**********************************************");
547 for (Long64_t i=0;i<n;i++) {
548 Printf("%8lld : %8lld : %8lld",
550 }
551 }
552}
553
554////////////////////////////////////////////////////////////////////////////////
555/// Stream an object of class TTreeIndex.
556/// Note that this Streamer should be changed to an automatic Streamer
557/// once TStreamerInfo supports an index of type Long64_t
558
559void TTreeIndex::Streamer(TBuffer &R__b)
560{
561 UInt_t R__s, R__c;
562 if (R__b.IsReading()) {
563 Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
564 TVirtualIndex::Streamer(R__b);
565 fMajorName.Streamer(R__b);
566 fMinorName.Streamer(R__b);
567 R__b >> fN;
568 fIndexValues = new Long64_t[fN];
570 if( R__v > 1 ) {
573 } else {
575 }
576 fIndex = new Long64_t[fN];
577 R__b.ReadFastArray(fIndex,fN);
578 R__b.CheckByteCount(R__s, R__c, TTreeIndex::IsA());
579 } else {
580 R__c = R__b.WriteVersion(TTreeIndex::IsA(), kTRUE);
581 TVirtualIndex::Streamer(R__b);
582 fMajorName.Streamer(R__b);
583 fMinorName.Streamer(R__b);
584 R__b << fN;
587 R__b.WriteFastArray(fIndex, fN);
588 R__b.SetByteCount(R__c, kTRUE);
589 }
590}
591
592////////////////////////////////////////////////////////////////////////////////
593/// Called by TChain::LoadTree when the parent chain changes it's tree.
594
596{
600 if (parent) fMajorFormulaParent->SetTree(const_cast<TTree*>(parent));
602 }
604 if (parent) fMinorFormulaParent->SetTree(const_cast<TTree*>(parent));
606 }
607}
608////////////////////////////////////////////////////////////////////////////////
609/// this function is called by TChain::LoadTree and TTreePlayer::UpdateFormulaLeaves
610/// when a new Tree is loaded.
611/// Because Trees in a TChain may have a different list of leaves, one
612/// must update the leaves numbers in the TTreeFormula used by the TreeIndex.
613
615{
616 fTree = (TTree*)T;
617}
618
int Int_t
Definition: RtypesCore.h:43
short Version_t
Definition: RtypesCore.h:63
unsigned int UInt_t
Definition: RtypesCore.h:44
const Bool_t kFALSE
Definition: RtypesCore.h:90
long Long_t
Definition: RtypesCore.h:52
bool Bool_t
Definition: RtypesCore.h:61
double Double_t
Definition: RtypesCore.h:57
long double LongDouble_t
Definition: RtypesCore.h:59
long long Long64_t
Definition: RtypesCore.h:71
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define ClassImp(name)
Definition: Rtypes.h:361
TRObject operator()(const T1 &t1) const
void Printf(const char *fmt,...)
virtual Int_t GetNdim() const
Definition: TFormula.h:237
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
Bool_t IsReading() const
Definition: TBuffer.h:85
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual void WriteFastArray(const Bool_t *b, Int_t n)=0
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
void MakeZombie()
Definition: TObject.h:49
Basic string class.
Definition: TString.h:131
const char * Data() const
Definition: TString.h:364
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:58
T EvalInstance(Int_t i=0, const char *stringStack[]=0)
Evaluate this treeformula.
virtual void SetTree(TTree *tree)
Definition: TTreeFormula.h:208
virtual void UpdateFormulaLeaves()
This function is called TTreePlayer::UpdateFormulaLeaves, itself called by TChain::LoadTree when a ne...
virtual TTree * GetTree() const
Definition: TTreeFormula.h:210
void SetQuickLoad(Bool_t quick)
Definition: TTreeFormula.h:207
A Tree Index with majorname and minorname.
Definition: TTreeIndex.h:29
TTreeIndex()
Default constructor for TTreeIndex.
Definition: TTreeIndex.cxx:49
virtual Long64_t * GetIndexValues() const
Definition: TTreeIndex.h:61
virtual Long64_t * GetIndexValuesMinor() const
Definition: TTreeIndex.cxx:430
TTreeFormula * fMajorFormula
Definition: TTreeIndex.h:38
TTreeFormula * fMajorFormulaParent
Pointer to minor TreeFormula.
Definition: TTreeIndex.h:40
Long64_t * fIndex
Definition: TTreeIndex.h:37
TTreeFormula * GetMajorFormulaParent(const TTree *parent)
Pointer to minor TreeFormula in Parent tree (if any)
Definition: TTreeIndex.cxx:464
virtual ~TTreeIndex()
Destructor.
Definition: TTreeIndex.cxx:202
Long64_t fN
Definition: TTreeIndex.h:34
virtual Long64_t * GetIndex() const
Definition: TTreeIndex.h:60
bool ConvertOldToNew()
conversion from old 64bit indexes return true if index was converted
Definition: TTreeIndex.cxx:300
TTreeFormula * fMinorFormula
Pointer to major TreeFormula.
Definition: TTreeIndex.h:39
virtual Bool_t IsValidFor(const TTree *parent)
Return kTRUE if index can be applied to the TTree.
Definition: TTreeIndex.cxx:502
virtual TTreeFormula * GetMajorFormula()
Return a pointer to the TreeFormula corresponding to the majorname.
Definition: TTreeIndex.cxx:440
virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const
Return entry number corresponding to major and minor number.
Definition: TTreeIndex.cxx:392
virtual void Print(Option_t *option="") const
Print the table with : serial number, majorname, minorname.
Definition: TTreeIndex.cxx:518
TTreeFormula * GetMinorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the minorname in parent tree.
Definition: TTreeIndex.cxx:483
TString fMinorName
Definition: TTreeIndex.h:33
virtual TTreeFormula * GetMinorFormula()
Return a pointer to the TreeFormula corresponding to the minorname.
Definition: TTreeIndex.cxx:452
virtual void Append(const TVirtualIndex *, Bool_t delaySort=kFALSE)
Append 'add' to this index.
Definition: TTreeIndex.cxx:219
Long64_t * fIndexValues
Definition: TTreeIndex.h:35
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const
Return entry number corresponding to major and minor number.
Definition: TTreeIndex.cxx:417
TString fMajorName
Definition: TTreeIndex.h:32
Long64_t * fIndexValuesMinor
Definition: TTreeIndex.h:36
TTreeFormula * fMinorFormulaParent
Pointer to major TreeFormula in Parent tree (if any)
Definition: TTreeIndex.h:41
Long64_t FindValues(Long64_t major, Long64_t minor) const
find position where major|minor values are in the IndexValues tables this is the index in IndexValues...
Definition: TTreeIndex.cxx:357
virtual void SetTree(const TTree *T)
this function is called by TChain::LoadTree and TTreePlayer::UpdateFormulaLeaves when a new Tree is l...
Definition: TTreeIndex.cxx:614
virtual Long64_t GetEntryNumberFriend(const TTree *parent)
Returns the entry number in this (friend) Tree corresponding to entry in the master Tree 'parent'.
Definition: TTreeIndex.cxx:322
virtual void UpdateFormulaLeaves(const TTree *parent)
Called by TChain::LoadTree when the parent chain changes it's tree.
Definition: TTreeIndex.cxx:595
Helper class to prevent infinite recursion in the usage of TTree Friends.
Definition: TTree.h:183
A TTree represents a columnar dataset.
Definition: TTree.h:78
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor=0) const
Return entry number corresponding to major and minor number.
Definition: TTree.cxx:5815
virtual TVirtualIndex * GetTreeIndex() const
Definition: TTree.h:512
virtual Long64_t GetEntries() const
Definition: TTree.h:457
virtual Long64_t GetReadEntry() const
Definition: TTree.h:503
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
Definition: TTree.cxx:6376
virtual Int_t GetTreeNumber() const
Definition: TTree.h:513
@ kFindBranch
Definition: TTree.h:207
@ kFindLeaf
Definition: TTree.h:208
@ kGetBranch
Definition: TTree.h:210
@ kGetLeaf
Definition: TTree.h:215
virtual void SetTreeIndex(TVirtualIndex *index)
The current TreeIndex is replaced by the new index.
Definition: TTree.cxx:9167
Abstract interface for Tree Index.
Definition: TVirtualIndex.h:30
virtual Long64_t GetN() const =0
RooCmdArg Index(RooCategory &icat)
const Int_t n
Definition: legend1.C:16
double T(double x)
Definition: ChebyshevPol.h:34