]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/EMCAL/AliEmcalParticle.h
Merge remote-tracking branch 'origin/master' into flatdev
[u/mrichter/AliRoot.git] / PWG / EMCAL / AliEmcalParticle.h
CommitLineData
d11dc2a6 1#ifndef ALIEMCALPARTICLE_H
2#define ALIEMCALPARTICLE_H
3
4// $Id$
5
6#include <TLorentzVector.h>
5ded2286 7#include <TMath.h>
02357c1c 8#include <TObjArray.h>
46dd554b 9#include "AliVCluster.h"
4e04e015 10#include "AliVParticle.h"
d11dc2a6 11#include "AliVTrack.h"
12
4e04e015 13class AliEmcalParticle: public AliVParticle {
d11dc2a6 14 public:
15 AliEmcalParticle();
46dd554b 16 AliEmcalParticle(TObject *particle, Int_t id = -1, Double_t vx=0, Double_t vy=0, Double_t vz=0);
d11dc2a6 17 AliEmcalParticle(const AliEmcalParticle &p);
18 AliEmcalParticle &operator=(const AliEmcalParticle &p);
9af299a9 19 virtual ~AliEmcalParticle();
d11dc2a6 20
4e04e015 21 // AliVParticle interface
22 Double_t Px() const { return fPt*TMath::Cos(fPhi); }
23 Double_t Py() const { return fPt*TMath::Sin(fPhi); };
24 Double_t Pz() const { return fPt*TMath::SinH(fEta); }
25 Double_t Pt() const { return fPt ; }
26 Double_t P() const { return TMath::Sqrt(Px()*Px()+Py()*Py()+Pz()*Pz()); }
27 Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return 1; }
28 Double_t Xv() const { return 0; }
29 Double_t Yv() const { return 0; }
30 Double_t Zv() const { return 0; }
31 Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return 1; }
32 Double_t OneOverPt() const { return 1./fPt; }
33 Double_t Phi() const { return fPhi; }
34 Double_t Theta() const { return 0.; }
006fb267 35 Double_t E() const { if (fTrack) return fTrack->E(); return fCluster->E(); }
4e04e015 36 Double_t M() const { if (fTrack) return fTrack->M(); return 0; }
37 Double_t Eta() const { return fEta; }
38 Double_t Y() const { if (fTrack) return fTrack->Y(); return fEta; }
39 Short_t Charge() const { if (fTrack) return fTrack->Charge(); else return 0; }
99264a5c
CL
40 Int_t GetLabel() const { if (fTrack) return fTrack->GetLabel(); return fCluster->GetLabel(); }
41 Int_t PdgCode() const { return 0; }
42 const Double_t *PID() const { return 0; }
4e04e015 43
02357c1c 44 void AddMatchedObj(Int_t id, Double_t d);
45 AliVCluster *GetCluster() const { return fCluster ; }
4e04e015 46 Int_t GetMatchedObjId(UShort_t i = 0) const { return fNMatched > i ? fMatchedIds[i] : -1 ; }
47 Double_t GetMatchedObjDistance(UShort_t i = 0) const { return fNMatched > i ? fMatchedDist[i] : -1 ; }
48 UShort_t GetNumberOfMatchedObj() const { return fNMatched ; }
02357c1c 49 AliVCluster *GetMatchedCluster(UShort_t i = 0) const { if (fTrack && fMatchedPtr && (fNMatched > i))
50 return static_cast<AliVCluster*>(fMatchedPtr->At(fMatchedIds[i]));
51 return 0 ; }
52 AliVTrack *GetMatchedTrack(UShort_t i = 0) const { if (fCluster && fMatchedPtr && (fNMatched > i))
53 return static_cast<AliVTrack*>(fMatchedPtr->At(fMatchedIds[i]));
54 return 0 ; }
55 AliVTrack *GetTrack() const { return fTrack ; }
d11dc2a6 56 Double_t GetTrackPhiOnEMCal() const { if (fTrack) return fTrack->GetTrackPhiOnEMCal(); else return -999; }
57 Double_t GetTrackEtaOnEMCal() const { if (fTrack) return fTrack->GetTrackEtaOnEMCal(); else return -999; }
00630d07 58 Double_t GetTrackPtOnEMCal() const { if (fTrack) return fTrack->GetTrackPtOnEMCal(); else return -999; }
9af299a9 59 Int_t IdInCollection() const { return fId ; }
60 Bool_t IsCluster() const { return (Bool_t) fCluster != 0 ; }
99264a5c 61 Bool_t IsEMCAL() const { if (fCluster) return fCluster->IsEMCAL();
d11dc2a6 62 if (fTrack) return fTrack->IsEMCAL();
63 return kFALSE; }
d11dc2a6 64 Bool_t IsTrack() const { return (Bool_t) fTrack != 0 ; }
5ded2286 65 Bool_t IsMC(Int_t minLabel=0) const { if (fTrack) return (TMath::Abs(fTrack->GetLabel()) > minLabel);
66 return (fCluster->GetLabel() > minLabel); }
d11dc2a6 67 void ResetMatchedObjects();
68 void SetIdInCollection(Int_t id) { fId = id ; }
69 void SetMatchedObj(Int_t id, Double_t d) { ResetMatchedObjects(); fMatchedIds[0] = id; fMatchedDist[0] = d; fNMatched = 1; }
02357c1c 70 void SetMatchedPtr(TObjArray *arr) { fMatchedPtr = arr; }
d11dc2a6 71
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
02357c1c 86 TObjArray *fMatchedPtr; //!pointer to array of matched tracks/clusters
d11dc2a6 87
00630d07 88 ClassDef(AliEmcalParticle, 2) // Emcal particle class
d11dc2a6 89};
90#endif