]>
Commit | Line | Data |
---|---|---|
914d486c | 1 | #ifndef AliEmcalJet_H |
2 | #define AliEmcalJet_H | |
7df864a3 | 3 | |
d1f0108e | 4 | #include <vector> |
5 | #include <algorithm> | |
6 | #include <utility> | |
f8087a81 | 7 | #include <TArrayS.h> |
7efbea04 | 8 | #include <TLorentzVector.h> |
9 | #include <TMath.h> | |
a55e4f1d | 10 | #include <TClonesArray.h> |
d1f0108e | 11 | #include <TVector2.h> |
a55e4f1d | 12 | |
f8087a81 | 13 | #include "AliVParticle.h" |
a55e4f1d | 14 | #include "AliVCluster.h" |
85d48773 | 15 | #include "AliVEvent.h" |
7efbea04 | 16 | |
914d486c | 17 | class AliEmcalJet : public AliVParticle |
7efbea04 | 18 | { |
7df864a3 | 19 | public: |
3c9775d9 | 20 | enum EFlavourTag{ |
21 | kDStar = 1<<0, | |
22 | kD0 = 1<<1 | |
23 | //..... | |
24 | }; | |
25 | ||
96919f91 | 26 | AliEmcalJet(); |
914d486c | 27 | AliEmcalJet(Double_t px, Double_t py, Double_t pz); |
101cefde | 28 | AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m); |
914d486c | 29 | AliEmcalJet(const AliEmcalJet &jet); |
30 | AliEmcalJet& operator=(const AliEmcalJet &jet); | |
7efbea04 | 31 | |
a55e4f1d | 32 | Double_t Px() const { return fPt*TMath::Cos(fPhi); } |
da1bd0e7 | 33 | Double_t Py() const { return fPt*TMath::Sin(fPhi); } |
a55e4f1d | 34 | Double_t Pz() const { return fPt*TMath::SinH(fEta); } |
35 | Double_t Pt() const { return fPt; } | |
36 | Double_t P() const { return fPt*TMath::CosH(fEta); } | |
37 | Bool_t PxPyPz(Double_t p[3]) const { p[0]=Px();p[1]=Py();p[2]=Pz(); return 1; } | |
38 | Double_t Xv() const { return 0.; } | |
39 | Double_t Yv() const { return 0.; } | |
40 | Double_t Zv() const { return 0.; } | |
41 | Bool_t XvYvZv(Double_t x[3]) const { x[0]=0;x[1]=0;x[2]=0; return 1; } | |
42 | Double_t OneOverPt() const { return 1./fPt; } | |
43 | Double_t Phi() const { return fPhi; } | |
44 | Double_t Theta() const { return 2*TMath::ATan(TMath::Exp(-fEta)); } | |
45 | Double_t E() const { Double_t p=P(); return TMath::Sqrt(M()*M()+p*p); } | |
abfd90d8 | 46 | Double_t M() const { return fM; } |
a55e4f1d | 47 | Double_t Eta() const { return fEta; } |
48 | Double_t Y() const { return 0.5*TMath::Log((E()+Pz())/(E()-Pz())); } | |
49 | Short_t Charge() const { return 0; } | |
50 | Int_t GetLabel() const { return -1; } | |
51 | Int_t PdgCode() const { return 0; } | |
52 | const Double_t *PID() const { return 0; } | |
53 | void GetMom(TLorentzVector &vec) const; | |
54 | void Print(Option_t* option = "") const; | |
688670de | 55 | |
a55e4f1d | 56 | Double_t Area() const { return fArea; } |
db8a0184 | 57 | Double_t AreaPt() const { return fArea; } |
58 | Double_t AreaEta() const { return fAreaEta; } | |
59 | Double_t AreaPhi() const { return fAreaPhi; } | |
101cefde | 60 | Double_t AreaEmc() const { return fAreaEmc; } |
61 | Bool_t AxisInEmcal() const { return fAxisInEmcal; } | |
db8a0184 | 62 | Int_t Compare(const TObject* obj) const; |
a55e4f1d | 63 | Short_t ClusterAt(Int_t idx) const { return fClusterIDs.At(idx); } |
8895e61b | 64 | AliVCluster *ClusterAt(Int_t idx, TClonesArray *ca) const { if (!ca) return 0; return dynamic_cast<AliVCluster*>(ca->At(ClusterAt(idx))); } |
f660c2d6 | 65 | AliVCluster *GetLeadingCluster(TClonesArray *clusters) const; |
db8a0184 | 66 | UShort_t GetNumberOfClusters() const { return fClusterIDs.GetSize(); } |
96919f91 | 67 | UShort_t GetNumberOfTracks() const { return fTrackIDs.GetSize(); } |
624bef5b | 68 | UShort_t GetNumberOfConstituents() const { return GetNumberOfClusters()+GetNumberOfTracks(); } |
101cefde | 69 | Double_t FracEmcalArea() const { return fAreaEmc/fArea; } |
101cefde | 70 | Bool_t IsInsideEmcal() const { return (fAreaEmc/fArea>0.999); } |
71 | Bool_t IsInEmcal() const { return (fAreaEmc>0); } | |
db8a0184 | 72 | Bool_t IsMC() const { return (Bool_t)(MCPt() > 0); } |
73 | Bool_t IsSortable() const { return kTRUE; } | |
96919f91 | 74 | Double_t MaxNeutralPt() const { return fMaxNPt; } |
75 | Double_t MaxChargedPt() const { return fMaxCPt; } | |
a55e4f1d | 76 | Double_t NEF() const { return fNEF; } |
96919f91 | 77 | UShort_t Nn() const { return fNn; } |
78 | UShort_t Nch() const { return fNch; } | |
a55e4f1d | 79 | UShort_t N() const { return Nch()+Nn(); } |
8895e61b | 80 | Int_t NEmc() const { return fNEmc; } |
96919f91 | 81 | Double_t MCPt() const { return fMCPt; } |
96919f91 | 82 | Double_t MaxClusterPt() const { return MaxNeutralPt(); } |
83 | Double_t MaxTrackPt() const { return MaxChargedPt(); } | |
e44e8726 | 84 | Double_t MaxPartPt() const { return fMaxCPt < fMaxNPt ? fMaxNPt : fMaxCPt; } |
8895e61b | 85 | Double_t PtEmc() const { return fPtEmc; } |
86 | Double_t PtSub() const { return fPtSub; } | |
87 | Double_t PtSub(Double_t rho) const { return fPt - fArea*rho; } | |
db8a0184 | 88 | Double_t PtSubVect(Double_t rho) const; |
db8a0184 | 89 | Short_t TrackAt(Int_t idx) const { return fTrackIDs.At(idx); } |
6d12a4a0 | 90 | AliVParticle *TrackAt(Int_t idx, TClonesArray *ta) const { if (!ta) return 0; return dynamic_cast<AliVParticle*>(ta->At(TrackAt(idx))); } |
f660c2d6 | 91 | AliVParticle *GetLeadingTrack(TClonesArray *tracks) const; |
3c9775d9 | 92 | Int_t GetFlavour() const { return fFlavourTagging; } |
93 | ||
a55e4f1d | 94 | void AddClusterAt(Int_t clus, Int_t idx){ fClusterIDs.AddAt(clus, idx); } |
3c9775d9 | 95 | void AddFlavourTag(Int_t tag) { fFlavourTagging |= tag; } |
a55e4f1d | 96 | void AddTrackAt(Int_t track, Int_t idx) { fTrackIDs.AddAt(track, idx); } |
038f0049 | 97 | void Clear(Option_t */*option*/="") { fClusterIDs.Set(0); fTrackIDs.Set(0); fClosestJets[0] = 0; fClosestJets[1] = 0; |
98 | fClosestJetsDist[0] = 0; fClosestJetsDist[1] = 0; fMatched = 0; fPtSub = 0; } | |
d1f0108e | 99 | Double_t DeltaR(const AliVParticle* part) const; |
101cefde | 100 | void SetArea(Double_t a) { fArea = a; } |
db8a0184 | 101 | void SetAreaEta(Double_t a) { fAreaEta = a; } |
102 | void SetAreaPhi(Double_t a) { fAreaPhi = a; } | |
101cefde | 103 | void SetAreaEmc(Double_t a) { fAreaEmc = a; } |
104 | void SetAxisInEmcal(Bool_t b) { fAxisInEmcal = b; } | |
3c9775d9 | 105 | void SetFlavour(Int_t flavour) { fFlavourTagging = flavour; } |
96919f91 | 106 | void SetMaxNeutralPt(Double32_t t) { fMaxNPt = t; } |
107 | void SetMaxChargedPt(Double32_t t) { fMaxCPt = t; } | |
101cefde | 108 | void SetNEF(Double_t nef) { fNEF = nef; } |
a55e4f1d | 109 | void SetNumberOfClusters(Int_t n) { fClusterIDs.Set(n); } |
110 | void SetNumberOfTracks(Int_t n) { fTrackIDs.Set(n); } | |
96919f91 | 111 | void SetNumberOfCharged(Int_t n) { fNch = n; } |
112 | void SetNumberOfNeutrals(Int_t n) { fNn = n; } | |
113 | void SetMCPt(Double_t p) { fMCPt = p; } | |
a55e4f1d | 114 | void SortConstituents(); |
d1f0108e | 115 | std::vector<int> SortConstituentsPt(TClonesArray *tracks) const; |
3c9775d9 | 116 | void SetNEmc(Int_t n) { fNEmc = n; } |
117 | void SetPtEmc(Double_t pt) { fPtEmc = pt; } | |
118 | void SetPtSub(Double_t ps) { fPtSub = ps; } | |
119 | void SetPtSubVect(Double_t ps) { fPtVectSub = ps; } | |
120 | Bool_t TestFlavourTag(Int_t tag) { return (Bool_t)((tag & fFlavourTagging) !=0); } | |
85d48773 | 121 | |
122 | // Trigger | |
123 | Bool_t IsTriggerJet(UInt_t trigger=AliVEvent::kEMCEJE) const { return (Bool_t)((fTriggers & trigger) != 0); } | |
124 | void SetTrigger(UInt_t trigger) { fTriggers = trigger; } | |
125 | void AddTrigger(UInt_t trigger) { fTriggers |= trigger; } | |
cfc2ac24 | 126 | |
127 | // Matching | |
2103dc6a | 128 | void SetClosestJet(AliEmcalJet *j, Double_t d) { fClosestJets[0] = j; fClosestJetsDist[0] = d ; } |
cfc2ac24 | 129 | void SetSecondClosestJet(AliEmcalJet *j, Double_t d) { fClosestJets[1] = j; fClosestJetsDist[1] = d ; } |
130 | void SetMatchedToClosest(UShort_t m) { fMatched = 0; fMatchingType = m ; } | |
131 | void SetMatchedToSecondClosest(UShort_t m) { fMatched = 1; fMatchingType = m ; } | |
2103dc6a | 132 | void ResetMatching(); |
cfc2ac24 | 133 | AliEmcalJet* ClosestJet() const { return fClosestJets[0] ; } |
134 | Double_t ClosestJetDistance() const { return fClosestJetsDist[0] ; } | |
135 | AliEmcalJet* SecondClosestJet() const { return fClosestJets[1] ; } | |
136 | Double_t SecondClosestJetDistance() const { return fClosestJetsDist[1] ; } | |
137 | AliEmcalJet* MatchedJet() const { return fMatched < 2 ? fClosestJets[fMatched] : 0; } | |
138 | UShort_t GetMatchingType() const { return fMatchingType ; } | |
629e03fc | 139 | |
254370e1 | 140 | void SetTaggedJet(AliEmcalJet *j) { fTaggedJet = j ; } |
141 | void SetTagStatus(Int_t i) { fTagStatus = i ; } | |
142 | AliEmcalJet* GetTaggedJet() const { return fTaggedJet ; } | |
143 | Int_t GetTagStatus() const { return fTagStatus ; } | |
144 | ||
7df864a3 | 145 | protected: |
43a9dcd0 | 146 | Double32_t fPt; //[0,0,12] pt |
147 | Double32_t fEta; //[-1,1,12] eta | |
148 | Double32_t fPhi; //[0,6.3,12] phi | |
149 | Double32_t fM; //[0,0,8] mass | |
150 | Double32_t fNEF; //[0,1,8] neutral energy fraction | |
151 | Double32_t fArea; //[0,0,12] area | |
db8a0184 | 152 | Double32_t fAreaEta; //[0,0,12] area eta |
153 | Double32_t fAreaPhi; //[0,0,12] area phi | |
43a9dcd0 | 154 | Double32_t fAreaEmc; //[0,0,12] area on EMCAL surface (determined from ghosts) |
155 | Bool_t fAxisInEmcal; // =true if jet axis inside EMCAL acceptance | |
3c9775d9 | 156 | Int_t fFlavourTagging; // tag jet with a falvour, bit 0 = no tag; bit 1= Dstar; bit 2 = D0 |
43a9dcd0 | 157 | Double32_t fMaxCPt; //[0,0,12] pt of maximum charged constituent |
158 | Double32_t fMaxNPt; //[0,0,12] pt of maximum neutral constituent | |
159 | Double32_t fMCPt; // pt from MC particles contributing to the jet | |
160 | Int_t fNn; // number of neutral constituents | |
161 | Int_t fNch; // number of charged constituents | |
8895e61b | 162 | Double32_t fPtEmc; //[0,0,12] pt in EMCAL acceptance |
163 | Int_t fNEmc; // number of constituents in EMCAL acceptance | |
6d12a4a0 | 164 | TArrayI fClusterIDs; // array containing ids of cluster constituents |
165 | TArrayI fTrackIDs; // array containing ids of track constituents | |
43a9dcd0 | 166 | AliEmcalJet *fClosestJets[2]; //! if this is MC it contains the two closest detector level jets in order of distance and viceversa |
167 | Double32_t fClosestJetsDist[2]; //! distance to closest jets (see above) | |
168 | UShort_t fMatched; //! 0,1 if it is matched with one of the closest jets; 2 if it is not matched | |
cfc2ac24 | 169 | UShort_t fMatchingType; //! matching type |
254370e1 | 170 | AliEmcalJet *fTaggedJet; //! jet tagged to this jet |
171 | Int_t fTagStatus; //! status of tagging -1: NA 0: not tagged 1: tagged | |
8895e61b | 172 | Double_t fPtSub; //! background subtracted pt (not stored set from outside) |
db8a0184 | 173 | Double_t fPtVectSub; //! background vector subtracted pt (not stored set from outside) |
85d48773 | 174 | UInt_t fTriggers; //! triggers that the jet might have fired (AliVEvent::EOfflineTriggerTypes) |
7df864a3 | 175 | |
d1f0108e | 176 | private: |
177 | struct sort_descend | |
178 | { // sort in decreasing order | |
179 | // first value of the pair is Pt and the second is entry index | |
180 | bool operator () (const std::pair<Double_t, Int_t>& p1, const std::pair<Double_t, Int_t>& p2) { return p1.first > p2.first ; } | |
181 | }; | |
182 | ||
183 | ClassDef(AliEmcalJet,13) // Emcal jet class in cylindrical coordinates | |
7df864a3 | 184 | }; |
f472e642 | 185 | #endif |