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.2 2000/05/18 13:43:54 jbarbosa
19 Added the ShowRing function.
21 Revision 1.1 2000/04/19 13:16:47 morsch
22 Minor changes on class names.
27 ///////////////////////////////////////////////////////////////////////////////
29 // This class contains the points for the ALICE event display //
33 <img src="gif/AliRICHPointsClass.gif">
38 ///////////////////////////////////////////////////////////////////////////////
43 #include "AliRICHDisplay.h"
44 #include "AliRICHPoints.h"
46 #include "AliRICHHit.h"
47 #include "AliRICHCerenkov.h"
48 #include "AliRICHPadHit.h"
49 #include "AliRICHDigit.h"
50 #include "AliRICHRawCluster.h"
51 #include "AliRICHRecHit.h"
53 const Int_t kMaxNipx=400, kMaxNipy=800;
55 ClassImp(AliRICHPoints)
57 //_____________________________________________________________________________
58 AliRICHPoints::AliRICHPoints()
61 // Default constructor
66 fMarker[0] = fMarker[1] = fMarker[2]=0;
69 //_____________________________________________________________________________
70 AliRICHPoints::AliRICHPoints(Int_t npoints)
74 // Standard constructor
79 fMarker[0] = fMarker[1] = fMarker[2]=0;
82 //_____________________________________________________________________________
83 AliRICHPoints::~AliRICHPoints()
93 //_____________________________________________________________________________
94 void AliRICHPoints::DumpHit()
97 // Dump hit corresponding to this point
99 AliRICHHit *hit = GetHit();
100 if (hit) hit->Dump();
103 //_____________________________________________________________________________
104 void AliRICHPoints::DumpDigit()
107 // Dump digit corresponding to this point
109 AliRICHDigit *digit = GetDigit();
110 if (digit) digit->Dump();
113 //_____________________________________________________________________________
114 void AliRICHPoints::InspectHit()
117 // Inspect hit corresponding to this point
119 AliRICHHit *hit = GetHit();
120 if (hit) hit->Inspect();
123 //_____________________________________________________________________________
124 void AliRICHPoints::InspectDigit()
127 // Inspect digit corresponding to this point
129 AliRICHDigit *digit = GetDigit();
130 if (digit) digit->Inspect();
133 //_____________________________________________________________________________
134 Int_t AliRICHPoints::GetTrackIndex()
137 // Dump digit corresponding to this point
139 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
143 //_____________________________________________________________________________
144 TParticle *AliRICHPoints::GetParticle() const
147 // Returns pointer to particle index in AliRun::fParticles
149 TClonesArray *particles = gAlice->Particles();
150 Int_t nparticles = particles->GetEntriesFast();
151 if (fIndex < 0 || fIndex >= nparticles) return 0;
152 return (TParticle*)particles->UncheckedAt(fIndex);
155 //_____________________________________________________________________________
156 AliRICHHit *AliRICHPoints::GetHit() const
159 // Returns pointer to hit index in AliRun::fParticles
161 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
162 gAlice->TreeH()->GetEvent(fTrackIndex);
163 TClonesArray *pRICHhits = pRICH->Hits();
164 Int_t nhits = pRICHhits->GetEntriesFast();
165 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
166 return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex);
169 //_____________________________________________________________________________
170 AliRICHDigit *AliRICHPoints::GetDigit() const
173 // Returns pointer to digit index in AliRun::fParticles
176 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
177 Int_t chamber=display->GetChamber();
178 Int_t cathode=display->GetCathode();
180 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
181 TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1);
182 gAlice->TreeD()->GetEvent(cathode);
183 Int_t ndigits = pRICHdigits->GetEntriesFast();
184 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
185 return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
187 //----------------------------------------------------------------------------
188 void AliRICHPoints::ShowRing(Int_t highlight) {
191 // Highlights all pads generated by the same mother particle
194 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
195 AliRICHChamber* iChamber;
196 AliRICHSegmentation* segmentation;
199 AliRICHPoints *points = 0;
200 TMarker3DBox *marker = 0;
202 AliRICHHit *mHit = GetHit();
204 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->fChamber);
206 TClonesArray *digits = pRICH->DigitsAddress(mHit->fChamber - 1);
207 iChamber = &(pRICH->Chamber(mHit->fChamber - 1));
208 segmentation=iChamber->GetSegmentationModel();
210 Float_t dpx = segmentation->Dpx();
211 Float_t dpy = segmentation->Dpy();
213 int ndigits=digits->GetEntriesFast();
215 printf("Show Ring called with %d digits\n",ndigits);
217 for (int digit=0;digit<ndigits;digit++) {
218 AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
219 points = new AliRICHPoints(1);
221 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
223 if (!points) continue;
224 if (fTrackIndex == mdig->fTracks[0]) {
226 printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->fTracks[0]);
228 Int_t charge=mdig->fSignal;
229 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
230 Int_t color=701+index;
231 if (color>722) color=722;
232 points->SetMarkerColor(color);
233 points->SetMarkerStyle(21);
234 points->SetMarkerSize(.5);
236 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
237 Float_t vectorLoc[3]={xpad,6.276,ypad};
238 Float_t vectorGlob[3];
239 points->SetParticle(-1);
240 points->SetHitIndex(-1);
241 points->SetTrackIndex(-1);
242 points->SetDigitIndex(digit);
243 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
244 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
246 segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY, xpad, ypad);
247 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
248 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
249 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
250 dpy/2,0,dpx/2,theta,phi);
251 marker->SetLineColor(highlight);
252 marker->SetFillStyle(1001);
253 marker->SetFillColor(color);
254 marker->SetRefObject((TObject*)points);
255 points->Set3DMarker(0, marker);
257 points->Draw("same");
258 for (Int_t im=0;im<3;im++) {
259 TMarker3DBox *marker=points->GetMarker(im);
263 TClonesArray *particles=gAlice->Particles();
264 TParticle *p = (TParticle*)particles->UncheckedAt(fIndex);
265 printf("\nTrack index %d\n",fTrackIndex);
266 printf("Particle ID %d\n",p->GetPdgCode());
267 printf("Parent %d\n",p->GetFirstMother());
268 printf("First child %d\n",p->GetFirstDaughter());
269 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
274 //_____________________________________________________________________________
275 const Text_t *AliRICHPoints::GetName() const
278 // Return name of the Geant3 particle corresponding to this point
280 TParticle *particle = GetParticle();
281 if (!particle) return "Particle";
282 return particle->GetName();
285 //_____________________________________________________________________________
286 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
289 // Redefines TObject::GetObjectInfo.
290 // Displays the info (particle,etc
291 // corresponding to cursor position px,py
293 static char info[64];
294 sprintf(info,"%s %d",GetName(),fIndex);