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.5 2000/10/02 21:28:12 fca
19 Removal of useless dependecies via forward declarations
21 Revision 1.4 2000/10/02 15:50:43 jbarbosa
22 Fixed forward declarations.
24 Revision 1.3 2000/06/12 15:26:36 jbarbosa
27 Revision 1.2 2000/05/18 13:43:54 jbarbosa
28 Added the ShowRing function.
30 Revision 1.1 2000/04/19 13:16:47 morsch
31 Minor changes on class names.
36 ///////////////////////////////////////////////////////////////////////////////
38 // This class contains the points for the ALICE event display //
42 <img src="gif/AliRICHPointsClass.gif">
47 ///////////////////////////////////////////////////////////////////////////////
52 #include <TPolyMarker3D.h>
53 #include <TMarker3DBox.h>
56 #include "TParticle.h"
57 #include "AliRICHDisplay.h"
58 #include "AliRICHPoints.h"
60 #include "AliRICHHit.h"
61 #include "AliRICHCerenkov.h"
62 #include "AliRICHPadHit.h"
63 #include "AliRICHDigit.h"
64 #include "AliRICHRawCluster.h"
65 #include "AliRICHRecHit.h"
67 const Int_t kMaxNipx=400, kMaxNipy=800;
69 ClassImp(AliRICHPoints)
71 //_____________________________________________________________________________
72 AliRICHPoints::AliRICHPoints()
75 // Default constructor
80 fMarker[0] = fMarker[1] = fMarker[2]=0;
83 //_____________________________________________________________________________
84 AliRICHPoints::AliRICHPoints(Int_t npoints)
88 // Standard constructor
93 fMarker[0] = fMarker[1] = fMarker[2]=0;
96 //_____________________________________________________________________________
97 AliRICHPoints::~AliRICHPoints()
100 // Default destructor
107 //_____________________________________________________________________________
108 void AliRICHPoints::DumpHit()
111 // Dump hit corresponding to this point
113 AliRICHHit *hit = GetHit();
114 if (hit) hit->Dump();
117 //_____________________________________________________________________________
118 void AliRICHPoints::DumpDigit()
121 // Dump digit corresponding to this point
123 AliRICHDigit *digit = GetDigit();
124 if (digit) digit->Dump();
127 //_____________________________________________________________________________
128 void AliRICHPoints::InspectHit()
131 // Inspect hit corresponding to this point
133 AliRICHHit *hit = GetHit();
134 if (hit) hit->Inspect();
137 //_____________________________________________________________________________
138 void AliRICHPoints::InspectDigit()
141 // Inspect digit corresponding to this point
143 AliRICHDigit *digit = GetDigit();
144 if (digit) digit->Inspect();
147 //_____________________________________________________________________________
148 Int_t AliRICHPoints::GetTrackIndex()
151 // Dump digit corresponding to this point
153 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
157 //_____________________________________________________________________________
158 TParticle *AliRICHPoints::GetParticle() const
161 // Returns pointer to particle index in AliRun::fParticles
163 TClonesArray *particles = gAlice->Particles();
164 Int_t nparticles = particles->GetEntriesFast();
165 if (fIndex < 0 || fIndex >= nparticles) return 0;
166 return (TParticle*)particles->UncheckedAt(fIndex);
169 //_____________________________________________________________________________
170 AliRICHHit *AliRICHPoints::GetHit() const
173 // Returns pointer to hit index in AliRun::fParticles
175 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
176 gAlice->TreeH()->GetEvent(fTrackIndex);
177 TClonesArray *pRICHhits = pRICH->Hits();
178 Int_t nhits = pRICHhits->GetEntriesFast();
179 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
180 return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex);
183 //_____________________________________________________________________________
184 AliRICHDigit *AliRICHPoints::GetDigit() const
187 // Returns pointer to digit index in AliRun::fParticles
190 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
191 Int_t chamber=display->GetChamber();
192 Int_t cathode=display->GetCathode();
194 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
195 TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1);
196 gAlice->TreeD()->GetEvent(cathode);
197 Int_t ndigits = pRICHdigits->GetEntriesFast();
198 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
199 return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
201 //----------------------------------------------------------------------------
202 void AliRICHPoints::ShowRing(Int_t highlight) {
205 // Highlights all pads generated by the same mother particle
208 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
209 AliRICHChamber* iChamber;
210 AliSegmentation* segmentation;
213 AliRICHPoints *points = 0;
214 TMarker3DBox *marker = 0;
216 AliRICHHit *mHit = GetHit();
218 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->fChamber);
220 TClonesArray *digits = pRICH->DigitsAddress(mHit->fChamber - 1);
221 iChamber = &(pRICH->Chamber(mHit->fChamber - 1));
222 segmentation=iChamber->GetSegmentationModel();
224 Float_t dpx = segmentation->Dpx();
225 Float_t dpy = segmentation->Dpy();
227 int ndigits=digits->GetEntriesFast();
229 printf("Show Ring called with %d digits\n",ndigits);
231 for (int digit=0;digit<ndigits;digit++) {
232 AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
233 points = new AliRICHPoints(1);
235 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
237 if (!points) continue;
238 if (fTrackIndex == mdig->fTracks[0]) {
240 printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->fTracks[0]);
242 Int_t charge=mdig->fSignal;
243 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
244 Int_t color=701+index;
245 if (color>722) color=722;
246 points->SetMarkerColor(color);
247 points->SetMarkerStyle(21);
248 points->SetMarkerSize(.5);
249 Float_t xpad, ypad, zpad;
250 segmentation->GetPadC(mdig->fPadX, mdig->fPadY,xpad, ypad, zpad);
251 Float_t vectorLoc[3]={xpad,6.276,ypad};
252 Float_t vectorGlob[3];
253 points->SetParticle(-1);
254 points->SetHitIndex(-1);
255 points->SetTrackIndex(-1);
256 points->SetDigitIndex(digit);
257 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
258 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
260 segmentation->GetPadC(mdig->fPadX, mdig->fPadY, xpad, ypad, zpad);
261 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
262 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
263 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
264 dpy/2,0,dpx/2,theta,phi);
265 marker->SetLineColor(highlight);
266 marker->SetFillStyle(1001);
267 marker->SetFillColor(color);
268 marker->SetRefObject((TObject*)points);
269 points->Set3DMarker(0, marker);
271 points->Draw("same");
272 for (Int_t im=0;im<3;im++) {
273 TMarker3DBox *marker=points->GetMarker(im);
277 TClonesArray *particles=gAlice->Particles();
278 TParticle *p = (TParticle*)particles->UncheckedAt(fIndex);
279 printf("\nTrack index %d\n",fTrackIndex);
280 printf("Particle ID %d\n",p->GetPdgCode());
281 printf("Parent %d\n",p->GetFirstMother());
282 printf("First child %d\n",p->GetFirstDaughter());
283 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
288 //_____________________________________________________________________________
289 const Text_t *AliRICHPoints::GetName() const
292 // Return name of the Geant3 particle corresponding to this point
294 TParticle *particle = GetParticle();
295 if (!particle) return "Particle";
296 return particle->GetName();
299 //_____________________________________________________________________________
300 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
303 // Redefines TObject::GetObjectInfo.
304 // Displays the info (particle,etc
305 // corresponding to cursor position px,py
307 static char info[64];
308 sprintf(info,"%s %d",GetName(),fIndex);