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.10.4.1 2002/05/31 09:37:59 hristov
19 First set of changes done by Piotr
21 Revision 1.10 2001/10/23 13:03:35 hristov
22 The access to several data members was changed from public to protected. The digitisation was adapted to the multi-event case (J.Chudoba)
24 Revision 1.9 2001/02/27 15:20:56 jbarbosa
25 Transition to SDigits.
27 Revision 1.8 2001/01/26 20:00:27 hristov
28 Major upgrade of AliRoot code
30 Revision 1.7 2000/11/02 09:10:57 jbarbosa
31 Removed AliRICHRecHit.h from include.
33 Revision 1.6 2000/10/03 21:44:09 morsch
34 Use AliSegmentation and AliHit abstract base classes.
36 Revision 1.5 2000/10/02 21:28:12 fca
37 Removal of useless dependecies via forward declarations
39 Revision 1.4 2000/10/02 15:50:43 jbarbosa
40 Fixed forward declarations.
42 Revision 1.3 2000/06/12 15:26:36 jbarbosa
45 Revision 1.2 2000/05/18 13:43:54 jbarbosa
46 Added the ShowRing function.
48 Revision 1.1 2000/04/19 13:16:47 morsch
49 Minor changes on class names.
54 ///////////////////////////////////////////////////////////////////////////////
56 // This class contains the points for the ALICE event display //
60 <img src="gif/AliRICHPointsClass.gif">
65 ///////////////////////////////////////////////////////////////////////////////
70 #include <TPolyMarker3D.h>
71 #include <TMarker3DBox.h>
74 #include "TParticle.h"
75 #include "AliRICHDisplay.h"
76 #include "AliRICHPoints.h"
78 #include "AliRICHHit.h"
79 #include "AliRICHCerenkov.h"
80 #include "AliRICHSDigit.h"
81 #include "AliRICHDigit.h"
82 #include "AliRICHRawCluster.h"
84 const Int_t kMaxNipx=400, kMaxNipy=800;
86 ClassImp(AliRICHPoints)
88 //_____________________________________________________________________________
89 AliRICHPoints::AliRICHPoints()
92 // Default constructor
97 fMarker[0] = fMarker[1] = fMarker[2]=0;
100 //_____________________________________________________________________________
101 AliRICHPoints::AliRICHPoints(Int_t npoints)
105 // Standard constructor
110 fMarker[0] = fMarker[1] = fMarker[2]=0;
113 //_____________________________________________________________________________
114 AliRICHPoints::~AliRICHPoints()
117 // Default destructor
124 //_____________________________________________________________________________
125 void AliRICHPoints::DumpHit()
128 // Dump hit corresponding to this point
130 AliRICHHit *hit = GetHit();
131 if (hit) hit->Dump();
134 //_____________________________________________________________________________
135 void AliRICHPoints::DumpDigit()
138 // Dump digit corresponding to this point
140 AliRICHDigit *digit = GetDigit();
141 if (digit) digit->Dump();
144 //_____________________________________________________________________________
145 void AliRICHPoints::InspectHit()
148 // Inspect hit corresponding to this point
150 AliRICHHit *hit = GetHit();
151 if (hit) hit->Inspect();
154 //_____________________________________________________________________________
155 void AliRICHPoints::InspectDigit()
158 // Inspect digit corresponding to this point
160 AliRICHDigit *digit = GetDigit();
161 if (digit) digit->Inspect();
164 //_____________________________________________________________________________
165 Int_t AliRICHPoints::GetTrackIndex()
168 // Dump digit corresponding to this point
170 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
174 //_____________________________________________________________________________
175 TParticle *AliRICHPoints::GetParticle() const
178 // Returns pointer to particle index in AliRun::fParticles
180 if (fIndex < 0 || fIndex >= gAlice->GetNtrack()) return 0;
181 return gAlice->Particle(fIndex);
184 //_____________________________________________________________________________
185 AliRICHHit *AliRICHPoints::GetHit() const
188 // Returns pointer to hit index in AliRun::fParticles
190 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
191 pRICH->TreeH()->GetEvent(fTrackIndex);
192 TClonesArray *pRICHhits = pRICH->Hits();
193 Int_t nhits = pRICHhits->GetEntriesFast();
194 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
195 return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex);
198 //_____________________________________________________________________________
199 AliRICHDigit *AliRICHPoints::GetDigit() const
202 // Returns pointer to digit index in AliRun::fParticles
205 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
206 Int_t chamber=display->GetChamber();
207 Int_t cathode=display->GetCathode();
209 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
210 TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1);
211 gAlice->TreeD()->GetEvent(cathode);
212 Int_t ndigits = pRICHdigits->GetEntriesFast();
213 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
214 return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
216 //----------------------------------------------------------------------------
217 void AliRICHPoints::ShowRing(Int_t highlight) {
220 // Highlights all pads generated by the same mother particle
223 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
224 AliRICHChamber* iChamber;
225 AliSegmentation* segmentation;
228 AliRICHPoints *points = 0;
229 TMarker3DBox *marker = 0;
231 AliRICHHit *mHit = GetHit();
233 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->Chamber());
235 TClonesArray *digits = pRICH->DigitsAddress(mHit->Chamber() - 1);
236 iChamber = &(pRICH->Chamber(mHit->Chamber() - 1));
237 segmentation=iChamber->GetSegmentationModel();
239 Float_t dpx = segmentation->Dpx();
240 Float_t dpy = segmentation->Dpy();
242 int ndigits=digits->GetEntriesFast();
244 printf("Show Ring called with %d digits\n",ndigits);
246 for (int digit=0;digit<ndigits;digit++) {
247 AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
248 points = new AliRICHPoints(1);
250 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
252 if (!points) continue;
253 if (fTrackIndex == mdig->Track(0)) {
255 printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->Track(0));
257 Int_t charge=mdig->Signal();
258 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
259 Int_t color=701+index;
260 if (color>722) color=722;
261 points->SetMarkerColor(color);
262 points->SetMarkerStyle(21);
263 points->SetMarkerSize(.5);
264 Float_t xpad, ypad, zpad;
265 segmentation->GetPadC(mdig->PadX(), mdig->PadY(),xpad, ypad, zpad);
266 Float_t vectorLoc[3]={xpad,6.276,ypad};
267 Float_t vectorGlob[3];
268 points->SetParticle(-1);
269 points->SetHitIndex(-1);
270 points->SetTrackIndex(-1);
271 points->SetDigitIndex(digit);
272 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
273 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
275 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
276 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
277 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
278 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
279 dpy/2,0,dpx/2,theta,phi);
280 marker->SetLineColor(highlight);
281 marker->SetFillStyle(1001);
282 marker->SetFillColor(color);
283 marker->SetRefObject((TObject*)points);
284 points->Set3DMarker(0, marker);
286 points->Draw("same");
287 for (Int_t im=0;im<3;im++) {
288 TMarker3DBox *marker=points->GetMarker(im);
292 TParticle *p = gAlice->Particle(fIndex);
293 printf("\nTrack index %d\n",fTrackIndex);
294 printf("Particle ID %d\n",p->GetPdgCode());
295 printf("Parent %d\n",p->GetFirstMother());
296 printf("First child %d\n",p->GetFirstDaughter());
297 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
302 //_____________________________________________________________________________
303 const Text_t *AliRICHPoints::GetName() const
306 // Return name of the Geant3 particle corresponding to this point
308 TParticle *particle = GetParticle();
309 if (!particle) return "Particle";
310 return particle->GetName();
313 //_____________________________________________________________________________
314 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
317 // Redefines TObject::GetObjectInfo.
318 // Displays the info (particle,etc
319 // corresponding to cursor position px,py
321 static char info[64];
322 sprintf(info,"%s %d",GetName(),fIndex);