X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ANALYSIS%2FAliAnalysisDataSlot.cxx;h=d859515d381a35f85ca438e8b48687ea9ea1003b;hb=8b52fa41ee1668dea15b9022ae2be5625227ebca;hp=2f39a7acd2e4b74f73f2e56ead35eba9df3b7545;hpb=521adffd7632d08b1abd44daf41be23aabdaef24;p=u%2Fmrichter%2FAliRoot.git diff --git a/ANALYSIS/AliAnalysisDataSlot.cxx b/ANALYSIS/AliAnalysisDataSlot.cxx index 2f39a7acd2e..d859515d381 100644 --- a/ANALYSIS/AliAnalysisDataSlot.cxx +++ b/ANALYSIS/AliAnalysisDataSlot.cxx @@ -138,6 +138,30 @@ void *AliAnalysisDataSlot::GetBranchAddress(const char *branchname) const return br->GetAddress(); } +//______________________________________________________________________________ +Int_t AliAnalysisDataSlot::EnableBranch(const char *bname, TTree *tree) +{ +// Static method to enable recursively a branch in a tree (why this in not in ROOT?) + TBranch *branch = tree->GetBranch(bname); + Int_t count = 0; +// static Int_t indent = 0; + if (!branch) return count; +// TString s; +// for (Int_t i=0; iGetName(), branch->TestBit(kDoNotProcess)); + branch->SetBit(kDoNotProcess, kFALSE); + TIter next(branch->GetListOfBranches()); + TBranch *branch_sub; + // Activate all sub-branches +// indent++; + while ((branch_sub=(TBranch*)next())) { + count += AliAnalysisDataSlot::EnableBranch(branch_sub->GetName(), tree); + } +// indent--; + return count; +} + //______________________________________________________________________________ Bool_t AliAnalysisDataSlot::SetBranchAddress(const char *branchname, void *address) { @@ -148,17 +172,6 @@ Bool_t AliAnalysisDataSlot::SetBranchAddress(const char *branchname, void *addre return kFALSE; } TTree *tree = (TTree*)GetData(); - // Activate the branch itself - tree->SetBranchStatus(branchname,1); - TBranch *branch = tree->GetBranch(branchname); - if (!branch) return kFALSE; - TIter next(branch->GetListOfLeaves()); - TLeaf *leaf; - // Activate all sub-branches - while ((leaf=(TLeaf*)next())) { - branch = (TBranch*)leaf->GetBranch(); - tree->SetBranchStatus(branch->GetName(),1); - } tree->SetBranchAddress(branchname, address); return kTRUE; }