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