]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODEvent.h
Wrong versiion was committed before, this is the correct one
[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"
9a244178 25#include "AliAODcascade.h"
821f8f1d 26#include "AliAODTracklets.h"
3dd9f9e3 27#include "AliAODJet.h"
28#include "AliAODCaloCells.h"
29#include "AliAODCaloCluster.h"
30#include "AliAODPmdCluster.h"
31#include "AliAODFmdCluster.h"
866d8d78 32#include "AliAODDimuon.h"
ae2bccf1 33#include "AliAODVZERO.h"
df9db588 34
8ff33247 35class TTree;
5c1dc41f 36class TFolder;
befa9db4 37class AliCentrality;
ce7adfe9 38class AliEventplane;
ec4af4c1 39
08e4c457 40class AliAODEvent : public AliVEvent {
df9db588 41
42 public :
08e4c457 43 enum AODListIndex_t {kAODHeader,
44 kAODTracks,
45 kAODVertices,
3dd9f9e3 46 kAODv0,
9a244178 47 kAODcascade,
08e4c457 48 kAODTracklets,
3dd9f9e3 49 kAODJets,
37792174 50 kAODEmcalCells,
51 kAODPhosCells,
3dd9f9e3 52 kAODCaloClusters,
53 kAODFmdClusters,
54 kAODPmdClusters,
866d8d78 55 kAODDimuons,
ae2bccf1 56 kAODVZERO,
08e4c457 57 kAODListN
58 };
59
df9db588 60 AliAODEvent();
61 virtual ~AliAODEvent();
62
9a244178 63 AliAODEvent(const AliAODEvent& aodevent);
64 AliAODEvent& operator=(const AliAODEvent& aodevent);
df9db588 65
66 void AddObject(TObject *obj);
4b3de353 67 void RemoveObject(TObject *obj);
2811495d 68 TObject *FindListObject(const char *objName) const;
df9db588 69 TList *GetList() const { return fAODObjects; }
788578f5 70 void SetConnected(Bool_t conn=kTRUE) {fConnected=conn;}
71 Bool_t GetConnected() const {return fConnected;}
df9db588 72
73 // -- Header
08e4c457 74 AliAODHeader *GetHeader() const { return fHeader; }
df9db588 75 void AddHeader(const AliAODHeader* hdx)
635db10f 76 {
77 delete fHeader; fHeader = new AliAODHeader(*hdx);
78 (fAODObjects->FirstLink())->SetObject(fHeader);
79 }
df9db588 80
08e4c457 81 // setters and getters for header information
82 void SetRunNumber(Int_t n) {if (fHeader) fHeader->SetRunNumber(n);}
83 void SetPeriodNumber(UInt_t n){if (fHeader) fHeader->SetPeriodNumber(n);}
84 void SetOrbitNumber(UInt_t n) {if (fHeader) fHeader->SetOrbitNumber(n);}
85 void SetBunchCrossNumber(UShort_t n) {if (fHeader) fHeader->SetBunchCrossNumber(n);}
86 void SetMagneticField(Double_t mf){if (fHeader) fHeader->SetMagneticField(mf);}
33fe5eb1 87 void SetMuonMagFieldScale(Double_t mf){if (fHeader) fHeader->SetMuonMagFieldScale(mf);}
3bfd99da 88 void SetDiamond(Float_t xy[2],Float_t cov[3]){if (fHeader) fHeader->SetDiamond(xy,cov);}
a98c78e5 89 void SetDiamondZ(Float_t z, Float_t sig2z){if (fHeader) fHeader->SetDiamondZ(z,sig2z);}
08e4c457 90 Int_t GetRunNumber() const {return fHeader ? fHeader->GetRunNumber() : -999;}
91 UInt_t GetPeriodNumber() const {return fHeader ? fHeader->GetPeriodNumber() : 0;}
92 UInt_t GetOrbitNumber() const {return fHeader ? fHeader->GetOrbitNumber() : 0;}
93 UShort_t GetBunchCrossNumber() const {return fHeader ? fHeader->GetBunchCrossNumber() : 0;}
94 Double_t GetMagneticField() const {return fHeader ? fHeader->GetMagneticField() : -999.;}
33fe5eb1 95 Double_t GetMuonMagFieldScale() const {return fHeader ? fHeader->GetMuonMagFieldScale() : -999.;}
3bfd99da 96 Double_t GetDiamondX() const {return fHeader ? fHeader->GetDiamondX() : -999.;}
97 Double_t GetDiamondY() const {return fHeader ? fHeader->GetDiamondY() : -999.;}
a98c78e5 98 Double_t GetDiamondZ() const {return fHeader ? fHeader->GetDiamondZ() : -999.;}
3bfd99da 99 void GetDiamondCovXY(Float_t cov[3]) const {cov[0]=-999.; if(fHeader) fHeader->GetDiamondCovXY(cov);}
a98c78e5 100 Double_t GetSigma2DiamondX() const {return fHeader ? fHeader->GetSigma2DiamondX() : -999.;}
101 Double_t GetSigma2DiamondY() const {return fHeader ? fHeader->GetSigma2DiamondY() : -999.;}
102 Double_t GetSigma2DiamondZ() const {return fHeader ? fHeader->GetSigma2DiamondZ() : -999.;}
08e4c457 103
104 void SetEventType(UInt_t eventType){fHeader->SetEventType(eventType);}
105 void SetTriggerMask(ULong64_t n) {fHeader->SetTriggerMask(n);}
106 void SetTriggerCluster(UChar_t n) {fHeader->SetTriggerCluster(n);}
107
27346f69 108 UInt_t GetEventType() const { return fHeader ? fHeader->GetEventType() : 0;}
109 ULong64_t GetTriggerMask() const { return fHeader ? fHeader->GetTriggerMask() : 0;}
110 UChar_t GetTriggerCluster() const { return fHeader ? fHeader->GetTriggerCluster() : 0;}
111 TString GetFiredTriggerClasses()const { return fHeader->GetFiredTriggerClasses();};
08e4c457 112 Double_t GetZDCN1Energy() const { return fHeader ? fHeader->GetZDCN1Energy() : -999.; }
113 Double_t GetZDCP1Energy() const { return fHeader ? fHeader->GetZDCP1Energy() : -999.; }
114 Double_t GetZDCN2Energy() const { return fHeader ? fHeader->GetZDCN2Energy() : -999.; }
115 Double_t GetZDCP2Energy() const { return fHeader ? fHeader->GetZDCP2Energy() : -999.; }
a85132e7 116 Double_t GetZDCEMEnergy(Int_t i) const { return fHeader ? fHeader->GetZDCEMEnergy(i) : -999.; }
08e4c457 117
df9db588 118 // -- Tracks
119 TClonesArray *GetTracks() const { return fTracks; }
5d691d96 120 Int_t GetNTracks() const { return fTracks? fTracks->GetEntriesFast() : 0; }
08e4c457 121 Int_t GetNumberOfTracks() const { return GetNTracks(); }
5d691d96 122 AliAODTrack *GetTrack(Int_t nTrack) const { return fTracks ? (AliAODTrack*)fTracks->UncheckedAt(nTrack):0; }
08e4c457 123 Int_t AddTrack(const AliAODTrack* trk)
124 {new((*fTracks)[fTracks->GetEntriesFast()]) AliAODTrack(*trk); return fTracks->GetEntriesFast()-1;}
fb41236c 125 Int_t GetMuonTracks(TRefArray *muonTracks) const;
fa8b0e56 126 Int_t GetNumberOfMuonTracks() const;
df9db588 127
128 // -- Vertex
129 TClonesArray *GetVertices() const { return fVertices; }
5d691d96 130 Int_t GetNumberOfVertices() const { return fVertices?fVertices->GetEntriesFast():0; }
131 AliAODVertex *GetVertex(Int_t nVertex) const { return fVertices?(AliAODVertex*)fVertices->At(nVertex):0; }
08e4c457 132 Int_t AddVertex(const AliAODVertex* vtx)
133 {new((*fVertices)[fVertices->GetEntriesFast()]) AliAODVertex(*vtx); return fVertices->GetEntriesFast()-1;}
5c2fdfa2 134
3dd9f9e3 135 // primary vertex
136 virtual AliAODVertex *GetPrimaryVertex() const { return GetVertex(0); }
a98c78e5 137 virtual AliAODVertex *GetPrimaryVertexSPD() const;
138
139 // -- Pileup vertices
140 Int_t GetNumberOfPileupVerticesTracks() const;
141 Int_t GetNumberOfPileupVerticesSPD() const;
142 virtual AliAODVertex *GetPileupVertexSPD(Int_t iV=0) const;
143 virtual AliAODVertex *GetPileupVertexTracks(Int_t iV=0) const;
144 virtual Bool_t IsPileupFromSPD(Int_t minContributors=3, Double_t minZdist=0.8, Double_t nSigmaZdist=3., Double_t nSigmaDiamXY=2., Double_t nSigmaDiamZ=5.) const;
b46ff4b0 145 virtual Bool_t IsPileupFromSPDInMultBins() const;
a98c78e5 146
df9db588 147
3dd9f9e3 148 // V0
149 TClonesArray *GetV0s() const { return fV0s; }
c1b93f02 150 Int_t GetNumberOfV0s() const { return fV0s->GetEntriesFast(); }
3dd9f9e3 151 AliAODv0 *GetV0(Int_t nV0) const { return (AliAODv0*)fV0s->UncheckedAt(nV0); }
152 Int_t AddV0(const AliAODv0* v0)
153 {new((*fV0s)[fV0s->GetEntriesFast()]) AliAODv0(*v0); return fV0s->GetEntriesFast()-1;}
154
9a244178 155 // Cascades
156 TClonesArray *GetCascades() const { return fCascades; }
157 Int_t GetNumberOfCascades() const { return fCascades->GetEntriesFast(); }
158 AliAODcascade *GetCascade(Int_t nCasc) const { return (AliAODcascade*)fCascades->UncheckedAt(nCasc); }
159 Int_t AddCascade(const AliAODcascade* cascade)
160 {new((*fCascades)[fCascades->GetEntriesFast()]) AliAODcascade(*cascade); return fCascades->GetEntriesFast()-1;}
161
3dd9f9e3 162 // -- EMCAL and PHOS Cluster
c8fe2783 163 TClonesArray *GetCaloClusters() const { return fCaloClusters; }
164 Int_t GetNumberOfCaloClusters() const { return fCaloClusters->GetEntriesFast(); }
3dd9f9e3 165 AliAODCaloCluster *GetCaloCluster(Int_t nCluster) const { return (AliAODCaloCluster*)fCaloClusters->UncheckedAt(nCluster); }
166 Int_t AddCaloCluster(const AliAODCaloCluster* clus)
167 {new((*fCaloClusters)[fCaloClusters->GetEntriesFast()]) AliAODCaloCluster(*clus); return fCaloClusters->GetEntriesFast()-1;}
168
78902954 169 Int_t GetEMCALClusters(TRefArray *clusters) const;
170 Int_t GetPHOSClusters(TRefArray *clusters) const;
171
172
3dd9f9e3 173 // -- FMD Cluster
174 TClonesArray *GetFmdClusters() const { return fFmdClusters; }
175 Int_t GetNFmdClusters() const { return fFmdClusters->GetEntriesFast(); }
176 AliAODFmdCluster *GetFmdCluster(Int_t nCluster) const { return (AliAODFmdCluster*)fFmdClusters->UncheckedAt(nCluster); }
177 Int_t AddFmdCluster(const AliAODFmdCluster* clus)
178 {new((*fFmdClusters)[fFmdClusters->GetEntriesFast()]) AliAODFmdCluster(*clus); return fFmdClusters->GetEntriesFast()-1;}
179
180 // -- PMD Cluster
181 TClonesArray *GetPmdClusters() const { return fPmdClusters; }
182 Int_t GetNPmdClusters() const { return fPmdClusters->GetEntriesFast(); }
183 AliAODPmdCluster *GetPmdCluster(Int_t nCluster) const { return (AliAODPmdCluster*)fPmdClusters->UncheckedAt(nCluster); }
184 Int_t AddPmdCluster(const AliAODPmdCluster* clus)
185 {new((*fPmdClusters)[fPmdClusters->GetEntriesFast()]) AliAODPmdCluster(*clus); return fPmdClusters->GetEntriesFast()-1;}
df9db588 186
187 // -- Jet
188 TClonesArray *GetJets() const { return fJets; }
5d691d96 189 Int_t GetNJets() const { return fJets?fJets->GetEntriesFast():0; }
190 AliAODJet *GetJet(Int_t nJet) const { return fJets?(AliAODJet*)fJets->UncheckedAt(nJet):0; }
08e4c457 191 Int_t AddJet(const AliAODJet* vtx)
192 {new((*fJets)[fJets->GetEntriesFast()]) AliAODJet(*vtx); return fJets->GetEntriesFast()-1;}
df9db588 193
821f8f1d 194 // -- Tracklets
195 AliAODTracklets *GetTracklets() const { return fTracklets; }
196
3dd9f9e3 197 // -- Calorimeter Cells
e649177a 198 AliAODCaloCells *GetEMCALCells() const { return fEmcalCells; }
199 AliAODCaloCells *GetPHOSCells() const { return fPhosCells; }
c8fe2783 200 const TGeoHMatrix* GetPHOSMatrix(Int_t /*i*/) const { return NULL; }
201 const TGeoHMatrix* GetEMCALMatrix(Int_t /*i*/)const { return NULL; }
202
3dd9f9e3 203
866d8d78 204 // -- Dimuons
205 TClonesArray *GetDimuons() const { return fDimuons; }
206 Int_t GetNDimuons() const { return fDimuons->GetEntriesFast(); }
207 Int_t GetNumberOfDimuons() const { return GetNDimuons(); }
208 AliAODDimuon *GetDimuon(Int_t nDimu) const { return (AliAODDimuon*)fDimuons->UncheckedAt(nDimu); }
209 Int_t AddDimuon(const AliAODDimuon* dimu)
210 {new((*fDimuons)[fDimuons->GetEntriesFast()]) AliAODDimuon(*dimu); return fDimuons->GetEntriesFast()-1;}
211
df9db588 212 // -- Services
ec4af4c1 213 void CreateStdContent();
08e4c457 214 void SetStdNames();
ec4af4c1 215 void GetStdContent();
5c1dc41f 216 void CreateStdFolders();
3dd9f9e3 217 void ResetStd(Int_t trkArrSize = 0,
218 Int_t vtxArrSize = 0,
219 Int_t v0ArrSize = 0,
9a244178 220 Int_t cascadeArrSize = 0,
3dd9f9e3 221 Int_t jetSize = 0,
222 Int_t caloClusSize = 0,
223 Int_t fmdClusSize = 0,
866d8d78 224 Int_t pmdClusSize = 0,
225 Int_t dimuonArrsize =0
9a244178 226 );
ec4af4c1 227 void ClearStd();
ec8aded8 228 void Reset() {ClearStd();}
3b93c32a 229 void ReadFromTree(TTree *tree, Option_t* opt = "");
f12d42ce 230 void WriteToTree(TTree* tree) const {tree->Branch(fAODObjects);}
08e4c457 231
232 void Print(Option_t *option="") const;
c8e4f399 233 void MakeEntriesReferencable();
5e6a3170 234 static void AssignIDtoCollection(const TCollection* col);
c8fe2783 235
236 //Following needed only for mixed event
237 virtual Int_t EventIndex(Int_t) const {return 0;}
238 virtual Int_t EventIndexForCaloCluster(Int_t) const {return 0;}
239 virtual Int_t EventIndexForPHOSCell(Int_t) const {return 0;}
240 virtual Int_t EventIndexForEMCALCell(Int_t) const {return 0;}
befa9db4 241 AliCentrality* GetCentrality() {return fHeader->GetCentralityP();}
ce7adfe9 242 AliEventplane* GetEventplane() {return fHeader->GetEventplaneP();}
ae2bccf1 243
244 // VZERO
245 AliAODVZERO *GetVZEROData() const { return fAODVZERO; }
246
c8fe2783 247 private :
df9db588 248
5c1dc41f 249 TList *fAODObjects; // list of AODObjects
250 TFolder *fAODFolder; // folder structure of branches
dd389a30 251 Bool_t fConnected; //! flag if leaves are alreday connected
df9db588 252 // standard content
3dd9f9e3 253 AliAODHeader *fHeader; //! event information
254 TClonesArray *fTracks; //! charged tracks
255 TClonesArray *fVertices; //! vertices
256 TClonesArray *fV0s; //! V0s
9a244178 257 TClonesArray *fCascades; //! Cascades
3dd9f9e3 258 AliAODTracklets *fTracklets; //! SPD tracklets
259 TClonesArray *fJets; //! jets
37792174 260 AliAODCaloCells *fEmcalCells; //! EMCAL calorimenter cells
261 AliAODCaloCells *fPhosCells; //! PHOS calorimenter cells
3dd9f9e3 262 TClonesArray *fCaloClusters; //! calorimeter clusters
263 TClonesArray *fFmdClusters; //! FMDclusters
264 TClonesArray *fPmdClusters; //! PMDclusters
866d8d78 265 TClonesArray *fDimuons; //! dimuons
ae2bccf1 266 AliAODVZERO *fAODVZERO; //! VZERO AOD
821f8f1d 267
08e4c457 268 static const char* fAODListName[kAODListN]; //!
269
ae2bccf1 270 ClassDef(AliAODEvent, 7);
df9db588 271};
272
273#endif