]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliAODHandler.h
Wrong versiion was committed before, this is the correct one
[u/mrichter/AliRoot.git] / STEER / AliAODHandler.h
1 #ifndef ALIAODHANDLER_H
2 #define ALIAODHANDLER_H
3 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //-------------------------------------------------------------------------
9 //     Implementation of the Event Handler Interface for AOD
10 //     Author: Andreas Morsch, CERN
11 //-------------------------------------------------------------------------
12
13 #include "AliVEventHandler.h"
14 #include "AliAODExtension.h"
15
16 class AliAODEvent;
17 class TFile;
18 class TTree;
19 class TObjArray;
20 class AliMCEventHandler;
21 class AliAODMCHeader;
22 class AliGenEventHeader;
23 class TMap;
24 class AliAnalysisFilter;
25
26 class AliAODHandler : public AliVEventHandler {
27     
28  public:
29     AliAODHandler();
30     AliAODHandler(const char* name, const char* title);
31     virtual ~AliAODHandler();
32     virtual void         SetOutputFileName(const char* fname);
33     virtual const char*  GetOutputFileName();
34     // Extra outputs as a string separated by commas
35     virtual const char*  GetExtraOutputs() const;
36     virtual Bool_t       Init(Option_t* option);
37     virtual Bool_t       Init(TTree* /*tree*/, Option_t* /*option*/)  {return kTRUE;}
38     virtual Bool_t       GetEntry() {return kTRUE;}
39             
40     virtual Bool_t       BeginEvent(Long64_t /*entry*/) {fFillAOD=kFALSE; fFillExtension=kFALSE; return kTRUE;}
41     virtual Bool_t       Notify() { return AliVEventHandler::Notify(); };
42     virtual Bool_t       Notify(const char * /* path */) {return kTRUE;}
43     virtual Bool_t       FinishEvent();
44     virtual Bool_t       Terminate();
45     virtual Bool_t       TerminateIO();
46     //
47     virtual void         SetCreateNonStandardAOD()               {fIsStandard = kFALSE;}
48     virtual void         SetFillAOD(Bool_t b)                    {fFillAOD = b;}
49     virtual void         SetFillExtension(Bool_t b)              {fFillExtension = b;}
50     virtual void         SetFillAODforRun(Bool_t b)              {fFillAODRun = b;}
51     virtual void         SetNeedsHeaderReplication()             {fNeedsHeaderReplication             = kTRUE;}
52     virtual void         SetNeedsTracksBranchReplication()       {fNeedsTracksBranchReplication       = kTRUE;}
53     virtual void         SetNeedsVerticesBranchReplication()     {fNeedsVerticesBranchReplication     = kTRUE;}
54     virtual void         SetNeedsV0sBranchReplication()          {fNeedsV0sBranchReplication          = kTRUE;}
55     virtual void         SetNeedsCascadesBranchReplication()     {fNeedsCascadesBranchReplication     = kTRUE;}
56     virtual void         SetNeedsTrackletsBranchReplication()    {fNeedsTrackletsBranchReplication    = kTRUE;}
57     virtual void         SetNeedsPMDClustersBranchReplication()  {fNeedsPMDClustersBranchReplication  = kTRUE;}
58     virtual void         SetNeedsJetsBranchReplication()         {fNeedsJetsBranchReplication         = kTRUE;}
59     virtual void         SetNeedsFMDClustersBranchReplication()  {fNeedsFMDClustersBranchReplication  = kTRUE;}
60     virtual void         SetNeedsCaloClustersBranchReplication() {fNeedsCaloClustersBranchReplication = kTRUE;}
61     virtual void         SetNeedsMCParticlesBranchReplication()  {fNeedsMCParticlesBranchReplication  = kTRUE;}
62     virtual void         SetNeedsDimuonsBranchReplication()      {fNeedsDimuonsBranchReplication      = kTRUE;}
63     virtual void         SetAODIsReplicated() {fAODIsReplicated = kTRUE;}
64     virtual void         SetAODExtensionMode()                   {fIsStandard=kFALSE; fFillAOD=kFALSE; fFillAODRun=kFALSE; fFillExtension=kTRUE;}
65     //
66     AliAODEvent*         GetAOD()  {return fAODEvent;}
67     virtual TTree*       GetTree() const {return fTreeA;}
68     TObjArray*           GetExtensions() const {return fExtensions;}
69     AliAODExtension*     GetExtension(const char *filename) const;
70     TObjArray*           GetFilters() const {return fFilters;}
71     AliAODExtension*     GetFilteredAOD(const char *filename) const;
72     void                 CreateTree(Int_t flag);
73     void                 FillTree();
74     void                 AddAODtoTreeUserInfo();
75     void                 AddBranch(const char* cname, void* addobj, const char *fname="");
76   
77     AliAODExtension*     AddExtension(const char *filename, const char *title="");                 
78     AliAODExtension*     AddFilteredAOD(const char *filename, const char *filtername);
79 //    AliAODExtension*     FindExtensionContainingBranch(const char* bname) const;
80     Bool_t               IsStandard()                         const {return fIsStandard;}
81     Bool_t               GetFillAOD()                         const {return fFillAOD;} 
82     Bool_t               NeedsHeaderReplication()             const {return  fNeedsHeaderReplication;}
83     Bool_t               NeedsTracksBranchReplication()       const {return  fNeedsTracksBranchReplication;}
84     Bool_t               NeedsVerticesBranchReplication()     const {return  fNeedsVerticesBranchReplication;}
85     Bool_t               NeedsV0sBranchReplication()          const {return  fNeedsV0sBranchReplication;}
86     Bool_t               NeedsCascadesBranchReplication()     const {return  fNeedsCascadesBranchReplication;}
87     Bool_t               NeedsTrackletsBranchReplication()    const {return  fNeedsTrackletsBranchReplication;}
88     Bool_t               NeedsPMDClustersBranchReplication()  const {return  fNeedsPMDClustersBranchReplication;}
89     Bool_t               NeedsJetsBranchReplication()         const {return  fNeedsJetsBranchReplication;}
90     Bool_t               NeedsFMDClustersBranchReplication()  const {return  fNeedsFMDClustersBranchReplication;}
91     Bool_t               NeedsCaloClustersBranchReplication() const {return  fNeedsCaloClustersBranchReplication;}
92     Bool_t               NeedsMCParticlesBranchReplication()  const {return  fNeedsMCParticlesBranchReplication;}
93     Bool_t               NeedsDimuonsBranchReplication()      const {return  fNeedsDimuonsBranchReplication;}
94     Bool_t               AODIsReplicated()                    const {return  fAODIsReplicated;}
95     //
96     void                 SetInputTree(TTree* /*tree*/) {;}
97     void                 SetMCEventHandler(AliMCEventHandler* mcH) {fMCEventH = mcH;} // For internal use
98     void StoreMCParticles(); // Store MC particles, only to be called from AliAnalyisTaskMCParticleFilter
99
100   Bool_t HasExtensions() const;
101   
102   void Print(Option_t* opt="") const;
103   
104  private:
105   void SetMCHeaderInfo(AliAODMCHeader *mcHeader,AliGenEventHeader *genHeader); // Utility function t catch different types of eventheaders
106   AliAODHandler(const AliAODHandler&);             // Not implemented
107   AliAODHandler& operator=(const AliAODHandler&);  // Not implemented
108   void PrintExtensions(const TObjArray& array) const;
109
110  private:
111     Bool_t                   fIsStandard;                         // Flag for standard aod creation
112     Bool_t                   fFillAOD;                            // Flag for filling of the AOD tree at the end (all or nothing evt by evt)
113     Bool_t                   fFillAODRun;                         // Flag for filling of the AOD tree at the end (run)
114     Bool_t                   fFillExtension;                      // Flag for filling or the delta AOD tree at the end
115     Bool_t                   fNeedsHeaderReplication;             // Flag for header replication
116     Bool_t                   fNeedsTracksBranchReplication;       // Flag for tracks replication
117     Bool_t                   fNeedsVerticesBranchReplication;     // Flag for vertices replication
118     Bool_t                   fNeedsV0sBranchReplication;          // Flag for V0s replication
119     Bool_t                   fNeedsCascadesBranchReplication;     // Flag for Cascade replication
120     Bool_t                   fNeedsTrackletsBranchReplication;    // Flag for Tracklets replication
121     Bool_t                   fNeedsPMDClustersBranchReplication;  // Flag for PMDClusters replication
122     Bool_t                   fNeedsJetsBranchReplication;         // Flag for Jets replication
123     Bool_t                   fNeedsFMDClustersBranchReplication;  // Flag for FMDClusters replication
124     Bool_t                   fNeedsCaloClustersBranchReplication; // Flag for CaloClusters replication
125     Bool_t                   fNeedsMCParticlesBranchReplication;  // Flag for MCParticles replication
126     Bool_t                   fNeedsDimuonsBranchReplication;      // Flag for Dimuons replication
127     Bool_t                   fAODIsReplicated;                    // Flag true if replication as been executed
128     AliAODEvent             *fAODEvent;               //! Pointer to the AOD event
129     AliMCEventHandler       *fMCEventH;               //! Pointer to mc event handler needed not to depend on the manager
130     TTree                   *fTreeA;                  //! tree for AOD persistency
131     TFile                   *fFileA;                  //! Output file
132     TString                  fFileName;               //  Output file name
133     TObjArray               *fExtensions;             //  List of extensions
134     TObjArray               *fFilters;                //  List of filtered AOD's
135
136   ClassDef(AliAODHandler, 7)
137 };
138
139 #endif