]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSFastRecParticle.cxx
removed iostream
[u/mrichter/AliRoot.git] / PHOS / AliPHOSFastRecParticle.cxx
CommitLineData
a73f33f0 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
b2a60966 16/* $Id$ */
17
a73f33f0 18//_________________________________________________________________________
b2a60966 19// A Particle modified by PHOS response and produced by AliPHOSvFast
20// To become a general class of AliRoot ?
21//
22//*-- Author: Yves Schutz (SUBATECH)
a73f33f0 23
24// --- ROOT system ---
25
26// --- Standard library ---
27
a73f33f0 28// --- AliRoot header files ---
29
30#include "AliPHOSFastRecParticle.h"
31#include "TPad.h"
32#include "TPaveText.h"
33
9ec91567 34ClassImp(AliPHOSFastRecParticle) ;
a73f33f0 35
03c03c49 36//____________________________________________________________________________
37AliPHOSFastRecParticle::AliPHOSFastRecParticle() : TParticle()
38{
39 // ctor
40 fType = 0 ;
41}
42
a73f33f0 43//____________________________________________________________________________
44 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const AliPHOSFastRecParticle & rp)
45{
b2a60966 46 // copy ctor
47
6a40c29e 48 fType = rp.fType ;
cafda784 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];
55 fWeight = rp.fWeight;
56 fCalcMass = rp.fCalcMass;
57 fPx = rp.fPx;
58 fPy = rp.fPy;
59 fPz = rp.fPz;
60 fE = rp.fE;
61 fVx = rp.fVx;
62 fVy = rp.fVy;
63 fVz = rp.fVz;
64 fVt = rp.fVt;
65 fPolarTheta = rp.fPolarTheta;
66 fPolarPhi = rp.fPolarPhi;
67 fParticlePDG = rp.fParticlePDG;
a73f33f0 68}
69
70//____________________________________________________________________________
71 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp)
72{
b2a60966 73 // ctor from a TParticle (crummy?!)
74
31aa6d6c 75 TParticle & pnoconst = (TParticle &)(pp) ;
76 AliPHOSFastRecParticle & p = (AliPHOSFastRecParticle &)(pnoconst) ;
03c03c49 77 fType = 0 ;
a73f33f0 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];
84 fWeight = p.fWeight;
85 fCalcMass = p.fCalcMass;
86 fPx = p.fPx;
87 fPy = p.fPy;
88 fPz = p.fPz;
89 fE = p.fE;
90 fVx = p.fVx;
91 fVy = p.fVy;
92 fVz = p.fVz;
93 fVt = p.fVt;
94 fPolarTheta = p.fPolarTheta;
95 fPolarPhi = p.fPolarPhi;
96 fParticlePDG = p.fParticlePDG;
78022019 97
a73f33f0 98}
99
a73f33f0 100//____________________________________________________________________________
101Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
102{
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.
106
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);
114
115 if (dist > kMaxDiff) return 9999;
116 return dist;
117}
118
119//___________________________________________________________________________
120 void AliPHOSFastRecParticle::Draw(Option_t *option)
121 {
122 // Draw this AliPHOSFastRecParticle with its current attributes
123
124 AppendPad(option);
125 }
126
127//______________________________________________________________________________
128void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
129{
130 // Execute action corresponding to one event
131 // This member function is called when a AliPHOSFastRecParticle is clicked with the locator
794c2bc3 132
a73f33f0 133 if (!gPad->IsEditable())
134 return ;
794c2bc3 135
a73f33f0 136 static TPaveText * clustertext = 0 ;
794c2bc3 137
a73f33f0 138 switch (event) {
139
140 case kButton1Down: {
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, "") ;
145 Text_t line1[40] ;
146 Text_t line2[40] ;
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("");
152 gPad->Update() ;
153 break ;
154 }
155
156 case kButton1Up: {
157 delete clustertext ;
158 clustertext = 0 ;
159 gPad->Update() ;
a4e98857 160 break ;
a73f33f0 161 }
a73f33f0 162 }
794c2bc3 163
a73f33f0 164}
794c2bc3 165
a73f33f0 166//____________________________________________________________________________
167TString AliPHOSFastRecParticle::Name()
168{
794c2bc3 169 // Returns the name of the particle type (only valid if PIDv1 is employed)
a73f33f0 170
794c2bc3 171 TString name ;
172
173 if(fType == 127)
174 name = "PHOTON_LOPU_HIEF" ; //PCA = 001 TOF = 111 CPV = 111
175
176 if(fType == 511)
177 name = "PHOTON_HIPU_LOEF" ; //PCA = 011 TOF = 111 CPV = 111
178
179 if(fType == 255)
180 name = "PHOTON_MED_PU_EF" ; //PCA = 111 TOF = 111 CPV = 111
181
182 if((fType == 383)||(fType == 447))
183 name = "PHOTON_STRANGE" ; //PCA = 101 or 110 TOF = 111 CPV = 111
184
185 if(fType == 63)
186 name = "NEUTRAL_FAST_HADRON" ; //PCA = 000 TOF = 111 CPV = 111
187
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
190
191 if((fType == 56)||(fType == 57))
192 name = "CHARGED_FAST_HADRON" ; //PCA = 000 TOF = 111 CPV = 000 or 001
193
194 if((fType < 8)&&(fType > 0))
195 name = "NEUTRAL_SLOW_HADRON" ; //PCA = 000 TOF = 000 CPV = 001 or 011 or 111
196
197 if((fType == 0))
198 name = "CHARGED_SLOW_HADRON" ; //PCA = 000 TOF = 000 CPV = 000
199
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
202
203
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
216
a73f33f0 217 return name ;
218}
219
220//______________________________________________________________________________
221void AliPHOSFastRecParticle::Paint(Option_t *)
222{
b2a60966 223 // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes
a73f33f0 224
225 Double_t kRADDEG = 180. / TMath::Pi() ;
b2a60966 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 ;
231
232 if (!gPad->IsBatch()) {
233 gVirtualX->SetMarkerColor(markercolor) ;
234 gVirtualX->SetMarkerSize (markersize) ;
235 gVirtualX->SetMarkerStyle(markerstyle) ;
236 }
237 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
238 gPad->PaintPolyMarker(1,&x,&y,"") ;
a73f33f0 239}
240
241//____________________________________________________________________________
0a6d52e3 242void AliPHOSFastRecParticle::Print(const char * opt)
a73f33f0 243{
a4e98857 244 // Print the type, energy and momentum of the reconstructed particle
b2a60966 245
21cd0c07 246 TString message ;
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(),
253 Name().Data(),
254 fE,
255 fPx,
256 fPy,
257 fPz );
a73f33f0 258}