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)
52 fPdgCode = rp.fPdgCode;
53 fStatusCode = rp.fStatusCode;
54 fMother[0] = rp.fMother[0];
55 fMother[1] = rp.fMother[1];
56 fDaughter[0] = rp.fDaughter[0];
57 fDaughter[1] = rp.fDaughter[1];
59 fCalcMass = rp.fCalcMass;
68 fPolarTheta = rp.fPolarTheta;
69 fPolarPhi = rp.fPolarPhi;
70 fParticlePDG = rp.fParticlePDG;
73 //____________________________________________________________________________
74 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp)
76 // ctor from a TParticle (crummy?!)
78 TParticle & pnoconst = (TParticle &)(pp) ;
79 AliPHOSFastRecParticle & p = (AliPHOSFastRecParticle &)(pnoconst) ;
81 fPdgCode = p.fPdgCode;
82 fStatusCode = p.fStatusCode;
83 fMother[0] = p.fMother[0];
84 fMother[1] = p.fMother[1];
85 fDaughter[0] = p.fDaughter[0];
86 fDaughter[1] = p.fDaughter[1];
88 fCalcMass = p.fCalcMass;
97 fPolarTheta = p.fPolarTheta;
98 fPolarPhi = p.fPolarPhi;
99 fParticlePDG = p.fParticlePDG;
103 //____________________________________________________________________________
104 Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
106 // Compute distance from point px,py to a AliPHOSFastRecParticle considered as a Tmarker
107 // Compute the closest distance of approach from point px,py to this marker.
108 // The distance is computed in pixels units.
110 Double_t kRADDEG = 180. / TMath::Pi() ;
111 Coord_t x = Phi() * kRADDEG ;
112 Coord_t y = Theta() * kRADDEG ;
113 const Int_t kMaxDiff = 10;
114 Int_t pxm = gPad->XtoAbsPixel(x);
115 Int_t pym = gPad->YtoAbsPixel(y);
116 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
118 if (dist > kMaxDiff) return 9999;
122 //___________________________________________________________________________
123 void AliPHOSFastRecParticle::Draw(Option_t *option)
125 // Draw this AliPHOSFastRecParticle with its current attributes
130 //______________________________________________________________________________
131 void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
133 // Execute action corresponding to one event
134 // This member function is called when a AliPHOSFastRecParticle is clicked with the locator
136 if (!gPad->IsEditable())
139 static TPaveText * clustertext = 0 ;
144 Double_t kRADDEG = 180. / TMath::Pi() ;
145 Coord_t x = Phi() * kRADDEG ;
146 Coord_t y = Theta() * kRADDEG ;
147 clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ;
150 sprintf( line1, "PID: %s ", (const char*)Name() ) ;
151 sprintf( line2, "ENERGY: %f ", Energy() ) ;
152 clustertext ->AddText(line1) ;
153 clustertext ->AddText(line2) ;
154 clustertext ->Draw("");
169 //____________________________________________________________________________
170 Bool_t AliPHOSFastRecParticle::IsPhoton(TString purity) const
172 // Rec.Particle is a photon if it has a photon-like shape, fast and neutral
173 // photon-like shape is defined with a purity "low", "medium" or "high"
176 Bool_t photonLike = kFALSE;
177 if (purity == "low" ) photonLike = TestPIDBit(6);
178 else if (purity == "medium") photonLike = TestPIDBit(7);
179 else if (purity == "high" ) photonLike = TestPIDBit(8);
180 else Error("IsPhoton","Wrong purity type: \'%s\'",purity.Data());
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
189 //____________________________________________________________________________
190 Bool_t AliPHOSFastRecParticle::IsPi0(TString purity) const
192 // Rec.Particle is a pi0 if it has a pi0-like shape, fast and neutral
193 // pi0-like shape is defined with a purity "low", "medium" or "high"
196 Bool_t pi0Like = kFALSE;
197 if (purity == "low" ) pi0Like = TestPIDBit(9);
198 else if (purity == "medium") pi0Like = TestPIDBit(10);
199 else if (purity == "high" ) pi0Like = TestPIDBit(11);
200 else Error("IsPi0","Wrong purity type: %s",purity.Data());
201 if (pi0Like && // pi0 by PCA
202 (TestPIDBit(5)||TestPIDBit(4)||TestPIDBit(3))&& // fast by TOF
203 (TestPIDBit(2)||TestPIDBit(1)||TestPIDBit(0))) // neutral by CPV
209 //____________________________________________________________________________
210 Bool_t AliPHOSFastRecParticle::IsElectron(TString purity) const
212 // Rec.Particle is an electron if it has a photon-like shape, fast and charged
213 // photon-like shape is defined with a purity "low", "medium" or "high"
216 Bool_t photonLike = kFALSE;
217 if (purity == "low" ) photonLike = TestPIDBit(6);
218 else if (purity == "medium") photonLike = TestPIDBit(7);
219 else if (purity == "high" ) photonLike = TestPIDBit(8);
220 else Error("IsElectron","Wrong purity type: %s",purity.Data());
221 if (photonLike && // photon by PCA
222 (TestPIDBit(5)||TestPIDBit(4)||TestPIDBit(3))&& // fast by TOF
223 !(TestPIDBit(2)||TestPIDBit(1)||TestPIDBit(0))) // charged by CPV
229 //____________________________________________________________________________
230 Bool_t AliPHOSFastRecParticle::IsHadron() const
232 // Rec.Particle is an hadron if it does not look like
233 // a low-purity photon nor low-purity pi0
235 if ( !TestPIDBit(6) && !TestPIDBit(9) ) // not photon nor pi0
241 //____________________________________________________________________________
242 Bool_t AliPHOSFastRecParticle::IsChargedHadron() const
244 // Rec.Particle is a charged hadron if it does not look like
245 // a low-purity photon nor low-purity pi0 and is low-purity charged
247 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
248 !TestPIDBit(2)) // charged by CPV
254 //____________________________________________________________________________
255 Bool_t AliPHOSFastRecParticle::IsNeutralHadron() const
257 // Rec.Particle is a neutral hadron if it does not look like
258 // a low-purity photon nor low-purity pi0 and is high-purity neutral
260 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
261 TestPIDBit(2)) // neutral by CPV
267 //____________________________________________________________________________
268 Bool_t AliPHOSFastRecParticle::IsFastChargedHadron() const
270 // Rec.Particle is a fast charged hadron if it does not look like
271 // a low-purity photon nor low-purity pi0, is low-purity charged
272 // and is high-purity fast
274 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
275 !TestPIDBit(2) && // charged by CPV
276 TestPIDBit(5)) // fast by TOF
282 //____________________________________________________________________________
283 Bool_t AliPHOSFastRecParticle::IsSlowChargedHadron() const
285 // Rec.Particle is a slow neutral hadron if it does not look like
286 // a low-purity photon nor low-purity pi0, is high-purity neutral
287 // and is not high-purity fast
289 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
290 !TestPIDBit(2) && // charged by CPV
291 !TestPIDBit(5)) // slow by TOF
298 //____________________________________________________________________________
299 Bool_t AliPHOSFastRecParticle::IsFastNeutralHadron() const
301 // Rec.Particle is a fast neutral hadron if it does not look like
302 // a low-purity photon nor low-purity pi0, is high-purity neutral
303 // and is high-purity fast
305 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
306 TestPIDBit(2) && // neutral by CPV
307 TestPIDBit(5)) // fast by TOF
313 //____________________________________________________________________________
314 Bool_t AliPHOSFastRecParticle::IsSlowNeutralHadron() const
316 // Rec.Particle is a slow neutral hadron if it does not look like
317 // a low-purity photon nor low-purity pi0, is high-purity neutral
318 // and is not high-purity fast
320 if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0
321 TestPIDBit(2) && // neutral by CPV
322 !TestPIDBit(5)) // slow by TOF
328 //____________________________________________________________________________
329 TString AliPHOSFastRecParticle::Name() const
331 // Returns the name of the particle type (only valid if PIDv1 is employed)
335 name = "Undefined particle" ;
338 name = "Photon low purity ";
339 else if (IsPhoton("medium"))
340 name = "Photon medium purity";
341 else if (IsPhoton("high"))
342 name = "Photon high purity ";
345 name += "Pi0 low purity ";
346 else if (IsPi0("medium"))
347 name += "Pi0 medium purity ";
348 else if (IsPi0("high"))
349 name += "Pi0 high purity ";
351 if (IsElectron("low"))
352 name += "Electron low purity ";
353 else if (IsElectron("medium"))
354 name += "Electron medium purity ";
355 else if (IsElectron("high"))
356 name += "Electron high purity ";
360 if (IsChargedHadron()) {
361 name.Prepend("charged ");
362 if (IsFastChargedHadron())
363 name.Prepend("fast ");
364 else if (IsSlowChargedHadron())
365 name.Prepend("slow ");
367 else if (IsNeutralHadron()) {
368 name.Prepend("neutral ");
369 if (IsFastNeutralHadron())
370 name.Prepend("fast ");
371 else if (IsSlowNeutralHadron())
372 name.Prepend("slow ");
380 //______________________________________________________________________________
381 void AliPHOSFastRecParticle::SetType(Int_t type) {
382 // sets the particle type
383 // bit-mask of the particle type means the following:
384 // bits 0,1,2 - neutral particle with low, medium and high purity
385 // bits 3.4,5 - fast particle with low, medium and high purity
386 // bits 6.7,8 - photon shower with low, medium and high purity
387 // bits 9,10,11 - hard-pi0 shower with low, medium and high purity
391 if((type == 127) || (fType == 511) || (fType == 255) ||(fType == 383)||(fType == 447)){
396 if ((fType == 63)|| ((fType < 8)&&(fType > 0)) ){
400 if ( ((fType == 504) || (fType == 505) ||(fType == 248)||(fType == 249)||(fType == 120)||(fType == 121)) ){
404 if ((fType == 448) || (fType == 449) ||(fType == 192)||(fType == 193)||(fType == 64)||(fType == 64)){
408 if((fType == 56)||(fType == 57)){
419 //______________________________________________________________________________
420 void AliPHOSFastRecParticle::Paint(Option_t *)
422 // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes
424 Double_t kRADDEG = 180. / TMath::Pi() ;
425 Coord_t x = Phi() * kRADDEG ;
426 Coord_t y = Theta() * kRADDEG ;
427 Color_t markercolor = 1 ;
428 Size_t markersize = 1. ;
429 Style_t markerstyle = 5 ;
431 if (!gPad->IsBatch()) {
432 gVirtualX->SetMarkerColor(markercolor) ;
433 gVirtualX->SetMarkerSize (markersize) ;
434 gVirtualX->SetMarkerStyle(markerstyle) ;
436 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
437 gPad->PaintPolyMarker(1,&x,&y,"") ;
440 //____________________________________________________________________________
441 void AliPHOSFastRecParticle::Print(Option_t * opt)const
443 // Print the type, energy and momentum of the reconstructed particle
446 message = "\n PID bits are %d%d%d %d%d%d %d%d%d %d%d%d" ;
447 message += ", type is \"%s\"\n" ;
448 message += " (E,Px,Py,Pz) = (% .3e, % .3e, % .3e, % .3e) GeV\n" ;
449 Info("Print", message.Data(),
450 TestPIDBit(0),TestPIDBit(1),
451 TestPIDBit(2),TestPIDBit(3),
452 TestPIDBit(4),TestPIDBit(5),
453 TestPIDBit(6),TestPIDBit(7),
454 TestPIDBit(8),TestPIDBit(9),
455 TestPIDBit(10),TestPIDBit(11),