25struct IndexSortComparator {
28 : fValMajor(major), fValMinor(minor)
31 template<
typename Index>
33 if( *(fValMajor + i1) == *(fValMajor + i2) )
34 return *(fValMinor + i1) < *(fValMinor + i2);
36 return *(fValMajor + i1) < *(fValMajor + i2);
140 fN =
T->GetEntries();
143 Error(
"TreeIndex",
"Cannot build a TreeIndex with a Tree having no entries");
173 if (centry < 0)
break;
183 for(i = 0; i <
fN; i++) {
fIndex[i] = i; }
184 std::sort(
fIndex,
fIndex +
fN, IndexSortComparator(tmp_major, tmp_minor) );
221 if (add && add->
GetN()) {
226 Error(
"Append",
"Can only Append a TTreeIndex to a TTreeIndex but got a %s",
245 memcpy(
fIndex,oldIndex, size);
253 memcpy(
fIndex + oldn, addIndex, add_size);
262 delete [] oldValues2;
272 for(
Long64_t i = 0; i <
fN; i++) { conv[i] = i; }
273 std::sort(conv, conv+
fN, IndexSortComparator(addValues, addValues2) );
287 delete [] addValues2;
303 for(
int i=0; i<
fN; i++) {
323 if (!parent)
return -3;
393 if (
fN == 0)
return -1;
418 if (
fN == 0)
return -1;
505 if ((majorFormula ==
nullptr || majorFormula->GetNdim() == 0) ||
506 (minorFormula ==
nullptr || minorFormula->GetNdim() == 0))
530 Printf(
"\n*****************************************************************");
532 Printf(
"*****************************************************************");
534 Printf(
"*****************************************************************");
536 Printf(
"%8lld : %8lld : %8lld : %8lld",
541 Printf(
"\n**********************************************");
543 Printf(
"**********************************************");
545 Printf(
"**********************************************");
547 Printf(
"%8lld : %8lld : %8lld",
558void TTreeIndex::Streamer(
TBuffer &R__b)
563 TVirtualIndex::Streamer(R__b);
580 TVirtualIndex::Streamer(R__b);
TRObject operator()(const T1 &t1) const
void Printf(const char *fmt,...)
Buffer base class used for serializing objects.
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
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.
virtual const char * GetName() const
Returns name of object.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
A Tree Index with majorname and minorname.
TTreeIndex()
Default constructor for TTreeIndex.
virtual Long64_t * GetIndexValues() const
virtual Long64_t * GetIndexValuesMinor() const
TTreeFormula * fMajorFormula
TTreeFormula * fMajorFormulaParent
Pointer to minor TreeFormula.
virtual TTreeFormula * GetMajorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the majorname in parent tree.
virtual ~TTreeIndex()
Destructor.
virtual Long64_t * GetIndex() const
bool ConvertOldToNew()
conversion from old 64bit indexes return true if index was converted
TTreeFormula * fMinorFormula
Pointer to major TreeFormula.
virtual Bool_t IsValidFor(const TTree *parent)
Return kTRUE if index can be applied to the TTree.
virtual TTreeFormula * GetMajorFormula()
Return a pointer to the TreeFormula corresponding to the majorname.
virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const
Return entry number corresponding to major and minor number.
virtual void Print(Option_t *option="") const
Print the table with : serial number, majorname, minorname.
virtual TTreeFormula * GetMinorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the minorname in parent tree.
virtual TTreeFormula * GetMinorFormula()
Return a pointer to the TreeFormula corresponding to the minorname.
virtual void Append(const TVirtualIndex *, Bool_t delaySort=kFALSE)
Append 'add' to this index.
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const
Return entry number corresponding to major and minor number.
Long64_t * fIndexValuesMinor
TTreeFormula * fMinorFormulaParent
Pointer to major TreeFormula in Parent tree (if any)
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...
virtual void SetTree(const TTree *T)
this function is called by TChain::LoadTree and TTreePlayer::UpdateFormulaLeaves when a new Tree is l...
virtual Long64_t GetEntryNumberFriend(const TTree *parent)
Returns the entry number in this (friend) Tree corresponding to entry in the master Tree 'parent'.
virtual void UpdateFormulaLeaves(const TTree *parent)
Called by TChain::LoadTree when the parent chain changes it's tree.
Helper class to prevent infinite recursion in the usage of TTree Friends.
A TTree represents a columnar dataset.
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 GetEntries() const
virtual Long64_t GetReadEntry() const
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
virtual Int_t GetTreeNumber() const
virtual void SetTreeIndex(TVirtualIndex *index)
The current TreeIndex is replaced by the new index.
Abstract interface for Tree Index.
virtual Long64_t GetN() const =0
RooCmdArg Index(RooCategory &icat)