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"
47 const Int_t kMaxNipx=400, kMaxNipy=800;
49 ClassImp(AliRICHPoints)
51 //_____________________________________________________________________________
52 AliRICHPoints::AliRICHPoints()
55 // Default constructor
60 fMarker[0] = fMarker[1] = fMarker[2]=0;
63 //_____________________________________________________________________________
64 AliRICHPoints::AliRICHPoints(Int_t npoints)
68 // Standard constructor
73 fMarker[0] = fMarker[1] = fMarker[2]=0;
76 //_____________________________________________________________________________
77 AliRICHPoints::~AliRICHPoints()
87 //_____________________________________________________________________________
88 void AliRICHPoints::DumpHit()
91 // Dump hit corresponding to this point
93 AliRICHhit *hit = GetHit();
97 //_____________________________________________________________________________
98 void AliRICHPoints::DumpDigit()
101 // Dump digit corresponding to this point
103 AliRICHDigit *digit = GetDigit();
104 if (digit) digit->Dump();
107 //_____________________________________________________________________________
108 void AliRICHPoints::InspectHit()
111 // Inspect hit corresponding to this point
113 AliRICHhit *hit = GetHit();
114 if (hit) hit->Inspect();
117 //_____________________________________________________________________________
118 void AliRICHPoints::InspectDigit()
121 // Inspect digit corresponding to this point
123 AliRICHDigit *digit = GetDigit();
124 if (digit) digit->Inspect();
127 //_____________________________________________________________________________
128 Int_t AliRICHPoints::GetTrackIndex()
131 // Dump digit corresponding to this point
133 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
137 //_____________________________________________________________________________
138 TParticle *AliRICHPoints::GetParticle() const
141 // Returns pointer to particle index in AliRun::fParticles
143 if (fIndex < 0 || fIndex >= gAlice->GetMCApp()->GetNtrack()) return 0;
144 return gAlice->GetMCApp()->Particle(fIndex);
147 //_____________________________________________________________________________
148 AliRICHhit *AliRICHPoints::GetHit() const
151 // Returns pointer to hit index in AliRun::fParticles
153 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
154 pRICH->TreeH()->GetEvent(fTrackIndex);
155 TClonesArray *pRICHhits = pRICH->Hits();
156 Int_t nhits = pRICHhits->GetEntriesFast();
157 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
158 return (AliRICHhit*)pRICHhits->UncheckedAt(fHitIndex);
161 //_____________________________________________________________________________
162 AliRICHDigit *AliRICHPoints::GetDigit() const
165 // Returns pointer to digit index in AliRun::fParticles
168 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
169 Int_t chamber=display->GetChamber();
170 Int_t cathode=display->GetCathode();
172 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
173 TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1);
174 gAlice->TreeD()->GetEvent(cathode);
175 Int_t ndigits = pRICHdigits->GetEntriesFast();
176 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
177 return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
179 //----------------------------------------------------------------------------
180 void AliRICHPoints::ShowRing(Int_t highlight) {
183 // Highlights all pads generated by the same mother particle
186 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
187 AliRICHChamber* iChamber;
188 AliSegmentation* segmentation;
191 AliRICHPoints *points = 0;
192 TMarker3DBox *marker = 0;
194 AliRICHhit *mHit = GetHit();
196 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->Chamber());
198 TClonesArray *digits = pRICH->DigitsAddress(mHit->Chamber() - 1);
199 iChamber = &(pRICH->Chamber(mHit->Chamber() - 1));
200 segmentation=iChamber->GetSegmentationModel();
202 Float_t dpx = segmentation->Dpx();
203 Float_t dpy = segmentation->Dpy();
205 int ndigits=digits->GetEntriesFast();
207 printf("Show Ring called with %d digits\n",ndigits);
209 for (int digit=0;digit<ndigits;digit++) {
210 AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
211 points = new AliRICHPoints(1);
213 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
215 if (!points) continue;
216 if (fTrackIndex == mdig->Track(0)) {
218 printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->Track(0));
220 Int_t charge=mdig->Signal();
221 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(kadc_satm)/22));
222 Int_t color=701+index;
223 if (color>722) color=722;
224 points->SetMarkerColor(color);
225 points->SetMarkerStyle(21);
226 points->SetMarkerSize(.5);
227 Float_t xpad, ypad, zpad;
228 segmentation->GetPadC(mdig->PadX(), mdig->PadY(),xpad, ypad, zpad);
229 Float_t vectorLoc[3]={xpad,6.276,ypad};
230 Float_t vectorGlob[3];
231 points->SetParticle(-1);
232 points->SetHitIndex(-1);
233 points->SetTrackIndex(-1);
234 points->SetDigitIndex(digit);
235 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
236 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
238 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
239 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
240 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
241 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
242 dpy/2,0,dpx/2,theta,phi);
243 marker->SetLineColor(highlight);
244 marker->SetFillStyle(1001);
245 marker->SetFillColor(color);
246 marker->SetRefObject((TObject*)points);
247 points->Set3DMarker(0, marker);
249 points->Draw("same");
250 for (Int_t im=0;im<3;im++) {
251 TMarker3DBox *marker=points->GetMarker(im);
255 TParticle *p = gAlice->GetMCApp()->Particle(fIndex);
256 printf("\nTrack index %d\n",fTrackIndex);
257 printf("Particle ID %d\n",p->GetPdgCode());
258 printf("Parent %d\n",p->GetFirstMother());
259 printf("First child %d\n",p->GetFirstDaughter());
260 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
265 //_____________________________________________________________________________
266 const Text_t *AliRICHPoints::GetName() const
269 // Return name of the Geant3 particle corresponding to this point
271 TParticle *particle = GetParticle();
272 if (!particle) return "Particle";
273 return particle->GetName();
276 //_____________________________________________________________________________
277 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
280 // Redefines TObject::GetObjectInfo.
281 // Displays the info (particle,etc
282 // corresponding to cursor position px,py
284 static char info[64];
285 sprintf(info,"%s %d",GetName(),fIndex);