X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliAODHandler.h;h=6448d6350b4bf857624fa1728f656869420ee58b;hb=0d6a82a50da2876423828e6b9952775c787cd867;hp=d87ec1d00d649ad1eabbad85eadf4ccc60336e4d;hpb=5f380da94d6012affa703dd9e66bd152aff40e84;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliAODHandler.h b/STEER/AliAODHandler.h index d87ec1d00d6..6448d6350b4 100644 --- a/STEER/AliAODHandler.h +++ b/STEER/AliAODHandler.h @@ -10,43 +10,164 @@ // Author: Andreas Morsch, CERN //------------------------------------------------------------------------- -#include "AliVirtualEventHandler.h" +#include "AliVEventHandler.h" class AliAODEvent; class TFile; class TTree; +class TObjArray; +class AliMCEventHandler; +class AliAODMCHeader; +class AliAODExtension; +class AliGenEventHeader; -class AliAODHandler : public AliVirtualEventHandler { +class AliAODHandler : public AliVEventHandler { public: AliAODHandler(); AliAODHandler(const char* name, const char* title); 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(){ return kTRUE;} + virtual void SetOutputFileName(const char* fname); + virtual const char* GetOutputFileName(); + // Extra outputs as a string separated by commas + virtual const char* GetExtraOutputs() const; + virtual Bool_t Init(Option_t* option); + virtual Bool_t Init(TTree* /*tree*/, Option_t* /*option*/) {return kTRUE;} + virtual Bool_t GetEntry() {return kTRUE;} + + virtual Bool_t BeginEvent(Long64_t /*entry*/) {fFillAOD=kFALSE; return kTRUE;} + virtual Bool_t Notify() { return AliVEventHandler::Notify(); }; + virtual Bool_t Notify(const char * /* path */) {return kTRUE;} virtual Bool_t FinishEvent(); virtual Bool_t Terminate(); virtual Bool_t TerminateIO(); - virtual Bool_t Notify() {return kTRUE;} + // + virtual void SetCreateNonStandardAOD() {fIsStandard = kFALSE;} + virtual void SetFillAOD(Bool_t b) {fFillAOD = b;} + virtual void SetFillAODforRun(Bool_t b) {fFillAODRun = b;} + virtual void SetNeedsHeaderReplication() {fNeedsHeaderReplication = kTRUE;} + virtual void SetNeedsTracksBranchReplication() {fNeedsTracksBranchReplication = kTRUE;} + virtual void SetNeedsVerticesBranchReplication() {fNeedsVerticesBranchReplication = kTRUE;} + virtual void SetNeedsV0sBranchReplication() {fNeedsV0sBranchReplication = kTRUE;} + virtual void SetNeedsCascadesBranchReplication() {fNeedsCascadesBranchReplication = kTRUE;} + virtual void SetNeedsTrackletsBranchReplication() {fNeedsTrackletsBranchReplication = kTRUE;} + virtual void SetNeedsPMDClustersBranchReplication() {fNeedsPMDClustersBranchReplication = kTRUE;} + virtual void SetNeedsJetsBranchReplication() {fNeedsJetsBranchReplication = kTRUE;} + virtual void SetNeedsFMDClustersBranchReplication() {fNeedsFMDClustersBranchReplication = kTRUE;} + virtual void SetNeedsCaloClustersBranchReplication() {fNeedsCaloClustersBranchReplication = kTRUE;} + virtual void SetNeedsMCParticlesBranchReplication() {fNeedsMCParticlesBranchReplication = kTRUE;} + virtual void SetNeedsDimuonsBranchReplication() {fNeedsDimuonsBranchReplication = kTRUE;} + virtual void SetAODIsReplicated() {fAODIsReplicated = kTRUE;} // AliAODEvent* GetAOD() {return fAODEvent;} - TTree* GetTree() {return fTreeA;} - void CreateTree(); + virtual TTree* GetTree() const {return fTreeA;} + TObjArray* GetExtensions() const {return fExtensions;} + AliAODExtension* GetExtension(const char *filename) const; + TObjArray* GetFilters() const {return fFilters;} + AliAODExtension* GetFilteredAOD(const char *filename) const; + void CreateTree(Int_t flag); void FillTree(); void AddAODtoTreeUserInfo(); + void AddBranch(const char* cname, void* addobj, const char *fname=""); + AliAODExtension* AddExtension(const char *filename, const char *title=""); + AliAODExtension* AddFilteredAOD(const char *filename, const char *filtername); + Bool_t IsStandard() const {return fIsStandard;} + Bool_t GetFillAOD() const {return fFillAOD;} + Bool_t NeedsHeaderReplication() const {return fNeedsHeaderReplication;} + Bool_t NeedsTracksBranchReplication() const {return fNeedsTracksBranchReplication;} + Bool_t NeedsVerticesBranchReplication() const {return fNeedsVerticesBranchReplication;} + Bool_t NeedsV0sBranchReplication() const {return fNeedsV0sBranchReplication;} + Bool_t NeedsCascadesBranchReplication() const {return fNeedsCascadesBranchReplication;} + Bool_t NeedsTrackletsBranchReplication() const {return fNeedsTrackletsBranchReplication;} + Bool_t NeedsPMDClustersBranchReplication() const {return fNeedsPMDClustersBranchReplication;} + Bool_t NeedsJetsBranchReplication() const {return fNeedsJetsBranchReplication;} + Bool_t NeedsFMDClustersBranchReplication() const {return fNeedsFMDClustersBranchReplication;} + Bool_t NeedsCaloClustersBranchReplication() const {return fNeedsCaloClustersBranchReplication;} + Bool_t NeedsMCParticlesBranchReplication() const {return fNeedsMCParticlesBranchReplication;} + Bool_t NeedsDimuonsBranchReplication() const {return fNeedsDimuonsBranchReplication;} + Bool_t AODIsReplicated() const {return fAODIsReplicated;} + // + void SetInputTree(TTree* /*tree*/) {;} + void SetMCEventHandler(AliMCEventHandler* mcH) {fMCEventH = mcH;} // For internal use + void StoreMCParticles(); // Store MC particles, only to be called from AliAnalyisTaskMCParticleFilter + private: + void SetMCHeaderInfo(AliAODMCHeader *mcHeader,AliGenEventHeader *genHeader); // Utility function t catch different types of eventheaders AliAODHandler(const AliAODHandler&); // Not implemented AliAODHandler& operator=(const AliAODHandler&); // Not implemented private: - AliAODEvent *fAODEvent; //! Pointer to the AOD event - TTree *fTreeA; //! tree for AOD persistency - TFile *fFileA; //! Output file - char *fName; //! Output file name - ClassDef(AliAODHandler, 1); + Bool_t fIsStandard; // Flag for standard aod creation + Bool_t fFillAOD; // Flag for filling of the AOD tree at the end (all or nothing evt by evt) + Bool_t fFillAODRun; // Flag for filling of the AOD tree at the end (run) + Bool_t fNeedsHeaderReplication; // Flag for header replication + Bool_t fNeedsTracksBranchReplication; // Flag for tracks replication + Bool_t fNeedsVerticesBranchReplication; // Flag for vertices replication + Bool_t fNeedsV0sBranchReplication; // Flag for V0s replication + Bool_t fNeedsCascadesBranchReplication; // Flag for Cascade replication + Bool_t fNeedsTrackletsBranchReplication; // Flag for Tracklets replication + Bool_t fNeedsPMDClustersBranchReplication; // Flag for PMDClusters replication + Bool_t fNeedsJetsBranchReplication; // Flag for Jets replication + Bool_t fNeedsFMDClustersBranchReplication; // Flag for FMDClusters replication + Bool_t fNeedsCaloClustersBranchReplication; // Flag for CaloClusters replication + Bool_t fNeedsMCParticlesBranchReplication; // Flag for MCParticles replication + Bool_t fNeedsDimuonsBranchReplication; // Flag for Dimuons replication + Bool_t fAODIsReplicated; // Flag true if replication as been executed + AliAODEvent *fAODEvent; //! Pointer to the AOD event + AliMCEventHandler *fMCEventH; //! Pointer to mc event handler needed not to depend on the manager + TTree *fTreeA; //! tree for AOD persistency + TFile *fFileA; //! Output file + TString fFileName; // Output file name + TObjArray *fExtensions; // List of extensions + TObjArray *fFilters; // List of filtered AOD's + ClassDef(AliAODHandler, 6) +}; + +//------------------------------------------------------------------------- +// Support class for AOD extensions. This is created by the user analysis +// that requires a separate file for some AOD branches. The name of the +// AliAODExtension object is the file name where the AOD branches will be +// stored. +// Author: Andrei Gheata, CERN +//------------------------------------------------------------------------- + +class AliAODExtension : public TNamed { + +public: + +enum EAliAODExtensionFlags { + kFilteredAOD = BIT(14) }; + + AliAODExtension() : TNamed(), fAODEvent(0), fTreeE(0), fFileE(0), fNtotal(0), fNpassed(0), fSelected(kFALSE) {} + AliAODExtension(const char* name, const char* title, Bool_t isfilter=kFALSE); + virtual ~AliAODExtension(); + void AddBranch(const char* cname, void* addobj); + Bool_t FinishEvent(); + Int_t GetNtotal() const {return fNtotal;} + Int_t GetNpassed() const {return fNpassed;} + const char* GetOutputFileName() const {return TNamed::GetName();} + AliAODEvent* GetAOD() const {return fAODEvent;} + TTree* GetTree() const {return fTreeE;} + Bool_t Init(Option_t *option); + Bool_t IsFilteredAOD() const {return TObject::TestBit(kFilteredAOD);} + Bool_t IsEventSelected() const {return fSelected;} + void SelectEvent(Bool_t flag=kTRUE) {fSelected = flag;} + void SetEvent(AliAODEvent *event); + void SetOutputFileName(const char* fname) {TNamed::SetName(fname);} + Bool_t TerminateIO(); + private: + AliAODExtension(const AliAODExtension&); // Not implemented + AliAODExtension& operator=(const AliAODExtension&); // Not implemented + private: + AliAODEvent *fAODEvent; //! Pointer to the AOD event + TTree *fTreeE; //! tree for AOD persistency + TFile *fFileE; //! Output file + Int_t fNtotal; //! Number of processed events + Int_t fNpassed; //! Number of events that passed the filter + Bool_t fSelected; //! Select current event for filtered AOD's. Made false at event start. + ClassDef(AliAODExtension, 1) // Support for extra AOD branches in a separate AOD file +}; #endif