Fixes for bug #52499: Field polarities inconsistiency
[u/mrichter/AliRoot.git] / STEER / AliESDEvent.h
CommitLineData
af885e0f 1// -*- mode: C++ -*-
2#ifndef ALIESDEVENT_H
3#define ALIESDEVENT_H
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7
8/* $Id$ */
9
10//-------------------------------------------------------------------------
f56a9fa7 11// Class AliESDEvent
6989bff3 12// This is the class to deal with during the physics analysis of data.
f56a9fa7 13// It also ensures the backward compatibility with the old ESD format.
af885e0f 14//
f56a9fa7 15// Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch
af885e0f 16//-------------------------------------------------------------------------
17
18#include <TClonesArray.h>
19#include <TObject.h>
20#include <TTree.h>
21#include <TArrayF.h>
22
23class TList;
24
024c7734 25#include "AliVEvent.h"
694aad0c 26// some includes for delegated methods
f0106218 27#include "AliESDCaloTrigger.h"
af885e0f 28#include "AliESDRun.h"
29#include "AliESDHeader.h"
3f47e572 30#include "AliESDTZERO.h"
f0106218 31#include "AliESDZDC.h"
bd95bae7 32#include "AliESDACORDE.h"
af885e0f 33
024c7734 34// AliESDtrack has to be included so that the compiler
35// knows its inheritance tree (= that it is a AliVParticle).
36#include "AliESDtrack.h"
5303c167 37// same for AliESDVertex (which is a AliVVertex)
38#include "AliESDVertex.h"
024c7734 39
af885e0f 40class AliESDfriend;
41class AliESDVZERO;
42class AliESDHLTtrack;
f0106218 43class AliESDVertex;
44class AliESDPmdTrack;
45class AliESDFMD;
46class AliESDkink;
f0106218 47class AliESDCaloCluster;
e649177a 48class AliESDCaloCells;
f0106218 49class AliESDv0;
f0106218 50class AliMultiplicity;
51class AliRawDataErrorLog;
52class AliESDRun;
53class AliESDTrdTrack;
54class AliESDMuonTrack;
af885e0f 55class AliESD;
f0106218 56class AliESDcascade;
cd1d4ee0 57class TRefArray;
bd95bae7 58class AliESDACORDE;
af885e0f 59
024c7734 60class AliESDEvent : public AliVEvent {
af885e0f 61public:
62
63
6989bff3 64 enum ESDListIndex {kESDRun,
af885e0f 65 kHeader,
66 kESDZDC,
67 kESDFMD,
68 kESDVZERO,
69 kESDTZERO,
06cc9d95 70 kTPCVertex,
af885e0f 71 kSPDVertex,
72 kPrimaryVertex,
73 kSPDMult,
74 kPHOSTrigger,
75 kEMCALTrigger,
04d01397 76 kSPDPileupVertices,
77 kTrkPileupVertices,
af885e0f 78 kTracks,
79 kMuonTracks,
80 kPmdTracks,
81 kTrdTracks,
82 kV0s,
83 kCascades,
84 kKinks,
85 kCaloClusters,
e649177a 86 kEMCALCells,
87 kPHOSCells,
af885e0f 88 kErrorLogs,
bd95bae7 89 kESDACORDE,
af885e0f 90 kESDListN
91 };
92
93 AliESDEvent();
732a24fe 94 virtual ~AliESDEvent();
95 AliESDEvent &operator=(const AliESDEvent& source); // or make private and use only copy?
96 virtual void Copy(TObject& obj) const;
af885e0f 97
98 // RUN
99 // move this to the UserData!!!
100 const AliESDRun* GetESDRun() const {return fESDRun;}
101
102 // Delegated methods for fESDRun
024c7734 103 void SetRunNumber(Int_t n) {fESDRun->SetRunNumber(n);}
104 Int_t GetRunNumber() const {return fESDRun->GetRunNumber();}
105 void SetPeriodNumber(UInt_t n){fESDRun->SetPeriodNumber(n);}
106 UInt_t GetPeriodNumber() const {return fESDRun->GetPeriodNumber();}
107 void SetMagneticField(Double_t mf){fESDRun->SetMagneticField(mf);}
108 Double_t GetMagneticField() const {return fESDRun->GetMagneticField();}
109 void SetDiamond(const AliESDVertex *vertex) { fESDRun->SetDiamond(vertex);}
694aad0c 110 Double_t GetDiamondX() const {return fESDRun->GetDiamondX();}
111 Double_t GetDiamondY() const {return fESDRun->GetDiamondY();}
112 Double_t GetSigma2DiamondX() const {return fESDRun->GetSigma2DiamondX();}
113 Double_t GetSigma2DiamondY() const {return fESDRun->GetSigma2DiamondY();}
114 void GetDiamondCovXY(Float_t cov[3]) const {fESDRun->GetDiamondCovXY(cov);}
b024fd7f 115 void SetTriggerClass(const char*name, Int_t index) {fESDRun->SetTriggerClass(name,index);}
8d218603 116 void SetPHOSMatrix(TGeoHMatrix*matrix, Int_t i) {fESDRun->SetPHOSMatrix(matrix,i);}
117 const TGeoHMatrix* GetPHOSMatrix(Int_t i) const {return fESDRun->GetPHOSMatrix(i);}
428557af 118 void SetEMCALMatrix(TGeoHMatrix*matrix, Int_t i) {fESDRun->SetEMCALMatrix(matrix,i);}
119 const TGeoHMatrix* GetEMCALMatrix(Int_t i) const {return fESDRun->GetEMCALMatrix(i);}
af885e0f 120
121 // HEADER
024c7734 122 AliESDHeader* GetHeader() const {return fHeader;}
af885e0f 123
124 // Delegated methods for fHeader
125 void SetTriggerMask(ULong64_t n) {fHeader->SetTriggerMask(n);}
126 void SetOrbitNumber(UInt_t n) {fHeader->SetOrbitNumber(n);}
127 void SetTimeStamp(UInt_t timeStamp){fHeader->SetTimeStamp(timeStamp);}
128 void SetEventType(UInt_t eventType){fHeader->SetEventType(eventType);}
129 void SetEventNumberInFile(Int_t n) {fHeader->SetEventNumberInFile(n);}
732a24fe 130 // void SetRunNumber(Int_t n) {fHeader->SetRunNumber(n);}
af885e0f 131 void SetBunchCrossNumber(UShort_t n) {fHeader->SetBunchCrossNumber(n);}
132 void SetTriggerCluster(UChar_t n) {fHeader->SetTriggerCluster(n);}
694aad0c 133
af885e0f 134 ULong64_t GetTriggerMask() const {return fHeader->GetTriggerMask();}
ed4e8b82 135 TString GetFiredTriggerClasses() const {return fESDRun->GetFiredTriggerClasses(fHeader->GetTriggerMask());}
136 Bool_t IsTriggerClassFired(const char *name) const {return fESDRun->IsTriggerClassFired(fHeader->GetTriggerMask(),name);}
3b286f80 137 TObject* GetHLTTriggerDecision() const;
138 TString GetHLTTriggerDescription() const;
139 Bool_t IsHLTTriggerFired(const char* name=NULL) const;
af885e0f 140 UInt_t GetOrbitNumber() const {return fHeader->GetOrbitNumber();}
141 UInt_t GetTimeStamp() const { return fHeader->GetTimeStamp();}
142 UInt_t GetEventType() const { return fHeader->GetEventType();}
143 Int_t GetEventNumberInFile() const {return fHeader->GetEventNumberInFile();}
144 UShort_t GetBunchCrossNumber() const {return fHeader->GetBunchCrossNumber();}
145 UChar_t GetTriggerCluster() const {return fHeader->GetTriggerCluster();}
146
147 // ZDC CKB: put this in the header?
a85132e7 148 AliESDZDC* GetESDZDC() const {return fESDZDC;}
af885e0f 149
150 // Delegated methods for fESDZDC
024c7734 151 Double_t GetZDCN1Energy() const {return fESDZDC->GetZDCN1Energy();}
152 Double_t GetZDCP1Energy() const {return fESDZDC->GetZDCP1Energy();}
153 Double_t GetZDCN2Energy() const {return fESDZDC->GetZDCN2Energy();}
154 Double_t GetZDCP2Energy() const {return fESDZDC->GetZDCP2Energy();}
a85132e7 155 Double_t GetZDCEMEnergy(Int_t i=0) const {return fESDZDC->GetZDCEMEnergy(i);}
af885e0f 156 Int_t GetZDCParticipants() const {return fESDZDC->GetZDCParticipants();}
a85132e7 157 void SetZDC(Float_t n1Energy, Float_t p1Energy, Float_t em1Energy, Float_t em2Energy,
5f0ec064 158 Float_t n2Energy, Float_t p2Energy, Int_t participants, Int_t nPartA,
159 Int_t nPartC, Double_t b, Double_t bA, Double_t bC, UInt_t recoflag)
2b6cdc43 160 {fESDZDC->SetZDC(n1Energy, p1Energy, em1Energy, em2Energy, n2Energy, p2Energy,
5f0ec064 161 participants, nPartA, nPartC, b, bA, bC, recoflag);}
af885e0f 162
163
164 // FMD
165 void SetFMDData(AliESDFMD * obj);
166 AliESDFMD *GetFMDData(){ return fESDFMD; }
167
168
169 // TZERO CKB: put this in the header?
170 const AliESDTZERO* GetESDTZERO() const {return fESDTZERO;}
171 // delegetated methods for fESDTZERO
172
694aad0c 173 Double_t GetT0zVertex() const {return fESDTZERO->GetT0zVertex();}
af885e0f 174 void SetT0zVertex(Float_t z) {fESDTZERO->SetT0zVertex(z);}
694aad0c 175 Double_t GetT0() const {return fESDTZERO->GetT0();}
af885e0f 176 void SetT0(Float_t timeStart) {fESDTZERO->SetT0(timeStart);}
571b0564 177 Float_t GetT0clock() const {return fESDTZERO->GetT0clock();}
178 void SetT0clock(Float_t timeStart) {fESDTZERO->SetT0clock(timeStart);}
694aad0c 179 const Double_t * GetT0time() const {return fESDTZERO->GetT0time();}
af885e0f 180 void SetT0time(Float_t time[24]) {fESDTZERO->SetT0time(time);}
694aad0c 181 const Double_t * GetT0amplitude() const {return fESDTZERO->GetT0amplitude();}
af885e0f 182 void SetT0amplitude(Float_t amp[24]){fESDTZERO->SetT0amplitude(amp);}
183
184 // VZERO
185 AliESDVZERO *GetVZEROData() const { return fESDVZERO; }
186 void SetVZEROData(AliESDVZERO * obj);
187
bd95bae7 188 // ACORDE
189 AliESDACORDE *GetACORDEData() const { return fESDACORDE;}
190 void SetACORDEData(AliESDACORDE * obj);
af885e0f 191
7d44c466 192 void SetESDfriend(const AliESDfriend *f) const;
af885e0f 193 void GetESDfriend(AliESDfriend *f) const;
194
195
196
06cc9d95 197 void SetPrimaryVertexTPC(const AliESDVertex *vertex);
198 const AliESDVertex *GetPrimaryVertexTPC() const {return fTPCVertex;}
199
200 void SetPrimaryVertexSPD(const AliESDVertex *vertex);
201 const AliESDVertex *GetPrimaryVertexSPD() const {return fSPDVertex;}
202 const AliESDVertex *GetVertex() const {
203 //For the backward compatibily only
204 return GetPrimaryVertexSPD();
205 }
af885e0f 206
c264b61b 207 void SetPrimaryVertexTracks(const AliESDVertex *vertex);
208 const AliESDVertex *GetPrimaryVertexTracks() const {return fPrimaryVertex;}
518573d7 209 AliESDVertex *PrimaryVertexTracksUnconstrained() const;
c264b61b 210
211 const AliESDVertex *GetPrimaryVertex() const;
af885e0f 212
f0106218 213 void SetMultiplicity(const AliMultiplicity *mul);
214
af885e0f 215 const AliMultiplicity *GetMultiplicity() const {return fSPDMult;}
f0106218 216
217
7f68891d 218 Bool_t Clean(Float_t *cleanPars);
7d44c466 219 Bool_t RemoveKink(Int_t i) const;
220 Bool_t RemoveV0(Int_t i) const;
221 Bool_t RemoveTrack(Int_t i) const;
d64bd07d 222
04d01397 223 const AliESDVertex *GetPileupVertexSPD(Int_t i) const {
224 return (const AliESDVertex *)fSPDPileupVertices->UncheckedAt(i);
225 }
6dc21f57 226 Char_t AddPileupVertexSPD(const AliESDVertex *vtx);
04d01397 227
228 const AliESDVertex *GetPileupVertexTracks(Int_t i) const {
229 return (const AliESDVertex *)fTrkPileupVertices->UncheckedAt(i);
230 }
6dc21f57 231 Char_t AddPileupVertexTracks(const AliESDVertex *vtx);
04d01397 232
af885e0f 233 AliESDtrack *GetTrack(Int_t i) const {
234 return (AliESDtrack *)fTracks->UncheckedAt(i);
235 }
236 Int_t AddTrack(const AliESDtrack *t);
237
238
239 AliESDHLTtrack *GetHLTConfMapTrack(Int_t /*i*/) const {
240 // return (AliESDHLTtrack *)fHLTConfMapTracks->UncheckedAt(i);
241 return 0;
242 }
243 void AddHLTConfMapTrack(const AliESDHLTtrack */*t*/) {
244 printf("ESD:: AddHLTConfMapTrack do nothing \n");
245 // TClonesArray &fhlt = *fHLTConfMapTracks;
246 // new(fhlt[fHLTConfMapTracks->GetEntriesFast()]) AliESDHLTtrack(*t);
247 }
248
249
250 AliESDHLTtrack *GetHLTHoughTrack(Int_t /*i*/) const {
251 // return (AliESDHLTtrack *)fHLTHoughTracks->UncheckedAt(i);
252 return 0;
253 }
254 void AddHLTHoughTrack(const AliESDHLTtrack */*t*/) {
255 printf("ESD:: AddHLTHoughTrack do nothing \n");
256 // TClonesArray &fhlt = *fHLTHoughTracks;
257 // new(fhlt[fHLTHoughTracks->GetEntriesFast()]) AliESDHLTtrack(*t);
258 }
259
260 AliESDMuonTrack *GetMuonTrack(Int_t i) const {
261 return (AliESDMuonTrack *)fMuonTracks->UncheckedAt(i);
262 }
f0106218 263
264 void AddMuonTrack(const AliESDMuonTrack *t);
af885e0f 265
266 AliESDPmdTrack *GetPmdTrack(Int_t i) const {
267 return (AliESDPmdTrack *)fPmdTracks->UncheckedAt(i);
268 }
f0106218 269
270 void AddPmdTrack(const AliESDPmdTrack *t);
271
af885e0f 272
273 AliESDTrdTrack *GetTrdTrack(Int_t i) const {
274 return (AliESDTrdTrack *)fTrdTracks->UncheckedAt(i);
275 }
f0106218 276
277
278 void AddTrdTrack(const AliESDTrdTrack *t);
af885e0f 279
280 AliESDv0 *GetV0(Int_t i) const {
281 return (AliESDv0*)fV0s->UncheckedAt(i);
282 }
283 Int_t AddV0(const AliESDv0 *v);
284
285 AliESDcascade *GetCascade(Int_t i) const {
286 return (AliESDcascade *)fCascades->UncheckedAt(i);
287 }
f0106218 288
289 void AddCascade(const AliESDcascade *c);
af885e0f 290
291 AliESDkink *GetKink(Int_t i) const {
292 return (AliESDkink *)fKinks->UncheckedAt(i);
293 }
294 Int_t AddKink(const AliESDkink *c);
295
296 AliESDCaloCluster *GetCaloCluster(Int_t i) const {
297 return (AliESDCaloCluster *)fCaloClusters->UncheckedAt(i);
298 }
e649177a 299
af885e0f 300 Int_t AddCaloCluster(const AliESDCaloCluster *c);
301
e649177a 302 AliESDCaloCells *GetEMCALCells() const {return fEMCALCells; }
303 AliESDCaloCells *GetPHOSCells() const {return fPHOSCells; }
304
af885e0f 305 AliRawDataErrorLog *GetErrorLog(Int_t i) const {
306 return (AliRawDataErrorLog *)fErrorLogs->UncheckedAt(i);
307 }
7d44c466 308 void AddRawDataErrorLog(const AliRawDataErrorLog *log) const;
f0106218 309
af885e0f 310 Int_t GetNumberOfErrorLogs() const {return fErrorLogs->GetEntriesFast();}
311
312
313 void AddPHOSTriggerPosition(TArrayF array) { fPHOSTrigger->AddTriggerPosition(array); }
314 void AddPHOSTriggerAmplitudes(TArrayF array) { fPHOSTrigger->AddTriggerAmplitudes(array);}
315 void AddEMCALTriggerPosition(TArrayF array) { fEMCALTrigger->AddTriggerPosition(array); }
316 void AddEMCALTriggerAmplitudes(TArrayF array){ fEMCALTrigger->AddTriggerAmplitudes(array); }
317
04d01397 318 Int_t GetNumberOfPileupVerticesSPD() const {
642f673b 319 return (fSPDPileupVertices?fSPDPileupVertices->GetEntriesFast():0);
04d01397 320 }
321 Int_t GetNumberOfPileupVerticesTracks() const {
642f673b 322 return (fTrkPileupVertices?fTrkPileupVertices->GetEntriesFast():0);
04d01397 323 }
af885e0f 324 Int_t GetNumberOfTracks() const {return fTracks->GetEntriesFast();}
325 Int_t GetNumberOfHLTConfMapTracks() const {return 0;}
326 // fHLTConfMapTracks->GetEntriesFast();}
327 Int_t GetNumberOfHLTHoughTracks() const {return 0; }
328 // fHLTHoughTracks->GetEntriesFast(); }
329
330 Int_t GetNumberOfMuonTracks() const {return fMuonTracks->GetEntriesFast();}
331 Int_t GetNumberOfPmdTracks() const {return fPmdTracks->GetEntriesFast();}
332 Int_t GetNumberOfTrdTracks() const {return fTrdTracks->GetEntriesFast();}
333 Int_t GetNumberOfV0s() const {return fV0s->GetEntriesFast();}
334 Int_t GetNumberOfCascades() const {return fCascades->GetEntriesFast();}
335 Int_t GetNumberOfKinks() const {return fKinks->GetEntriesFast();}
e649177a 336
cd1d4ee0 337 Int_t GetEMCALClusters(TRefArray *clusters) const;
338 Int_t GetPHOSClusters(TRefArray *clusters) const;
af885e0f 339 Int_t GetNumberOfCaloClusters() const {return fCaloClusters->GetEntriesFast();}
340
a2fbb067 341 void SetUseOwnList(Bool_t b){fUseOwnList = b;}
342 Bool_t GetUseOwnList(){return fUseOwnList;}
e649177a 343
344 // Remove this stuff CKB?
345 //---------------------------------------------------
af885e0f 346 Int_t GetNumberOfEMCALClusters() const {return fEMCALClusters;}
347 void SetNumberOfEMCALClusters(Int_t clus) {fEMCALClusters = clus;}
348 Int_t GetFirstEMCALCluster() const {return fFirstEMCALCluster;}
349 void SetFirstEMCALCluster(Int_t index) {fFirstEMCALCluster = index;}
e649177a 350
af885e0f 351 Int_t GetNumberOfPHOSClusters() const {return fPHOSClusters;}
352 void SetNumberOfPHOSClusters(Int_t part) { fPHOSClusters = part ; }
353 void SetFirstPHOSCluster(Int_t index) { fFirstPHOSCluster = index ; }
354 Int_t GetFirstPHOSCluster() const { return fFirstPHOSCluster ; }
e649177a 355 //-------------------------------------------------------
356
357 TArrayF *GetEMCALTriggerPosition() const {return fEMCALTrigger->GetTriggerPosition();}
358 TArrayF *GetEMCALTriggerAmplitudes() const {return fEMCALTrigger->GetTriggerAmplitudes();}
af885e0f 359 TArrayF *GetPHOSTriggerPosition() const {return fPHOSTrigger->GetTriggerPosition();}
360 TArrayF *GetPHOSTriggerAmplitudes() const {return fPHOSTrigger->GetTriggerAmplitudes();}
361
362 void ResetV0s() { fV0s->Clear(); }
363 void ResetCascades() { fCascades->Clear(); }
364 void Reset();
365
366 void Print(Option_t *option="") const;
367
368 void AddObject(TObject* obj);
1d0dd492 369 void ReadFromTree(TTree *tree, Option_t* opt = "");
001b9beb 370 TObject* FindListObject(const char *name);
af885e0f 371 AliESD *GetAliESDOld(){return fESDOld;}
f12d42ce 372 void WriteToTree(TTree* tree) const;
af885e0f 373 void GetStdContent();
374 void ResetStdContent();
375 void CreateStdContent();
a2fbb067 376 void CreateStdContent(Bool_t bUseThisList);
af885e0f 377 void SetStdNames();
378 void CopyFromOldESD();
024c7734 379 TList* GetList() const {return fESDObjects;}
af885e0f 380
381protected:
382 AliESDEvent(const AliESDEvent&);
102c56c8 383 static Bool_t ResetWithPlacementNew(TObject *pObject);
af885e0f 384
385 TList *fESDObjects; // List of esd Objects
386
387 AliESDRun *fESDRun; //! Run information tmp put in the Userdata
388 AliESDHeader *fHeader; //! ESD Event Header
389 AliESDZDC *fESDZDC; //! ZDC information
390 AliESDFMD *fESDFMD; //! FMD object containing rough multiplicity
391 AliESDVZERO *fESDVZERO; //! VZERO object containing rough multiplicity
392 AliESDTZERO *fESDTZERO; //! TZEROObject
06cc9d95 393 AliESDVertex *fTPCVertex; //! Primary vertex estimated by the TPC
af885e0f 394 AliESDVertex *fSPDVertex; //! Primary vertex estimated by the SPD
395 AliESDVertex *fPrimaryVertex; //! Primary vertex estimated using ESD tracks
396 AliMultiplicity *fSPDMult; //! SPD tracklet multiplicity
397 AliESDCaloTrigger* fPHOSTrigger; //! PHOS Trigger information
398 AliESDCaloTrigger* fEMCALTrigger; //! PHOS Trigger information
bd95bae7 399 AliESDACORDE *fESDACORDE; //! ACORDE ESD object caontaining bit pattern
af885e0f 400
04d01397 401 TClonesArray *fSPDPileupVertices;//! Pileup primary vertices reconstructed by SPD
402 TClonesArray *fTrkPileupVertices;//! Pileup primary vertices reconstructed using the tracks
af885e0f 403 TClonesArray *fTracks; //! ESD tracks
404 TClonesArray *fMuonTracks; //! MUON ESD tracks
405 TClonesArray *fPmdTracks; //! PMD ESD tracks
406 TClonesArray *fTrdTracks; //! TRD ESD tracks (triggered)
407 TClonesArray *fV0s; //! V0 vertices
408 TClonesArray *fCascades; //! Cascade vertices
409 TClonesArray *fKinks; //! Kinks
410 TClonesArray *fCaloClusters; //! Calorimeter clusters for PHOS/EMCAL
e649177a 411 AliESDCaloCells *fEMCALCells; //! EMCAL cell info
412 AliESDCaloCells *fPHOSCells; //! PHOS cell info
af885e0f 413 TClonesArray *fErrorLogs; //! Raw-data reading error messages
414
415
416
1bd10080 417 AliESD *fESDOld; //! Old esd Structure
418 AliESDfriend *fESDFriendOld; //! Old friend esd Structure
60e8f114 419 Bool_t fConnected; //! flag if leaves are alreday connected
a2fbb067 420 Bool_t fUseOwnList; //! Do not use the list from the esdTree but use the one created by this class
60e8f114 421
6989bff3 422 static const char* fgkESDListName[kESDListN]; //!
af885e0f 423
af885e0f 424 // Remove this stuff CKB
425 Int_t fEMCALClusters; // Number of EMCAL clusters (subset of caloclusters)
426 Int_t fFirstEMCALCluster; // First EMCAL cluster in the fCaloClusters list
427
428 Int_t fPHOSClusters; // Number of PHOS clusters (subset of caloclusters)
429 Int_t fFirstPHOSCluster; // First PHOS cluster in the fCaloClusters list
430
04d01397 431 ClassDef(AliESDEvent,10) //ESDEvent class
af885e0f 432};
433#endif
434