]>
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 | ||
16 | //_________________________________________________________________________ | |
17 | // Particle modified by PHOS response to be used by AliPHOSvFast | |
18 | //*-- Y. Schutz: SUBATECH | |
19 | ////////////////////////////////////////////////////////////////////////////// | |
20 | ||
21 | // --- ROOT system --- | |
22 | ||
23 | // --- Standard library --- | |
24 | ||
25 | #include <iostream> | |
26 | ||
27 | // --- AliRoot header files --- | |
28 | ||
29 | #include "AliPHOSFastRecParticle.h" | |
30 | #include "TPad.h" | |
31 | #include "TPaveText.h" | |
32 | ||
33 | ClassImp(AliPHOSFastRecParticle) | |
34 | ||
35 | //____________________________________________________________________________ | |
36 | AliPHOSFastRecParticle::AliPHOSFastRecParticle(const AliPHOSFastRecParticle & rp) | |
37 | { | |
38 | fType = rp.fType ; | |
cafda784 | 39 | fPdgCode = rp.fPdgCode; |
40 | fStatusCode = rp.fStatusCode; | |
41 | fMother[0] = rp.fMother[0]; | |
42 | fMother[1] = rp.fMother[1]; | |
43 | fDaughter[0] = rp.fDaughter[0]; | |
44 | fDaughter[1] = rp.fDaughter[1]; | |
45 | fWeight = rp.fWeight; | |
46 | fCalcMass = rp.fCalcMass; | |
47 | fPx = rp.fPx; | |
48 | fPy = rp.fPy; | |
49 | fPz = rp.fPz; | |
50 | fE = rp.fE; | |
51 | fVx = rp.fVx; | |
52 | fVy = rp.fVy; | |
53 | fVz = rp.fVz; | |
54 | fVt = rp.fVt; | |
55 | fPolarTheta = rp.fPolarTheta; | |
56 | fPolarPhi = rp.fPolarPhi; | |
57 | fParticlePDG = rp.fParticlePDG; | |
a73f33f0 | 58 | } |
59 | ||
60 | //____________________________________________________________________________ | |
61 | AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp) | |
62 | { | |
63 | TParticle & pnoconst = const_cast<TParticle &>(pp) ; | |
64 | AliPHOSFastRecParticle & p = static_cast<AliPHOSFastRecParticle&>(pnoconst) ; | |
65 | ||
66 | fPdgCode = p.fPdgCode; | |
67 | fStatusCode = p.fStatusCode; | |
68 | fMother[0] = p.fMother[0]; | |
69 | fMother[1] = p.fMother[1]; | |
70 | fDaughter[0] = p.fDaughter[0]; | |
71 | fDaughter[1] = p.fDaughter[1]; | |
72 | fWeight = p.fWeight; | |
73 | fCalcMass = p.fCalcMass; | |
74 | fPx = p.fPx; | |
75 | fPy = p.fPy; | |
76 | fPz = p.fPz; | |
77 | fE = p.fE; | |
78 | fVx = p.fVx; | |
79 | fVy = p.fVy; | |
80 | fVz = p.fVz; | |
81 | fVt = p.fVt; | |
82 | fPolarTheta = p.fPolarTheta; | |
83 | fPolarPhi = p.fPolarPhi; | |
84 | fParticlePDG = p.fParticlePDG; | |
85 | } | |
86 | ||
87 | //____________________________________________________________________________ | |
88 | AliPHOSFastRecParticle::~AliPHOSFastRecParticle() | |
89 | { | |
90 | } | |
91 | ||
92 | //____________________________________________________________________________ | |
93 | Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py) | |
94 | { | |
95 | // Compute distance from point px,py to a AliPHOSFastRecParticle considered as a Tmarker | |
96 | // Compute the closest distance of approach from point px,py to this marker. | |
97 | // The distance is computed in pixels units. | |
98 | ||
99 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
100 | Coord_t x = Phi() * kRADDEG ; | |
101 | Coord_t y = Theta() * kRADDEG ; | |
102 | const Int_t kMaxDiff = 10; | |
103 | Int_t pxm = gPad->XtoAbsPixel(x); | |
104 | Int_t pym = gPad->YtoAbsPixel(y); | |
105 | Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym); | |
106 | ||
107 | if (dist > kMaxDiff) return 9999; | |
108 | return dist; | |
109 | } | |
110 | ||
111 | //___________________________________________________________________________ | |
112 | void AliPHOSFastRecParticle::Draw(Option_t *option) | |
113 | { | |
114 | // Draw this AliPHOSFastRecParticle with its current attributes | |
115 | ||
116 | AppendPad(option); | |
117 | } | |
118 | ||
119 | //______________________________________________________________________________ | |
120 | void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py) | |
121 | { | |
122 | // Execute action corresponding to one event | |
123 | // This member function is called when a AliPHOSFastRecParticle is clicked with the locator | |
124 | // | |
125 | ||
126 | if (!gPad->IsEditable()) | |
127 | return ; | |
128 | ||
129 | static TPaveText * clustertext = 0 ; | |
130 | ||
131 | switch (event) { | |
132 | ||
133 | case kButton1Down: { | |
134 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
135 | Coord_t x = Phi() * kRADDEG ; | |
136 | Coord_t y = Theta() * kRADDEG ; | |
137 | clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ; | |
138 | Text_t line1[40] ; | |
139 | Text_t line2[40] ; | |
140 | sprintf( line1, "PID: %s ", (const char*)Name() ) ; | |
141 | sprintf( line2, "ENERGY: %f ", Energy() ) ; | |
142 | clustertext ->AddText(line1) ; | |
143 | clustertext ->AddText(line2) ; | |
144 | clustertext ->Draw(""); | |
145 | gPad->Update() ; | |
146 | break ; | |
147 | } | |
148 | ||
149 | case kButton1Up: { | |
150 | delete clustertext ; | |
151 | clustertext = 0 ; | |
152 | gPad->Update() ; | |
153 | break ; | |
154 | } | |
155 | ||
156 | } | |
157 | ||
158 | } | |
159 | //____________________________________________________________________________ | |
160 | TString AliPHOSFastRecParticle::Name() | |
161 | { | |
162 | TString name ; | |
163 | switch (fType) { | |
164 | case kGAMMA: | |
165 | name = "PHOTON" ; | |
166 | break ; | |
167 | case kELECTRON: | |
168 | name = "ELECTRON" ; | |
169 | break ; | |
170 | case kNEUTRAL: | |
171 | name = "NEUTRAL" ; | |
172 | break ; | |
173 | case kCHARGEDHADRON: | |
174 | name = "CHARGED HADRON" ; | |
175 | break ; | |
176 | case kNEUTRALHADRON: | |
177 | name = "NEUTRAL HADRON" ; | |
178 | break ; | |
179 | case kNEUTRALEM: | |
180 | name = "NEUTRAL EM" ; | |
181 | break ; | |
182 | case kGAMMAHADRON: | |
183 | name = "PHOTON HADRON" ; | |
184 | break ; | |
185 | ||
186 | } | |
187 | return name ; | |
188 | } | |
189 | ||
190 | //______________________________________________________________________________ | |
191 | void AliPHOSFastRecParticle::Paint(Option_t *) | |
192 | { | |
193 | // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes | |
194 | ||
195 | Double_t kRADDEG = 180. / TMath::Pi() ; | |
196 | Coord_t x = Phi() * kRADDEG ; | |
197 | Coord_t y = Theta() * kRADDEG ; | |
198 | Color_t markercolor = 1 ; | |
199 | Size_t markersize = 1. ; | |
200 | Style_t markerstyle = 5 ; | |
201 | ||
202 | if (!gPad->IsBatch()) { | |
203 | gVirtualX->SetMarkerColor(markercolor) ; | |
204 | gVirtualX->SetMarkerSize (markersize) ; | |
205 | gVirtualX->SetMarkerStyle(markerstyle) ; | |
206 | } | |
207 | gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ; | |
208 | gPad->PaintPolyMarker(1,&x,&y,"") ; | |
209 | } | |
210 | ||
211 | //____________________________________________________________________________ | |
212 | void AliPHOSFastRecParticle::Print() | |
213 | { | |
214 | cout << "AliPHOSFastRecParticle > " << "type is " << Name() << endl | |
215 | << " " << "Energy = " << fE << endl | |
216 | << " " << "Px = " << fPx << endl | |
217 | << " " << "Py = " << fPy << endl | |
218 | << " " << "Pz = " << fPz << endl ; | |
219 | } |