]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/EMCAL/AliEmcalParticle.h
create general emcal task lib
[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>
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; }
32 Double_t Theta() const { return 0.; }
006fb267 33 Double_t E() const { if (fTrack) return fTrack->E(); return fCluster->E(); }
4e04e015 34 Double_t M() const { if (fTrack) return fTrack->M(); return 0; }
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; }
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; }
41
9af299a9 42 AliVCluster* GetCluster() const { return fCluster ; }
4e04e015 43 Int_t GetMatchedObjId(UShort_t i = 0) const { return fNMatched > i ? fMatchedIds[i] : -1 ; }
44 Double_t GetMatchedObjDistance(UShort_t i = 0) const { return fNMatched > i ? fMatchedDist[i] : -1 ; }
45 UShort_t GetNumberOfMatchedObj() const { return fNMatched ; }
9af299a9 46 AliVTrack* GetTrack() const { return fTrack ; }
d11dc2a6 47 Double_t GetTrackPhiOnEMCal() const { if (fTrack) return fTrack->GetTrackPhiOnEMCal(); else return -999; }
48 Double_t GetTrackEtaOnEMCal() const { if (fTrack) return fTrack->GetTrackEtaOnEMCal(); else return -999; }
9af299a9 49 Int_t IdInCollection() const { return fId ; }
50 Bool_t IsCluster() const { return (Bool_t) fCluster != 0 ; }
d11dc2a6 51 Bool_t IsEMCAL() const { if (fCluster) return kTRUE;
52 if (fTrack) return fTrack->IsEMCAL();
53 return kFALSE; }
d11dc2a6 54 Bool_t IsTrack() const { return (Bool_t) fTrack != 0 ; }
46dd554b 55 Bool_t IsMC() const { if (fTrack) return (fTrack->GetLabel() == 100);
56 return (fCluster->Chi2() == 100); }
d11dc2a6 57
d11dc2a6 58 void AddMatchedObj(Int_t id, Double_t d);
59 void ResetMatchedObjects();
60 void SetIdInCollection(Int_t id) { fId = id ; }
61 void SetMatchedObj(Int_t id, Double_t d) { ResetMatchedObjects(); fMatchedIds[0] = id; fMatchedDist[0] = d; fNMatched = 1; }
62
63 protected:
46dd554b 64 TLorentzVector &GetLorentzVector(const Double_t *vertex = 0) const;
65
66 static const UShort_t fSizeMatched = 99; //!size of matched clusters array
d11dc2a6 67
68 AliVTrack *fTrack; //!track
69 AliVCluster *fCluster; //!cluster
70 UShort_t fMatchedIds[fSizeMatched]; //!ids of matched clusters, ordered from the closest to the farthest
71 Double_t fMatchedDist[fSizeMatched]; //!distances of matched clusters
72 UShort_t fNMatched; //!number of matched objects
46dd554b 73 Int_t fId; //!id in original collection
74 Double_t fPhi; //!phi
75 Double_t fEta; //!eta
76 Double_t fPt; //!pt
d11dc2a6 77
4e04e015 78 ClassDef(AliEmcalParticle, 1) // Emcal particle class
d11dc2a6 79};
80#endif