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"
45 const Int_t kMaxNipx=400, kMaxNipy=800;
47 ClassImp(AliRICHPoints)
49 //_____________________________________________________________________________
50 AliRICHPoints::AliRICHPoints()
53 // Default constructor
58 fMarker[0] = fMarker[1] = fMarker[2]=0;
61 //_____________________________________________________________________________
62 AliRICHPoints::AliRICHPoints(Int_t npoints)
66 // Standard constructor
71 fMarker[0] = fMarker[1] = fMarker[2]=0;
74 //_____________________________________________________________________________
75 AliRICHPoints::~AliRICHPoints()
85 //_____________________________________________________________________________
86 void AliRICHPoints::DumpHit()
89 // Dump hit corresponding to this point
91 AliRICHhit *hit = GetHit();
95 //_____________________________________________________________________________
96 void AliRICHPoints::DumpDigit()
99 // Dump digit corresponding to this point
101 AliRICHdigit *digit = GetDigit();
102 if (digit) digit->Dump();
105 //_____________________________________________________________________________
106 void AliRICHPoints::InspectHit()
109 // Inspect hit corresponding to this point
111 AliRICHhit *hit = GetHit();
112 if (hit) hit->Inspect();
115 //_____________________________________________________________________________
116 void AliRICHPoints::InspectDigit()
119 // Inspect digit corresponding to this point
121 AliRICHdigit *digit = GetDigit();
122 if (digit) digit->Inspect();
125 //_____________________________________________________________________________
126 Int_t AliRICHPoints::GetTrackIndex()
129 // Dump digit corresponding to this point
131 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
135 //_____________________________________________________________________________
136 TParticle *AliRICHPoints::GetParticle() const
139 // Returns pointer to particle index in AliRun::fParticles
141 if (fIndex < 0 || fIndex >= gAlice->GetMCApp()->GetNtrack()) return 0;
142 return gAlice->GetMCApp()->Particle(fIndex);
145 //_____________________________________________________________________________
146 AliRICHhit *AliRICHPoints::GetHit() const
149 // Returns pointer to hit index in AliRun::fParticles
151 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
152 pRICH->TreeH()->GetEvent(fTrackIndex);
153 TClonesArray *pRICHhits = pRICH->Hits();
154 Int_t nhits = pRICHhits->GetEntriesFast();
155 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
156 return (AliRICHhit*)pRICHhits->UncheckedAt(fHitIndex);
159 //_____________________________________________________________________________
160 AliRICHdigit *AliRICHPoints::GetDigit() const
163 // Returns pointer to digit index in AliRun::fParticles
166 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
167 Int_t chamber=display->GetChamber();
168 Int_t cathode=display->GetCathode();
170 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
171 TClonesArray *pRICHdigits = pRICH->Digits(chamber);
172 gAlice->TreeD()->GetEvent(cathode);
173 Int_t ndigits = pRICHdigits->GetEntriesFast();
174 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
175 return (AliRICHdigit*)pRICHdigits->UncheckedAt(fDigitIndex);
177 //----------------------------------------------------------------------------
178 void AliRICHPoints::ShowRing(Int_t highlight) {
181 // Highlights all pads generated by the same mother particle
184 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
185 AliRICHChamber* iChamber;
186 AliSegmentation* segmentation;
189 AliRICHPoints *points = 0;
190 TMarker3DBox *marker = 0;
192 AliRICHhit *mHit = GetHit();
194 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->Chamber());
196 TClonesArray *digits = pRICH->Digits(mHit->Chamber());
197 iChamber = &(pRICH->Chamber(mHit->Chamber() - 1));
198 segmentation=iChamber->GetSegmentationModel();
200 Float_t dpx = segmentation->Dpx();
201 Float_t dpy = segmentation->Dpy();
203 int ndigits=digits->GetEntriesFast();
205 printf("Show Ring called with %d digits\n",ndigits);
207 for (int digit=0;digit<ndigits;digit++) {
208 AliRICHdigit *mdig = (AliRICHdigit*)digits->UncheckedAt(digit);
209 points = new AliRICHPoints(1);
211 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
213 if (!points) continue;
214 if (fTrackIndex == mdig->T(0)) {
217 Int_t charge=(Int_t)mdig->Q();
218 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(kadc_satm)/22));
219 Int_t color=701+index;
220 if (color>722) color=722;
221 points->SetMarkerColor(color);
222 points->SetMarkerStyle(21);
223 points->SetMarkerSize(.5);
224 Float_t xpad, ypad, zpad;
225 segmentation->GetPadC(mdig->X(), mdig->Y(),xpad, ypad, zpad);
226 Float_t vectorLoc[3]={xpad,6.276,ypad};
227 Float_t vectorGlob[3];
228 points->SetParticle(-1);
229 points->SetHitIndex(-1);
230 points->SetTrackIndex(-1);
231 points->SetDigitIndex(digit);
232 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
233 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
235 segmentation->GetPadC(mdig->X(), mdig->Y(), xpad, ypad, zpad);
236 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
237 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
238 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
239 dpy/2,0,dpx/2,theta,phi);
240 marker->SetLineColor(highlight);
241 marker->SetFillStyle(1001);
242 marker->SetFillColor(color);
243 marker->SetRefObject((TObject*)points);
244 points->Set3DMarker(0, marker);
246 points->Draw("same");
247 for (Int_t im=0;im<3;im++) {
248 TMarker3DBox *marker=points->GetMarker(im);
252 TParticle *p = gAlice->GetMCApp()->Particle(fIndex);
253 printf("\nTrack index %d\n",fTrackIndex);
254 printf("Particle ID %d\n",p->GetPdgCode());
255 printf("Parent %d\n",p->GetFirstMother());
256 printf("First child %d\n",p->GetFirstDaughter());
257 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
262 //_____________________________________________________________________________
263 const Text_t *AliRICHPoints::GetName() const
266 // Return name of the Geant3 particle corresponding to this point
268 TParticle *particle = GetParticle();
269 if (!particle) return "Particle";
270 return particle->GetName();
273 //_____________________________________________________________________________
274 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
277 // Redefines TObject::GetObjectInfo.
278 // Displays the info (particle,etc
279 // corresponding to cursor position px,py
281 static char info[64];
282 sprintf(info,"%s %d",GetName(),fIndex);