]>
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; | |
78022019 | 92 | |
a73f33f0 | 93 | } |
94 | ||
a73f33f0 | 95 | //____________________________________________________________________________ |
96 | Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py) | |
97 | { | |
98 | // Compute distance from point px,py to a AliPHOSFastRecParticle considered as a Tmarker | |
99 | // Compute the closest distance of approach from point px,py to this marker. | |
100 | // The distance is computed in pixels units. | |
101 | ||
102 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
103 | Coord_t x = Phi() * kRADDEG ; | |
104 | Coord_t y = Theta() * kRADDEG ; | |
105 | const Int_t kMaxDiff = 10; | |
106 | Int_t pxm = gPad->XtoAbsPixel(x); | |
107 | Int_t pym = gPad->YtoAbsPixel(y); | |
108 | Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym); | |
109 | ||
110 | if (dist > kMaxDiff) return 9999; | |
111 | return dist; | |
112 | } | |
113 | ||
114 | //___________________________________________________________________________ | |
115 | void AliPHOSFastRecParticle::Draw(Option_t *option) | |
116 | { | |
117 | // Draw this AliPHOSFastRecParticle with its current attributes | |
118 | ||
119 | AppendPad(option); | |
120 | } | |
121 | ||
122 | //______________________________________________________________________________ | |
123 | void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py) | |
124 | { | |
125 | // Execute action corresponding to one event | |
126 | // This member function is called when a AliPHOSFastRecParticle is clicked with the locator | |
b2a60966 | 127 | |
a73f33f0 | 128 | if (!gPad->IsEditable()) |
129 | return ; | |
130 | ||
131 | static TPaveText * clustertext = 0 ; | |
132 | ||
133 | switch (event) { | |
134 | ||
135 | case kButton1Down: { | |
136 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
137 | Coord_t x = Phi() * kRADDEG ; | |
138 | Coord_t y = Theta() * kRADDEG ; | |
139 | clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ; | |
140 | Text_t line1[40] ; | |
141 | Text_t line2[40] ; | |
142 | sprintf( line1, "PID: %s ", (const char*)Name() ) ; | |
143 | sprintf( line2, "ENERGY: %f ", Energy() ) ; | |
144 | clustertext ->AddText(line1) ; | |
145 | clustertext ->AddText(line2) ; | |
146 | clustertext ->Draw(""); | |
147 | gPad->Update() ; | |
148 | break ; | |
149 | } | |
150 | ||
151 | case kButton1Up: { | |
152 | delete clustertext ; | |
153 | clustertext = 0 ; | |
154 | gPad->Update() ; | |
155 | break ; | |
156 | } | |
157 | ||
158 | } | |
159 | ||
160 | } | |
b2a60966 | 161 | |
a73f33f0 | 162 | //____________________________________________________________________________ |
163 | TString AliPHOSFastRecParticle::Name() | |
164 | { | |
b2a60966 | 165 | // Returns the name of the particle type |
166 | ||
a73f33f0 | 167 | TString name ; |
168 | switch (fType) { | |
169 | case kGAMMA: | |
170 | name = "PHOTON" ; | |
171 | break ; | |
172 | case kELECTRON: | |
173 | name = "ELECTRON" ; | |
174 | break ; | |
88714635 | 175 | case kCHARGEDHA: |
2aad621e | 176 | name = "CHARGED_HA" ; |
a73f33f0 | 177 | break ; |
88714635 | 178 | case kNEUTRALHA: |
2aad621e | 179 | name = "NEUTRAL_HA" ; |
a73f33f0 | 180 | break ; |
88714635 | 181 | case kNEUTRALEM: |
2aad621e | 182 | name = "NEUTRAL_EM" ; |
a73f33f0 | 183 | break ; |
88714635 | 184 | case kGAMMAHA: |
2aad621e | 185 | name = "PHOTON_HA" ; |
a73f33f0 | 186 | break ; |
187 | ||
188 | } | |
189 | return name ; | |
190 | } | |
191 | ||
192 | //______________________________________________________________________________ | |
193 | void AliPHOSFastRecParticle::Paint(Option_t *) | |
194 | { | |
b2a60966 | 195 | // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes |
a73f33f0 | 196 | |
197 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
b2a60966 | 198 | Coord_t x = Phi() * kRADDEG ; |
199 | Coord_t y = Theta() * kRADDEG ; | |
200 | Color_t markercolor = 1 ; | |
201 | Size_t markersize = 1. ; | |
202 | Style_t markerstyle = 5 ; | |
203 | ||
204 | if (!gPad->IsBatch()) { | |
205 | gVirtualX->SetMarkerColor(markercolor) ; | |
206 | gVirtualX->SetMarkerSize (markersize) ; | |
207 | gVirtualX->SetMarkerStyle(markerstyle) ; | |
208 | } | |
209 | gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ; | |
210 | gPad->PaintPolyMarker(1,&x,&y,"") ; | |
a73f33f0 | 211 | } |
212 | ||
213 | //____________________________________________________________________________ | |
0a6d52e3 | 214 | void AliPHOSFastRecParticle::Print(const char * opt) |
a73f33f0 | 215 | { |
b2a60966 | 216 | // Print the typr, energy and momentum |
217 | ||
a73f33f0 | 218 | cout << "AliPHOSFastRecParticle > " << "type is " << Name() << endl |
219 | << " " << "Energy = " << fE << endl | |
220 | << " " << "Px = " << fPx << endl | |
221 | << " " << "Py = " << fPy << endl | |
222 | << " " << "Pz = " << fPz << endl ; | |
223 | } |