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 //*-- Author: Yves Schutz (SUBATECH)
24 // --- ROOT system ---
26 // --- Standard library ---
28 // --- AliRoot header files ---
30 #include "AliPHOSFastRecParticle.h"
32 #include "TPaveText.h"
34 ClassImp(AliPHOSFastRecParticle) ;
36 //____________________________________________________________________________
37 AliPHOSFastRecParticle::AliPHOSFastRecParticle() : TParticle()
43 //____________________________________________________________________________
44 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const AliPHOSFastRecParticle & rp)
49 fPdgCode = rp.fPdgCode;
50 fStatusCode = rp.fStatusCode;
51 fMother[0] = rp.fMother[0];
52 fMother[1] = rp.fMother[1];
53 fDaughter[0] = rp.fDaughter[0];
54 fDaughter[1] = rp.fDaughter[1];
56 fCalcMass = rp.fCalcMass;
65 fPolarTheta = rp.fPolarTheta;
66 fPolarPhi = rp.fPolarPhi;
67 fParticlePDG = rp.fParticlePDG;
70 //____________________________________________________________________________
71 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp)
73 // ctor from a TParticle (crummy?!)
75 TParticle & pnoconst = (TParticle &)(pp) ;
76 AliPHOSFastRecParticle & p = (AliPHOSFastRecParticle &)(pnoconst) ;
78 fPdgCode = p.fPdgCode;
79 fStatusCode = p.fStatusCode;
80 fMother[0] = p.fMother[0];
81 fMother[1] = p.fMother[1];
82 fDaughter[0] = p.fDaughter[0];
83 fDaughter[1] = p.fDaughter[1];
85 fCalcMass = p.fCalcMass;
94 fPolarTheta = p.fPolarTheta;
95 fPolarPhi = p.fPolarPhi;
96 fParticlePDG = p.fParticlePDG;
100 //____________________________________________________________________________
101 Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
103 // Compute distance from point px,py to a AliPHOSFastRecParticle considered as a Tmarker
104 // Compute the closest distance of approach from point px,py to this marker.
105 // The distance is computed in pixels units.
107 Double_t kRADDEG = 180. / TMath::Pi() ;
108 Coord_t x = Phi() * kRADDEG ;
109 Coord_t y = Theta() * kRADDEG ;
110 const Int_t kMaxDiff = 10;
111 Int_t pxm = gPad->XtoAbsPixel(x);
112 Int_t pym = gPad->YtoAbsPixel(y);
113 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
115 if (dist > kMaxDiff) return 9999;
119 //___________________________________________________________________________
120 void AliPHOSFastRecParticle::Draw(Option_t *option)
122 // Draw this AliPHOSFastRecParticle with its current attributes
127 //______________________________________________________________________________
128 void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
130 // Execute action corresponding to one event
131 // This member function is called when a AliPHOSFastRecParticle is clicked with the locator
133 if (!gPad->IsEditable())
136 static TPaveText * clustertext = 0 ;
141 Double_t kRADDEG = 180. / TMath::Pi() ;
142 Coord_t x = Phi() * kRADDEG ;
143 Coord_t y = Theta() * kRADDEG ;
144 clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ;
147 sprintf( line1, "PID: %s ", (const char*)Name() ) ;
148 sprintf( line2, "ENERGY: %f ", Energy() ) ;
149 clustertext ->AddText(line1) ;
150 clustertext ->AddText(line2) ;
151 clustertext ->Draw("");
166 //____________________________________________________________________________
167 TString AliPHOSFastRecParticle::Name()
169 // Returns the name of the particle type (only valid if PIDv1 is employed)
174 name = "PHOTON_LOPU_HIEF" ; //PCA = 001 TOF = 111 CPV = 111
177 name = "PHOTON_HIPU_LOEF" ; //PCA = 011 TOF = 111 CPV = 111
180 name = "PHOTON_MED_PU_EF" ; //PCA = 111 TOF = 111 CPV = 111
182 if((fType == 383)||(fType == 447))
183 name = "PHOTON_STRANGE" ; //PCA = 101 or 110 TOF = 111 CPV = 111
186 name = "NEUTRAL_FAST_HADRON" ; //PCA = 000 TOF = 111 CPV = 111
188 if((fType == 504) || (fType == 505) ||(fType == 248)||(fType == 249)||(fType == 120)||(fType == 121))
189 name = "CHARGED_FAST_EM" ; //PCA = 111, 011 or 001 TOF =111 CPV = 000 or 001
191 if((fType == 56)||(fType == 57))
192 name = "CHARGED_FAST_HADRON" ; //PCA = 000 TOF = 111 CPV = 000 or 001
194 if((fType < 8)&&(fType > 0))
195 name = "NEUTRAL_SLOW_HADRON" ; //PCA = 000 TOF = 000 CPV = 001 or 011 or 111
198 name = "CHARGED_SLOW_HADRON" ; //PCA = 000 TOF = 000 CPV = 000
200 if((fType == 448) || (fType == 449) ||(fType == 192)||(fType == 193)||(fType == 64)||(fType == 64))
201 name = "CHARGED_SLOW_EM" ; //PCA = 111, 011 or 001 TOF =000 CPV = 000 or 001
204 if ( name.Contains("PHOTON") )
205 fPdgCode = 22 ; // Sets the pdg GetName() to gamma
206 if ( name.Contains("NEUTRAL") )
207 fPdgCode = 2112 ; // Sets the pdg GetName() to neutron
208 if ( name.Contains("CHARGED_FAST_EM") )
209 fPdgCode = 11 ; // Sets the pdg GetName() to electron
210 if ( name.Contains("CHARGED_SLOW_EM") )
211 fPdgCode = 13 ; // Sets the pdg GetName() to muon
212 if ( name.Contains("CHARGED_FAST_HADRON") )
213 fPdgCode = 211 ; // Sets the pdg GetName() to pion
214 if ( name.Contains("CHARGED_SLOW_HADRON") )
215 fPdgCode = 2212 ; // Sets the pdg GetName() to proton
220 //______________________________________________________________________________
221 void AliPHOSFastRecParticle::Paint(Option_t *)
223 // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes
225 Double_t kRADDEG = 180. / TMath::Pi() ;
226 Coord_t x = Phi() * kRADDEG ;
227 Coord_t y = Theta() * kRADDEG ;
228 Color_t markercolor = 1 ;
229 Size_t markersize = 1. ;
230 Style_t markerstyle = 5 ;
232 if (!gPad->IsBatch()) {
233 gVirtualX->SetMarkerColor(markercolor) ;
234 gVirtualX->SetMarkerSize (markersize) ;
235 gVirtualX->SetMarkerStyle(markerstyle) ;
237 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
238 gPad->PaintPolyMarker(1,&x,&y,"") ;
241 //____________________________________________________________________________
242 void AliPHOSFastRecParticle::Print(const char * opt)
244 // Print the type, energy and momentum of the reconstructed particle
247 message = "AliPHOSFastRecParticle > type is %s\n" ;
248 message += " Energy = %f\n" ;
249 message += " Px = %f\n" ;
250 message += " Py = %f\n" ;
251 message += " Pz = %f\n" ;
252 Info("Print", message.Data(),