}
-Bool_t AliAODHandler::InitIO(Option_t* opt)
+Bool_t AliAODHandler::Init(Option_t* opt)
{
// Initialize IO
//
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();
{
}
-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;
}
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
//-------------------------------------------------------------------------
#include <TTree.h>
+#include <TString.h>
+#include <TObjString.h>
#include "AliESDInputHandler.h"
#include "AliESDEvent.h"
#include "AliESD.h"
+#include "AliLog.h"
ClassImp(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;
}
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()));
+ }
+}
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);
};
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);
delete fFileTR;
}
-Bool_t AliMCEventHandler::InitIO(Option_t* opt)
+Bool_t AliMCEventHandler::Init(Option_t* opt)
{
// Initialize input
//
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();
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