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.6 2000/10/03 21:44:09 morsch
19 Use AliSegmentation and AliHit abstract base classes.
21 Revision 1.5 2000/10/02 21:28:12 fca
22 Removal of useless dependecies via forward declarations
24 Revision 1.4 2000/10/02 15:50:43 jbarbosa
25 Fixed forward declarations.
27 Revision 1.3 2000/06/12 15:26:36 jbarbosa
30 Revision 1.2 2000/05/18 13:43:54 jbarbosa
31 Added the ShowRing function.
33 Revision 1.1 2000/04/19 13:16:47 morsch
34 Minor changes on class names.
39 ///////////////////////////////////////////////////////////////////////////////
41 // This class contains the points for the ALICE event display //
45 <img src="gif/AliRICHPointsClass.gif">
50 ///////////////////////////////////////////////////////////////////////////////
55 #include <TPolyMarker3D.h>
56 #include <TMarker3DBox.h>
59 #include "TParticle.h"
60 #include "AliRICHDisplay.h"
61 #include "AliRICHPoints.h"
63 #include "AliRICHHit.h"
64 #include "AliRICHCerenkov.h"
65 #include "AliRICHPadHit.h"
66 #include "AliRICHDigit.h"
67 #include "AliRICHRawCluster.h"
69 const Int_t kMaxNipx=400, kMaxNipy=800;
71 ClassImp(AliRICHPoints)
73 //_____________________________________________________________________________
74 AliRICHPoints::AliRICHPoints()
77 // Default constructor
82 fMarker[0] = fMarker[1] = fMarker[2]=0;
85 //_____________________________________________________________________________
86 AliRICHPoints::AliRICHPoints(Int_t npoints)
90 // Standard constructor
95 fMarker[0] = fMarker[1] = fMarker[2]=0;
98 //_____________________________________________________________________________
99 AliRICHPoints::~AliRICHPoints()
102 // Default destructor
109 //_____________________________________________________________________________
110 void AliRICHPoints::DumpHit()
113 // Dump hit corresponding to this point
115 AliRICHHit *hit = GetHit();
116 if (hit) hit->Dump();
119 //_____________________________________________________________________________
120 void AliRICHPoints::DumpDigit()
123 // Dump digit corresponding to this point
125 AliRICHDigit *digit = GetDigit();
126 if (digit) digit->Dump();
129 //_____________________________________________________________________________
130 void AliRICHPoints::InspectHit()
133 // Inspect hit corresponding to this point
135 AliRICHHit *hit = GetHit();
136 if (hit) hit->Inspect();
139 //_____________________________________________________________________________
140 void AliRICHPoints::InspectDigit()
143 // Inspect digit corresponding to this point
145 AliRICHDigit *digit = GetDigit();
146 if (digit) digit->Inspect();
149 //_____________________________________________________________________________
150 Int_t AliRICHPoints::GetTrackIndex()
153 // Dump digit corresponding to this point
155 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
159 //_____________________________________________________________________________
160 TParticle *AliRICHPoints::GetParticle() const
163 // Returns pointer to particle index in AliRun::fParticles
165 TClonesArray *particles = gAlice->Particles();
166 Int_t nparticles = particles->GetEntriesFast();
167 if (fIndex < 0 || fIndex >= nparticles) return 0;
168 return (TParticle*)particles->UncheckedAt(fIndex);
171 //_____________________________________________________________________________
172 AliRICHHit *AliRICHPoints::GetHit() const
175 // Returns pointer to hit index in AliRun::fParticles
177 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
178 gAlice->TreeH()->GetEvent(fTrackIndex);
179 TClonesArray *pRICHhits = pRICH->Hits();
180 Int_t nhits = pRICHhits->GetEntriesFast();
181 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
182 return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex);
185 //_____________________________________________________________________________
186 AliRICHDigit *AliRICHPoints::GetDigit() const
189 // Returns pointer to digit index in AliRun::fParticles
192 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
193 Int_t chamber=display->GetChamber();
194 Int_t cathode=display->GetCathode();
196 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
197 TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1);
198 gAlice->TreeD()->GetEvent(cathode);
199 Int_t ndigits = pRICHdigits->GetEntriesFast();
200 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
201 return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
203 //----------------------------------------------------------------------------
204 void AliRICHPoints::ShowRing(Int_t highlight) {
207 // Highlights all pads generated by the same mother particle
210 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
211 AliRICHChamber* iChamber;
212 AliSegmentation* segmentation;
215 AliRICHPoints *points = 0;
216 TMarker3DBox *marker = 0;
218 AliRICHHit *mHit = GetHit();
220 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->fChamber);
222 TClonesArray *digits = pRICH->DigitsAddress(mHit->fChamber - 1);
223 iChamber = &(pRICH->Chamber(mHit->fChamber - 1));
224 segmentation=iChamber->GetSegmentationModel();
226 Float_t dpx = segmentation->Dpx();
227 Float_t dpy = segmentation->Dpy();
229 int ndigits=digits->GetEntriesFast();
231 printf("Show Ring called with %d digits\n",ndigits);
233 for (int digit=0;digit<ndigits;digit++) {
234 AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
235 points = new AliRICHPoints(1);
237 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
239 if (!points) continue;
240 if (fTrackIndex == mdig->fTracks[0]) {
242 printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->fTracks[0]);
244 Int_t charge=mdig->fSignal;
245 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
246 Int_t color=701+index;
247 if (color>722) color=722;
248 points->SetMarkerColor(color);
249 points->SetMarkerStyle(21);
250 points->SetMarkerSize(.5);
251 Float_t xpad, ypad, zpad;
252 segmentation->GetPadC(mdig->fPadX, mdig->fPadY,xpad, ypad, zpad);
253 Float_t vectorLoc[3]={xpad,6.276,ypad};
254 Float_t vectorGlob[3];
255 points->SetParticle(-1);
256 points->SetHitIndex(-1);
257 points->SetTrackIndex(-1);
258 points->SetDigitIndex(digit);
259 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
260 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
262 segmentation->GetPadC(mdig->fPadX, mdig->fPadY, xpad, ypad, zpad);
263 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
264 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
265 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
266 dpy/2,0,dpx/2,theta,phi);
267 marker->SetLineColor(highlight);
268 marker->SetFillStyle(1001);
269 marker->SetFillColor(color);
270 marker->SetRefObject((TObject*)points);
271 points->Set3DMarker(0, marker);
273 points->Draw("same");
274 for (Int_t im=0;im<3;im++) {
275 TMarker3DBox *marker=points->GetMarker(im);
279 TClonesArray *particles=gAlice->Particles();
280 TParticle *p = (TParticle*)particles->UncheckedAt(fIndex);
281 printf("\nTrack index %d\n",fTrackIndex);
282 printf("Particle ID %d\n",p->GetPdgCode());
283 printf("Parent %d\n",p->GetFirstMother());
284 printf("First child %d\n",p->GetFirstDaughter());
285 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
290 //_____________________________________________________________________________
291 const Text_t *AliRICHPoints::GetName() const
294 // Return name of the Geant3 particle corresponding to this point
296 TParticle *particle = GetParticle();
297 if (!particle) return "Particle";
298 return particle->GetName();
301 //_____________________________________________________________________________
302 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
305 // Redefines TObject::GetObjectInfo.
306 // Displays the info (particle,etc
307 // corresponding to cursor position px,py
309 static char info[64];
310 sprintf(info,"%s %d",GetName(),fIndex);