]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisDataSlot.cxx
Added support for dylib in test mode
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisDataSlot.cxx
index de55e65e451fb0d6fc902ba72138c3a4015d26f4..ddcf4fd88499369b1dc920d5b93ad0ab0776c684 100644 (file)
 #include <TROOT.h>
 #include <TClass.h>
 #include <TTree.h>
+#include <TLeaf.h>
 
 #include "AliAnalysisDataSlot.h"
 #include "AliAnalysisTask.h"
 #include "AliAnalysisDataContainer.h"
 
+using std::endl;
+using std::cout;
 ClassImp(AliAnalysisDataSlot)
 
 //______________________________________________________________________________
@@ -137,6 +140,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; i<indent; i++) s += " ";
+   count++;
+//   printf("%sbranch %s: kDoNotProcess=%d\n",s.Data(), branch->GetName(), 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)
 {
@@ -147,7 +174,6 @@ Bool_t AliAnalysisDataSlot::SetBranchAddress(const char *branchname, void *addre
       return kFALSE;
    }
    TTree *tree = (TTree*)GetData();
-   tree->SetBranchStatus(branchname,1);
    tree->SetBranchAddress(branchname, address);
    return kTRUE;
 }   
@@ -157,7 +183,6 @@ TObject *AliAnalysisDataSlot::GetData() const
 {
 // Retreives the data from the container if it is ready.
    if (!fContainer) {
-     cout<<"Data slot of type "<<GetTitle()<<" of task "<<fParent->GetName()<<" has no connected data container"<<endl;
      //AliError(Form("Data slot of type %s of task %s has no connected data container",fType->GetName(), fParent->GetName()));    
       return NULL;
    }