]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Separate methods Init(Option_t *) (called by AnalysisManager::SlaveBegin)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Nov 2007 14:09:02 +0000 (14:09 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Nov 2007 14:09:02 +0000 (14:09 +0000)
and Init(TTree* ) (called by AnalysisManager::Init())

STEER/AliAODHandler.cxx
STEER/AliAODHandler.h
STEER/AliAODInputHandler.cxx
STEER/AliAODInputHandler.h
STEER/AliESDInputHandler.cxx
STEER/AliESDInputHandler.h
STEER/AliInputEventHandler.h
STEER/AliMCEventHandler.cxx
STEER/AliMCEventHandler.h
STEER/AliVEventHandler.h

index 0c61768b3676d73d6b2a86ba88b2439b10aa0100..316436567e271d63dcd73a8c58419c2fcdaab96b 100644 (file)
@@ -65,7 +65,7 @@ AliAODHandler::~AliAODHandler()
 }
 
 
-Bool_t AliAODHandler::InitIO(Option_t* opt)
+Bool_t AliAODHandler::Init(Option_t* opt)
 {
   // Initialize IO
   //
index a143e8d8f8f191abc561b3c4857002326b16fc55..dac04dd15c8bb97975fd47105bbaa8155bd8290d 100644 (file)
@@ -26,9 +26,9 @@ class AliAODHandler : public AliVEventHandler {
     virtual ~AliAODHandler();
     virtual void         SetOutputFileName(char* fname) {fName = fname;}
     virtual char*        GetOutputFileName() {return fName;}
-    virtual Bool_t       InitIO(Option_t* option);
-    virtual Bool_t       BeginEvent(Long64_t /*entry*/) {return kTRUE;}
-    // needed to prevent warning of hidden virtual Bool_t TObject::Notify()
+    virtual Bool_t       Init(Option_t* option);
+    virtual Bool_t       Init(TTree* /*tree*/, Option_t* /*option*/)  {return kTRUE;}
+    virtual Bool_t       BeginEvent(Long64_t /*entry*/)  {return kTRUE;}
     virtual Bool_t       Notify() { return AliVEventHandler::Notify(); };
     virtual Bool_t       Notify(const char * /* path */) {return kTRUE;}
     virtual Bool_t       FinishEvent();
index 13f55237096cac9b81c29540a1075ee1a444d2b9..3bad2226ab606dbc5374e8ed744d061a8ffdebd8 100644 (file)
@@ -47,10 +47,18 @@ AliAODInputHandler::AliAODInputHandler(const char* name, const char* title):
 {
 }
 
-Bool_t AliAODInputHandler::InitIO(Option_t* /*opt*/)
+Bool_t AliAODInputHandler::Init(TTree* tree, Option_t* /*opt*/)
 {
+    // Initialisation necessary for each new tree
+    fTree = tree;
+    if (!fTree) return kFALSE;
     // Get pointer to AOD event
+    if (fEvent) {
+      delete fEvent;
+      fEvent = 0;
+    }
     fEvent = new AliAODEvent();
+
     fEvent->ReadFromTree(fTree);
     return kTRUE;
 }
index 700068c7578f28d27aeb2c88ca4d62e99167a6e5..e66e7be9494cd35d08076af1dd6571a514a719bb 100644 (file)
@@ -19,7 +19,8 @@ class AliAODInputHandler : public AliInputEventHandler {
     AliAODInputHandler();
     AliAODInputHandler(const char* name, const char* title);
     virtual ~AliAODInputHandler();
-    virtual Bool_t       InitIO(Option_t* opt);
+    virtual Bool_t       Init(Option_t* /*opt*/) {return kTRUE;}
+    virtual Bool_t       Init(TTree* tree, Option_t* opt);
     AliAODEvent         *GetEvent() const {return fEvent;}    
  private:
     AliAODEvent    *fEvent;   //! Pointer to the event 
index 86ce0ae6b890b0df690542087e9f400646a85134..0c425580a38e58615b03325a55403c1f10e18331 100644 (file)
 //-------------------------------------------------------------------------
 
 #include <TTree.h>
+#include <TString.h>
+#include <TObjString.h>
 
 #include "AliESDInputHandler.h"
 #include "AliESDEvent.h"
 #include "AliESD.h"
+#include "AliLog.h"
 
 ClassImp(AliESDInputHandler)
 
@@ -45,14 +48,19 @@ AliESDInputHandler::~AliESDInputHandler()
 
 //______________________________________________________________________________
 AliESDInputHandler::AliESDInputHandler(const char* name, const char* title):
-  AliInputEventHandler(name, title), fEvent(0x0)
+    AliInputEventHandler(name, title), fEvent(0x0), fBranches("")
 {
 }
 
-Bool_t AliESDInputHandler::InitIO(Option_t* /*opt*/)
+Bool_t AliESDInputHandler::Init(TTree* tree,  Option_t* /*opt*/)
 {
+    // Initialisation necessary for each new tree 
+    fTree = tree;
+    
     if (!fTree) return kFALSE;
     // Get pointer to ESD event
+    SwitchOffBranches();
+    
     if (fEvent) {
       delete fEvent;
       fEvent = 0;
@@ -75,7 +83,18 @@ Bool_t AliESDInputHandler::BeginEvent(Long64_t /*entry*/)
 }
 
 Bool_t  AliESDInputHandler::FinishEvent(){
-  //  if(fEvent)fEvent->Reset();
+    //
   return kTRUE;
 } 
 
+void AliESDInputHandler::SwitchOffBranches() const {
+  //
+  // Switch of branches on user request
+  TObjArray * tokens = fBranches.Tokenize(" ");
+  Int_t ntok = tokens->GetEntries();
+  for (Int_t i = 0; i < ntok; i++)  {
+    TString str = ((TObjString*) tokens->At(i))->GetString();
+    fTree->SetBranchStatus(Form("%s%s%s","*", str.Data(), "*"), 0);
+    AliInfo(Form("Branch %s switched off \n", str.Data()));
+  }
+}
index b0c5bfcd2b0bcb74bb7e69629695c996318a0831..bea49fd1f352495d691903de8e24c679f7349902 100644 (file)
@@ -19,12 +19,18 @@ class AliESDInputHandler : public AliInputEventHandler {
     AliESDInputHandler();
     AliESDInputHandler(const char* name, const char* title);
     virtual ~AliESDInputHandler();
-    virtual Bool_t       InitIO(Option_t* opt);
+    virtual Bool_t       Init(Option_t* /*opt*/) {return kTRUE;}
+    virtual Bool_t       Init(TTree* tree, Option_t* opt);
     virtual Bool_t       BeginEvent(Long64_t entry);
     virtual Bool_t       FinishEvent();
     AliESDEvent         *GetEvent() const {return fEvent;}
-    private:
-    AliESDEvent    *fEvent;   //! Pointer to the event 
+    //
+    void SetInactiveBranches(const char* branches) {fBranches = branches;}
+ private:
+    void SwitchOffBranches() const;
+ private:
+    AliESDEvent    *fEvent;      //! Pointer to the event
+    TString         fBranches;   //List of branches to be switched off (separated by space
     ClassDef(AliESDInputHandler, 2);
 };
 
index e2f7f94b7190db78d9b9549070a9f4ef81385633..731a20940cbba39606e9685b190b00c60a8cbf4e 100644 (file)
@@ -22,20 +22,20 @@ class AliInputEventHandler : public AliVEventHandler {
     AliInputEventHandler(const char* name, const char* title);
     virtual ~AliInputEventHandler();
     virtual void         SetOutputFileName(char* /*fname*/) {;}
-    virtual char        *GetOutputFileName()                {return 0;}
-    virtual Bool_t       InitIO(Option_t* /*opt*/)          {return kTRUE;}
-    virtual Bool_t       BeginEvent(Long64_t /*entry*/)     {return kTRUE;}
-    // needed to prevent warning of hidden virtual Bool_t TObject::Notify()
+    virtual char        *GetOutputFileName()                          {return 0;}
+    virtual Bool_t       Init(Option_t* /*opt*/)                      {return kTRUE;}
+    virtual Bool_t       Init(TTree* /*tree*/, Option_t* /*opt*/) {return kTRUE;}
+    virtual Bool_t       BeginEvent(Long64_t /*entry*/)               {return kTRUE;}
     virtual Bool_t       Notify() { return AliVEventHandler::Notify(); };
-    virtual Bool_t       Notify(const char */*path*/)       {return kTRUE;}
-    virtual Bool_t       FinishEvent()                      {return kTRUE;}        
-    virtual Bool_t       Terminate()                        {return kTRUE;}
-    virtual Bool_t       TerminateIO()                      {return kTRUE;}
+    virtual Bool_t       Notify(const char */*path*/)                 {return kTRUE;}
+    virtual Bool_t       FinishEvent()                                {return kTRUE;}        
+    virtual Bool_t       Terminate()                                  {return kTRUE;}
+    virtual Bool_t       TerminateIO()                                {return kTRUE;}
     // Setters
-    virtual void         SetInputTree(TTree* tree)          {fTree = tree;}
+    virtual void         SetInputTree(TTree* tree)                    {fTree = tree;}
      // Getters
-    virtual AliVEvent   *GetEvent() const                   {return 0;}
-    virtual TTree       *GetTree( ) const                   {return fTree;}
+    virtual AliVEvent   *GetEvent() const                             {return 0;}
+    virtual TTree       *GetTree( ) const                             {return fTree;}
  protected:
     TTree        *fTree;    //! Pointer to the tree
     ClassDef(AliInputEventHandler, 1);
index 3850812e282346f3c1f574a2266f255cecd6ecdf..4c6ffc11298077e098032ae5c1fadb578e25b83f 100644 (file)
@@ -92,7 +92,7 @@ AliMCEventHandler::~AliMCEventHandler()
     delete fFileTR;
 }
 
-Bool_t AliMCEventHandler::InitIO(Option_t* opt)
+Bool_t AliMCEventHandler::Init(Option_t* opt)
 { 
     // Initialize input
     //
index 88972c9abf799bd8525608e394f7fd37bfa08857..41ce29eb287f5cc921884afc9d750da78ac38ad3 100644 (file)
@@ -39,9 +39,10 @@ public:
     virtual void         SetInputPath(char* fname); 
     virtual void         SetInputTree(TTree* /*tree*/) {;}
     virtual TString*     GetInputPath() {return fPathName;}
-    virtual Bool_t       InitIO(Option_t* opt);
+    virtual Bool_t       Init(Option_t* opt);
+    virtual Bool_t       InitIO(Option_t* opt) {return Init(opt);};
+    virtual Bool_t       Init(TTree* /*tree*/, Option_t* /*opt*/) {return kTRUE;}
     virtual Bool_t       BeginEvent(Long64_t entry);
-    // needed to prevent warning of hidden virtual Bool_t TObject::Notify()
     virtual Bool_t       Notify() { return AliVEventHandler::Notify(); };
     virtual Bool_t       Notify(const char* path);
     virtual Bool_t       FinishEvent();
index 99cf9a87ef6bd9576d31ca63f399ed380e0579bd..29a754c88f298d1fa43e236fe6f2e7499734fc44 100644 (file)
@@ -21,21 +21,22 @@ class AliVEventHandler : public TNamed {
     AliVEventHandler(const char* name, const char* title);
     virtual ~AliVEventHandler();
     // Output
-    virtual void         SetOutputFileName(char* fname)  = 0;
-    virtual char*        GetOutputFileName()             = 0;
+    virtual void         SetOutputFileName(char* fname)   = 0;
+    virtual char*        GetOutputFileName()              = 0;
     // Input
-    virtual void         SetInputTree(TTree* tree)       = 0;
+    virtual void         SetInputTree(TTree* tree)        = 0;
     // Steering 
-    virtual Bool_t       InitIO(Option_t* opt)           = 0;
-    virtual Bool_t       BeginEvent(Long64_t entry)      = 0;
-    // needed to prevent warning of hidden virtual Bool_t TObject::Notify()
+    virtual Bool_t       Init(Option_t* opt)              = 0;
+    virtual Bool_t       Init(TTree* tree, Option_t* opt) = 0;
+    virtual Bool_t       BeginEvent(Long64_t entry)       = 0;
+    virtual Bool_t       Notify(const char *path)         = 0;
+    virtual Bool_t       FinishEvent()                    = 0;
+    virtual Bool_t       Terminate()                      = 0;
+    virtual Bool_t       TerminateIO()                    = 0;
+    //
     virtual Bool_t       Notify() { return TNamed::Notify(); };
-    virtual Bool_t       Notify(const char *path)        = 0;
-    virtual Bool_t       FinishEvent()                   = 0;
-    virtual Bool_t       Terminate()                     = 0;
-    virtual Bool_t       TerminateIO()                   = 0;
  private :
-  ClassDef(AliVEventHandler, 0);
+  ClassDef(AliVEventHandler, 1);
 };
 
 #endif