]>
Commit | Line | Data |
---|---|---|
0279872e | 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 | $Log$ | |
94de3818 | 18 | Revision 1.4 2000/10/02 15:50:43 jbarbosa |
19 | Fixed forward declarations. | |
20 | ||
488e98ba | 21 | Revision 1.3 2000/06/12 15:26:36 jbarbosa |
22 | Cleaned up version. | |
23 | ||
237c933d | 24 | Revision 1.2 2000/05/18 13:43:54 jbarbosa |
25 | Added the ShowRing function. | |
26 | ||
7ea4320b | 27 | Revision 1.1 2000/04/19 13:16:47 morsch |
28 | Minor changes on class names. | |
29 | ||
0279872e | 30 | */ |
31 | ||
32 | ||
33 | /////////////////////////////////////////////////////////////////////////////// | |
34 | // // | |
35 | // This class contains the points for the ALICE event display // | |
36 | // // | |
37 | //Begin_Html | |
38 | /* | |
39 | <img src="gif/AliRICHPointsClass.gif"> | |
40 | */ | |
41 | //End_Html | |
42 | // // | |
43 | // // | |
44 | /////////////////////////////////////////////////////////////////////////////// | |
237c933d | 45 | #include <TPad.h> |
94de3818 | 46 | #include <TTree.h> |
237c933d | 47 | #include <TView.h> |
48 | #include <TMath.h> | |
488e98ba | 49 | #include <TPolyMarker3D.h> |
50 | #include <TMarker3DBox.h> | |
237c933d | 51 | |
488e98ba | 52 | #include <AliRICH.h> |
94de3818 | 53 | #include "TParticle.h" |
0279872e | 54 | #include "AliRICHDisplay.h" |
55 | #include "AliRICHPoints.h" | |
56 | #include "AliRun.h" | |
237c933d | 57 | #include "AliRICHHit.h" |
58 | #include "AliRICHCerenkov.h" | |
59 | #include "AliRICHPadHit.h" | |
60 | #include "AliRICHDigit.h" | |
61 | #include "AliRICHRawCluster.h" | |
62 | #include "AliRICHRecHit.h" | |
63 | ||
64 | const Int_t kMaxNipx=400, kMaxNipy=800; | |
0279872e | 65 | |
66 | ClassImp(AliRICHPoints) | |
67 | ||
68 | //_____________________________________________________________________________ | |
69 | AliRICHPoints::AliRICHPoints() | |
70 | { | |
71 | // | |
72 | // Default constructor | |
73 | // | |
74 | fHitIndex = 0; | |
75 | fTrackIndex = 0; | |
76 | fDigitIndex = 0; | |
77 | fMarker[0] = fMarker[1] = fMarker[2]=0; | |
78 | } | |
79 | ||
80 | //_____________________________________________________________________________ | |
81 | AliRICHPoints::AliRICHPoints(Int_t npoints) | |
82 | :AliPoints(npoints) | |
83 | { | |
84 | // | |
85 | // Standard constructor | |
86 | // | |
87 | fHitIndex = 0; | |
88 | fTrackIndex = 0; | |
89 | fDigitIndex = 0; | |
90 | fMarker[0] = fMarker[1] = fMarker[2]=0; | |
91 | } | |
92 | ||
93 | //_____________________________________________________________________________ | |
94 | AliRICHPoints::~AliRICHPoints() | |
95 | { | |
96 | // | |
97 | // Default destructor | |
98 | // | |
99 | fHitIndex = 0; | |
100 | fTrackIndex = 0; | |
101 | fDigitIndex = 0; | |
102 | } | |
103 | ||
104 | //_____________________________________________________________________________ | |
105 | void AliRICHPoints::DumpHit() | |
106 | { | |
107 | // | |
108 | // Dump hit corresponding to this point | |
109 | // | |
110 | AliRICHHit *hit = GetHit(); | |
111 | if (hit) hit->Dump(); | |
112 | } | |
113 | ||
114 | //_____________________________________________________________________________ | |
115 | void AliRICHPoints::DumpDigit() | |
116 | { | |
117 | // | |
118 | // Dump digit corresponding to this point | |
119 | // | |
120 | AliRICHDigit *digit = GetDigit(); | |
121 | if (digit) digit->Dump(); | |
122 | } | |
123 | ||
124 | //_____________________________________________________________________________ | |
125 | void AliRICHPoints::InspectHit() | |
126 | { | |
127 | // | |
128 | // Inspect hit corresponding to this point | |
129 | // | |
130 | AliRICHHit *hit = GetHit(); | |
131 | if (hit) hit->Inspect(); | |
132 | } | |
133 | ||
134 | //_____________________________________________________________________________ | |
135 | void AliRICHPoints::InspectDigit() | |
136 | { | |
137 | // | |
138 | // Inspect digit corresponding to this point | |
139 | // | |
140 | AliRICHDigit *digit = GetDigit(); | |
141 | if (digit) digit->Inspect(); | |
142 | } | |
143 | ||
144 | //_____________________________________________________________________________ | |
145 | Int_t AliRICHPoints::GetTrackIndex() | |
146 | { | |
147 | // | |
148 | // Dump digit corresponding to this point | |
149 | // | |
150 | printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex); | |
151 | this->Inspect(); | |
152 | return fTrackIndex; | |
153 | } | |
7ea4320b | 154 | //_____________________________________________________________________________ |
155 | TParticle *AliRICHPoints::GetParticle() const | |
156 | { | |
157 | // | |
158 | // Returns pointer to particle index in AliRun::fParticles | |
159 | // | |
160 | TClonesArray *particles = gAlice->Particles(); | |
161 | Int_t nparticles = particles->GetEntriesFast(); | |
162 | if (fIndex < 0 || fIndex >= nparticles) return 0; | |
163 | return (TParticle*)particles->UncheckedAt(fIndex); | |
164 | } | |
0279872e | 165 | |
166 | //_____________________________________________________________________________ | |
167 | AliRICHHit *AliRICHPoints::GetHit() const | |
168 | { | |
169 | // | |
170 | // Returns pointer to hit index in AliRun::fParticles | |
171 | // | |
237c933d | 172 | AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); |
0279872e | 173 | gAlice->TreeH()->GetEvent(fTrackIndex); |
237c933d | 174 | TClonesArray *pRICHhits = pRICH->Hits(); |
175 | Int_t nhits = pRICHhits->GetEntriesFast(); | |
0279872e | 176 | if (fHitIndex < 0 || fHitIndex >= nhits) return 0; |
237c933d | 177 | return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex); |
0279872e | 178 | } |
179 | ||
180 | //_____________________________________________________________________________ | |
181 | AliRICHDigit *AliRICHPoints::GetDigit() const | |
182 | { | |
183 | // | |
184 | // Returns pointer to digit index in AliRun::fParticles | |
185 | // | |
186 | ||
187 | AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display(); | |
188 | Int_t chamber=display->GetChamber(); | |
189 | Int_t cathode=display->GetCathode(); | |
190 | ||
237c933d | 191 | AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); |
192 | TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1); | |
0279872e | 193 | gAlice->TreeD()->GetEvent(cathode); |
237c933d | 194 | Int_t ndigits = pRICHdigits->GetEntriesFast(); |
0279872e | 195 | if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0; |
237c933d | 196 | return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex); |
0279872e | 197 | } |
7ea4320b | 198 | //---------------------------------------------------------------------------- |
199 | void AliRICHPoints::ShowRing(Int_t highlight) { | |
237c933d | 200 | |
201 | // | |
202 | // Highlights all pads generated by the same mother particle | |
203 | ||
7ea4320b | 204 | |
237c933d | 205 | AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); |
7ea4320b | 206 | AliRICHChamber* iChamber; |
207 | AliRICHSegmentation* segmentation; | |
208 | ||
209 | ||
210 | AliRICHPoints *points = 0; | |
211 | TMarker3DBox *marker = 0; | |
212 | ||
213 | AliRICHHit *mHit = GetHit(); | |
214 | ||
215 | printf("Hit %d on chamber: %d\n",fHitIndex, mHit->fChamber); | |
216 | ||
237c933d | 217 | TClonesArray *digits = pRICH->DigitsAddress(mHit->fChamber - 1); |
218 | iChamber = &(pRICH->Chamber(mHit->fChamber - 1)); | |
7ea4320b | 219 | segmentation=iChamber->GetSegmentationModel(); |
220 | ||
221 | Float_t dpx = segmentation->Dpx(); | |
222 | Float_t dpy = segmentation->Dpy(); | |
223 | ||
224 | int ndigits=digits->GetEntriesFast(); | |
225 | ||
226 | printf("Show Ring called with %d digits\n",ndigits); | |
227 | ||
228 | for (int digit=0;digit<ndigits;digit++) { | |
229 | AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit); | |
230 | points = new AliRICHPoints(1); | |
231 | ||
232 | //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]); | |
233 | ||
234 | if (!points) continue; | |
235 | if (fTrackIndex == mdig->fTracks[0]) { | |
236 | ||
237 | printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->fTracks[0]); | |
238 | ||
239 | Int_t charge=mdig->fSignal; | |
240 | Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22)); | |
241 | Int_t color=701+index; | |
242 | if (color>722) color=722; | |
243 | points->SetMarkerColor(color); | |
244 | points->SetMarkerStyle(21); | |
245 | points->SetMarkerSize(.5); | |
246 | Float_t xpad, ypad; | |
247 | segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad); | |
237c933d | 248 | Float_t vectorLoc[3]={xpad,6.276,ypad}; |
249 | Float_t vectorGlob[3]; | |
7ea4320b | 250 | points->SetParticle(-1); |
251 | points->SetHitIndex(-1); | |
252 | points->SetTrackIndex(-1); | |
253 | points->SetDigitIndex(digit); | |
237c933d | 254 | iChamber->LocaltoGlobal(vectorLoc,vectorGlob); |
255 | points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]); | |
7ea4320b | 256 | |
257 | segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY, xpad, ypad); | |
258 | Float_t theta = iChamber->GetRotMatrix()->GetTheta(); | |
259 | Float_t phi = iChamber->GetRotMatrix()->GetPhi(); | |
237c933d | 260 | marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2], |
7ea4320b | 261 | dpy/2,0,dpx/2,theta,phi); |
262 | marker->SetLineColor(highlight); | |
263 | marker->SetFillStyle(1001); | |
264 | marker->SetFillColor(color); | |
265 | marker->SetRefObject((TObject*)points); | |
266 | points->Set3DMarker(0, marker); | |
267 | ||
268 | points->Draw("same"); | |
269 | for (Int_t im=0;im<3;im++) { | |
270 | TMarker3DBox *marker=points->GetMarker(im); | |
271 | if (marker) | |
272 | marker->Draw(); | |
273 | } | |
274 | TClonesArray *particles=gAlice->Particles(); | |
275 | TParticle *p = (TParticle*)particles->UncheckedAt(fIndex); | |
276 | printf("\nTrack index %d\n",fTrackIndex); | |
277 | printf("Particle ID %d\n",p->GetPdgCode()); | |
278 | printf("Parent %d\n",p->GetFirstMother()); | |
279 | printf("First child %d\n",p->GetFirstDaughter()); | |
280 | printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz()); | |
281 | } | |
282 | } | |
283 | } | |
0279872e | 284 | |
285 | //_____________________________________________________________________________ | |
286 | const Text_t *AliRICHPoints::GetName() const | |
287 | { | |
288 | // | |
289 | // Return name of the Geant3 particle corresponding to this point | |
290 | // | |
291 | TParticle *particle = GetParticle(); | |
292 | if (!particle) return "Particle"; | |
293 | return particle->GetName(); | |
294 | } | |
295 | ||
296 | //_____________________________________________________________________________ | |
297 | Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t) | |
298 | { | |
299 | // | |
300 | // Redefines TObject::GetObjectInfo. | |
301 | // Displays the info (particle,etc | |
302 | // corresponding to cursor position px,py | |
303 | // | |
304 | static char info[64]; | |
305 | sprintf(info,"%s %d",GetName(),fIndex); | |
306 | return info; | |
307 | } | |
308 | ||
309 | ||
310 |