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