1 #ifndef AliAODCluster_H
2 #define AliAODCluster_H
3 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 //-------------------------------------------------------------------------
9 // AOD cluster base class
10 // Author: Markus Oldenburg, CERN
11 //-------------------------------------------------------------------------
15 #include "AliVParticle.h"
16 #include "AliAODVertex.h"
17 #include "AliAODTrack.h"
19 class AliAODCluster : public AliVParticle {
23 enum AODClu_t {kUndef = -1,
43 AliAODCluster(Int_t id,
47 Double_t covMatrix[10],
49 AliAODVertex *prodVertex, // not necessary for PMD
50 AliAODTrack *primTrack,
53 AliAODCluster(Int_t id,
57 Float_t covMatrix[10],
59 AliAODVertex *prodVertex,
60 AliAODTrack *primTrack,
63 virtual ~AliAODCluster();
64 AliAODCluster(const AliAODCluster& trk);
65 AliAODCluster& operator=(const AliAODCluster& trk);
67 Double_t Chi2() const { return fChi2; }
69 virtual Double_t E() const { return fEnergy; }
70 // make a connection to the PID object, here!!!
71 virtual Double_t M() const { return (fType==AliAODCluster::kPHOSNeutral) ? 0. : -999.; }
73 // make a connection to the PID object, here!!!
74 virtual Double_t Y() const { return (fType==AliAODCluster::kPHOSNeutral) ? Eta() : -999.; }
77 virtual const Double_t *PID() const { return fPID; }
78 AODCluPID_t GetMostProbablePID() const;
80 template <class T> void GetPID(T *pid) const {
81 for(Int_t i=0; i<9; ++i) pid[i]=fPID[i];}
83 template <class T> void SetPID(const T *pid) {
84 if(pid) for(Int_t i=0; i<9; ++i) fPID[i]=pid[i];
85 else {for(Int_t i=0; i<9; fPID[i++]=0);} fPID[AliAODCluster::kUnknown]=1.;}
87 Int_t GetID() const { return fID; }
88 Int_t GetLabel() const { return fLabel; }
90 template <class T> Bool_t GetPosition(T *x) const {
91 x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
94 template <class T> void SetCovMatrix(const T *covMatrix) {
95 if(!fCovMatrix) fCovMatrix=new AliAODRedCov<4>();
96 fCovMatrix->SetCovMatrix(covMatrix);}
98 template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
99 if(!fCovMatrix) return kFALSE;
100 fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
102 void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
104 AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
105 AliAODTrack *GetPrimTrack() const { return (AliAODTrack*)fPrimTrack.GetObject(); }
108 void Print(const Option_t *opt = "") const;
111 void SetID(Int_t id) { fID = id; }
112 void SetLabel(Int_t label) {fLabel = label; }
114 template <class T> void SetPosition(const T *x);
116 void SetChi2(Double_t chi2) { fChi2 = chi2; }
118 void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
119 void SetPrimTrack(TObject *ptrack) { fPrimTrack = ptrack; }
121 virtual Double_t Px() const {return (fType==AliAODCluster::kPHOSNeutral) ? fEnergy*fPosition[0] : 0.;}
122 virtual Double_t Py() const {return (fType==AliAODCluster::kPHOSNeutral) ? fEnergy*fPosition[1] : 0.;}
123 virtual Double_t Pz() const {return (fType==AliAODCluster::kPHOSNeutral) ? fEnergy*fPosition[2] : 0.;}
124 virtual Double_t Pt() const {return TMath::Sqrt(Px()*Px() + Py()*Py()); }
125 virtual Double_t P() const {return TMath::Sqrt(Px()*Px() + Py()*Py() + Pz()*Pz()); }
126 virtual Double_t OneOverPt() const {return Pt() ? 1./Pt(): -999.;}
127 virtual Double_t Phi() const {return (fType==AliAODCluster::kPHOSNeutral) ? TMath::Pi()+TMath::ATan2(-fPosition[1], -fPosition[0]) : 0.;}
128 virtual Double_t Theta() const {return (fType==AliAODCluster::kPHOSNeutral) ? TMath::ATan2(Pt(), fPosition[2]) : 0.;}
129 virtual Double_t Eta() const {return (fType==AliAODCluster::kPHOSNeutral) ? -TMath::Log(TMath::Tan(0.5 * Theta())) : 0.;}
130 virtual Short_t Charge() const {return (fType==AliAODCluster::kPHOSNeutral) ? 0 : -999;}
135 Double32_t fEnergy; // energy
136 Double32_t fPosition[3]; // position of the cluster
138 Double32_t fChi2; // chi2 (probably not necessary for PMD)
139 Double32_t fPID[9]; // [0.,1.,8] pointer to PID object
141 Int_t fID; // unique cluster ID, points back to the ESD cluster
142 Int_t fLabel; // particle label, points back to MC track
144 Char_t fType; // cluster type
146 AliAODRedCov<4> *fCovMatrix; // covariance matrix (x, y, z, E)
147 TRef fProdVertex; // vertex of origin (not necessary for PMD)
148 TRef fPrimTrack; // primary track associated with this cluster (not necessary for PMD)
150 // TRef fAssocCluster; // for PMD: cluster of other layer associated with this cluster
152 ClassDef(AliAODCluster,3);