32 template<
typename Index>
141 fN = T->GetEntries();
144 Error(
"TreeIndex",
"Cannot build a TreeIndex with a Tree having no entries");
174 if (centry < 0)
break;
180 auto GetAndRangeCheck = [
this](
bool isMajor,
Long64_t entry) {
189 retCloserToZero -= 1;
191 retCloserToZero += 1;
192 if (retCloserToZero == ret) {
194 "In tree entry %lld, %s value %s=%Lf possibly out of range for internal `long double`", entry,
199 tmp_major[i] = GetAndRangeCheck(
true, i);
200 tmp_minor[i] = GetAndRangeCheck(
false, i);
203 for(i = 0; i <
fN; i++) {
fIndex[i] = i; }
241 if (add && add->
GetN()) {
246 Error(
"Append",
"Can only Append a TTreeIndex to a TTreeIndex but got a %s",
273 memcpy(
fIndex + oldn, addIndex, add_size);
282 delete [] oldValues2;
292 for(
Long64_t i = 0; i <
fN; i++) { conv[i] = i; }
307 delete [] addValues2;
323 for(
int i=0; i<
fN; i++) {
343 if (!parent)
return -3;
416 if (
fN == 0)
return -1;
441 if (
fN == 0)
return -1;
528 if ((majorFormula ==
nullptr || majorFormula->GetNdim() == 0) ||
529 (minorFormula ==
nullptr || minorFormula->GetNdim() == 0))
553 Printf(
"\n*****************************************************************");
555 Printf(
"*****************************************************************");
557 Printf(
"*****************************************************************");
559 Printf(
"%8lld : %8lld : %8lld : %8lld",
564 Printf(
"\n**********************************************");
566 Printf(
"**********************************************");
568 Printf(
"**********************************************");
570 Printf(
"%8lld : %8lld : %8lld",
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Buffer base class used for serializing objects.
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=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
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
const char * Data() const
virtual void Streamer(TBuffer &)
Stream a string object.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
A Tree Index with majorname and minorname.
TTreeIndex()
Default constructor for TTreeIndex.
virtual void SetTree(TTree *T)
this function is called by TChain::LoadTree and TTreePlayer::UpdateFormulaLeaves when a new Tree is l...
virtual Long64_t * GetIndexValues() const
virtual Long64_t * GetIndexValuesMinor() const
TTreeFormula * fMajorFormula
! Pointer to major TreeFormula
TTreeFormula * fMajorFormulaParent
! Pointer to major TreeFormula in Parent tree (if any)
Long64_t * fIndex
[fN] Index of sorted values
TTreeFormula * GetMajorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the majorname in parent tree.
virtual ~TTreeIndex()
Destructor.
virtual TClass * IsA() const
Long64_t fN
Number of entries.
virtual Long64_t * GetIndex() const
virtual void Streamer(TBuffer &)
Stream an object of class TTreeIndex.
bool ConvertOldToNew()
conversion from old 64bit indexes return true if index was converted
TTreeFormula * fMinorFormula
! Pointer to minor 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.
TTreeFormula * GetMinorFormulaParent(const TTree *parent)
Return a pointer to the TreeFormula corresponding to the minorname in parent tree.
TString fMinorName
Index minor name.
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.
Long64_t * fIndexValues
[fN] Sorted index values, higher 64bits
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor) const
Return entry number corresponding to major and minor number.
TString fMajorName
Index major name.
Long64_t * fIndexValuesMinor
[fN] Sorted index values, lower 64bits
TTreeFormula * fMinorFormulaParent
! Pointer to minor 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 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.
void Streamer(TBuffer &) override
Stream an object of class TObject.
virtual Long64_t GetN() const =0
TClass * IsA() const override
bool operator()(Index i1, Index i2)
IndexSortComparator(Long64_t *major, Long64_t *minor)