diff --git a/tree/tree/inc/TLeaf.h b/tree/tree/inc/TLeaf.h index 2c3f6fec7ec66e8ac6ff77306399d52081ac5ff1..ea22d948be796012e506a4a8e0f5bd21601bd280 100644 --- a/tree/tree/inc/TLeaf.h +++ b/tree/tree/inc/TLeaf.h @@ -82,7 +82,7 @@ public: virtual Double_t GetValue(Int_t i = 0) const; virtual Long64_t GetValueLong64(Int_t i = 0) const { return GetValue(i); } //overload only when it matters. - virtual LongDouble_t GetValueLongDouble(Int_t i = 0) const { return GetValue(i); } // overload only when it matters. + virtual LongDouble_t GetValueLongDouble(Int_t i = 0) const { return GetValue(i); } // overload only when it matters. template <typename T > T GetTypedValue(Int_t i = 0) const { return GetValueHelper<T>::Exec(this, i); } virtual void Import(TClonesArray*, Int_t) {} @@ -109,15 +109,14 @@ public: template <> struct TLeaf::GetValueHelper<Long64_t> { - static Long64_t Exec(const TLeaf *leaf, Int_t i = 0) { return leaf->GetValueLong64(i); } -}; + static Long64_t Exec(const TLeaf *leaf, Int_t i = 0) { return leaf->GetValueLong64(i); } +}; template <> struct TLeaf::GetValueHelper<ULong64_t> { - static ULong64_t Exec(const TLeaf *leaf, Int_t i = 0) { return (ULong64_t)leaf->GetValueLong64(i); } -}; + static ULong64_t Exec(const TLeaf *leaf, Int_t i = 0) { return (ULong64_t)leaf->GetValueLong64(i); } +}; template <> struct TLeaf::GetValueHelper<LongDouble_t> { - static LongDouble_t Exec(const TLeaf *leaf, Int_t i = 0) { return leaf->GetValueLongDouble(i); } -}; - + static LongDouble_t Exec(const TLeaf *leaf, Int_t i = 0) { return leaf->GetValueLongDouble(i); } +}; inline Double_t TLeaf::GetValue(Int_t /*i = 0*/) const { return 0.0; } diff --git a/tree/tree/inc/TLeafElement.h b/tree/tree/inc/TLeafElement.h index dcc289feddf3d6b20ee36e02c1fb50dc6bfa55e7..43a84638c773181f916b158c2d73cd6ccf42b59a 100644 --- a/tree/tree/inc/TLeafElement.h +++ b/tree/tree/inc/TLeafElement.h @@ -53,7 +53,7 @@ public: virtual Long64_t GetValueLong64(Int_t i = 0) const { return ((TBranchElement*)fBranch)->GetTypedValue<Long64_t>(i, fLen, kFALSE); } virtual LongDouble_t GetValueLongDouble(Int_t i = 0) const { return ((TBranchElement*)fBranch)->GetTypedValue<LongDouble_t>(i, fLen, kFALSE); } template<typename T> T GetTypedValueSubArray(Int_t i=0, Int_t j=0) const {return ((TBranchElement*)fBranch)->GetTypedValue<T>(i, j, kTRUE);} - + virtual void *GetValuePointer() const { return ((TBranchElement*)fBranch)->GetValuePointer(); } virtual Bool_t IsOnTerminalBranch() const; virtual void PrintValue(Int_t i=0) const {((TBranchElement*)fBranch)->PrintValue(i);} diff --git a/tree/treeplayer/inc/TChainIndex.h b/tree/treeplayer/inc/TChainIndex.h index c35ab648fea2362664101422813f9aeb7862eea4..2a457d83c72aee9913d907ff533c7a0fe7943bb5 100644 --- a/tree/treeplayer/inc/TChainIndex.h +++ b/tree/treeplayer/inc/TChainIndex.h @@ -44,15 +44,15 @@ public: class TChainIndexEntry { // holds a description of indices of trees in the chain. public: - TChainIndexEntry() : fMinIndexValue(0), fMinIndexValMinor(0), - fMaxIndexValue(0), fMaxIndexValMinor(0), - fTreeIndex(0) {} + TChainIndexEntry() : fMinIndexValue(0), fMinIndexValMinor(0), + fMaxIndexValue(0), fMaxIndexValMinor(0), + fTreeIndex(0) {} - typedef std::pair<Long64_t, Long64_t> IndexValPair_t; + typedef std::pair<Long64_t, Long64_t> IndexValPair_t; - IndexValPair_t GetMinIndexValPair() const { return IndexValPair_t(fMinIndexValue, fMinIndexValMinor); } - IndexValPair_t GetMaxIndexValPair() const { return IndexValPair_t(fMaxIndexValue, fMaxIndexValMinor); } - void SetMinMaxFrom(const TTreeIndex *index ); + IndexValPair_t GetMinIndexValPair() const { return IndexValPair_t(fMinIndexValue, fMinIndexValMinor); } + IndexValPair_t GetMaxIndexValPair() const { return IndexValPair_t(fMaxIndexValue, fMaxIndexValMinor); } + void SetMinMaxFrom(const TTreeIndex *index ); Long64_t fMinIndexValue; // the minimum value of the index (upper bits) Long64_t fMinIndexValMinor; // the minimum value of the index (lower bits) diff --git a/tree/treeplayer/inc/TFormLeafInfo.h b/tree/treeplayer/inc/TFormLeafInfo.h index 18d12eb94faf9b69fa7bf23e866cda09363d102e..f43685df65cc5e8cf2f3b1a04e9801fb7fe02733 100644 --- a/tree/treeplayer/inc/TFormLeafInfo.h +++ b/tree/treeplayer/inc/TFormLeafInfo.h @@ -28,23 +28,23 @@ // declare the extra versions of GetValue() plus templated implementation #define DECLARE_GETVAL \ - virtual Double_t GetValue(TLeaf *leaf, Int_t instance = 0) \ - { return GetValueImpl<Double_t>(leaf, instance); } \ - virtual Long64_t GetValueLong64(TLeaf *leaf, Int_t instance = 0) \ - { return GetValueImpl<Long64_t>(leaf, instance); } \ + virtual Double_t GetValue(TLeaf *leaf, Int_t instance = 0) \ + { return GetValueImpl<Double_t>(leaf, instance); } \ + virtual Long64_t GetValueLong64(TLeaf *leaf, Int_t instance = 0) \ + { return GetValueImpl<Long64_t>(leaf, instance); } \ virtual LongDouble_t GetValueLongDouble(TLeaf *leaf, Int_t instance = 0) \ { return GetValueImpl<LongDouble_t>(leaf, instance); } \ template<typename T> T GetValueImpl(TLeaf *leaf, Int_t instance = 0) // no semicolon - + // declare the extra versions of ReadValue() plus templated implementation #define DECLARE_READVAL \ - virtual Double_t ReadValue(char *where, Int_t instance = 0) \ - { return ReadValueImpl<Double_t>(where, instance); } \ - virtual Long64_t ReadValueLong64(char *where, Int_t instance = 0) \ - { return ReadValueImpl<Long64_t>(where, instance); } \ - virtual LongDouble_t ReadValueLongDouble(char *where, Int_t instance = 0) \ - { return ReadValueImpl<LongDouble_t>(where, instance); } \ + virtual Double_t ReadValue(char *where, Int_t instance = 0) \ + { return ReadValueImpl<Double_t>(where, instance); } \ + virtual Long64_t ReadValueLong64(char *where, Int_t instance = 0) \ + { return ReadValueImpl<Long64_t>(where, instance); } \ + virtual LongDouble_t ReadValueLongDouble(char *where, Int_t instance = 0) \ + { return ReadValueImpl<LongDouble_t>(where, instance); } \ template<typename T> T ReadValueImpl(char *where, Int_t instance = 0) // no semicolon @@ -116,48 +116,51 @@ public: virtual void SetSize(Int_t index, Int_t val); virtual void SetBranch(TBranch* br) { if ( fNext ) fNext->SetBranch(br); } virtual void UpdateSizes(TArrayI *garr); - - virtual Bool_t Update(); + + virtual Bool_t Update(); DECLARE_GETVAL; DECLARE_READVAL; - + template <typename T> struct ReadValueHelper { - static T Exec(TFormLeafInfo *leaf, char *where, Int_t instance) - { return leaf->ReadValue(where, instance); } + static T Exec(TFormLeafInfo *leaf, char *where, Int_t instance) { + return leaf->ReadValue(where, instance); + } }; - template <typename T > T ReadTypedValue(char *where, Int_t instance = 0) - { return ReadValueHelper<T>::Exec(this, where, instance); } + template <typename T > T ReadTypedValue(char *where, Int_t instance = 0) { + return ReadValueHelper<T>::Exec(this, where, instance); + } template <typename T> struct GetValueHelper { - static T Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) - { return linfo->GetValue(leaf, instance); } + static T Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) { + return linfo->GetValue(leaf, instance); + } }; - template <typename T > T GetTypedValue(TLeaf *leaf, Int_t instance = 0) - { return GetValueHelper<T>::Exec(this, leaf, instance); } + template <typename T > T GetTypedValue(TLeaf *leaf, Int_t instance = 0) { + return GetValueHelper<T>::Exec(this, leaf, instance); + } }; template <> struct TFormLeafInfo::ReadValueHelper<Long64_t> { - static Long64_t Exec(TFormLeafInfo *leaf, char *where, Int_t instance) { return leaf->ReadValueLong64(where, instance); } -}; + static Long64_t Exec(TFormLeafInfo *leaf, char *where, Int_t instance) { return leaf->ReadValueLong64(where, instance); } +}; template <> struct TFormLeafInfo::ReadValueHelper<ULong64_t> { - static ULong64_t Exec(TFormLeafInfo *leaf, char *where, Int_t instance) { return (ULong64_t)leaf->ReadValueLong64(where, instance); } -}; + static ULong64_t Exec(TFormLeafInfo *leaf, char *where, Int_t instance) { return (ULong64_t)leaf->ReadValueLong64(where, instance); } +}; template <> struct TFormLeafInfo::ReadValueHelper<LongDouble_t> { - static LongDouble_t Exec(TFormLeafInfo *leaf, char *where, Int_t instance) { return leaf->ReadValueLongDouble(where, instance); } -}; - + static LongDouble_t Exec(TFormLeafInfo *leaf, char *where, Int_t instance) { return leaf->ReadValueLongDouble(where, instance); } +}; template <> struct TFormLeafInfo::GetValueHelper<Long64_t> { - static Long64_t Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) { return linfo->GetValueLong64(leaf, instance); } -}; + static Long64_t Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) { return linfo->GetValueLong64(leaf, instance); } +}; template <> struct TFormLeafInfo::GetValueHelper<ULong64_t> { - static ULong64_t Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) { return (ULong64_t)linfo->GetValueLong64(leaf, instance); } -}; + static ULong64_t Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) { return (ULong64_t)linfo->GetValueLong64(leaf, instance); } +}; template <> struct TFormLeafInfo::GetValueHelper<LongDouble_t> { - static LongDouble_t Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) { return linfo->GetValueLongDouble(leaf, instance); } -}; + static LongDouble_t Exec(TFormLeafInfo *linfo, TLeaf *leaf, Int_t instance) { return linfo->GetValueLongDouble(leaf, instance); } +}; @@ -306,8 +309,8 @@ public: virtual Bool_t Update(); - DECLARE_GETVAL; - DECLARE_READVAL; + DECLARE_GETVAL; + DECLARE_READVAL; virtual Int_t GetCounterValue(TLeaf* leaf); virtual Int_t ReadCounterValue(char* where); virtual Int_t GetCounterValue(TLeaf* leaf, Int_t instance); @@ -363,8 +366,8 @@ public: virtual TFormLeafInfo* DeepCopy() const; - DECLARE_GETVAL; - DECLARE_READVAL; + DECLARE_GETVAL; + DECLARE_READVAL; }; //______________________________________________________________________________ diff --git a/tree/treeplayer/inc/TTreeFormula.h b/tree/treeplayer/inc/TTreeFormula.h index 1759a0ac9bcc2c45cf960139e9ba6cd8702269d8..4d1e85f347620fe2edf46038793403193bdec527 100644 --- a/tree/treeplayer/inc/TTreeFormula.h +++ b/tree/treeplayer/inc/TTreeFormula.h @@ -161,8 +161,8 @@ private: // Not implemented yet TTreeFormula(const TTreeFormula&); TTreeFormula& operator=(const TTreeFormula&); - - template<typename T> T GetConstant(Int_t k) ; + + template<typename T> T GetConstant(Int_t k); public: TTreeFormula(); diff --git a/tree/treeplayer/src/TChainIndex.cxx b/tree/treeplayer/src/TChainIndex.cxx index 7ad9bf940110b88caffc8a5dcf00c224febf63c4..0331dea397a11a0b0ac92974804a9057b9f9fec6 100644 --- a/tree/treeplayer/src/TChainIndex.cxx +++ b/tree/treeplayer/src/TChainIndex.cxx @@ -23,7 +23,7 @@ #include "TError.h" - + //______________________________________________________________________________ void TChainIndex::TChainIndexEntry::SetMinMaxFrom(const TTreeIndex *index ) { @@ -124,15 +124,14 @@ TChainIndex::TChainIndex(const TTree *T, const char *majorname, const char *mino Error("TChainIndex", "The indices in files of this chain aren't sorted."); } } - } - //______________________________________________________________________________ void TChainIndex::Append(const TVirtualIndex *index, Bool_t delaySort ) { // add an index to this chain // if delaySort is kFALSE (default) check if the indices of different trees are in order. + if (index) { const TTreeIndex *ti_index = dynamic_cast<const TTreeIndex*>(index); if (ti_index == 0) { @@ -197,7 +196,7 @@ std::pair<TVirtualIndex*, Int_t> TChainIndex::GetSubTreeIndex(Long64_t major, Lo } const TChainIndexEntry::IndexValPair_t indexValue(major, minor); - + if( indexValue < fEntries[0].GetMinIndexValPair() ) { Warning("GetSubTreeIndex", "The index value is less than the smallest index values in subtrees"); return make_pair(static_cast<TVirtualIndex*>(0), 0); diff --git a/tree/treeplayer/src/TFormLeafInfo.cxx b/tree/treeplayer/src/TFormLeafInfo.cxx index 72f976c01394604bcd9f8451ab4bcd412b95e2a1..1f9774439831d643c3cc9f983c90780129863716 100644 --- a/tree/treeplayer/src/TFormLeafInfo.cxx +++ b/tree/treeplayer/src/TFormLeafInfo.cxx @@ -770,9 +770,8 @@ void* TFormLeafInfo::GetLocalValuePointer(char *thisobj, Int_t instance) case kOther_t: default: return 0; } - } - + //______________________________________________________________________________ template <typename T> @@ -1611,7 +1610,7 @@ Int_t TFormLeafInfoCollection::GetCounterValue(TLeaf* leaf, Int_t instance) } //______________________________________________________________________________ -template <typename T> +template <typename T> T TFormLeafInfoCollection::ReadValueImpl(char *where, Int_t instance) { // Return the value of the underlying data member inside the @@ -1647,7 +1646,6 @@ T TFormLeafInfoCollection::ReadValueImpl(char *where, Int_t instance) INSTANTIATE_GETVAL(TFormLeafInfoCollection); INSTANTIATE_READVAL(TFormLeafInfoCollection); - //______________________________________________________________________________ void* TFormLeafInfoCollection::GetLocalValuePointer(TLeaf *leaf, Int_t /*instance*/) { diff --git a/tree/treeplayer/src/TFormLeafInfoReference.cxx b/tree/treeplayer/src/TFormLeafInfoReference.cxx index 7c7665f8c72ec078410216eb73b1baa9a213f25b..a2755aa1374be590b203d64b74f4ebd8bbce7c55 100644 --- a/tree/treeplayer/src/TFormLeafInfoReference.cxx +++ b/tree/treeplayer/src/TFormLeafInfoReference.cxx @@ -167,10 +167,10 @@ T TFormLeafInfoReference::GetValueImpl(TLeaf *leaf, Int_t instance) fBranch = leaf->GetBranch(); return TFormLeafInfo::GetValueImpl<T>(leaf, instance); } -template Double_t TFormLeafInfoReference::GetValueImpl<Double_t>(TLeaf*, Int_t); -template Long64_t TFormLeafInfoReference::GetValueImpl<Long64_t>(TLeaf*, Int_t); -template LongDouble_t TFormLeafInfoReference::GetValueImpl<LongDouble_t>(TLeaf*, Int_t); +template Double_t TFormLeafInfoReference::GetValueImpl<Double_t>(TLeaf*, Int_t); +template Long64_t TFormLeafInfoReference::GetValueImpl<Long64_t>(TLeaf*, Int_t); +template LongDouble_t TFormLeafInfoReference::GetValueImpl<LongDouble_t>(TLeaf*, Int_t); //______________________________________________________________________________ void *TFormLeafInfoReference::GetLocalValuePointer( TLeaf *from, Int_t instance) @@ -220,7 +220,7 @@ T TFormLeafInfoReference::ReadValueImpl(char *where, Int_t instance) return result; } -template Double_t TFormLeafInfoReference::ReadValueImpl<Double_t>(char*, Int_t); -template Long64_t TFormLeafInfoReference::ReadValueImpl<Long64_t>(char*, Int_t); +template Double_t TFormLeafInfoReference::ReadValueImpl<Double_t>(char*, Int_t); +template Long64_t TFormLeafInfoReference::ReadValueImpl<Long64_t>(char*, Int_t); template LongDouble_t TFormLeafInfoReference::ReadValueImpl<LongDouble_t>(char*, Int_t); diff --git a/tree/treeplayer/src/TTreeFormula.cxx b/tree/treeplayer/src/TTreeFormula.cxx index afafe3d2a13588e4bec09874865909daea0fe928..c5baf5b093796a058f6ee384419728564b6dfc13 100644 --- a/tree/treeplayer/src/TTreeFormula.cxx +++ b/tree/treeplayer/src/TTreeFormula.cxx @@ -3884,7 +3884,7 @@ template<> inline LongDouble_t TTreeFormula::GetConstant(Int_t k) { for (Int_t op=0; op<fNoper ; ++op) { const Int_t oper = GetOper()[op]; if( (oper >> kTFOperShift) == kConstant ) { - int i = (oper & kTFOperMask); + int i = (oper & kTFOperMask); if( !strncmp(fExpr[op], "0x", 2) || !strncmp(fExpr[op], "0X", 2) ) { ULong64_t val; sscanf( fExpr[op], "%llx", &val ); @@ -3911,7 +3911,7 @@ T TTreeFormula::EvalInstance(Int_t instance, const char *stringStackArg[]) // efficiencies. if (TestBit(kMissingLeaf)) return 0; if (fNoper == 1 && fNcodes > 0) { - + switch (fLookupType[0]) { case kDirect: { TT_EVAL_INIT; diff --git a/tree/treeplayer/src/TTreeIndex.cxx b/tree/treeplayer/src/TTreeIndex.cxx index f750ce028da5dbe1ed55583756e1a827ff597d5a..27b056524dd7db10c9c95b133467fb23b87d063d 100644 --- a/tree/treeplayer/src/TTreeIndex.cxx +++ b/tree/treeplayer/src/TTreeIndex.cxx @@ -41,7 +41,7 @@ struct IndexSortComparator { Long64_t *fValMajor, *fValMinor; }; - + //______________________________________________________________________________ TTreeIndex::TTreeIndex(): TVirtualIndex() { @@ -172,7 +172,7 @@ TTreeIndex::TTreeIndex(const TTree *T, const char *majorname, const char *minorn tmp_major[i] = (Long64_t) fMajorFormula->EvalInstance<LongDouble_t>(); tmp_minor[i] = (Long64_t) fMinorFormula->EvalInstance<LongDouble_t>(); } - fIndex = new Long64_t[fN]; + fIndex = new Long64_t[fN]; for(i = 0; i < fN; i++) { fIndex[i] = i; } std::sort(fIndex, fIndex + fN, IndexSortComparator(tmp_major, tmp_minor) ); //TMath::Sort(fN,w,fIndex,0); @@ -345,7 +345,7 @@ Long64_t TTreeIndex::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 table, not entry# ! - // use lower_bound STD algorithm + // use lower_bound STD algorithm. Long64_t mid, step, pos = 0, count = fN; // find lower bound using bisection @@ -363,7 +363,7 @@ Long64_t TTreeIndex::FindValues(Long64_t major, Long64_t minor) const return pos; } - + //______________________________________________________________________________ Long64_t TTreeIndex::GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) const { @@ -389,7 +389,7 @@ Long64_t TTreeIndex::GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor) return fIndex[pos]; if( --pos < 0 ) return -1; - return fIndex[pos]; + return fIndex[pos]; }