23 struct IndexSortComparator {
26 : fValMajor(major), fValMinor(minor)
29 template<
typename Index>
31 if( *(fValMajor + i1) == *(fValMajor + i2) )
32 return *(fValMinor + i1) < *(fValMinor + i2);
34 return *(fValMajor + i1) < *(fValMajor + i2);
141 Error(
"TreeIndex",
"Cannot build a TreeIndex with a Tree having no entries");
171 if (centry < 0)
break;
181 for(i = 0; i <
fN; i++) {
fIndex[i] = i; }
182 std::sort(
fIndex,
fIndex + fN, IndexSortComparator(tmp_major, tmp_minor) );
219 if (add && add->
GetN()) {
224 Error(
"Append",
"Can only Append a TTreeIndex to a TTreeIndex but got a %s",
243 memcpy(
fIndex,oldIndex, size);
251 memcpy(
fIndex + oldn, addIndex, add_size);
260 delete [] oldValues2;
270 for(
Long64_t i = 0; i <
fN; i++) { conv[i] = i; }
271 std::sort(conv, conv+fN, IndexSortComparator(addValues, addValues2) );
285 delete [] addValues2;
301 for(
int i=0; i<
fN; i++) {
321 if (!parent)
return -3;
391 if (
fN == 0)
return -1;
416 if (
fN == 0)
return -1;
516 Printf(
"\n*****************************************************************");
518 Printf(
"*****************************************************************");
520 Printf(
"*****************************************************************");
522 Printf(
"%8lld : %8lld : %8lld : %8lld",
527 Printf(
"\n**********************************************");
529 Printf(
"**********************************************");
531 Printf(
"**********************************************");
533 Printf(
"%8lld : %8lld : %8lld",
544 void TTreeIndex::Streamer(
TBuffer &R__b)
549 TVirtualIndex::Streamer(R__b);
566 TVirtualIndex::Streamer(R__b);
virtual const char * GetName() const
Returns name of object.
virtual TTreeFormula * GetMinorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the minorname in parent tree.
Abstract interface for Tree Index.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t mid
virtual void UpdateFormulaLeaves(const TTree *parent)
Called by TChain::LoadTree when the parent chain changes it's tree.
Long64_t * fIndexValuesMinor
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
TTreeFormula * fMajorFormulaParent
Pointer to minor TreeFormula.
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
A Tree Index with majorname and minorname.
TRObject operator()(const T1 &t1) const
virtual Long64_t GetReadEntry() const
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
virtual void SetTreeIndex(TVirtualIndex *index)
The current TreeIndex is replaced by the new index.
virtual Int_t GetTreeNumber() const
virtual Long64_t * GetIndexValuesMinor() const
TTreeFormula * fMinorFormulaParent
Pointer to major TreeFormula in Parent tree (if any)
virtual TTreeFormula * GetMajorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the majorname in parent tree.
virtual Long64_t * GetIndex() const
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor=0) const
Return entry number corresponding to major and minor number.
virtual TVirtualIndex * GetTreeIndex() const
virtual Long64_t GetEntryNumberFriend(const TTree *parent)
Returns the entry number in this (friend) Tree corresponding to entry in the master Tree 'parent'...
virtual Long64_t * GetIndexValues() const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual Long64_t GetN() const =0
virtual void Print(Option_t *option="") const
Print the table with : serial number, majorname, minorname.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const
Return entry number corresponding to major and minor number.
virtual TTreeFormula * GetMajorFormula()
Return a pointer to the TreeFormula corresponding to the majorname.
virtual ~TTreeIndex()
Destructor.
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
virtual void WriteFastArray(const Bool_t *b, Int_t n)=0
virtual void SetTree(const TTree *T)
this function is called by TChain::LoadTree and TTreePlayer::UpdateFormulaLeaves when a new Tree is l...
RooCmdArg Index(RooCategory &icat)
virtual TTreeFormula * GetMinorFormula()
Return a pointer to the TreeFormula corresponding to the minorname.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
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...
Helper class to prevent infinite recursion in the usage of TTree Friends.
virtual Long64_t GetEntries() const
bool ConvertOldToNew()
conversion from old 64bit indexes return true if index was converted
TTreeFormula * fMajorFormula
A TTree object has a header with a name and a title.
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const
Return entry number corresponding to major and minor number.
TTreeIndex()
Default constructor for TTreeIndex.
TTreeFormula * fMinorFormula
Pointer to major TreeFormula.
virtual void Append(const TVirtualIndex *, Bool_t delaySort=kFALSE)
Append 'add' to this index.
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.
const char * Data() const