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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////////
18 // This class contains the points for the ALICE event display //
22 <img src="gif/AliRICHPointsClass.gif">
27 ///////////////////////////////////////////////////////////////////////////////
28 #include "AliRICHPoints.h"
29 #include "AliRICHDisplay.h"
30 #include "AliRICHChamber.h"
32 #include "AliRICHSDigit.h"
37 #include <TPolyMarker3D.h>
38 #include <TMarker3DBox.h>
39 #include <TParticle.h>
42 #include <TRotMatrix.h>
44 const Int_t kMaxNipx=400, kMaxNipy=800;
46 ClassImp(AliRICHPoints)
48 //_____________________________________________________________________________
49 AliRICHPoints::AliRICHPoints()
52 // Default constructor
57 fMarker[0] = fMarker[1] = fMarker[2]=0;
60 //_____________________________________________________________________________
61 AliRICHPoints::AliRICHPoints(Int_t npoints)
65 // Standard constructor
70 fMarker[0] = fMarker[1] = fMarker[2]=0;
73 //_____________________________________________________________________________
74 AliRICHPoints::~AliRICHPoints()
84 //_____________________________________________________________________________
85 void AliRICHPoints::DumpHit()
88 // Dump hit corresponding to this point
90 AliRICHhit *hit = GetHit();
94 //_____________________________________________________________________________
95 void AliRICHPoints::DumpDigit()
98 // Dump digit corresponding to this point
100 AliRICHdigit *digit = GetDigit();
101 if (digit) digit->Dump();
104 //_____________________________________________________________________________
105 void AliRICHPoints::InspectHit()
108 // Inspect hit corresponding to this point
110 AliRICHhit *hit = GetHit();
111 if (hit) hit->Inspect();
114 //_____________________________________________________________________________
115 void AliRICHPoints::InspectDigit()
118 // Inspect digit corresponding to this point
120 AliRICHdigit *digit = GetDigit();
121 if (digit) digit->Inspect();
124 //_____________________________________________________________________________
125 Int_t AliRICHPoints::GetTrackIndex()
128 // Dump digit corresponding to this point
130 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
134 //_____________________________________________________________________________
135 TParticle *AliRICHPoints::GetParticle() const
138 // Returns pointer to particle index in AliRun::fParticles
140 if (fIndex < 0 || fIndex >= gAlice->GetMCApp()->GetNtrack()) return 0;
141 return gAlice->GetMCApp()->Particle(fIndex);
144 //_____________________________________________________________________________
145 AliRICHhit *AliRICHPoints::GetHit() const
148 // Returns pointer to hit index in AliRun::fParticles
150 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
151 pRICH->TreeH()->GetEvent(fTrackIndex);
152 TClonesArray *pRICHhits = pRICH->Hits();
153 Int_t nhits = pRICHhits->GetEntriesFast();
154 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
155 return (AliRICHhit*)pRICHhits->UncheckedAt(fHitIndex);
158 //_____________________________________________________________________________
159 AliRICHdigit *AliRICHPoints::GetDigit() const
162 // Returns pointer to digit index in AliRun::fParticles
165 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
166 Int_t chamber=display->GetChamber();
167 Int_t cathode=display->GetCathode();
169 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
170 TClonesArray *pRICHdigits = pRICH->Digits(chamber);
171 gAlice->TreeD()->GetEvent(cathode);
172 Int_t ndigits = pRICHdigits->GetEntriesFast();
173 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
174 return (AliRICHdigit*)pRICHdigits->UncheckedAt(fDigitIndex);
176 //----------------------------------------------------------------------------
177 void AliRICHPoints::ShowRing(Int_t highlight) {
180 // Highlights all pads generated by the same mother particle
183 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
184 AliRICHChamber* iChamber;
185 AliSegmentation* segmentation;
188 AliRICHPoints *points = 0;
189 TMarker3DBox *marker = 0;
191 AliRICHhit *mHit = GetHit();
193 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->Chamber());
195 TClonesArray *digits = pRICH->Digits(mHit->Chamber());
196 iChamber = &(pRICH->Chamber(mHit->Chamber() - 1));
197 segmentation=iChamber->GetSegmentationModel();
199 Float_t dpx = segmentation->Dpx();
200 Float_t dpy = segmentation->Dpy();
202 int ndigits=digits->GetEntriesFast();
204 printf("Show Ring called with %d digits\n",ndigits);
206 for (int digit=0;digit<ndigits;digit++) {
207 AliRICHdigit *mdig = (AliRICHdigit*)digits->UncheckedAt(digit);
208 points = new AliRICHPoints(1);
210 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
212 if (!points) continue;
213 if (fTrackIndex == mdig->Tid(0)) {
216 Int_t charge=(Int_t)mdig->Q();
217 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(kadc_satm)/22));
218 Int_t color=701+index;
219 if (color>722) color=722;
220 points->SetMarkerColor(color);
221 points->SetMarkerStyle(21);
222 points->SetMarkerSize(.5);
223 Float_t xpad, ypad, zpad;
224 segmentation->GetPadC(mdig->X(), mdig->Y(),xpad, ypad, zpad);
225 Float_t vectorLoc[3]={xpad,6.276,ypad};
226 Float_t vectorGlob[3];
227 points->SetParticle(-1);
228 points->SetHitIndex(-1);
229 points->SetTrackIndex(-1);
230 points->SetDigitIndex(digit);
231 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
232 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
234 segmentation->GetPadC(mdig->X(), mdig->Y(), xpad, ypad, zpad);
235 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
236 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
237 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
238 dpy/2,0,dpx/2,theta,phi);
239 marker->SetLineColor(highlight);
240 marker->SetFillStyle(1001);
241 marker->SetFillColor(color);
242 marker->SetRefObject((TObject*)points);
243 points->Set3DMarker(0, marker);
245 points->Draw("same");
246 for (Int_t im=0;im<3;im++) {
247 TMarker3DBox *marker=points->GetMarker(im);
251 TParticle *p = gAlice->GetMCApp()->Particle(fIndex);
252 printf("\nTrack index %d\n",fTrackIndex);
253 printf("Particle ID %d\n",p->GetPdgCode());
254 printf("Parent %d\n",p->GetFirstMother());
255 printf("First child %d\n",p->GetFirstDaughter());
256 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
261 //_____________________________________________________________________________
262 const Text_t *AliRICHPoints::GetName() const
265 // Return name of the Geant3 particle corresponding to this point
267 TParticle *particle = GetParticle();
268 if (!particle) return "Particle";
269 return particle->GetName();
272 //_____________________________________________________________________________
273 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
276 // Redefines TObject::GetObjectInfo.
277 // Displays the info (particle,etc
278 // corresponding to cursor position px,py
280 static char info[64];
281 sprintf(info,"%s %d",GetName(),fIndex);