]>
Commit | Line | Data |
---|---|---|
45a58699 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //_________________________________________________________________________ | |
19 | // A Particle modified by EMCAL response and produced by AliEMCALvFast | |
20 | //*-- | |
21 | // To become a general class of AliRoot ? | |
22 | //*-- | |
23 | //*-- Author: Yves Schutz (SUBATECH) | |
24 | //*-- | |
25 | ///////////////////////////////////////////////////////////////////////////// | |
26 | ||
27 | // --- ROOT system --- | |
28 | ||
29 | // --- Standard library --- | |
30 | ||
31 | // --- AliRoot header files --- | |
32 | ||
33 | #include "AliEMCALFastRecParticle.h" | |
34 | #include "TPad.h" | |
35 | #include "TPaveText.h" | |
36 | ||
37 | ClassImp(AliEMCALFastRecParticle) | |
38 | ||
39 | //____________________________________________________________________________ | |
40 | AliEMCALFastRecParticle::AliEMCALFastRecParticle() : TParticle() | |
41 | { | |
42 | // ctor | |
43 | fType = 0 ; | |
44 | } | |
45 | ||
46 | //____________________________________________________________________________ | |
47 | AliEMCALFastRecParticle::AliEMCALFastRecParticle(const AliEMCALFastRecParticle & rp) | |
48 | : TParticle(rp) | |
49 | { | |
50 | // copy ctor | |
51 | ||
52 | fType = rp.fType ; | |
53 | fPdgCode = rp.fPdgCode; | |
54 | fStatusCode = rp.fStatusCode; | |
55 | fMother[0] = rp.fMother[0]; | |
56 | fMother[1] = rp.fMother[1]; | |
57 | fDaughter[0] = rp.fDaughter[0]; | |
58 | fDaughter[1] = rp.fDaughter[1]; | |
59 | fWeight = rp.fWeight; | |
60 | fCalcMass = rp.fCalcMass; | |
61 | fPx = rp.fPx; | |
62 | fPy = rp.fPy; | |
63 | fPz = rp.fPz; | |
64 | fE = rp.fE; | |
65 | fVx = rp.fVx; | |
66 | fVy = rp.fVy; | |
67 | fVz = rp.fVz; | |
68 | fVt = rp.fVt; | |
69 | fPolarTheta = rp.fPolarTheta; | |
70 | fPolarPhi = rp.fPolarPhi; | |
71 | fParticlePDG = rp.fParticlePDG; | |
72 | } | |
73 | ||
74 | //____________________________________________________________________________ | |
75 | AliEMCALFastRecParticle::AliEMCALFastRecParticle(const TParticle & pp) | |
76 | { | |
77 | // ctor from a TParticle (crummy?!) | |
78 | ||
79 | TParticle & pnoconst = (TParticle &)(pp) ; | |
80 | AliEMCALFastRecParticle & p = (AliEMCALFastRecParticle &)(pnoconst) ; | |
81 | fType = 0 ; | |
82 | fPdgCode = p.fPdgCode; | |
83 | fStatusCode = p.fStatusCode; | |
84 | fMother[0] = p.fMother[0]; | |
85 | fMother[1] = p.fMother[1]; | |
86 | fDaughter[0] = p.fDaughter[0]; | |
87 | fDaughter[1] = p.fDaughter[1]; | |
88 | fWeight = p.fWeight; | |
89 | fCalcMass = p.fCalcMass; | |
90 | fPx = p.fPx; | |
91 | fPy = p.fPy; | |
92 | fPz = p.fPz; | |
93 | fE = p.fE; | |
94 | fVx = p.fVx; | |
95 | fVy = p.fVy; | |
96 | fVz = p.fVz; | |
97 | fVt = p.fVt; | |
98 | fPolarTheta = p.fPolarTheta; | |
99 | fPolarPhi = p.fPolarPhi; | |
100 | fParticlePDG = p.fParticlePDG; | |
101 | ||
102 | } | |
103 | ||
104 | //____________________________________________________________________________ | |
105 | Int_t AliEMCALFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py) | |
106 | { | |
107 | // Compute distance from point px,py to a AliEMCALFastRecParticle considered as a Tmarker | |
108 | // Compute the closest distance of approach from point px,py to this marker. | |
109 | // The distance is computed in pixels units. | |
110 | ||
111 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
112 | Coord_t x = Phi() * kRADDEG ; | |
113 | Coord_t y = Theta() * kRADDEG ; | |
114 | const Int_t kMaxDiff = 10; | |
115 | Int_t pxm = gPad->XtoAbsPixel(x); | |
116 | Int_t pym = gPad->YtoAbsPixel(y); | |
117 | Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym); | |
118 | ||
119 | if (dist > kMaxDiff) return 9999; | |
120 | return dist; | |
121 | } | |
122 | ||
123 | //___________________________________________________________________________ | |
124 | void AliEMCALFastRecParticle::Draw(Option_t *option) | |
125 | { | |
126 | // Draw this AliEMCALFastRecParticle with its current attributes | |
127 | ||
128 | AppendPad(option); | |
129 | } | |
130 | ||
131 | //______________________________________________________________________________ | |
132 | void AliEMCALFastRecParticle::ExecuteEvent(Int_t event, Int_t /*px*/, Int_t /*py*/) | |
133 | { | |
134 | // Execute action corresponding to one event | |
135 | // This member function is called when a AliEMCALFastRecParticle is clicked with the locator | |
136 | ||
137 | if (!gPad->IsEditable()) | |
138 | return ; | |
139 | ||
140 | static TPaveText * clustertext = 0 ; | |
141 | ||
142 | switch (event) { | |
143 | ||
144 | case kButton1Down: { | |
145 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
146 | Coord_t x = Phi() * kRADDEG ; | |
147 | Coord_t y = Theta() * kRADDEG ; | |
148 | clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ; | |
149 | Text_t line1[40] ; | |
150 | Text_t line2[40] ; | |
151 | sprintf( line1, "PID: %s ", (const char*)Name() ) ; | |
152 | sprintf( line2, "ENERGY: %f ", Energy() ) ; | |
153 | clustertext ->AddText(line1) ; | |
154 | clustertext ->AddText(line2) ; | |
155 | clustertext ->Draw(""); | |
156 | gPad->Update() ; | |
157 | break ; | |
158 | } | |
159 | ||
160 | case kButton1Up: { | |
161 | delete clustertext ; | |
162 | clustertext = 0 ; | |
163 | gPad->Update() ; | |
164 | break ; | |
165 | } | |
166 | } | |
167 | ||
168 | } | |
169 | ||
170 | //____________________________________________________________________________ | |
171 | Bool_t AliEMCALFastRecParticle::IsPhoton(TString purity) const | |
172 | { | |
173 | //FIXME : just a blind copy from PHOS | |
174 | // Rec.Particle is a photon if it has a photon-like shape, fast and neutral | |
175 | // photon-like shape is defined with a purity "low", "medium" or "high" | |
176 | ||
177 | purity.ToLower(); | |
178 | Bool_t photonLike = kFALSE; | |
179 | if (purity == "low" ) photonLike = TestPIDBit(6); | |
180 | else if (purity == "medium") photonLike = TestPIDBit(7); | |
181 | else if (purity == "high" ) photonLike = TestPIDBit(8); | |
182 | if (photonLike && // photon by PCA | |
183 | (TestPIDBit(5)||TestPIDBit(4)||TestPIDBit(3))&& // fast by TOF | |
184 | (TestPIDBit(2)||TestPIDBit(1)||TestPIDBit(0))&& // neutral by CPV | |
185 | !TestPIDBit(14)) // no charged track | |
186 | return kTRUE ; | |
187 | else | |
188 | return kFALSE; | |
189 | } | |
190 | ||
191 | //____________________________________________________________________________ | |
192 | Bool_t AliEMCALFastRecParticle::IsPi0(TString purity) const | |
193 | { | |
194 | //FIXME : just a blind copy from PHOS | |
195 | // Rec.Particle is a pi0 if it has a pi0-like shape, fast and neutral | |
196 | // pi0-like shape is defined with a purity "low", "medium" or "high" | |
197 | ||
198 | purity.ToLower(); | |
199 | Bool_t pi0Like = kFALSE; | |
200 | if (purity == "low" ) pi0Like = TestPIDBit(9); | |
201 | else if (purity == "medium") pi0Like = TestPIDBit(10); | |
202 | else if (purity == "high" ) pi0Like = TestPIDBit(11); | |
203 | else Error("IsPi0","Wrong purity type: %s",purity.Data()); | |
204 | if (pi0Like && // pi0 by PCA | |
205 | (TestPIDBit(5)||TestPIDBit(4)||TestPIDBit(3))&& // fast by TOF | |
206 | (TestPIDBit(2)||TestPIDBit(1)||TestPIDBit(0))&& // neutral by CPV | |
207 | !TestPIDBit(14)) // no charged track | |
208 | return kTRUE ; | |
209 | else | |
210 | return kFALSE; | |
211 | } | |
212 | ||
213 | //____________________________________________________________________________ | |
214 | Bool_t AliEMCALFastRecParticle::IsElectron(TString purity) const | |
215 | { | |
216 | //FIXME : just a blind copy from PHOS | |
217 | // Rec.Particle is an electron if it has a photon-like shape, fast and charged | |
218 | // photon-like shape is defined with a purity "low", "medium" or "high" | |
219 | ||
220 | purity.ToLower(); | |
221 | Bool_t photonLike = kFALSE; | |
222 | if (purity == "low" ) photonLike = TestPIDBit(6); | |
223 | else if (purity == "medium") photonLike = TestPIDBit(7); | |
224 | else if (purity == "high" ) photonLike = TestPIDBit(8); | |
225 | else Error("IsElectron","Wrong purity type: %s",purity.Data()); | |
226 | ||
227 | if (photonLike && // photon by PCA | |
228 | (TestPIDBit(5)|| TestPIDBit(4)|| TestPIDBit(3))&& // fast by TOF | |
229 | (!TestPIDBit(2)||!TestPIDBit(1)||!TestPIDBit(0))&& // charged by CPV | |
230 | TestPIDBit(14)) // no charged track | |
231 | return kTRUE ; | |
232 | else | |
233 | return kFALSE; | |
234 | } | |
235 | ||
236 | //____________________________________________________________________________ | |
237 | Bool_t AliEMCALFastRecParticle::IsEleCon(TString purity) const | |
238 | { | |
239 | //FIXME : just a blind copy from PHOS | |
240 | // Rec.Particle is an electron if it has a photon-like shape, fast and charged | |
241 | // photon-like shape is defined with a purity "low", "medium" or "high" | |
242 | ||
243 | purity.ToLower(); | |
244 | Bool_t photonLike = kFALSE; | |
245 | if (purity == "low" ) photonLike = TestPIDBit(6); | |
246 | else if (purity == "medium") photonLike = TestPIDBit(7); | |
247 | else if (purity == "high" ) photonLike = TestPIDBit(8); | |
248 | else Error("IsElectron","Wrong purity type: %s",purity.Data()); | |
249 | ||
250 | if (photonLike && // photon by PCA | |
251 | (TestPIDBit(5)|| TestPIDBit(4)|| TestPIDBit(3))&& // fast by TOF | |
252 | (!TestPIDBit(2)||!TestPIDBit(1)||!TestPIDBit(0))&& // charged by CPV | |
253 | !TestPIDBit(14)) // no charged track | |
254 | return kTRUE ; | |
255 | else | |
256 | return kFALSE; | |
257 | } | |
258 | ||
259 | //____________________________________________________________________________ | |
260 | Bool_t AliEMCALFastRecParticle::IsHardPhoton() const | |
261 | { | |
262 | //FIXME : just a blind copy from PHOS | |
263 | // Rec.Particle is a hard photon (E > 30 GeV) if its second moment M2x | |
264 | // corresponds to photons | |
265 | if (TestPIDBit(12) && !TestPIDBit(14)) | |
266 | return kTRUE; | |
267 | else | |
268 | return kFALSE; | |
269 | } | |
270 | ||
271 | //____________________________________________________________________________ | |
272 | Bool_t AliEMCALFastRecParticle::IsHardPi0() const | |
273 | { | |
274 | //FIXME : just a blind copy from EMCAL | |
275 | // Rec.Particle is a hard pi0 (E > 30 GeV) if its second moment M2x | |
276 | // corresponds to pi0 | |
277 | if (TestPIDBit(13)&& !TestPIDBit(14)) | |
278 | return kTRUE; | |
279 | else | |
280 | return kFALSE; | |
281 | } | |
282 | ||
283 | //____________________________________________________________________________ | |
284 | Bool_t AliEMCALFastRecParticle::IsHadron() const | |
285 | { | |
286 | //FIXME : just a blind copy from EMCAL | |
287 | // Rec.Particle is an hadron if it does not look like | |
288 | // a low-purity photon nor low-purity pi0 | |
289 | ||
290 | if ( !TestPIDBit(6) && !TestPIDBit(9) ) // not photon nor pi0 | |
291 | return kTRUE ; | |
292 | else | |
293 | return kFALSE; | |
294 | } | |
295 | ||
296 | //____________________________________________________________________________ | |
297 | Bool_t AliEMCALFastRecParticle::IsChargedHadron() const | |
298 | { | |
299 | //FIXME : just a blind copy from EMCAL | |
300 | // Rec.Particle is a charged hadron if it does not look like | |
301 | // a low-purity photon nor low-purity pi0 and is low-purity charged | |
302 | ||
303 | if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 | |
304 | !TestPIDBit(2)) // charged by CPV | |
305 | return kTRUE ; | |
306 | else | |
307 | return kFALSE; | |
308 | } | |
309 | ||
310 | //____________________________________________________________________________ | |
311 | Bool_t AliEMCALFastRecParticle::IsNeutralHadron() const | |
312 | { | |
313 | //FIXME : just a blind copy from EMCAL | |
314 | // Rec.Particle is a neutral hadron if it does not look like | |
315 | // a low-purity photon nor low-purity pi0 and is high-purity neutral | |
316 | ||
317 | if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 | |
318 | TestPIDBit(2)) // neutral by CPV | |
319 | return kTRUE ; | |
320 | else | |
321 | return kFALSE; | |
322 | } | |
323 | ||
324 | //____________________________________________________________________________ | |
325 | Bool_t AliEMCALFastRecParticle::IsFastChargedHadron() const | |
326 | { | |
327 | //FIXME : just a blind copy from EMCAL | |
328 | // Rec.Particle is a fast charged hadron if it does not look like | |
329 | // a low-purity photon nor low-purity pi0, is low-purity charged | |
330 | // and is high-purity fast | |
331 | ||
332 | if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 | |
333 | !TestPIDBit(2) && // charged by CPV | |
334 | TestPIDBit(5)) // fast by TOF | |
335 | return kTRUE ; | |
336 | else | |
337 | return kFALSE; | |
338 | } | |
339 | ||
340 | //____________________________________________________________________________ | |
341 | Bool_t AliEMCALFastRecParticle::IsSlowChargedHadron() const | |
342 | { | |
343 | //FIXME : just a blind copy from EMCAL | |
344 | // Rec.Particle is a slow neutral hadron if it does not look like | |
345 | // a low-purity photon nor low-purity pi0, is high-purity neutral | |
346 | // and is not high-purity fast | |
347 | ||
348 | if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 | |
349 | !TestPIDBit(2) && // charged by CPV | |
350 | !TestPIDBit(5)) // slow by TOF | |
351 | return kTRUE ; | |
352 | else | |
353 | return kFALSE; | |
354 | ||
355 | } | |
356 | ||
357 | //____________________________________________________________________________ | |
358 | Bool_t AliEMCALFastRecParticle::IsFastNeutralHadron() const | |
359 | { | |
360 | //FIXME : just a blind copy from EMCAL | |
361 | // Rec.Particle is a fast neutral hadron if it does not look like | |
362 | // a low-purity photon nor low-purity pi0, is high-purity neutral | |
363 | // and is high-purity fast | |
364 | ||
365 | if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 | |
366 | TestPIDBit(2) && // neutral by CPV | |
367 | TestPIDBit(5)) // fast by TOF | |
368 | return kTRUE ; | |
369 | else | |
370 | return kFALSE; | |
371 | } | |
372 | ||
373 | //____________________________________________________________________________ | |
374 | Bool_t AliEMCALFastRecParticle::IsSlowNeutralHadron() const | |
375 | { | |
376 | //FIXME : just a blind copy from EMCAL | |
377 | // Rec.Particle is a slow neutral hadron if it does not look like | |
378 | // a low-purity photon nor low-purity pi0, is high-purity neutral | |
379 | // and is not high-purity fast | |
380 | ||
381 | if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 | |
382 | TestPIDBit(2) && // neutral by CPV | |
383 | !TestPIDBit(5)) // slow by TOF | |
384 | return kTRUE ; | |
385 | else | |
386 | return kFALSE; | |
387 | } | |
388 | ||
389 | ||
390 | //____________________________________________________________________________ | |
391 | TString AliEMCALFastRecParticle::Name()const | |
392 | { | |
393 | // Returns the name of the particle type (only valid if PIDv1 is employed) | |
394 | ||
395 | TString name ; | |
396 | ||
397 | name = "Undefined particle" ; | |
398 | ||
399 | if (IsPhoton("low")) | |
400 | name = "Photon low purity, "; | |
401 | else if (IsPhoton("medium")) | |
402 | name = "Photon medium purity, "; | |
403 | else if (IsPhoton("high")) | |
404 | name = "Photon high purity, "; | |
405 | ||
406 | if (IsPi0("low")) | |
407 | name += "Pi0 low purity, "; | |
408 | else if (IsPi0("medium")) | |
409 | name += "Pi0 medium purity, "; | |
410 | else if (IsPi0("high")) | |
411 | name += "Pi0 high purity, "; | |
412 | ||
413 | if (IsElectron("low")) | |
414 | name += "Electron low purity, "; | |
415 | else if (IsElectron("medium")) | |
416 | name += "Electron medium purity, "; | |
417 | else if (IsElectron("high")) | |
418 | name += "Electron high purity, "; | |
419 | ||
420 | if (IsHadron()) { | |
421 | name = "hadron"; | |
422 | if (IsChargedHadron()) { | |
423 | name.Prepend("charged, "); | |
424 | if (IsFastChargedHadron()) | |
425 | name.Prepend("fast, "); | |
426 | else if (IsSlowChargedHadron()) | |
427 | name.Prepend("slow, "); | |
428 | } | |
429 | else if (IsNeutralHadron()) { | |
430 | name.Prepend("neutral, "); | |
431 | if (IsFastNeutralHadron()) | |
432 | name.Prepend("fast, "); | |
433 | else if (IsSlowNeutralHadron()) | |
434 | name.Prepend("slow, "); | |
435 | } | |
436 | } | |
437 | ||
438 | return name ; | |
439 | } | |
440 | ||
441 | //______________________________________________________________________________ | |
442 | void AliEMCALFastRecParticle::SetType(Int_t type) { | |
443 | // sets the particle type | |
444 | // bit-mask of the particle type means the following: | |
445 | // bits 0,1,2 - neutral particle with low, medium and high purity | |
446 | // bits 3.4,5 - fast particle with low, medium and high purity | |
447 | // bits 6.7,8 - photon shower with low, medium and high purity | |
448 | // bits 9,10,11 - hard-pi0 shower with low, medium and high purity | |
449 | ||
450 | fType = type ; | |
451 | ||
452 | if((type == 127) || (fType == 511) || (fType == 255) ||(fType == 383)||(fType == 447)){ | |
453 | fPdgCode = 22 ; | |
454 | return ; | |
455 | } | |
456 | ||
457 | if ((fType == 63)|| ((fType < 8)&&(fType > 0)) ){ | |
458 | fPdgCode = 2112 ; | |
459 | return ; | |
460 | } | |
461 | if ( ((fType == 504) || (fType == 505) ||(fType == 248)||(fType == 249)||(fType == 120)||(fType == 121)) ){ | |
462 | fPdgCode = 11 ; | |
463 | return ; | |
464 | } | |
465 | if ((fType == 448) || (fType == 449) ||(fType == 192)||(fType == 193)||(fType == 64)||(fType == 64)){ | |
466 | fPdgCode = 13 ; | |
467 | return ; | |
468 | } | |
469 | if((fType == 56)||(fType == 57)){ | |
470 | fPdgCode = 211 ; | |
471 | return ; | |
472 | } | |
473 | if (fType == 0){ | |
474 | fPdgCode = 2212 ; | |
475 | return ; | |
476 | } | |
477 | ||
478 | } | |
479 | ||
480 | //______________________________________________________________________________ | |
481 | void AliEMCALFastRecParticle::Paint(Option_t *) | |
482 | { | |
483 | // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes | |
484 | ||
485 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
486 | Coord_t x = Phi() * kRADDEG ; | |
487 | Coord_t y = Theta() * kRADDEG ; | |
488 | Color_t markercolor = 1 ; | |
489 | Size_t markersize = 1. ; | |
490 | Style_t markerstyle = 5 ; | |
491 | ||
492 | if (!gPad->IsBatch()) { | |
493 | gVirtualX->SetMarkerColor(markercolor) ; | |
494 | gVirtualX->SetMarkerSize (markersize) ; | |
495 | gVirtualX->SetMarkerStyle(markerstyle) ; | |
496 | } | |
497 | gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ; | |
498 | gPad->PaintPolyMarker(1,&x,&y,"") ; | |
499 | } | |
500 | ||
501 | //____________________________________________________________________________ | |
502 | void AliEMCALFastRecParticle::Print(Option_t * /*opt*/)const | |
503 | { | |
504 | // Print the type, energy and momentum of the reconstructed particle | |
505 | ||
506 | printf("Print Summary:") ; | |
507 | printf("AliEMCALFastRecParticle > type is %s\n", Name().Data()) ; | |
508 | printf(" Energy = %f\n", fE) ; | |
509 | printf(" Px = %f\n", fPx) ; | |
510 | printf(" Py = %f\n", fPy) ; | |
511 | printf(" Pz = %f\n", fPz) ; | |
512 | } |