]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliESDInputHandler.cxx
Fix fixed-string length bug
[u/mrichter/AliRoot.git] / STEER / AliESDInputHandler.cxx
index d5cbbfe5e2371505fbf4dadea7c7c38ea5c6d3cf..e6e86712113532dc89cc2ea67fedb283c39b6e17 100644 (file)
@@ -23,6 +23,7 @@
 #include <TTree.h>
 #include <TString.h>
 #include <TObjString.h>
+#include <TProcessID.h>
 
 #include "AliESDInputHandler.h"
 #include "AliESDEvent.h"
@@ -35,7 +36,8 @@ ClassImp(AliESDInputHandler)
 AliESDInputHandler::AliESDInputHandler() :
   AliInputEventHandler(),
   fEvent(0x0),
-  fBranches("")
+  fBranches(""),
+  fBranchesOn("")
 {
   // default constructor
 }
@@ -49,8 +51,9 @@ AliESDInputHandler::~AliESDInputHandler()
 
 //______________________________________________________________________________
 AliESDInputHandler::AliESDInputHandler(const char* name, const char* title):
-    AliInputEventHandler(name, title), fEvent(0x0), fBranches("")
+  AliInputEventHandler(name, title), fEvent(0x0), fBranches(""), fBranchesOn("")
 {
+    // Constructor
 }
 
 Bool_t AliESDInputHandler::Init(TTree* tree,  Option_t* /*opt*/)
@@ -61,6 +64,7 @@ Bool_t AliESDInputHandler::Init(TTree* tree,  Option_t* /*opt*/)
     if (!fTree) return kFALSE;
     // Get pointer to ESD event
     SwitchOffBranches();
+    SwitchOnBranches();
     
     if (fEvent) {
       delete fEvent;
@@ -83,21 +87,38 @@ Bool_t AliESDInputHandler::BeginEvent(Long64_t /*entry*/)
   return kTRUE;
 }
 
-Bool_t  AliESDInputHandler::FinishEvent(){
-  if(fEvent)fEvent->Reset();
-  return kTRUE;
+Bool_t  AliESDInputHandler::FinishEvent()
+{
+    // Finish the event 
+    if(fEvent)fEvent->Reset();
+    return kTRUE;
 } 
 
 void AliESDInputHandler::SwitchOffBranches() const {
   //
   // Switch of branches on user request
-  TObjArray * tokens = fBranches.Tokenize(" ");
+    TObjArray * tokens = fBranches.Tokenize(" ");
+    Int_t ntok = tokens->GetEntries();
+    for (Int_t i = 0; i < ntok; i++)  {
+       TString str = ((TObjString*) tokens->At(i))->GetString();
+       if (str.Length() == 0)
+           continue;
+       fTree->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 0);
+       AliInfo(Form("Branch %s switched off \n", str.Data()));
+    }
+}
+
+void AliESDInputHandler::SwitchOnBranches() const {
+  //
+  // Switch of branches on user request
+  TObjArray * tokens = fBranchesOn.Tokenize(" ");
   Int_t ntok = tokens->GetEntries();
+
   for (Int_t i = 0; i < ntok; i++)  {
-    TString str = ((TObjString*) tokens->At(i))->GetString();
-    if (str.Length() == 0)
-       continue;
-    fTree->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 0);
-    AliInfo(Form("Branch %s switched off \n", str.Data()));
+      TString str = ((TObjString*) tokens->At(i))->GetString();
+      if (str.Length() == 0)
+         continue;
+      fTree->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 1);
+      AliInfo(Form("Branch %s switched on \n", str.Data()));
   }
 }