]>
Commit | Line | Data |
---|---|---|
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 | ||
de9ec31b | 28 | #include <iostream.h> |
a73f33f0 | 29 | |
30 | // --- AliRoot header files --- | |
31 | ||
32 | #include "AliPHOSFastRecParticle.h" | |
33 | #include "TPad.h" | |
34 | #include "TPaveText.h" | |
35 | ||
9ec91567 | 36 | ClassImp(AliPHOSFastRecParticle) ; |
a73f33f0 | 37 | |
03c03c49 | 38 | //____________________________________________________________________________ |
39 | AliPHOSFastRecParticle::AliPHOSFastRecParticle() : TParticle() | |
40 | { | |
41 | // ctor | |
42 | fType = 0 ; | |
43 | } | |
44 | ||
a73f33f0 | 45 | //____________________________________________________________________________ |
46 | AliPHOSFastRecParticle::AliPHOSFastRecParticle(const AliPHOSFastRecParticle & rp) | |
47 | { | |
b2a60966 | 48 | // copy ctor |
49 | ||
6a40c29e | 50 | fType = rp.fType ; |
cafda784 | 51 | fPdgCode = rp.fPdgCode; |
52 | fStatusCode = rp.fStatusCode; | |
53 | fMother[0] = rp.fMother[0]; | |
54 | fMother[1] = rp.fMother[1]; | |
55 | fDaughter[0] = rp.fDaughter[0]; | |
56 | fDaughter[1] = rp.fDaughter[1]; | |
57 | fWeight = rp.fWeight; | |
58 | fCalcMass = rp.fCalcMass; | |
59 | fPx = rp.fPx; | |
60 | fPy = rp.fPy; | |
61 | fPz = rp.fPz; | |
62 | fE = rp.fE; | |
63 | fVx = rp.fVx; | |
64 | fVy = rp.fVy; | |
65 | fVz = rp.fVz; | |
66 | fVt = rp.fVt; | |
67 | fPolarTheta = rp.fPolarTheta; | |
68 | fPolarPhi = rp.fPolarPhi; | |
69 | fParticlePDG = rp.fParticlePDG; | |
a73f33f0 | 70 | } |
71 | ||
72 | //____________________________________________________________________________ | |
73 | AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp) | |
74 | { | |
b2a60966 | 75 | // ctor from a TParticle (crummy?!) |
76 | ||
31aa6d6c | 77 | TParticle & pnoconst = (TParticle &)(pp) ; |
78 | AliPHOSFastRecParticle & p = (AliPHOSFastRecParticle &)(pnoconst) ; | |
03c03c49 | 79 | fType = 0 ; |
a73f33f0 | 80 | fPdgCode = p.fPdgCode; |
81 | fStatusCode = p.fStatusCode; | |
82 | fMother[0] = p.fMother[0]; | |
83 | fMother[1] = p.fMother[1]; | |
84 | fDaughter[0] = p.fDaughter[0]; | |
85 | fDaughter[1] = p.fDaughter[1]; | |
86 | fWeight = p.fWeight; | |
87 | fCalcMass = p.fCalcMass; | |
88 | fPx = p.fPx; | |
89 | fPy = p.fPy; | |
90 | fPz = p.fPz; | |
91 | fE = p.fE; | |
92 | fVx = p.fVx; | |
93 | fVy = p.fVy; | |
94 | fVz = p.fVz; | |
95 | fVt = p.fVt; | |
96 | fPolarTheta = p.fPolarTheta; | |
97 | fPolarPhi = p.fPolarPhi; | |
98 | fParticlePDG = p.fParticlePDG; | |
78022019 | 99 | |
a73f33f0 | 100 | } |
101 | ||
a73f33f0 | 102 | //____________________________________________________________________________ |
103 | Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py) | |
104 | { | |
105 | // Compute distance from point px,py to a AliPHOSFastRecParticle considered as a Tmarker | |
106 | // Compute the closest distance of approach from point px,py to this marker. | |
107 | // The distance is computed in pixels units. | |
108 | ||
109 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
110 | Coord_t x = Phi() * kRADDEG ; | |
111 | Coord_t y = Theta() * kRADDEG ; | |
112 | const Int_t kMaxDiff = 10; | |
113 | Int_t pxm = gPad->XtoAbsPixel(x); | |
114 | Int_t pym = gPad->YtoAbsPixel(y); | |
115 | Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym); | |
116 | ||
117 | if (dist > kMaxDiff) return 9999; | |
118 | return dist; | |
119 | } | |
120 | ||
121 | //___________________________________________________________________________ | |
122 | void AliPHOSFastRecParticle::Draw(Option_t *option) | |
123 | { | |
124 | // Draw this AliPHOSFastRecParticle with its current attributes | |
125 | ||
126 | AppendPad(option); | |
127 | } | |
128 | ||
129 | //______________________________________________________________________________ | |
130 | void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py) | |
131 | { | |
132 | // Execute action corresponding to one event | |
133 | // This member function is called when a AliPHOSFastRecParticle is clicked with the locator | |
794c2bc3 | 134 | |
a73f33f0 | 135 | if (!gPad->IsEditable()) |
136 | return ; | |
794c2bc3 | 137 | |
a73f33f0 | 138 | static TPaveText * clustertext = 0 ; |
794c2bc3 | 139 | |
a73f33f0 | 140 | switch (event) { |
141 | ||
142 | case kButton1Down: { | |
143 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
144 | Coord_t x = Phi() * kRADDEG ; | |
145 | Coord_t y = Theta() * kRADDEG ; | |
146 | clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ; | |
147 | Text_t line1[40] ; | |
148 | Text_t line2[40] ; | |
149 | sprintf( line1, "PID: %s ", (const char*)Name() ) ; | |
150 | sprintf( line2, "ENERGY: %f ", Energy() ) ; | |
151 | clustertext ->AddText(line1) ; | |
152 | clustertext ->AddText(line2) ; | |
153 | clustertext ->Draw(""); | |
154 | gPad->Update() ; | |
155 | break ; | |
156 | } | |
157 | ||
158 | case kButton1Up: { | |
159 | delete clustertext ; | |
160 | clustertext = 0 ; | |
161 | gPad->Update() ; | |
a4e98857 | 162 | break ; |
a73f33f0 | 163 | } |
a73f33f0 | 164 | } |
794c2bc3 | 165 | |
a73f33f0 | 166 | } |
794c2bc3 | 167 | |
a73f33f0 | 168 | //____________________________________________________________________________ |
169 | TString AliPHOSFastRecParticle::Name() | |
170 | { | |
794c2bc3 | 171 | // Returns the name of the particle type (only valid if PIDv1 is employed) |
a73f33f0 | 172 | |
794c2bc3 | 173 | TString name ; |
174 | ||
175 | if(fType == 127) | |
176 | name = "PHOTON_LOPU_HIEF" ; //PCA = 001 TOF = 111 CPV = 111 | |
177 | ||
178 | if(fType == 511) | |
179 | name = "PHOTON_HIPU_LOEF" ; //PCA = 011 TOF = 111 CPV = 111 | |
180 | ||
181 | if(fType == 255) | |
182 | name = "PHOTON_MED_PU_EF" ; //PCA = 111 TOF = 111 CPV = 111 | |
183 | ||
184 | if((fType == 383)||(fType == 447)) | |
185 | name = "PHOTON_STRANGE" ; //PCA = 101 or 110 TOF = 111 CPV = 111 | |
186 | ||
187 | if(fType == 63) | |
188 | name = "NEUTRAL_FAST_HADRON" ; //PCA = 000 TOF = 111 CPV = 111 | |
189 | ||
190 | if((fType == 504) || (fType == 505) ||(fType == 248)||(fType == 249)||(fType == 120)||(fType == 121)) | |
191 | name = "CHARGED_FAST_EM" ; //PCA = 111, 011 or 001 TOF =111 CPV = 000 or 001 | |
192 | ||
193 | if((fType == 56)||(fType == 57)) | |
194 | name = "CHARGED_FAST_HADRON" ; //PCA = 000 TOF = 111 CPV = 000 or 001 | |
195 | ||
196 | if((fType < 8)&&(fType > 0)) | |
197 | name = "NEUTRAL_SLOW_HADRON" ; //PCA = 000 TOF = 000 CPV = 001 or 011 or 111 | |
198 | ||
199 | if((fType == 0)) | |
200 | name = "CHARGED_SLOW_HADRON" ; //PCA = 000 TOF = 000 CPV = 000 | |
201 | ||
202 | if((fType == 448) || (fType == 449) ||(fType == 192)||(fType == 193)||(fType == 64)||(fType == 64)) | |
203 | name = "CHARGED_SLOW_EM" ; //PCA = 111, 011 or 001 TOF =000 CPV = 000 or 001 | |
204 | ||
205 | ||
206 | if ( name.Contains("PHOTON") ) | |
207 | fPdgCode = 22 ; // Sets the pdg GetName() to gamma | |
208 | if ( name.Contains("NEUTRAL") ) | |
209 | fPdgCode = 2112 ; // Sets the pdg GetName() to neutron | |
210 | if ( name.Contains("CHARGED_FAST_EM") ) | |
211 | fPdgCode = 11 ; // Sets the pdg GetName() to electron | |
212 | if ( name.Contains("CHARGED_SLOW_EM") ) | |
213 | fPdgCode = 13 ; // Sets the pdg GetName() to muon | |
214 | if ( name.Contains("CHARGED_FAST_HADRON") ) | |
215 | fPdgCode = 211 ; // Sets the pdg GetName() to pion | |
216 | if ( name.Contains("CHARGED_SLOW_HADRON") ) | |
217 | fPdgCode = 2212 ; // Sets the pdg GetName() to proton | |
218 | ||
a73f33f0 | 219 | return name ; |
220 | } | |
221 | ||
222 | //______________________________________________________________________________ | |
223 | void AliPHOSFastRecParticle::Paint(Option_t *) | |
224 | { | |
b2a60966 | 225 | // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes |
a73f33f0 | 226 | |
227 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
b2a60966 | 228 | Coord_t x = Phi() * kRADDEG ; |
229 | Coord_t y = Theta() * kRADDEG ; | |
230 | Color_t markercolor = 1 ; | |
231 | Size_t markersize = 1. ; | |
232 | Style_t markerstyle = 5 ; | |
233 | ||
234 | if (!gPad->IsBatch()) { | |
235 | gVirtualX->SetMarkerColor(markercolor) ; | |
236 | gVirtualX->SetMarkerSize (markersize) ; | |
237 | gVirtualX->SetMarkerStyle(markerstyle) ; | |
238 | } | |
239 | gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ; | |
240 | gPad->PaintPolyMarker(1,&x,&y,"") ; | |
a73f33f0 | 241 | } |
242 | ||
243 | //____________________________________________________________________________ | |
0a6d52e3 | 244 | void AliPHOSFastRecParticle::Print(const char * opt) |
a73f33f0 | 245 | { |
a4e98857 | 246 | // Print the type, energy and momentum of the reconstructed particle |
b2a60966 | 247 | |
a73f33f0 | 248 | cout << "AliPHOSFastRecParticle > " << "type is " << Name() << endl |
249 | << " " << "Energy = " << fE << endl | |
250 | << " " << "Px = " << fPx << endl | |
251 | << " " << "Py = " << fPy << endl | |
252 | << " " << "Pz = " << fPz << endl ; | |
253 | } |