1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // A Particle modified by PHOS response and produced by AliPHOSvFast
20 // To become a general class of AliRoot ?
22 // This is also a base class for AliPHOSRecParticle produced by AliPHOSPIDv1
23 // The rec.particle type is to be defined by AliPHOSvFast or AliPHOSPIDv1
25 //*-- Author: Yves Schutz (SUBATECH)
27 // --- ROOT system ---
29 // --- Standard library ---
31 // --- AliRoot header files ---
33 #include "AliPHOSFastRecParticle.h"
35 #include "TPaveText.h"
37 ClassImp(AliPHOSFastRecParticle) ;
39 //____________________________________________________________________________
40 AliPHOSFastRecParticle::AliPHOSFastRecParticle() : TParticle()
46 //____________________________________________________________________________
47 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const AliPHOSFastRecParticle & rp)
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];
60 fCalcMass = rp.fCalcMass;
69 fPolarTheta = rp.fPolarTheta;
70 fPolarPhi = rp.fPolarPhi;
71 fParticlePDG = rp.fParticlePDG;
74 //____________________________________________________________________________
75 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp)
77 // ctor from a TParticle (crummy?!)
79 TParticle & pnoconst = (TParticle &)(pp) ;
80 AliPHOSFastRecParticle & p = (AliPHOSFastRecParticle &)(pnoconst) ;
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];
89 fCalcMass = p.fCalcMass;
98 fPolarTheta = p.fPolarTheta;
99 fPolarPhi = p.fPolarPhi;
100 fParticlePDG = p.fParticlePDG;
104 //____________________________________________________________________________
105 Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
107 // Compute distance from point px,py to a AliPHOSFastRecParticle 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.
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);
119 if (dist > kMaxDiff) return 9999;
123 //___________________________________________________________________________
124 void AliPHOSFastRecParticle::Draw(Option_t *option)
126 // Draw this AliPHOSFastRecParticle with its current attributes
131 //______________________________________________________________________________
132 void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t , Int_t )
134 // Execute action corresponding to one event
135 // This member function is called when a AliPHOSFastRecParticle is clicked with the locator
137 if (!gPad->IsEditable())
140 static TPaveText * clustertext = 0 ;
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, "") ;
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("");
170 //____________________________________________________________________________
171 Bool_t AliPHOSFastRecParticle::IsPhoton(TString purity) const
173 // Rec.Particle is a photon if it has a photon-like shape, fast and neutral
174 // photon-like shape is defined with a purity "low", "medium" or "high"
177 Bool_t photonLike = kFALSE;
178 if (purity == "low" ) photonLike = TestPIDBit(6);
179 else if (purity == "medium") photonLike = TestPIDBit(7);
180 else if (purity == "high" ) photonLike = TestPIDBit(8);
181 if (photonLike && // photon by PCA
182 (TestPIDBit(5)||TestPIDBit(4)||TestPIDBit(3))&& // fast by TOF
183 (TestPIDBit(2)||TestPIDBit(1)||TestPIDBit(0))&& // neutral by CPV
184 !TestPIDBit(14)) // no charged track
190 //____________________________________________________________________________
191 Bool_t AliPHOSFastRecParticle::IsPi0(TString purity) const
193 // Rec.Particle is a pi0 if it has a pi0-like shape, fast and neutral
194 // pi0-like shape is defined with a purity "low", "medium" or "high"
197 Bool_t pi0Like = kFALSE;
198 if (purity == "low" ) pi0Like = TestPIDBit(9);
199 else if (purity == "medium") pi0Like = TestPIDBit(10);
200 else if (purity == "high" ) pi0Like = TestPIDBit(11);
201 else Error("IsPi0","Wrong purity type: %s",purity.Data());
202 if (pi0Like && // pi0 by PCA
203 (TestPIDBit(5)||TestPIDBit(4)||TestPIDBit(3))&& // fast by TOF
204 (TestPIDBit(2)||TestPIDBit(1)||TestPIDBit(0))&& // neutral by CPV
205 !TestPIDBit(14)) // no charged track
211 //____________________________________________________________________________
212 Bool_t AliPHOSFastRecParticle::IsElectron(TString purity) const
214 // Rec.Particle is an electron if it has a photon-like shape, fast and charged
215 // photon-like shape is defined with a purity "low", "medium" or "high"
218 Bool_t photonLike = kFALSE;
219 if (purity == "low" ) photonLike = TestPIDBit(6);
220 else if (purity == "medium") photonLike = TestPIDBit(7);
221 else if (purity == "high" ) photonLike = TestPIDBit(8);
222 else Error("IsElectron","Wrong purity type: %s",purity.Data());
224 if (photonLike && // photon by PCA
225 (TestPIDBit(5)|| TestPIDBit(4)|| TestPIDBit(3))&& // fast by TOF
226 (!TestPIDBit(2)||!TestPIDBit(1)||!TestPIDBit(0))&& // charged by CPV
227 TestPIDBit(14)) // no charged track
233 //____________________________________________________________________________
234 Bool_t AliPHOSFastRecParticle::IsEleCon(TString purity) const
236 // Rec.Particle is an electron if it has a photon-like shape, fast and charged
237 // photon-like shape is defined with a purity "low", "medium" or "high"
240 Bool_t photonLike = kFALSE;
241 if (purity == "low" ) photonLike = TestPIDBit(6);
242 else if (purity == "medium") photonLike = TestPIDBit(7);
243 else if (purity == "high" ) photonLike = TestPIDBit(8);
244 else Error("IsElectron","Wrong purity type: %s",purity.Data());
246 if (photonLike && // photon by PCA
247 (TestPIDBit(5)|| TestPIDBit(4)|| TestPIDBit(3))&& // fast by TOF
248 (!TestPIDBit(2)||!TestPIDBit(1)||!TestPIDBit(0))&& // charged by CPV
249 !TestPIDBit(14)) // no charged track
255 //____________________________________________________________________________
256 Bool_t AliPHOSFastRecParticle::IsHardPhoton() const
258 // Rec.Particle is a hard photon (E > 30 GeV) if its second moment M2x
259 // corresponds to photons
260 if (TestPIDBit(12) && !TestPIDBit(14))
266 //____________________________________________________________________________
267 Bool_t AliPHOSFastRecParticle::IsHardPi0() const
269 // Rec.Particle is a hard pi0 (E > 30 GeV) if its second moment M2x
270 // corresponds to pi0
271 if (TestPIDBit(13)&& !TestPIDBit(14))
277 //____________________________________________________________________________
278 Bool_t AliPHOSFastRecParticle::IsHadron() const
280 // Rec.Particle is an hadron if it does not look like
281 // a low-purity photon nor low-purity pi0
283 if ( !TestPIDBit(6) && !TestPIDBit(9) ) // not photon nor pi0
289 //____________________________________________________________________________
290 Bool_t AliPHOSFastRecParticle::IsChargedHadron() const
292 // Rec.Particle is a charged hadron if it does not look like
293 // a low-purity photon nor low-purity pi0 and is low-purity charged
295 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
296 !TestPIDBit(2)) // charged by CPV
302 //____________________________________________________________________________
303 Bool_t AliPHOSFastRecParticle::IsNeutralHadron() const
305 // Rec.Particle is a neutral hadron if it does not look like
306 // a low-purity photon nor low-purity pi0 and is high-purity neutral
308 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
309 TestPIDBit(2)) // neutral by CPV
315 //____________________________________________________________________________
316 Bool_t AliPHOSFastRecParticle::IsFastChargedHadron() const
318 // Rec.Particle is a fast charged hadron if it does not look like
319 // a low-purity photon nor low-purity pi0, is low-purity charged
320 // and is high-purity fast
322 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
323 !TestPIDBit(2) && // charged by CPV
324 TestPIDBit(5)) // fast by TOF
330 //____________________________________________________________________________
331 Bool_t AliPHOSFastRecParticle::IsSlowChargedHadron() const
333 // Rec.Particle is a slow neutral hadron if it does not look like
334 // a low-purity photon nor low-purity pi0, is high-purity neutral
335 // and is not high-purity fast
337 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
338 !TestPIDBit(2) && // charged by CPV
339 !TestPIDBit(5)) // slow by TOF
346 //____________________________________________________________________________
347 Bool_t AliPHOSFastRecParticle::IsFastNeutralHadron() const
349 // Rec.Particle is a fast neutral hadron if it does not look like
350 // a low-purity photon nor low-purity pi0, is high-purity neutral
351 // and is high-purity fast
353 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
354 TestPIDBit(2) && // neutral by CPV
355 TestPIDBit(5)) // fast by TOF
361 //____________________________________________________________________________
362 Bool_t AliPHOSFastRecParticle::IsSlowNeutralHadron() const
364 // Rec.Particle is a slow neutral hadron if it does not look like
365 // a low-purity photon nor low-purity pi0, is high-purity neutral
366 // and is not high-purity fast
368 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
369 TestPIDBit(2) && // neutral by CPV
370 !TestPIDBit(5)) // slow by TOF
376 //____________________________________________________________________________
377 TString AliPHOSFastRecParticle::Name() const
379 // Returns the name of the particle type (only valid if PIDv1 is employed)
383 name = "Undefined particle" ;
386 name = "Photon low purity, ";
387 else if (IsPhoton("medium"))
388 name = "Photon medium purity, ";
389 else if (IsPhoton("high"))
390 name = "Photon high purity, ";
393 name = "Pi0 low purity, ";
394 else if (IsPi0("medium"))
395 name = "Pi0 medium purity, ";
396 else if (IsPi0("high"))
397 name = "Pi0 high purity, ";
399 if (IsElectron("low"))
400 name = "Electron low purity, ";
401 else if (IsElectron("medium"))
402 name = "Electron medium purity, ";
403 else if (IsElectron("high"))
404 name = "Electron high purity, ";
408 if (IsChargedHadron()) {
409 name.Prepend("charged, ");
410 if (IsFastChargedHadron())
411 name.Prepend("fast, ");
412 else if (IsSlowChargedHadron())
413 name.Prepend("slow, ");
415 else if (IsNeutralHadron()) {
416 name.Prepend("neutral, ");
417 if (IsFastNeutralHadron())
418 name.Prepend("fast, ");
419 else if (IsSlowNeutralHadron())
420 name.Prepend("slow, ");
428 //______________________________________________________________________________
429 void AliPHOSFastRecParticle::SetType(Int_t type) {
430 // sets the particle type
431 // bit-mask of the particle type means the following:
432 // bits 0,1,2 - neutral particle with low, medium and high purity
433 // bits 3.4,5 - fast particle with low, medium and high purity
434 // bits 6.7,8 - photon shower with low, medium and high purity
435 // bits 9,10,11 - hard-pi0 shower with low, medium and high purity
439 if((type == 127) || (fType == 511) || (fType == 255) ||(fType == 383)||(fType == 447)){
444 if ((fType == 63)|| ((fType < 8)&&(fType > 0)) ){
448 if ( ((fType == 504) || (fType == 505) ||(fType == 248)||(fType == 249)||(fType == 120)||(fType == 121)) ){
452 if ((fType == 448) || (fType == 449) ||(fType == 192)||(fType == 193)||(fType == 64)||(fType == 64)){
456 if((fType == 56)||(fType == 57)){
467 //______________________________________________________________________________
468 void AliPHOSFastRecParticle::Paint(Option_t *)
470 // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes
472 Double_t kRADDEG = 180. / TMath::Pi() ;
473 Coord_t x = Phi() * kRADDEG ;
474 Coord_t y = Theta() * kRADDEG ;
475 Color_t markercolor = 1 ;
476 Size_t markersize = 1. ;
477 Style_t markerstyle = 5 ;
479 if (!gPad->IsBatch()) {
480 gVirtualX->SetMarkerColor(markercolor) ;
481 gVirtualX->SetMarkerSize (markersize) ;
482 gVirtualX->SetMarkerStyle(markerstyle) ;
484 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
485 gPad->PaintPolyMarker(1,&x,&y,"") ;
488 //____________________________________________________________________________
489 void AliPHOSFastRecParticle::Print()const
491 // Print the type, energy and momentum of the reconstructed particle
494 message = "\n PID bits are %d%d%d %d%d%d %d%d%d %d%d%d" ;
495 message += ", type is \"%s\"\n" ;
496 message += " (E,Px,Py,Pz) = (% .3e, % .3e, % .3e, % .3e) GeV\n" ;
497 Info("Print", message.Data(),
498 TestPIDBit(0),TestPIDBit(1),
499 TestPIDBit(2),TestPIDBit(3),
500 TestPIDBit(4),TestPIDBit(5),
501 TestPIDBit(6),TestPIDBit(7),
502 TestPIDBit(8),TestPIDBit(9),
503 TestPIDBit(10),TestPIDBit(11),