]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/EMCAL/AliEmcalParticle.h
Fixing coverity defects:
[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
85c423bc 70 void SetPt(Double_t pt) { fPt = pt ; }
71 void SetPhi(Double_t phi) { fPhi = phi; }
72 void SetEta(Double_t eta) { fEta = eta; }
59a3310e 73 void SetM(Double_t m) { fM = m ; }
85c423bc 74
d11dc2a6 75 protected:
46dd554b 76 TLorentzVector &GetLorentzVector(const Double_t *vertex = 0) const;
77
78 static const UShort_t fSizeMatched = 99; //!size of matched clusters array
d11dc2a6 79
80 AliVTrack *fTrack; //!track
81 AliVCluster *fCluster; //!cluster
02357c1c 82 UShort_t fMatchedIds[fSizeMatched]; //!ids of matched tracks/clusters, ordered from the closest to the farthest
83 Double_t fMatchedDist[fSizeMatched]; //!distances of matched tracks/clusters
d11dc2a6 84 UShort_t fNMatched; //!number of matched objects
46dd554b 85 Int_t fId; //!id in original collection
86 Double_t fPhi; //!phi
87 Double_t fEta; //!eta
88 Double_t fPt; //!pt
59a3310e 89 Double_t fM; //!M
02357c1c 90 TObjArray *fMatchedPtr; //!pointer to array of matched tracks/clusters
d11dc2a6 91
59a3310e 92 ClassDef(AliEmcalParticle, 3) // Emcal particle class
d11dc2a6 93};
94#endif