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 ///////////////////////////////////////////////////////////////////////////////
20 // This class contains the points for the ALICE event display //
24 <img src="gif/AliRICHPointsClass.gif">
29 ///////////////////////////////////////////////////////////////////////////////
34 #include <TPolyMarker3D.h>
35 #include <TMarker3DBox.h>
38 #include <TParticle.h>
39 #include "AliRICHDisplay.h"
40 #include "AliRICHPoints.h"
42 #include "AliRICHSDigit.h"
43 #include "AliRICHDigit.h"
44 #include "AliRICHRawCluster.h"
46 const Int_t kMaxNipx=400, kMaxNipy=800;
48 ClassImp(AliRICHPoints)
50 //_____________________________________________________________________________
51 AliRICHPoints::AliRICHPoints()
54 // Default constructor
59 fMarker[0] = fMarker[1] = fMarker[2]=0;
62 //_____________________________________________________________________________
63 AliRICHPoints::AliRICHPoints(Int_t npoints)
67 // Standard constructor
72 fMarker[0] = fMarker[1] = fMarker[2]=0;
75 //_____________________________________________________________________________
76 AliRICHPoints::~AliRICHPoints()
86 //_____________________________________________________________________________
87 void AliRICHPoints::DumpHit()
90 // Dump hit corresponding to this point
92 AliRICHhit *hit = GetHit();
96 //_____________________________________________________________________________
97 void AliRICHPoints::DumpDigit()
100 // Dump digit corresponding to this point
102 AliRICHDigit *digit = GetDigit();
103 if (digit) digit->Dump();
106 //_____________________________________________________________________________
107 void AliRICHPoints::InspectHit()
110 // Inspect hit corresponding to this point
112 AliRICHhit *hit = GetHit();
113 if (hit) hit->Inspect();
116 //_____________________________________________________________________________
117 void AliRICHPoints::InspectDigit()
120 // Inspect digit corresponding to this point
122 AliRICHDigit *digit = GetDigit();
123 if (digit) digit->Inspect();
126 //_____________________________________________________________________________
127 Int_t AliRICHPoints::GetTrackIndex()
130 // Dump digit corresponding to this point
132 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
136 //_____________________________________________________________________________
137 TParticle *AliRICHPoints::GetParticle() const
140 // Returns pointer to particle index in AliRun::fParticles
142 if (fIndex < 0 || fIndex >= gAlice->GetNtrack()) return 0;
143 return gAlice->Particle(fIndex);
146 //_____________________________________________________________________________
147 AliRICHhit *AliRICHPoints::GetHit() const
150 // Returns pointer to hit index in AliRun::fParticles
152 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
153 pRICH->TreeH()->GetEvent(fTrackIndex);
154 TClonesArray *pRICHhits = pRICH->Hits();
155 Int_t nhits = pRICHhits->GetEntriesFast();
156 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
157 return (AliRICHhit*)pRICHhits->UncheckedAt(fHitIndex);
160 //_____________________________________________________________________________
161 AliRICHDigit *AliRICHPoints::GetDigit() const
164 // Returns pointer to digit index in AliRun::fParticles
167 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
168 Int_t chamber=display->GetChamber();
169 Int_t cathode=display->GetCathode();
171 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
172 TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1);
173 gAlice->TreeD()->GetEvent(cathode);
174 Int_t ndigits = pRICHdigits->GetEntriesFast();
175 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
176 return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
178 //----------------------------------------------------------------------------
179 void AliRICHPoints::ShowRing(Int_t highlight) {
182 // Highlights all pads generated by the same mother particle
185 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
186 AliRICHChamber* iChamber;
187 AliSegmentation* segmentation;
190 AliRICHPoints *points = 0;
191 TMarker3DBox *marker = 0;
193 AliRICHhit *mHit = GetHit();
195 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->Chamber());
197 TClonesArray *digits = pRICH->DigitsAddress(mHit->Chamber() - 1);
198 iChamber = &(pRICH->Chamber(mHit->Chamber() - 1));
199 segmentation=iChamber->GetSegmentationModel();
201 Float_t dpx = segmentation->Dpx();
202 Float_t dpy = segmentation->Dpy();
204 int ndigits=digits->GetEntriesFast();
206 printf("Show Ring called with %d digits\n",ndigits);
208 for (int digit=0;digit<ndigits;digit++) {
209 AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
210 points = new AliRICHPoints(1);
212 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
214 if (!points) continue;
215 if (fTrackIndex == mdig->Track(0)) {
217 printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->Track(0));
219 Int_t charge=mdig->Signal();
220 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
221 Int_t color=701+index;
222 if (color>722) color=722;
223 points->SetMarkerColor(color);
224 points->SetMarkerStyle(21);
225 points->SetMarkerSize(.5);
226 Float_t xpad, ypad, zpad;
227 segmentation->GetPadC(mdig->PadX(), mdig->PadY(),xpad, ypad, zpad);
228 Float_t vectorLoc[3]={xpad,6.276,ypad};
229 Float_t vectorGlob[3];
230 points->SetParticle(-1);
231 points->SetHitIndex(-1);
232 points->SetTrackIndex(-1);
233 points->SetDigitIndex(digit);
234 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
235 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
237 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
238 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
239 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
240 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
241 dpy/2,0,dpx/2,theta,phi);
242 marker->SetLineColor(highlight);
243 marker->SetFillStyle(1001);
244 marker->SetFillColor(color);
245 marker->SetRefObject((TObject*)points);
246 points->Set3DMarker(0, marker);
248 points->Draw("same");
249 for (Int_t im=0;im<3;im++) {
250 TMarker3DBox *marker=points->GetMarker(im);
254 TParticle *p = gAlice->Particle(fIndex);
255 printf("\nTrack index %d\n",fTrackIndex);
256 printf("Particle ID %d\n",p->GetPdgCode());
257 printf("Parent %d\n",p->GetFirstMother());
258 printf("First child %d\n",p->GetFirstDaughter());
259 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
264 //_____________________________________________________________________________
265 const Text_t *AliRICHPoints::GetName() const
268 // Return name of the Geant3 particle corresponding to this point
270 TParticle *particle = GetParticle();
271 if (!particle) return "Particle";
272 return particle->GetName();
275 //_____________________________________________________________________________
276 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
279 // Redefines TObject::GetObjectInfo.
280 // Displays the info (particle,etc
281 // corresponding to cursor position px,py
283 static char info[64];
284 sprintf(info,"%s %d",GetName(),fIndex);