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.8 2001/01/26 20:00:27 hristov
19 Major upgrade of AliRoot code
21 Revision 1.7 2000/11/02 09:10:57 jbarbosa
22 Removed AliRICHRecHit.h from include.
24 Revision 1.6 2000/10/03 21:44:09 morsch
25 Use AliSegmentation and AliHit abstract base classes.
27 Revision 1.5 2000/10/02 21:28:12 fca
28 Removal of useless dependecies via forward declarations
30 Revision 1.4 2000/10/02 15:50:43 jbarbosa
31 Fixed forward declarations.
33 Revision 1.3 2000/06/12 15:26:36 jbarbosa
36 Revision 1.2 2000/05/18 13:43:54 jbarbosa
37 Added the ShowRing function.
39 Revision 1.1 2000/04/19 13:16:47 morsch
40 Minor changes on class names.
45 ///////////////////////////////////////////////////////////////////////////////
47 // This class contains the points for the ALICE event display //
51 <img src="gif/AliRICHPointsClass.gif">
56 ///////////////////////////////////////////////////////////////////////////////
61 #include <TPolyMarker3D.h>
62 #include <TMarker3DBox.h>
65 #include "TParticle.h"
66 #include "AliRICHDisplay.h"
67 #include "AliRICHPoints.h"
69 #include "AliRICHHit.h"
70 #include "AliRICHCerenkov.h"
71 #include "AliRICHSDigit.h"
72 #include "AliRICHDigit.h"
73 #include "AliRICHRawCluster.h"
75 const Int_t kMaxNipx=400, kMaxNipy=800;
77 ClassImp(AliRICHPoints)
79 //_____________________________________________________________________________
80 AliRICHPoints::AliRICHPoints()
83 // Default constructor
88 fMarker[0] = fMarker[1] = fMarker[2]=0;
91 //_____________________________________________________________________________
92 AliRICHPoints::AliRICHPoints(Int_t npoints)
96 // Standard constructor
101 fMarker[0] = fMarker[1] = fMarker[2]=0;
104 //_____________________________________________________________________________
105 AliRICHPoints::~AliRICHPoints()
108 // Default destructor
115 //_____________________________________________________________________________
116 void AliRICHPoints::DumpHit()
119 // Dump hit corresponding to this point
121 AliRICHHit *hit = GetHit();
122 if (hit) hit->Dump();
125 //_____________________________________________________________________________
126 void AliRICHPoints::DumpDigit()
129 // Dump digit corresponding to this point
131 AliRICHDigit *digit = GetDigit();
132 if (digit) digit->Dump();
135 //_____________________________________________________________________________
136 void AliRICHPoints::InspectHit()
139 // Inspect hit corresponding to this point
141 AliRICHHit *hit = GetHit();
142 if (hit) hit->Inspect();
145 //_____________________________________________________________________________
146 void AliRICHPoints::InspectDigit()
149 // Inspect digit corresponding to this point
151 AliRICHDigit *digit = GetDigit();
152 if (digit) digit->Inspect();
155 //_____________________________________________________________________________
156 Int_t AliRICHPoints::GetTrackIndex()
159 // Dump digit corresponding to this point
161 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
165 //_____________________________________________________________________________
166 TParticle *AliRICHPoints::GetParticle() const
169 // Returns pointer to particle index in AliRun::fParticles
171 if (fIndex < 0 || fIndex >= gAlice->GetNtrack()) return 0;
172 return gAlice->Particle(fIndex);
175 //_____________________________________________________________________________
176 AliRICHHit *AliRICHPoints::GetHit() const
179 // Returns pointer to hit index in AliRun::fParticles
181 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
182 gAlice->TreeH()->GetEvent(fTrackIndex);
183 TClonesArray *pRICHhits = pRICH->Hits();
184 Int_t nhits = pRICHhits->GetEntriesFast();
185 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
186 return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex);
189 //_____________________________________________________________________________
190 AliRICHDigit *AliRICHPoints::GetDigit() const
193 // Returns pointer to digit index in AliRun::fParticles
196 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
197 Int_t chamber=display->GetChamber();
198 Int_t cathode=display->GetCathode();
200 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
201 TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1);
202 gAlice->TreeD()->GetEvent(cathode);
203 Int_t ndigits = pRICHdigits->GetEntriesFast();
204 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
205 return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
207 //----------------------------------------------------------------------------
208 void AliRICHPoints::ShowRing(Int_t highlight) {
211 // Highlights all pads generated by the same mother particle
214 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
215 AliRICHChamber* iChamber;
216 AliSegmentation* segmentation;
219 AliRICHPoints *points = 0;
220 TMarker3DBox *marker = 0;
222 AliRICHHit *mHit = GetHit();
224 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->fChamber);
226 TClonesArray *digits = pRICH->DigitsAddress(mHit->fChamber - 1);
227 iChamber = &(pRICH->Chamber(mHit->fChamber - 1));
228 segmentation=iChamber->GetSegmentationModel();
230 Float_t dpx = segmentation->Dpx();
231 Float_t dpy = segmentation->Dpy();
233 int ndigits=digits->GetEntriesFast();
235 printf("Show Ring called with %d digits\n",ndigits);
237 for (int digit=0;digit<ndigits;digit++) {
238 AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
239 points = new AliRICHPoints(1);
241 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
243 if (!points) continue;
244 if (fTrackIndex == mdig->fTracks[0]) {
246 printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->fTracks[0]);
248 Int_t charge=mdig->fSignal;
249 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
250 Int_t color=701+index;
251 if (color>722) color=722;
252 points->SetMarkerColor(color);
253 points->SetMarkerStyle(21);
254 points->SetMarkerSize(.5);
255 Float_t xpad, ypad, zpad;
256 segmentation->GetPadC(mdig->fPadX, mdig->fPadY,xpad, ypad, zpad);
257 Float_t vectorLoc[3]={xpad,6.276,ypad};
258 Float_t vectorGlob[3];
259 points->SetParticle(-1);
260 points->SetHitIndex(-1);
261 points->SetTrackIndex(-1);
262 points->SetDigitIndex(digit);
263 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
264 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
266 segmentation->GetPadC(mdig->fPadX, mdig->fPadY, xpad, ypad, zpad);
267 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
268 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
269 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
270 dpy/2,0,dpx/2,theta,phi);
271 marker->SetLineColor(highlight);
272 marker->SetFillStyle(1001);
273 marker->SetFillColor(color);
274 marker->SetRefObject((TObject*)points);
275 points->Set3DMarker(0, marker);
277 points->Draw("same");
278 for (Int_t im=0;im<3;im++) {
279 TMarker3DBox *marker=points->GetMarker(im);
283 TParticle *p = gAlice->Particle(fIndex);
284 printf("\nTrack index %d\n",fTrackIndex);
285 printf("Particle ID %d\n",p->GetPdgCode());
286 printf("Parent %d\n",p->GetFirstMother());
287 printf("First child %d\n",p->GetFirstDaughter());
288 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
293 //_____________________________________________________________________________
294 const Text_t *AliRICHPoints::GetName() const
297 // Return name of the Geant3 particle corresponding to this point
299 TParticle *particle = GetParticle();
300 if (!particle) return "Particle";
301 return particle->GetName();
304 //_____________________________________________________________________________
305 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
308 // Redefines TObject::GetObjectInfo.
309 // Displays the info (particle,etc
310 // corresponding to cursor position px,py
312 static char info[64];
313 sprintf(info,"%s %d",GetName(),fIndex);