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