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