cleaning
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliEmcalParticle.h
CommitLineData
d11dc2a6 1#ifndef ALIEMCALPARTICLE_H
2#define ALIEMCALPARTICLE_H
3
d11dc2a6 4#include <TLorentzVector.h>
5ded2286 5#include <TMath.h>
02357c1c 6#include <TObjArray.h>
46dd554b 7#include "AliVCluster.h"
4e04e015 8#include "AliVParticle.h"
d11dc2a6 9#include "AliVTrack.h"
10
4e04e015 11class AliEmcalParticle: public AliVParticle {
d11dc2a6 12 public:
13 AliEmcalParticle();
46dd554b 14 AliEmcalParticle(TObject *particle, Int_t id = -1, Double_t vx=0, Double_t vy=0, Double_t vz=0);
d11dc2a6 15 AliEmcalParticle(const AliEmcalParticle &p);
16 AliEmcalParticle &operator=(const AliEmcalParticle &p);
9af299a9 17 virtual ~AliEmcalParticle();
d11dc2a6 18
4e04e015 19 // AliVParticle interface
20 Double_t Px() const { return fPt*TMath::Cos(fPhi); }
21 Double_t Py() const { return fPt*TMath::Sin(fPhi); };
22 Double_t Pz() const { return fPt*TMath::SinH(fEta); }
23 Double_t Pt() const { return fPt ; }
24 Double_t P() const { return TMath::Sqrt(Px()*Px()+Py()*Py()+Pz()*Pz()); }
25 Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return 1; }
26 Double_t Xv() const { return 0; }
27 Double_t Yv() const { return 0; }
28 Double_t Zv() const { return 0; }
29 Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return 1; }
30 Double_t OneOverPt() const { return 1./fPt; }
31 Double_t Phi() const { return fPhi; }
59a3310e 32 Double_t Theta() const { return 2*TMath::ATan(TMath::Exp(-fEta)); }
33 Double_t E() const { Double_t p=P(); return TMath::Sqrt(M()*M()+p*p); }
34 Double_t M() const { return fM; }
4e04e015 35 Double_t Eta() const { return fEta; }
36 Double_t Y() const { if (fTrack) return fTrack->Y(); return fEta; }
37 Short_t Charge() const { if (fTrack) return fTrack->Charge(); else return 0; }
99264a5c
CL
38 Int_t GetLabel() const { if (fTrack) return fTrack->GetLabel(); return fCluster->GetLabel(); }
39 Int_t PdgCode() const { return 0; }
40 const Double_t *PID() const { return 0; }
4e04e015 41
02357c1c 42 void AddMatchedObj(Int_t id, Double_t d);
43 AliVCluster *GetCluster() const { return fCluster ; }
4e04e015 44 Int_t GetMatchedObjId(UShort_t i = 0) const { return fNMatched > i ? fMatchedIds[i] : -1 ; }
45 Double_t GetMatchedObjDistance(UShort_t i = 0) const { return fNMatched > i ? fMatchedDist[i] : -1 ; }
46 UShort_t GetNumberOfMatchedObj() const { return fNMatched ; }
02357c1c 47 AliVCluster *GetMatchedCluster(UShort_t i = 0) const { if (fTrack && fMatchedPtr && (fNMatched > i))
48 return static_cast<AliVCluster*>(fMatchedPtr->At(fMatchedIds[i]));
49 return 0 ; }
50 AliVTrack *GetMatchedTrack(UShort_t i = 0) const { if (fCluster && fMatchedPtr && (fNMatched > i))
51 return static_cast<AliVTrack*>(fMatchedPtr->At(fMatchedIds[i]));
52 return 0 ; }
53 AliVTrack *GetTrack() const { return fTrack ; }
d11dc2a6 54 Double_t GetTrackPhiOnEMCal() const { if (fTrack) return fTrack->GetTrackPhiOnEMCal(); else return -999; }
55 Double_t GetTrackEtaOnEMCal() const { if (fTrack) return fTrack->GetTrackEtaOnEMCal(); else return -999; }
00630d07 56 Double_t GetTrackPtOnEMCal() const { if (fTrack) return fTrack->GetTrackPtOnEMCal(); else return -999; }
9af299a9 57 Int_t IdInCollection() const { return fId ; }
58 Bool_t IsCluster() const { return (Bool_t) fCluster != 0 ; }
99264a5c 59 Bool_t IsEMCAL() const { if (fCluster) return fCluster->IsEMCAL();
d11dc2a6 60 if (fTrack) return fTrack->IsEMCAL();
61 return kFALSE; }
d11dc2a6 62 Bool_t IsTrack() const { return (Bool_t) fTrack != 0 ; }
5ded2286 63 Bool_t IsMC(Int_t minLabel=0) const { if (fTrack) return (TMath::Abs(fTrack->GetLabel()) > minLabel);
64 return (fCluster->GetLabel() > minLabel); }
d11dc2a6 65 void ResetMatchedObjects();
66 void SetIdInCollection(Int_t id) { fId = id ; }
67 void SetMatchedObj(Int_t id, Double_t d) { ResetMatchedObjects(); fMatchedIds[0] = id; fMatchedDist[0] = d; fNMatched = 1; }
02357c1c 68 void SetMatchedPtr(TObjArray *arr) { fMatchedPtr = arr; }
d11dc2a6 69
7a84c1bf 70 void SetPtEtaPhiM(Double_t pt, Double_t eta, Double_t phi, Double_t m) {fPt=pt; fEta=eta; fPhi=phi; fM=m;}
71
d11dc2a6 72 protected:
46dd554b 73 TLorentzVector &GetLorentzVector(const Double_t *vertex = 0) const;
74
75 static const UShort_t fSizeMatched = 99; //!size of matched clusters array
d11dc2a6 76
77 AliVTrack *fTrack; //!track
78 AliVCluster *fCluster; //!cluster
02357c1c 79 UShort_t fMatchedIds[fSizeMatched]; //!ids of matched tracks/clusters, ordered from the closest to the farthest
80 Double_t fMatchedDist[fSizeMatched]; //!distances of matched tracks/clusters
d11dc2a6 81 UShort_t fNMatched; //!number of matched objects
46dd554b 82 Int_t fId; //!id in original collection
83 Double_t fPhi; //!phi
84 Double_t fEta; //!eta
85 Double_t fPt; //!pt
59a3310e 86 Double_t fM; //!M
02357c1c 87 TObjArray *fMatchedPtr; //!pointer to array of matched tracks/clusters
d11dc2a6 88
59a3310e 89 ClassDef(AliEmcalParticle, 3) // Emcal particle class
d11dc2a6 90};
91#endif