Provide methods to make AOD objects "referencable" in a separate process, i.e.
[u/mrichter/AliRoot.git] / STEER / AliAODEvent.h
CommitLineData
df9db588 1#ifndef AliAODEvent_H
2#define AliAODEvent_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// AOD base class
10// Author: Markus Oldenburg, CERN
11//-------------------------------------------------------------------------
12
13#include <TBuffer.h>
14#include <TClonesArray.h>
15#include <TList.h>
8ff33247 16#include <TTree.h>
df9db588 17#include <TNamed.h>
18
08e4c457 19#include "AliVEvent.h"
20#include "AliVParticle.h"
df9db588 21#include "AliAODHeader.h"
22#include "AliAODTrack.h"
23#include "AliAODVertex.h"
3dd9f9e3 24#include "AliAODv0.h"
821f8f1d 25#include "AliAODTracklets.h"
3dd9f9e3 26#include "AliAODJet.h"
27#include "AliAODCaloCells.h"
28#include "AliAODCaloCluster.h"
29#include "AliAODPmdCluster.h"
30#include "AliAODFmdCluster.h"
df9db588 31
8ff33247 32class TTree;
5c1dc41f 33class TFolder;
ec4af4c1 34
08e4c457 35class AliAODEvent : public AliVEvent {
df9db588 36
37 public :
08e4c457 38 enum AODListIndex_t {kAODHeader,
39 kAODTracks,
40 kAODVertices,
3dd9f9e3 41 kAODv0,
08e4c457 42 kAODTracklets,
3dd9f9e3 43 kAODJets,
37792174 44 kAODEmcalCells,
45 kAODPhosCells,
3dd9f9e3 46 kAODCaloClusters,
47 kAODFmdClusters,
48 kAODPmdClusters,
08e4c457 49 kAODListN
50 };
51
df9db588 52 AliAODEvent();
53 virtual ~AliAODEvent();
54
5c1dc41f 55 AliAODEvent(const AliAODEvent& aodevent);
56 AliAODEvent& operator=(const AliAODEvent& aodevent);
df9db588 57
58 void AddObject(TObject *obj);
4b3de353 59 void RemoveObject(TObject *obj);
08e4c457 60 TObject *FindListObject(const char *objName) ;
df9db588 61 TList *GetList() const { return fAODObjects; }
62
63 // -- Header
08e4c457 64 AliAODHeader *GetHeader() const { return fHeader; }
df9db588 65 void AddHeader(const AliAODHeader* hdx)
635db10f 66 {
67 delete fHeader; fHeader = new AliAODHeader(*hdx);
68 (fAODObjects->FirstLink())->SetObject(fHeader);
69 }
df9db588 70
08e4c457 71 // setters and getters for header information
72 void SetRunNumber(Int_t n) {if (fHeader) fHeader->SetRunNumber(n);}
73 void SetPeriodNumber(UInt_t n){if (fHeader) fHeader->SetPeriodNumber(n);}
74 void SetOrbitNumber(UInt_t n) {if (fHeader) fHeader->SetOrbitNumber(n);}
75 void SetBunchCrossNumber(UShort_t n) {if (fHeader) fHeader->SetBunchCrossNumber(n);}
76 void SetMagneticField(Double_t mf){if (fHeader) fHeader->SetMagneticField(mf);}
77
78 Int_t GetRunNumber() const {return fHeader ? fHeader->GetRunNumber() : -999;}
79 UInt_t GetPeriodNumber() const {return fHeader ? fHeader->GetPeriodNumber() : 0;}
80 UInt_t GetOrbitNumber() const {return fHeader ? fHeader->GetOrbitNumber() : 0;}
81 UShort_t GetBunchCrossNumber() const {return fHeader ? fHeader->GetBunchCrossNumber() : 0;}
82 Double_t GetMagneticField() const {return fHeader ? fHeader->GetMagneticField() : -999.;}
83
84 void SetEventType(UInt_t eventType){fHeader->SetEventType(eventType);}
85 void SetTriggerMask(ULong64_t n) {fHeader->SetTriggerMask(n);}
86 void SetTriggerCluster(UChar_t n) {fHeader->SetTriggerCluster(n);}
87
88 UInt_t GetEventType() const { return fHeader ? fHeader->GetEventType() : 0;}
89 ULong64_t GetTriggerMask() const {return fHeader ? fHeader->GetTriggerMask() : 0;}
90 UChar_t GetTriggerCluster() const {return fHeader ? fHeader->GetTriggerCluster() : 0;}
91
92 Double_t GetZDCN1Energy() const { return fHeader ? fHeader->GetZDCN1Energy() : -999.; }
93 Double_t GetZDCP1Energy() const { return fHeader ? fHeader->GetZDCP1Energy() : -999.; }
94 Double_t GetZDCN2Energy() const { return fHeader ? fHeader->GetZDCN2Energy() : -999.; }
95 Double_t GetZDCP2Energy() const { return fHeader ? fHeader->GetZDCP2Energy() : -999.; }
a85132e7 96 Double_t GetZDCEMEnergy(Int_t i) const { return fHeader ? fHeader->GetZDCEMEnergy(i) : -999.; }
08e4c457 97
df9db588 98 // -- Tracks
99 TClonesArray *GetTracks() const { return fTracks; }
100 Int_t GetNTracks() const { return fTracks->GetEntriesFast(); }
08e4c457 101 Int_t GetNumberOfTracks() const { return GetNTracks(); }
102 AliAODTrack *GetTrack(Int_t nTrack) const { return (AliAODTrack*)fTracks->UncheckedAt(nTrack); }
103 Int_t AddTrack(const AliAODTrack* trk)
104 {new((*fTracks)[fTracks->GetEntriesFast()]) AliAODTrack(*trk); return fTracks->GetEntriesFast()-1;}
fb41236c 105 Int_t GetMuonTracks(TRefArray *muonTracks) const;
df9db588 106
107 // -- Vertex
108 TClonesArray *GetVertices() const { return fVertices; }
109 Int_t GetNVertices() const { return fVertices->GetEntriesFast(); }
08e4c457 110 AliAODVertex *GetVertex(Int_t nVertex) const { return (AliAODVertex*)fVertices->UncheckedAt(nVertex); }
111 Int_t AddVertex(const AliAODVertex* vtx)
112 {new((*fVertices)[fVertices->GetEntriesFast()]) AliAODVertex(*vtx); return fVertices->GetEntriesFast()-1;}
5c2fdfa2 113
3dd9f9e3 114 // primary vertex
115 virtual AliAODVertex *GetPrimaryVertex() const { return GetVertex(0); }
df9db588 116
3dd9f9e3 117 // V0
118 TClonesArray *GetV0s() const { return fV0s; }
119 Int_t GetNV0s() const { return fV0s->GetEntriesFast(); }
120 AliAODv0 *GetV0(Int_t nV0) const { return (AliAODv0*)fV0s->UncheckedAt(nV0); }
121 Int_t AddV0(const AliAODv0* v0)
122 {new((*fV0s)[fV0s->GetEntriesFast()]) AliAODv0(*v0); return fV0s->GetEntriesFast()-1;}
123
124 // -- EMCAL and PHOS Cluster
125 TClonesArray *GetCaloClusters() const { return fCaloClusters; }
126 Int_t GetNCaloClusters() const { return fCaloClusters->GetEntriesFast(); }
127 AliAODCaloCluster *GetCaloCluster(Int_t nCluster) const { return (AliAODCaloCluster*)fCaloClusters->UncheckedAt(nCluster); }
128 Int_t AddCaloCluster(const AliAODCaloCluster* clus)
129 {new((*fCaloClusters)[fCaloClusters->GetEntriesFast()]) AliAODCaloCluster(*clus); return fCaloClusters->GetEntriesFast()-1;}
130
131 // -- FMD Cluster
132 TClonesArray *GetFmdClusters() const { return fFmdClusters; }
133 Int_t GetNFmdClusters() const { return fFmdClusters->GetEntriesFast(); }
134 AliAODFmdCluster *GetFmdCluster(Int_t nCluster) const { return (AliAODFmdCluster*)fFmdClusters->UncheckedAt(nCluster); }
135 Int_t AddFmdCluster(const AliAODFmdCluster* clus)
136 {new((*fFmdClusters)[fFmdClusters->GetEntriesFast()]) AliAODFmdCluster(*clus); return fFmdClusters->GetEntriesFast()-1;}
137
138 // -- PMD Cluster
139 TClonesArray *GetPmdClusters() const { return fPmdClusters; }
140 Int_t GetNPmdClusters() const { return fPmdClusters->GetEntriesFast(); }
141 AliAODPmdCluster *GetPmdCluster(Int_t nCluster) const { return (AliAODPmdCluster*)fPmdClusters->UncheckedAt(nCluster); }
142 Int_t AddPmdCluster(const AliAODPmdCluster* clus)
143 {new((*fPmdClusters)[fPmdClusters->GetEntriesFast()]) AliAODPmdCluster(*clus); return fPmdClusters->GetEntriesFast()-1;}
df9db588 144
145 // -- Jet
146 TClonesArray *GetJets() const { return fJets; }
147 Int_t GetNJets() const { return fJets->GetEntriesFast(); }
08e4c457 148 AliAODJet *GetJet(Int_t nJet) const { return (AliAODJet*)fJets->UncheckedAt(nJet); }
149 Int_t AddJet(const AliAODJet* vtx)
150 {new((*fJets)[fJets->GetEntriesFast()]) AliAODJet(*vtx); return fJets->GetEntriesFast()-1;}
df9db588 151
821f8f1d 152 // -- Tracklets
153 AliAODTracklets *GetTracklets() const { return fTracklets; }
154
3dd9f9e3 155 // -- Calorimeter Cells
e649177a 156 AliAODCaloCells *GetEMCALCells() const { return fEmcalCells; }
157 AliAODCaloCells *GetPHOSCells() const { return fPhosCells; }
3dd9f9e3 158
df9db588 159 // -- Services
ec4af4c1 160 void CreateStdContent();
08e4c457 161 void SetStdNames();
ec4af4c1 162 void GetStdContent();
5c1dc41f 163 void CreateStdFolders();
3dd9f9e3 164 void ResetStd(Int_t trkArrSize = 0,
165 Int_t vtxArrSize = 0,
166 Int_t v0ArrSize = 0,
167 Int_t jetSize = 0,
168 Int_t caloClusSize = 0,
169 Int_t fmdClusSize = 0,
170 Int_t pmdClusSize = 0);
ec4af4c1 171 void ClearStd();
8ff33247 172 void ReadFromTree(TTree *tree);
08e4c457 173 const void WriteToTree(TTree* tree) const {tree->Branch(fAODObjects);}
174
175 void Print(Option_t *option="") const;
c8e4f399 176 void MakeEntriesReferencable();
177 static void AssignIDtoCollection(TCollection* col);
08e4c457 178 private :
df9db588 179
5c1dc41f 180 TList *fAODObjects; // list of AODObjects
181 TFolder *fAODFolder; // folder structure of branches
182
df9db588 183 // standard content
3dd9f9e3 184 AliAODHeader *fHeader; //! event information
185 TClonesArray *fTracks; //! charged tracks
186 TClonesArray *fVertices; //! vertices
187 TClonesArray *fV0s; //! V0s
188 AliAODTracklets *fTracklets; //! SPD tracklets
189 TClonesArray *fJets; //! jets
37792174 190 AliAODCaloCells *fEmcalCells; //! EMCAL calorimenter cells
191 AliAODCaloCells *fPhosCells; //! PHOS calorimenter cells
3dd9f9e3 192 TClonesArray *fCaloClusters; //! calorimeter clusters
193 TClonesArray *fFmdClusters; //! FMDclusters
194 TClonesArray *fPmdClusters; //! PMDclusters
821f8f1d 195
08e4c457 196 static const char* fAODListName[kAODListN]; //!
197
5c1dc41f 198 ClassDef(AliAODEvent, 4);
df9db588 199};
200
201#endif