1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.4 2000/10/02 15:50:43 jbarbosa
19 Fixed forward declarations.
21 Revision 1.3 2000/06/12 15:26:36 jbarbosa
24 Revision 1.2 2000/05/18 13:43:54 jbarbosa
25 Added the ShowRing function.
27 Revision 1.1 2000/04/19 13:16:47 morsch
28 Minor changes on class names.
33 ///////////////////////////////////////////////////////////////////////////////
35 // This class contains the points for the ALICE event display //
39 <img src="gif/AliRICHPointsClass.gif">
44 ///////////////////////////////////////////////////////////////////////////////
49 #include <TPolyMarker3D.h>
50 #include <TMarker3DBox.h>
53 #include "TParticle.h"
54 #include "AliRICHDisplay.h"
55 #include "AliRICHPoints.h"
57 #include "AliRICHHit.h"
58 #include "AliRICHCerenkov.h"
59 #include "AliRICHPadHit.h"
60 #include "AliRICHDigit.h"
61 #include "AliRICHRawCluster.h"
62 #include "AliRICHRecHit.h"
64 const Int_t kMaxNipx=400, kMaxNipy=800;
66 ClassImp(AliRICHPoints)
68 //_____________________________________________________________________________
69 AliRICHPoints::AliRICHPoints()
72 // Default constructor
77 fMarker[0] = fMarker[1] = fMarker[2]=0;
80 //_____________________________________________________________________________
81 AliRICHPoints::AliRICHPoints(Int_t npoints)
85 // Standard constructor
90 fMarker[0] = fMarker[1] = fMarker[2]=0;
93 //_____________________________________________________________________________
94 AliRICHPoints::~AliRICHPoints()
104 //_____________________________________________________________________________
105 void AliRICHPoints::DumpHit()
108 // Dump hit corresponding to this point
110 AliRICHHit *hit = GetHit();
111 if (hit) hit->Dump();
114 //_____________________________________________________________________________
115 void AliRICHPoints::DumpDigit()
118 // Dump digit corresponding to this point
120 AliRICHDigit *digit = GetDigit();
121 if (digit) digit->Dump();
124 //_____________________________________________________________________________
125 void AliRICHPoints::InspectHit()
128 // Inspect hit corresponding to this point
130 AliRICHHit *hit = GetHit();
131 if (hit) hit->Inspect();
134 //_____________________________________________________________________________
135 void AliRICHPoints::InspectDigit()
138 // Inspect digit corresponding to this point
140 AliRICHDigit *digit = GetDigit();
141 if (digit) digit->Inspect();
144 //_____________________________________________________________________________
145 Int_t AliRICHPoints::GetTrackIndex()
148 // Dump digit corresponding to this point
150 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
154 //_____________________________________________________________________________
155 TParticle *AliRICHPoints::GetParticle() const
158 // Returns pointer to particle index in AliRun::fParticles
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);
166 //_____________________________________________________________________________
167 AliRICHHit *AliRICHPoints::GetHit() const
170 // Returns pointer to hit index in AliRun::fParticles
172 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
173 gAlice->TreeH()->GetEvent(fTrackIndex);
174 TClonesArray *pRICHhits = pRICH->Hits();
175 Int_t nhits = pRICHhits->GetEntriesFast();
176 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
177 return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex);
180 //_____________________________________________________________________________
181 AliRICHDigit *AliRICHPoints::GetDigit() const
184 // Returns pointer to digit index in AliRun::fParticles
187 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
188 Int_t chamber=display->GetChamber();
189 Int_t cathode=display->GetCathode();
191 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
192 TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1);
193 gAlice->TreeD()->GetEvent(cathode);
194 Int_t ndigits = pRICHdigits->GetEntriesFast();
195 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
196 return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
198 //----------------------------------------------------------------------------
199 void AliRICHPoints::ShowRing(Int_t highlight) {
202 // Highlights all pads generated by the same mother particle
205 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
206 AliRICHChamber* iChamber;
207 AliRICHSegmentation* segmentation;
210 AliRICHPoints *points = 0;
211 TMarker3DBox *marker = 0;
213 AliRICHHit *mHit = GetHit();
215 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->fChamber);
217 TClonesArray *digits = pRICH->DigitsAddress(mHit->fChamber - 1);
218 iChamber = &(pRICH->Chamber(mHit->fChamber - 1));
219 segmentation=iChamber->GetSegmentationModel();
221 Float_t dpx = segmentation->Dpx();
222 Float_t dpy = segmentation->Dpy();
224 int ndigits=digits->GetEntriesFast();
226 printf("Show Ring called with %d digits\n",ndigits);
228 for (int digit=0;digit<ndigits;digit++) {
229 AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
230 points = new AliRICHPoints(1);
232 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
234 if (!points) continue;
235 if (fTrackIndex == mdig->fTracks[0]) {
237 printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->fTracks[0]);
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);
247 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
248 Float_t vectorLoc[3]={xpad,6.276,ypad};
249 Float_t vectorGlob[3];
250 points->SetParticle(-1);
251 points->SetHitIndex(-1);
252 points->SetTrackIndex(-1);
253 points->SetDigitIndex(digit);
254 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
255 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
257 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY, xpad, ypad);
258 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
259 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
260 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
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);
268 points->Draw("same");
269 for (Int_t im=0;im<3;im++) {
270 TMarker3DBox *marker=points->GetMarker(im);
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());
285 //_____________________________________________________________________________
286 const Text_t *AliRICHPoints::GetName() const
289 // Return name of the Geant3 particle corresponding to this point
291 TParticle *particle = GetParticle();
292 if (!particle) return "Particle";
293 return particle->GetName();
296 //_____________________________________________________________________________
297 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
300 // Redefines TObject::GetObjectInfo.
301 // Displays the info (particle,etc
302 // corresponding to cursor position px,py
304 static char info[64];
305 sprintf(info,"%s %d",GetName(),fIndex);