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