]>
Commit | Line | Data |
---|---|---|
04f6e9de | 1 | // |
2 | // Emcal jet class. | |
3 | // | |
cd231d42 | 4 | // Author: C.Loizides |
7efbea04 | 5 | |
914d486c | 6 | #include "AliEmcalJet.h" |
7df864a3 | 7 | |
59ebe296 | 8 | #include "AliLog.h" |
9 | #include "Riostream.h" | |
10 | ||
914d486c | 11 | ClassImp(AliEmcalJet) |
7efbea04 | 12 | |
96919f91 | 13 | //__________________________________________________________________________________________________ |
14 | AliEmcalJet::AliEmcalJet() : | |
15 | AliVParticle(), | |
16 | fPt(0), | |
17 | fEta(0), | |
18 | fPhi(0), | |
19 | fM(0), | |
20 | fNEF(0), | |
21 | fArea(0), | |
db8a0184 | 22 | fAreaEta(0), |
23 | fAreaPhi(0), | |
96919f91 | 24 | fAreaEmc(-1), |
25 | fAxisInEmcal(0), | |
3c9775d9 | 26 | fFlavourTagging(0), |
96919f91 | 27 | fMaxCPt(0), |
28 | fMaxNPt(0), | |
29 | fMCPt(0), | |
30 | fNn(0), | |
31 | fNch(0), | |
8895e61b | 32 | fPtEmc(0), |
33 | fNEmc(0), | |
96919f91 | 34 | fClusterIDs(), |
35 | fTrackIDs(), | |
8895e61b | 36 | fMatched(2), |
cfc2ac24 | 37 | fMatchingType(0), |
254370e1 | 38 | fTaggedJet(0x0), |
39 | fTagStatus(-1), | |
db8a0184 | 40 | fPtSub(0), |
85d48773 | 41 | fPtVectSub(0), |
8082a80b | 42 | fTriggers(0), |
43 | fJetShapeMassFirstDer(0), | |
44 | fJetShapeMassSecondDer(0), | |
45 | fJetShapeMassFirstSub(0), | |
46 | fJetShapeMassSecondSub(0), | |
47 | fLabel(-1) | |
96919f91 | 48 | { |
49 | // Constructor. | |
50 | ||
51 | fClosestJets[0] = 0; | |
52 | fClosestJets[1] = 0; | |
53 | fClosestJetsDist[0] = 999; | |
54 | fClosestJetsDist[1] = 999; | |
96919f91 | 55 | } |
56 | ||
7efbea04 | 57 | //__________________________________________________________________________________________________ |
101cefde | 58 | AliEmcalJet::AliEmcalJet(Double_t px, Double_t py, Double_t pz) : |
59 | AliVParticle(), | |
60 | fPt(TMath::Sqrt(px*px+py*py)), | |
61 | fEta(TMath::ASinH(pz/fPt)), | |
62 | fPhi(0), | |
63 | fM(0), | |
64 | fNEF(0), | |
65 | fArea(0), | |
db8a0184 | 66 | fAreaEta(0), |
67 | fAreaPhi(0), | |
101cefde | 68 | fAreaEmc(-1), |
69 | fAxisInEmcal(0), | |
3c9775d9 | 70 | fFlavourTagging(0), |
101cefde | 71 | fMaxCPt(0), |
72 | fMaxNPt(0), | |
96919f91 | 73 | fMCPt(0), |
74 | fNn(0), | |
75 | fNch(0), | |
8895e61b | 76 | fPtEmc(0), |
77 | fNEmc(0), | |
101cefde | 78 | fClusterIDs(), |
96919f91 | 79 | fTrackIDs(), |
8895e61b | 80 | fMatched(2), |
cfc2ac24 | 81 | fMatchingType(0), |
254370e1 | 82 | fTaggedJet(0x0), |
83 | fTagStatus(-1), | |
db8a0184 | 84 | fPtSub(0), |
85d48773 | 85 | fPtVectSub(0), |
8082a80b | 86 | fTriggers(0), |
87 | fJetShapeMassFirstDer(0), | |
88 | fJetShapeMassSecondDer(0), | |
89 | fJetShapeMassFirstSub(0), | |
90 | fJetShapeMassSecondSub(0), | |
91 | fLabel(-1) | |
7efbea04 | 92 | { |
93 | // Constructor. | |
94 | ||
95 | if (fPt != 0) { | |
96 | fPhi = TMath::ATan2(py, px); | |
97 | if (fPhi<0.) | |
98 | fPhi += 2. * TMath::Pi(); | |
99 | } | |
96919f91 | 100 | |
101 | fClosestJets[0] = 0; | |
102 | fClosestJets[1] = 0; | |
103 | fClosestJetsDist[0] = 999; | |
104 | fClosestJetsDist[1] = 999; | |
7efbea04 | 105 | } |
106 | ||
9cffd2d0 | 107 | //_________________________________________________________________________________________________ |
914d486c | 108 | AliEmcalJet::AliEmcalJet(Double_t pt, Double_t eta, Double_t phi, Double_t m) : |
9cffd2d0 | 109 | AliVParticle(), |
f8087a81 | 110 | fPt(pt), |
111 | fEta(eta), | |
112 | fPhi(phi), | |
113 | fM(m), | |
114 | fNEF(0), | |
115 | fArea(0), | |
db8a0184 | 116 | fAreaEta(0), |
117 | fAreaPhi(0), | |
101cefde | 118 | fAreaEmc(-1), |
119 | fAxisInEmcal(0), | |
3c9775d9 | 120 | fFlavourTagging(0), |
f8087a81 | 121 | fMaxCPt(0), |
96919f91 | 122 | fMaxNPt(0), |
123 | fMCPt(0), | |
124 | fNn(0), | |
125 | fNch(0), | |
8895e61b | 126 | fPtEmc(0), |
127 | fNEmc(0), | |
f8087a81 | 128 | fClusterIDs(), |
96919f91 | 129 | fTrackIDs(), |
8895e61b | 130 | fMatched(2), |
cfc2ac24 | 131 | fMatchingType(0), |
254370e1 | 132 | fTaggedJet(0x0), |
133 | fTagStatus(-1), | |
db8a0184 | 134 | fPtSub(0), |
85d48773 | 135 | fPtVectSub(0), |
8082a80b | 136 | fTriggers(0), |
137 | fJetShapeMassFirstDer(0), | |
138 | fJetShapeMassSecondDer(0), | |
139 | fJetShapeMassFirstSub(0), | |
140 | fJetShapeMassSecondSub(0), | |
141 | fLabel(-1) | |
9cffd2d0 | 142 | { |
143 | // Constructor. | |
144 | ||
4f149872 | 145 | if (fPhi<0.) |
146 | fPhi += TMath::TwoPi(); | |
96919f91 | 147 | |
148 | fClosestJets[0] = 0; | |
149 | fClosestJets[1] = 0; | |
150 | fClosestJetsDist[0] = 999; | |
151 | fClosestJetsDist[1] = 999; | |
9cffd2d0 | 152 | } |
153 | ||
7efbea04 | 154 | //_________________________________________________________________________________________________ |
914d486c | 155 | AliEmcalJet::AliEmcalJet(const AliEmcalJet &jet) : |
7efbea04 | 156 | AliVParticle(jet), |
f8087a81 | 157 | fPt(jet.fPt), |
158 | fEta(jet.fEta), | |
159 | fPhi(jet.fPhi), | |
160 | fM(jet.fM), | |
161 | fNEF(jet.fNEF), | |
162 | fArea(jet.fArea), | |
db8a0184 | 163 | fAreaEta(jet.fAreaEta), |
164 | fAreaPhi(jet.fAreaPhi), | |
101cefde | 165 | fAreaEmc(jet.fAreaEmc), |
166 | fAxisInEmcal(jet.fAxisInEmcal), | |
3c9775d9 | 167 | fFlavourTagging(jet.fFlavourTagging), |
f8087a81 | 168 | fMaxCPt(jet.fMaxCPt), |
169 | fMaxNPt(jet.fMaxNPt), | |
96919f91 | 170 | fMCPt(jet.fMCPt), |
171 | fNn(jet.fNn), | |
172 | fNch(jet.fNch), | |
8895e61b | 173 | fPtEmc(jet.fPtEmc), |
174 | fNEmc(jet.fNEmc), | |
f8087a81 | 175 | fClusterIDs(jet.fClusterIDs), |
4f149872 | 176 | fTrackIDs(jet.fTrackIDs), |
8895e61b | 177 | fMatched(jet.fMatched), |
cfc2ac24 | 178 | fMatchingType(jet.fMatchingType), |
254370e1 | 179 | fTaggedJet(jet.fTaggedJet), |
180 | fTagStatus(jet.fTagStatus), | |
db8a0184 | 181 | fPtSub(jet.fPtSub), |
85d48773 | 182 | fPtVectSub(jet.fPtVectSub), |
8082a80b | 183 | fTriggers(jet.fTriggers), |
184 | fJetShapeMassFirstDer(jet.fJetShapeMassFirstDer), | |
185 | fJetShapeMassSecondDer(jet.fJetShapeMassSecondDer), | |
186 | fJetShapeMassFirstSub(jet.fJetShapeMassFirstSub), | |
187 | fJetShapeMassSecondSub(jet.fJetShapeMassSecondSub), | |
188 | fLabel(jet.fLabel) | |
7df864a3 | 189 | { |
101cefde | 190 | // Copy constructor. |
4f149872 | 191 | |
192 | fClosestJets[0] = jet.fClosestJets[0]; | |
193 | fClosestJets[1] = jet.fClosestJets[1]; | |
194 | fClosestJetsDist[0] = jet.fClosestJetsDist[0]; | |
195 | fClosestJetsDist[1] = jet.fClosestJetsDist[1]; | |
7efbea04 | 196 | } |
197 | ||
198 | //_________________________________________________________________________________________________ | |
914d486c | 199 | AliEmcalJet &AliEmcalJet::operator=(const AliEmcalJet &jet) |
7efbea04 | 200 | { |
201 | // Assignment operator. | |
202 | ||
203 | if (this!=&jet) { | |
204 | AliVParticle::operator=(jet); | |
4f149872 | 205 | fPt = jet.fPt; |
206 | fEta = jet.fEta; | |
207 | fPhi = jet.fPhi; | |
208 | fM = jet.fM; | |
209 | fNEF = jet.fNEF; | |
210 | fArea = jet.fArea; | |
db8a0184 | 211 | fAreaEta = jet.fAreaEta; |
212 | fAreaPhi = jet.fAreaPhi; | |
4f149872 | 213 | fAreaEmc = jet.fAreaEmc; |
214 | fAxisInEmcal = jet.fAxisInEmcal; | |
3c9775d9 | 215 | fFlavourTagging = jet.fFlavourTagging; |
4f149872 | 216 | fMaxCPt = jet.fMaxCPt; |
217 | fMaxNPt = jet.fMaxNPt; | |
218 | fMCPt = jet.fMCPt; | |
219 | fNn = jet.fNn; | |
220 | fNch = jet.fNch; | |
8895e61b | 221 | fPtEmc = jet.fPtEmc; |
222 | fNEmc = jet.fNEmc; | |
4f149872 | 223 | fClusterIDs = jet.fClusterIDs; |
224 | fTrackIDs = jet.fTrackIDs; | |
225 | fClosestJets[0] = jet.fClosestJets[0]; | |
226 | fClosestJets[1] = jet.fClosestJets[1]; | |
227 | fClosestJetsDist[0] = jet.fClosestJetsDist[0]; | |
228 | fClosestJetsDist[1] = jet.fClosestJetsDist[1]; | |
229 | fMatched = jet.fMatched; | |
254370e1 | 230 | fTaggedJet = jet.fTaggedJet; |
231 | fTagStatus = jet.fTagStatus; | |
8895e61b | 232 | fPtSub = jet.fPtSub; |
f660c2d6 | 233 | fPtVectSub = jet.fPtVectSub; |
85d48773 | 234 | fTriggers = jet.fTriggers; |
8082a80b | 235 | fJetShapeMassFirstDer = jet.fJetShapeMassFirstDer; |
236 | fJetShapeMassSecondDer = jet.fJetShapeMassSecondDer; | |
237 | fJetShapeMassFirstSub = jet.fJetShapeMassFirstSub; | |
238 | fJetShapeMassSecondSub = jet.fJetShapeMassSecondSub; | |
239 | fLabel = jet.fLabel; | |
7efbea04 | 240 | } |
241 | ||
242 | return *this; | |
7df864a3 | 243 | } |
7efbea04 | 244 | |
2103dc6a | 245 | //_________________________________________________________________________________________________ |
db8a0184 | 246 | Int_t AliEmcalJet::Compare(const TObject* obj) const |
247 | { | |
248 | //Return -1 if this is smaller than obj, 0 if objects are equal and 1 if this is larger than obj. | |
249 | ||
250 | const AliEmcalJet *jet = static_cast<const AliEmcalJet *>(obj); | |
251 | if (!obj) | |
252 | return 0; | |
253 | if (Pt()>jet->Pt()) | |
254 | return -1; | |
255 | return 1; | |
256 | } | |
257 | ||
7efbea04 | 258 | //__________________________________________________________________________________________________ |
914d486c | 259 | void AliEmcalJet::GetMom(TLorentzVector &vec) const |
7efbea04 | 260 | { |
261 | // Return momentum as four vector. | |
262 | ||
263 | Double_t p = fPt *TMath::CosH(fEta); | |
264 | vec.SetPtEtaPhiE(fPt,fEta,fPhi,TMath::Sqrt(p*p+fM*fM)); | |
265 | } | |
266 | ||
267 | //__________________________________________________________________________________________________ | |
914d486c | 268 | void AliEmcalJet::Print(Option_t* /*option*/) const |
7efbea04 | 269 | { |
270 | // Print jet information. | |
271 | ||
59ebe296 | 272 | Printf("Jet pt=%.2f, eta=%.2f, phi=%.2f, area=%.2f, NEF=%.2f", fPt, fEta, fPhi, fArea, fNEF); |
7efbea04 | 273 | } |
629e03fc | 274 | |
db8a0184 | 275 | //__________________________________________________________________________________________________ |
276 | Double_t AliEmcalJet::PtSubVect(Double_t rho) const | |
277 | { | |
278 | // Return vectorial subtracted transverse momentum. | |
279 | ||
280 | Double_t dx = Px() - rho * fArea * TMath::Cos(fAreaPhi); | |
281 | Double_t dy = Py() - rho * fArea * TMath::Sin(fAreaPhi); | |
282 | //Double_t dz = Pz() - rho * fArea * TMath::SinH(fAreaEta); | |
283 | return TMath::Sqrt(dx*dx+dy*dy); | |
284 | } | |
285 | ||
629e03fc | 286 | //__________________________________________________________________________________________________ |
287 | void AliEmcalJet::SortConstituents() | |
288 | { | |
f8087a81 | 289 | // Sort constituent by index (increasing). |
290 | ||
291 | std::sort(fClusterIDs.GetArray(), fClusterIDs.GetArray() + fClusterIDs.GetSize()); | |
292 | std::sort(fTrackIDs.GetArray(), fTrackIDs.GetArray() + fTrackIDs.GetSize()); | |
629e03fc | 293 | } |
f660c2d6 | 294 | |
d1f0108e | 295 | //__________________________________________________________________________________________________ |
296 | Double_t AliEmcalJet::DeltaR (const AliVParticle* part) const | |
297 | { // Helper function to calculate the distance between two jets or a jet and a particle | |
298 | Double_t dPhi = this->Phi() - part->Phi(); | |
299 | Double_t dEta = this->Eta() - part->Eta(); | |
300 | dPhi = TVector2::Phi_mpi_pi ( dPhi ); | |
301 | ||
302 | return TMath::Sqrt ( dPhi * dPhi + dEta * dEta ); | |
303 | } | |
304 | ||
305 | ||
306 | //__________________________________________________________________________________________________ | |
307 | std::vector<int> AliEmcalJet::SortConstituentsPt( TClonesArray *tracks ) const | |
308 | { //___________________________________________ | |
309 | // Sorting by p_T (decreasing) jet constituents | |
310 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
311 | typedef std::pair<Double_t, Int_t> ptidx_pair; | |
312 | ||
313 | // Create vector for Pt sorting | |
314 | std::vector<ptidx_pair> pair_list ; | |
315 | ||
316 | for ( Int_t i_entry = 0; i_entry < GetNumberOfTracks(); i_entry++ ) | |
317 | { | |
318 | AliVParticle *track = TrackAt(i_entry, tracks); | |
319 | if (!track) | |
320 | { | |
321 | AliError(Form("Unable to find jet track %d in collection %s (pos in collection %d, max %d)", i_entry, tracks->GetName(), TrackAt(i_entry), tracks->GetEntriesFast())); | |
322 | continue; | |
323 | } | |
324 | ||
325 | pair_list.push_back( std::make_pair ( track->Pt(), i_entry ) ); | |
326 | } | |
327 | ||
328 | std::stable_sort( pair_list.begin() , pair_list.end() , sort_descend() ); | |
329 | ||
330 | // return an vector of indexes of constituents (sorted descending by pt) | |
331 | std::vector <int> index_sorted_list; | |
332 | ||
333 | for ( std::vector< std::pair<Double_t,Int_t> >::iterator it = pair_list.begin(); it != pair_list.end(); ++it) | |
334 | { index_sorted_list.push_back( (*it).second ); } // populating the return object with indexes of sorted tracks | |
335 | ||
336 | return index_sorted_list; | |
337 | } | |
338 | ||
f660c2d6 | 339 | //__________________________________________________________________________________________________ |
340 | AliVParticle* AliEmcalJet::GetLeadingTrack(TClonesArray *tracks) const | |
341 | { | |
342 | AliVParticle* maxTrack = 0; | |
343 | for (Int_t i = 0; i < GetNumberOfTracks(); i++) { | |
344 | AliVParticle *track = TrackAt(i, tracks); | |
59ebe296 | 345 | if (!track) { |
3c9775d9 | 346 | AliError(Form("Unable to find jet track %d in collection %s (pos in collection %d, max %d)", |
347 | i,tracks->GetName(),TrackAt(i),tracks->GetEntriesFast())); | |
59ebe296 | 348 | continue; |
349 | } | |
f660c2d6 | 350 | if (!maxTrack || track->Pt() > maxTrack->Pt()) |
351 | maxTrack = track; | |
352 | } | |
353 | ||
354 | return maxTrack; | |
355 | } | |
356 | ||
357 | //__________________________________________________________________________________________________ | |
358 | AliVCluster* AliEmcalJet::GetLeadingCluster(TClonesArray *clusters) const | |
359 | { | |
360 | AliVCluster* maxCluster = 0; | |
361 | for (Int_t i = 0; i < GetNumberOfClusters(); i++) { | |
362 | AliVCluster *cluster = ClusterAt(i, clusters); | |
59ebe296 | 363 | if (!cluster) { |
3c9775d9 | 364 | AliError(Form("Unable to find jet cluster %d in collection %s (pos in collection %d, max %d)", |
365 | i,clusters->GetName(),ClusterAt(i),clusters->GetEntriesFast())); | |
59ebe296 | 366 | continue; |
367 | } | |
f660c2d6 | 368 | if (!maxCluster || cluster->E() > maxCluster->E()) |
369 | maxCluster = cluster; | |
370 | } | |
371 | ||
372 | return maxCluster; | |
373 | } | |
2103dc6a | 374 | |
375 | //__________________________________________________________________________________________________ | |
376 | void AliEmcalJet::ResetMatching() | |
377 | { | |
378 | fClosestJets[0] = 0; | |
379 | fClosestJets[1] = 0; | |
380 | fClosestJetsDist[0] = 999; | |
381 | fClosestJetsDist[1] = 999; | |
382 | fMatched = 2; | |
383 | } |