Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions tree/tree/inc/TChain.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ class TChain : public TTree {
TObjArray *GetListOfFiles() const {return fFiles;}
TObjArray *GetListOfLeaves() override;
const char *GetAlias(const char *aliasName) const override;
Double_t GetMaximum(const char *columname) override;
Double_t GetMinimum(const char *columname) override;
Int_t GetNbranches() override;
Long64_t GetReadEntry() const override;
TList *GetStatus() const { return fStatus; }
Expand Down
12 changes: 10 additions & 2 deletions tree/tree/inc/TTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ class TTree : public TNamed, public TAttLine, public TAttFill, public TAttMarker
Int_t
SetBranchAddressImp(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr);

// Helper method to factorize the processing logic for GetMinium, GetMaximum
double ComputeExtremum(const char *columname, double errVal, bool (*cmp)(double, double));

protected:
friend TBranch *ROOT::Internal::TreeUtils::CallBranchImpRef(TTree &tree, const char *branchname, TClass *ptrClass,
EDataType datatype, void *addobj, Int_t bufsize,
Expand All @@ -200,8 +203,7 @@ class TTree : public TNamed, public TAttLine, public TAttFill, public TAttMarker
virtual Int_t CheckBranchAddressType(TBranch* branch, TClass* ptrClass, EDataType datatype, bool ptr);
virtual TBranch *BronchExec(const char* name, const char* classname, void* addobj, bool isptrptr, Int_t bufsize, Int_t splitlevel);
friend TBranch *TTreeBranchImpRef(TTree *tree, const char* branchname, TClass* ptrClass, EDataType datatype, void* addobj, Int_t bufsize, Int_t splitlevel);
Int_t SetBranchAddressImp(TBranch *branch, void* addr, TBranch** ptr);
virtual TLeaf *GetLeafImpl(const char* branchname, const char* leafname);
Int_t SetBranchAddressImp(TBranch *branch, void *addr, TBranch **ptr);

Long64_t GetCacheAutoSize(bool withDefault = false);
char GetNewlineValue(std::istream &inputStream);
Expand All @@ -218,6 +220,12 @@ class TTree : public TNamed, public TAttLine, public TAttFill, public TAttMarker
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype,
bool isptr, bool suppressMissingBranchError);

// Group of methods to help better separating logic used in GetLeaf
TBranch *FindBranchFromSelf(const char *branchName);
TBranch *FindBranchFromFriends(const char *branchName);
TLeaf *SearchLeafInListOfLeaves(const char *branchName, const char *leafName);
TLeaf *SearchLeafInListOfFriends(const char *branchName, const char *leafName);

class TFriendLock {
// Helper class to prevent infinite recursion in the
// usage of TTree Friends. Implemented in TTree.cxx.
Expand Down
70 changes: 0 additions & 70 deletions tree/tree/src/TChain.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1134,76 +1134,6 @@ TObjArray* TChain::GetListOfLeaves()
return nullptr;
}

////////////////////////////////////////////////////////////////////////////////
/// Return maximum of column with name columname.

Double_t TChain::GetMaximum(const char* columname)
{
Double_t cmax = -DBL_MAX;
TLeaf *leaf = nullptr;
TBranch *branch = nullptr;
Int_t treenumber = -1;
for (Long64_t i = 0; i < fEntries; ++i) {
Long64_t entryNumber = this->GetEntryNumber(i);
if (entryNumber < 0)
break;
Long64_t localEntryNumber = this->LoadTree(entryNumber);
if (localEntryNumber < 0)
break;
if (treenumber != this->GetTreeNumber()) {
leaf = this->GetLeaf(columname);
if (leaf)
branch = leaf->GetBranch();
}
treenumber = this->GetTreeNumber();
if (!branch)
continue;
branch->GetEntry(localEntryNumber);
for (Int_t j = 0; j < leaf->GetLen(); ++j) {
Double_t val = leaf->GetValue(j);
if (val > cmax) {
cmax = val;
}
}
}
return cmax;
}

////////////////////////////////////////////////////////////////////////////////
/// Return minimum of column with name columname.

Double_t TChain::GetMinimum(const char* columname)
{
Double_t cmin = DBL_MAX;
TLeaf *leaf = nullptr;
TBranch *branch = nullptr;
Int_t treenumber = -1;
for (Long64_t i = 0; i < fEntries; ++i) {
Long64_t entryNumber = this->GetEntryNumber(i);
if (entryNumber < 0)
break;
Long64_t localEntryNumber = this->LoadTree(entryNumber);
if (localEntryNumber < 0)
break;
if (treenumber != this->GetTreeNumber()) {
leaf = this->GetLeaf(columname);
if (leaf)
branch = leaf->GetBranch();
}
treenumber = this->GetTreeNumber();
if (!branch)
continue;
branch->GetEntry(localEntryNumber);
for (Int_t j = 0; j < leaf->GetLen(); ++j) {
Double_t val = leaf->GetValue(j);
if (val < cmin) {
cmin = val;
}
}
}
return cmin;
}

////////////////////////////////////////////////////////////////////////////////
/// Return the number of branches of the current tree.
///
Expand Down
Loading
Loading