Line data Source code
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() const;
34 : // Extra outputs as a string separated by commas
35 : virtual const char* GetExtraOutputs(Bool_t merge=kTRUE) const;
36 : virtual Bool_t Init(Option_t* option);
37 4 : virtual Bool_t Init(TTree* /*tree*/, Option_t* /*option*/) {return kTRUE;}
38 0 : virtual Bool_t GetEntry() {return kTRUE;}
39 :
40 16 : virtual Bool_t BeginEvent(Long64_t /*entry*/) {fFillAOD=kFALSE; fFillExtension=kFALSE; return kTRUE;}
41 0 : virtual Bool_t Notify() { return AliVEventHandler::Notify(); };
42 4 : 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 0 : virtual void SetCreateNonStandardAOD() {Changed(); fIsStandard = kFALSE;}
48 8 : virtual void SetFillAOD(Bool_t b) {Changed(); fFillAOD = b;}
49 8 : virtual void SetFillExtension(Bool_t b) {Changed(); fFillExtension = b;}
50 0 : virtual void SetFillAODforRun(Bool_t b) {Changed(); fFillAODRun = b;}
51 0 : virtual void SetNeedsHeaderReplication() {fNeedsHeaderReplication = kTRUE;}
52 0 : virtual void SetNeedsTOFHeaderReplication() {fNeedsTOFHeaderReplication = kTRUE;}
53 0 : virtual void SetNeedsVZEROReplication() {fNeedsVZEROReplication = kTRUE;}
54 0 : virtual void SetNeedsTracksBranchReplication() {fNeedsTracksBranchReplication = kTRUE;}
55 0 : virtual void SetNeedsVerticesBranchReplication() {fNeedsVerticesBranchReplication = kTRUE;}
56 0 : virtual void SetNeedsV0sBranchReplication() {fNeedsV0sBranchReplication = kTRUE;}
57 0 : virtual void SetNeedsCascadesBranchReplication() {fNeedsCascadesBranchReplication = kTRUE;}
58 0 : virtual void SetNeedsTrackletsBranchReplication() {fNeedsTrackletsBranchReplication = kTRUE;}
59 0 : virtual void SetNeedsPMDClustersBranchReplication() {fNeedsPMDClustersBranchReplication = kTRUE;}
60 0 : virtual void SetNeedsJetsBranchReplication() {fNeedsJetsBranchReplication = kTRUE;}
61 0 : virtual void SetNeedsFMDClustersBranchReplication() {fNeedsFMDClustersBranchReplication = kTRUE;}
62 0 : virtual void SetNeedsCaloClustersBranchReplication() {fNeedsCaloClustersBranchReplication = kTRUE;}
63 0 : virtual void SetNeedsCaloTriggerBranchReplication() {fNeedsCaloTriggerBranchReplication = kTRUE;}
64 0 : virtual void SetNeedsMCParticlesBranchReplication() {fNeedsMCParticlesBranchReplication = kTRUE;}
65 0 : virtual void SetNeedsDimuonsBranchReplication() {fNeedsDimuonsBranchReplication = kTRUE;}
66 0 : virtual void SetNeedsHMPIDBranchReplication() {fNeedsHMPIDBranchReplication = kTRUE;}
67 0 : virtual void SetAODIsReplicated() {Changed(); fAODIsReplicated = kTRUE;}
68 0 : virtual void SetAODExtensionMode() {Changed(); fIsStandard=kFALSE; fFillAOD=kFALSE; fFillAODRun=kFALSE; fFillExtension=kTRUE;}
69 : //
70 14 : AliAODEvent* GetAOD() {return fAODEvent;}
71 22 : virtual TTree* GetTree() const {return fTreeA;}
72 0 : TObjArray* GetExtensions() const {return fExtensions;}
73 : AliAODExtension* GetExtension(const char *filename) const;
74 0 : TObjArray* GetFilters() const {return fFilters;}
75 : AliAODExtension* GetFilteredAOD(const char *filename) const;
76 : void CreateTree(Int_t flag);
77 : void FillTree();
78 : void AddAODtoTreeUserInfo();
79 : void AddBranch(const char* cname, void* addobj, const char *fname="");
80 :
81 : AliAODExtension* AddExtension(const char *filename, const char *title="", Bool_t tomerge=kFALSE);
82 : AliAODExtension* AddFilteredAOD(const char *filename, const char *filtername, Bool_t tomerge=kFALSE);
83 : // AliAODExtension* FindExtensionContainingBranch(const char* bname) const;
84 14 : Bool_t IsStandard() const {return fIsStandard;}
85 0 : Bool_t GetFillAOD() const {return fFillAOD;}
86 0 : Bool_t GetFillExtension() const {return fFillExtension;}
87 0 : Bool_t NeedsHeaderReplication() const {return fNeedsHeaderReplication;}
88 0 : Bool_t NeedsTOFHeaderReplication() const {return fNeedsTOFHeaderReplication;}
89 0 : Bool_t NeedsVZEROReplication() const {return fNeedsVZEROReplication;}
90 0 : Bool_t NeedsTracksBranchReplication() const {return fNeedsTracksBranchReplication;}
91 0 : Bool_t NeedsVerticesBranchReplication() const {return fNeedsVerticesBranchReplication;}
92 0 : Bool_t NeedsV0sBranchReplication() const {return fNeedsV0sBranchReplication;}
93 0 : Bool_t NeedsCascadesBranchReplication() const {return fNeedsCascadesBranchReplication;}
94 0 : Bool_t NeedsTrackletsBranchReplication() const {return fNeedsTrackletsBranchReplication;}
95 0 : Bool_t NeedsPMDClustersBranchReplication() const {return fNeedsPMDClustersBranchReplication;}
96 0 : Bool_t NeedsJetsBranchReplication() const {return fNeedsJetsBranchReplication;}
97 0 : Bool_t NeedsFMDClustersBranchReplication() const {return fNeedsFMDClustersBranchReplication;}
98 0 : Bool_t NeedsCaloClustersBranchReplication() const {return fNeedsCaloClustersBranchReplication;}
99 0 : Bool_t NeedsCaloTriggerBranchReplication() const {return fNeedsCaloTriggerBranchReplication;}
100 0 : Bool_t NeedsMCParticlesBranchReplication() const {return fNeedsMCParticlesBranchReplication;}
101 0 : Bool_t NeedsDimuonsBranchReplication() const {return fNeedsDimuonsBranchReplication;}
102 0 : Bool_t NeedsHMPIDBranchReplication() const {return fNeedsHMPIDBranchReplication;}
103 0 : Bool_t AODIsReplicated() const {return fAODIsReplicated;}
104 : //
105 0 : void SetInputTree(TTree* /*tree*/) {;}
106 2 : void SetMCEventHandler(AliMCEventHandler* mcH) {fMCEventH = mcH;} // For internal use
107 : void StoreMCParticles(); // Store MC particles, only to be called from AliAnalyisTaskMCParticleFilter
108 0 : void SetTreeBuffSize(Long64_t sz=30000000) {fTreeBuffSize = sz;}
109 : Bool_t HasExtensions() const;
110 :
111 : void Print(Option_t* opt="") const;
112 :
113 : private:
114 : void SetMCHeaderInfo(AliAODMCHeader *mcHeader,AliGenEventHeader *genHeader); // Utility function t catch different types of eventheaders
115 : AliAODHandler(const AliAODHandler&); // Not implemented
116 : AliAODHandler& operator=(const AliAODHandler&); // Not implemented
117 : void PrintExtensions(const TObjArray& array) const;
118 :
119 : private:
120 : Bool_t fIsStandard; // Flag for standard aod creation
121 : Bool_t fFillAOD; // Flag for filling of the AOD tree at the end (all or nothing evt by evt)
122 : Bool_t fFillAODRun; // Flag for filling of the AOD tree at the end (run)
123 : Bool_t fFillExtension; // Flag for filling or the delta AOD tree at the end
124 : Bool_t fNeedsHeaderReplication; // Flag for header replication
125 : Bool_t fNeedsTOFHeaderReplication; // Flag for header replication
126 : Bool_t fNeedsVZEROReplication; // Flag for header replication
127 : Bool_t fNeedsTracksBranchReplication; // Flag for tracks replication
128 : Bool_t fNeedsVerticesBranchReplication; // Flag for vertices replication
129 : Bool_t fNeedsV0sBranchReplication; // Flag for V0s replication
130 : Bool_t fNeedsCascadesBranchReplication; // Flag for Cascade replication
131 : Bool_t fNeedsTrackletsBranchReplication; // Flag for Tracklets replication
132 : Bool_t fNeedsPMDClustersBranchReplication; // Flag for PMDClusters replication
133 : Bool_t fNeedsJetsBranchReplication; // Flag for Jets replication
134 : Bool_t fNeedsFMDClustersBranchReplication; // Flag for FMDClusters replication
135 : Bool_t fNeedsCaloClustersBranchReplication; // Flag for CaloClusters replication
136 : Bool_t fNeedsCaloTriggerBranchReplication; // Flag for Calo Trigger replication
137 : Bool_t fNeedsMCParticlesBranchReplication; // Flag for MCParticles replication
138 : Bool_t fNeedsDimuonsBranchReplication; // Flag for Dimuons replication
139 : Bool_t fNeedsHMPIDBranchReplication; // Flag for HMPID replication
140 : Bool_t fAODIsReplicated; // Flag true if replication as been executed
141 : // Counters for SetAutoFlush configuration
142 : Long64_t fTreeBuffSize; // allowed uncompressed buffer size per tree
143 : Long64_t fMemCountAOD; //! accumulated AOD size before AutoSave
144 : AliAODEvent *fAODEvent; //! Pointer to the AOD event
145 : AliMCEventHandler *fMCEventH; //! Pointer to mc event handler needed not to depend on the manager
146 : TTree *fTreeA; //! tree for AOD persistency
147 : TFile *fFileA; //! Output file
148 : TString fFileName; // Output file name
149 : TObjArray *fExtensions; // List of extensions
150 : TObjArray *fFilters; // List of filtered AOD's
151 :
152 218 : ClassDef(AliAODHandler, 8)
153 : };
154 :
155 : #endif
|