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.3 2000/06/12 15:26:36 jbarbosa
21 Revision 1.2 2000/05/18 13:43:54 jbarbosa
22 Added the ShowRing function.
24 Revision 1.1 2000/04/19 13:16:47 morsch
25 Minor changes on class names.
30 ///////////////////////////////////////////////////////////////////////////////
32 // This class contains the points for the ALICE event display //
36 <img src="gif/AliRICHPointsClass.gif">
41 ///////////////////////////////////////////////////////////////////////////////
45 #include <TPolyMarker3D.h>
46 #include <TMarker3DBox.h>
49 #include "AliRICHDisplay.h"
50 #include "AliRICHPoints.h"
52 #include "AliRICHHit.h"
53 #include "AliRICHCerenkov.h"
54 #include "AliRICHPadHit.h"
55 #include "AliRICHDigit.h"
56 #include "AliRICHRawCluster.h"
57 #include "AliRICHRecHit.h"
59 const Int_t kMaxNipx=400, kMaxNipy=800;
61 ClassImp(AliRICHPoints)
63 //_____________________________________________________________________________
64 AliRICHPoints::AliRICHPoints()
67 // Default constructor
72 fMarker[0] = fMarker[1] = fMarker[2]=0;
75 //_____________________________________________________________________________
76 AliRICHPoints::AliRICHPoints(Int_t npoints)
80 // Standard constructor
85 fMarker[0] = fMarker[1] = fMarker[2]=0;
88 //_____________________________________________________________________________
89 AliRICHPoints::~AliRICHPoints()
99 //_____________________________________________________________________________
100 void AliRICHPoints::DumpHit()
103 // Dump hit corresponding to this point
105 AliRICHHit *hit = GetHit();
106 if (hit) hit->Dump();
109 //_____________________________________________________________________________
110 void AliRICHPoints::DumpDigit()
113 // Dump digit corresponding to this point
115 AliRICHDigit *digit = GetDigit();
116 if (digit) digit->Dump();
119 //_____________________________________________________________________________
120 void AliRICHPoints::InspectHit()
123 // Inspect hit corresponding to this point
125 AliRICHHit *hit = GetHit();
126 if (hit) hit->Inspect();
129 //_____________________________________________________________________________
130 void AliRICHPoints::InspectDigit()
133 // Inspect digit corresponding to this point
135 AliRICHDigit *digit = GetDigit();
136 if (digit) digit->Inspect();
139 //_____________________________________________________________________________
140 Int_t AliRICHPoints::GetTrackIndex()
143 // Dump digit corresponding to this point
145 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
149 //_____________________________________________________________________________
150 TParticle *AliRICHPoints::GetParticle() const
153 // Returns pointer to particle index in AliRun::fParticles
155 TClonesArray *particles = gAlice->Particles();
156 Int_t nparticles = particles->GetEntriesFast();
157 if (fIndex < 0 || fIndex >= nparticles) return 0;
158 return (TParticle*)particles->UncheckedAt(fIndex);
161 //_____________________________________________________________________________
162 AliRICHHit *AliRICHPoints::GetHit() const
165 // Returns pointer to hit index in AliRun::fParticles
167 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
168 gAlice->TreeH()->GetEvent(fTrackIndex);
169 TClonesArray *pRICHhits = pRICH->Hits();
170 Int_t nhits = pRICHhits->GetEntriesFast();
171 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
172 return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex);
175 //_____________________________________________________________________________
176 AliRICHDigit *AliRICHPoints::GetDigit() const
179 // Returns pointer to digit index in AliRun::fParticles
182 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
183 Int_t chamber=display->GetChamber();
184 Int_t cathode=display->GetCathode();
186 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
187 TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1);
188 gAlice->TreeD()->GetEvent(cathode);
189 Int_t ndigits = pRICHdigits->GetEntriesFast();
190 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
191 return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
193 //----------------------------------------------------------------------------
194 void AliRICHPoints::ShowRing(Int_t highlight) {
197 // Highlights all pads generated by the same mother particle
200 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
201 AliRICHChamber* iChamber;
202 AliRICHSegmentation* segmentation;
205 AliRICHPoints *points = 0;
206 TMarker3DBox *marker = 0;
208 AliRICHHit *mHit = GetHit();
210 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->fChamber);
212 TClonesArray *digits = pRICH->DigitsAddress(mHit->fChamber - 1);
213 iChamber = &(pRICH->Chamber(mHit->fChamber - 1));
214 segmentation=iChamber->GetSegmentationModel();
216 Float_t dpx = segmentation->Dpx();
217 Float_t dpy = segmentation->Dpy();
219 int ndigits=digits->GetEntriesFast();
221 printf("Show Ring called with %d digits\n",ndigits);
223 for (int digit=0;digit<ndigits;digit++) {
224 AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
225 points = new AliRICHPoints(1);
227 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
229 if (!points) continue;
230 if (fTrackIndex == mdig->fTracks[0]) {
232 printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->fTracks[0]);
234 Int_t charge=mdig->fSignal;
235 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
236 Int_t color=701+index;
237 if (color>722) color=722;
238 points->SetMarkerColor(color);
239 points->SetMarkerStyle(21);
240 points->SetMarkerSize(.5);
242 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
243 Float_t vectorLoc[3]={xpad,6.276,ypad};
244 Float_t vectorGlob[3];
245 points->SetParticle(-1);
246 points->SetHitIndex(-1);
247 points->SetTrackIndex(-1);
248 points->SetDigitIndex(digit);
249 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
250 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
252 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY, xpad, ypad);
253 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
254 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
255 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
256 dpy/2,0,dpx/2,theta,phi);
257 marker->SetLineColor(highlight);
258 marker->SetFillStyle(1001);
259 marker->SetFillColor(color);
260 marker->SetRefObject((TObject*)points);
261 points->Set3DMarker(0, marker);
263 points->Draw("same");
264 for (Int_t im=0;im<3;im++) {
265 TMarker3DBox *marker=points->GetMarker(im);
269 TClonesArray *particles=gAlice->Particles();
270 TParticle *p = (TParticle*)particles->UncheckedAt(fIndex);
271 printf("\nTrack index %d\n",fTrackIndex);
272 printf("Particle ID %d\n",p->GetPdgCode());
273 printf("Parent %d\n",p->GetFirstMother());
274 printf("First child %d\n",p->GetFirstDaughter());
275 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
280 //_____________________________________________________________________________
281 const Text_t *AliRICHPoints::GetName() const
284 // Return name of the Geant3 particle corresponding to this point
286 TParticle *particle = GetParticle();
287 if (!particle) return "Particle";
288 return particle->GetName();
291 //_____________________________________________________________________________
292 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
295 // Redefines TObject::GetObjectInfo.
296 // Displays the info (particle,etc
297 // corresponding to cursor position px,py
299 static char info[64];
300 sprintf(info,"%s %d",GetName(),fIndex);