]>
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 | |
38 | //____________________________________________________________________________ | |
39 | AliPHOSFastRecParticle::AliPHOSFastRecParticle(const AliPHOSFastRecParticle & rp) | |
40 | { | |
b2a60966 | 41 | // copy ctor |
42 | ||
a73f33f0 | 43 | fType = rp.fType ; |
cafda784 | 44 | fPdgCode = rp.fPdgCode; |
45 | fStatusCode = rp.fStatusCode; | |
46 | fMother[0] = rp.fMother[0]; | |
47 | fMother[1] = rp.fMother[1]; | |
48 | fDaughter[0] = rp.fDaughter[0]; | |
49 | fDaughter[1] = rp.fDaughter[1]; | |
50 | fWeight = rp.fWeight; | |
51 | fCalcMass = rp.fCalcMass; | |
52 | fPx = rp.fPx; | |
53 | fPy = rp.fPy; | |
54 | fPz = rp.fPz; | |
55 | fE = rp.fE; | |
56 | fVx = rp.fVx; | |
57 | fVy = rp.fVy; | |
58 | fVz = rp.fVz; | |
59 | fVt = rp.fVt; | |
60 | fPolarTheta = rp.fPolarTheta; | |
61 | fPolarPhi = rp.fPolarPhi; | |
62 | fParticlePDG = rp.fParticlePDG; | |
a73f33f0 | 63 | } |
64 | ||
65 | //____________________________________________________________________________ | |
66 | AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp) | |
67 | { | |
b2a60966 | 68 | // ctor from a TParticle (crummy?!) |
69 | ||
31aa6d6c | 70 | TParticle & pnoconst = (TParticle &)(pp) ; |
71 | AliPHOSFastRecParticle & p = (AliPHOSFastRecParticle &)(pnoconst) ; | |
a73f33f0 | 72 | |
73 | fPdgCode = p.fPdgCode; | |
74 | fStatusCode = p.fStatusCode; | |
75 | fMother[0] = p.fMother[0]; | |
76 | fMother[1] = p.fMother[1]; | |
77 | fDaughter[0] = p.fDaughter[0]; | |
78 | fDaughter[1] = p.fDaughter[1]; | |
79 | fWeight = p.fWeight; | |
80 | fCalcMass = p.fCalcMass; | |
81 | fPx = p.fPx; | |
82 | fPy = p.fPy; | |
83 | fPz = p.fPz; | |
84 | fE = p.fE; | |
85 | fVx = p.fVx; | |
86 | fVy = p.fVy; | |
87 | fVz = p.fVz; | |
88 | fVt = p.fVt; | |
89 | fPolarTheta = p.fPolarTheta; | |
90 | fPolarPhi = p.fPolarPhi; | |
91 | fParticlePDG = p.fParticlePDG; | |
92 | } | |
93 | ||
a73f33f0 | 94 | //____________________________________________________________________________ |
95 | Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py) | |
96 | { | |
97 | // Compute distance from point px,py to a AliPHOSFastRecParticle considered as a Tmarker | |
98 | // Compute the closest distance of approach from point px,py to this marker. | |
99 | // The distance is computed in pixels units. | |
100 | ||
101 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
102 | Coord_t x = Phi() * kRADDEG ; | |
103 | Coord_t y = Theta() * kRADDEG ; | |
104 | const Int_t kMaxDiff = 10; | |
105 | Int_t pxm = gPad->XtoAbsPixel(x); | |
106 | Int_t pym = gPad->YtoAbsPixel(y); | |
107 | Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym); | |
108 | ||
109 | if (dist > kMaxDiff) return 9999; | |
110 | return dist; | |
111 | } | |
112 | ||
113 | //___________________________________________________________________________ | |
114 | void AliPHOSFastRecParticle::Draw(Option_t *option) | |
115 | { | |
116 | // Draw this AliPHOSFastRecParticle with its current attributes | |
117 | ||
118 | AppendPad(option); | |
119 | } | |
120 | ||
121 | //______________________________________________________________________________ | |
122 | void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py) | |
123 | { | |
124 | // Execute action corresponding to one event | |
125 | // This member function is called when a AliPHOSFastRecParticle is clicked with the locator | |
b2a60966 | 126 | |
a73f33f0 | 127 | if (!gPad->IsEditable()) |
128 | return ; | |
129 | ||
130 | static TPaveText * clustertext = 0 ; | |
131 | ||
132 | switch (event) { | |
133 | ||
134 | case kButton1Down: { | |
135 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
136 | Coord_t x = Phi() * kRADDEG ; | |
137 | Coord_t y = Theta() * kRADDEG ; | |
138 | clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ; | |
139 | Text_t line1[40] ; | |
140 | Text_t line2[40] ; | |
141 | sprintf( line1, "PID: %s ", (const char*)Name() ) ; | |
142 | sprintf( line2, "ENERGY: %f ", Energy() ) ; | |
143 | clustertext ->AddText(line1) ; | |
144 | clustertext ->AddText(line2) ; | |
145 | clustertext ->Draw(""); | |
146 | gPad->Update() ; | |
147 | break ; | |
148 | } | |
149 | ||
150 | case kButton1Up: { | |
151 | delete clustertext ; | |
152 | clustertext = 0 ; | |
153 | gPad->Update() ; | |
154 | break ; | |
155 | } | |
156 | ||
157 | } | |
158 | ||
159 | } | |
b2a60966 | 160 | |
161 | //____________________________________________________________________________ | |
162 | Int_t * AliPHOSFastRecParticle::GetPrimaries(Int_t & number) | |
163 | { | |
164 | // Retrieves the unique primary particle at the origine of the present reconstruced particle | |
165 | ||
166 | number = 1 ; | |
167 | Int_t * list = new Int_t[1] ; | |
168 | list[0] = fPrimary ; | |
169 | ||
170 | return list ; | |
171 | } | |
172 | ||
a73f33f0 | 173 | //____________________________________________________________________________ |
174 | TString AliPHOSFastRecParticle::Name() | |
175 | { | |
b2a60966 | 176 | // Returns the name of the particle type |
177 | ||
a73f33f0 | 178 | TString name ; |
179 | switch (fType) { | |
180 | case kGAMMA: | |
181 | name = "PHOTON" ; | |
182 | break ; | |
183 | case kELECTRON: | |
184 | name = "ELECTRON" ; | |
185 | break ; | |
88714635 | 186 | case kCHARGEDHA: |
2aad621e | 187 | name = "CHARGED_HA" ; |
a73f33f0 | 188 | break ; |
88714635 | 189 | case kNEUTRALHA: |
2aad621e | 190 | name = "NEUTRAL_HA" ; |
a73f33f0 | 191 | break ; |
88714635 | 192 | case kNEUTRALEM: |
2aad621e | 193 | name = "NEUTRAL_EM" ; |
a73f33f0 | 194 | break ; |
88714635 | 195 | case kGAMMAHA: |
2aad621e | 196 | name = "PHOTON_HA" ; |
a73f33f0 | 197 | break ; |
198 | ||
199 | } | |
200 | return name ; | |
201 | } | |
202 | ||
203 | //______________________________________________________________________________ | |
204 | void AliPHOSFastRecParticle::Paint(Option_t *) | |
205 | { | |
b2a60966 | 206 | // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes |
a73f33f0 | 207 | |
208 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
b2a60966 | 209 | Coord_t x = Phi() * kRADDEG ; |
210 | Coord_t y = Theta() * kRADDEG ; | |
211 | Color_t markercolor = 1 ; | |
212 | Size_t markersize = 1. ; | |
213 | Style_t markerstyle = 5 ; | |
214 | ||
215 | if (!gPad->IsBatch()) { | |
216 | gVirtualX->SetMarkerColor(markercolor) ; | |
217 | gVirtualX->SetMarkerSize (markersize) ; | |
218 | gVirtualX->SetMarkerStyle(markerstyle) ; | |
219 | } | |
220 | gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ; | |
221 | gPad->PaintPolyMarker(1,&x,&y,"") ; | |
a73f33f0 | 222 | } |
223 | ||
224 | //____________________________________________________________________________ | |
0a6d52e3 | 225 | void AliPHOSFastRecParticle::Print(const char * opt) |
a73f33f0 | 226 | { |
b2a60966 | 227 | // Print the typr, energy and momentum |
228 | ||
a73f33f0 | 229 | cout << "AliPHOSFastRecParticle > " << "type is " << Name() << endl |
230 | << " " << "Energy = " << fE << endl | |
231 | << " " << "Px = " << fPx << endl | |
232 | << " " << "Py = " << fPy << endl | |
233 | << " " << "Pz = " << fPz << endl ; | |
234 | } |