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.9 2001/02/27 15:20:56 jbarbosa
19 Transition to SDigits.
21 Revision 1.8 2001/01/26 20:00:27 hristov
22 Major upgrade of AliRoot code
24 Revision 1.7 2000/11/02 09:10:57 jbarbosa
25 Removed AliRICHRecHit.h from include.
27 Revision 1.6 2000/10/03 21:44:09 morsch
28 Use AliSegmentation and AliHit abstract base classes.
30 Revision 1.5 2000/10/02 21:28:12 fca
31 Removal of useless dependecies via forward declarations
33 Revision 1.4 2000/10/02 15:50:43 jbarbosa
34 Fixed forward declarations.
36 Revision 1.3 2000/06/12 15:26:36 jbarbosa
39 Revision 1.2 2000/05/18 13:43:54 jbarbosa
40 Added the ShowRing function.
42 Revision 1.1 2000/04/19 13:16:47 morsch
43 Minor changes on class names.
48 ///////////////////////////////////////////////////////////////////////////////
50 // This class contains the points for the ALICE event display //
54 <img src="gif/AliRICHPointsClass.gif">
59 ///////////////////////////////////////////////////////////////////////////////
64 #include <TPolyMarker3D.h>
65 #include <TMarker3DBox.h>
68 #include "TParticle.h"
69 #include "AliRICHDisplay.h"
70 #include "AliRICHPoints.h"
72 #include "AliRICHHit.h"
73 #include "AliRICHCerenkov.h"
74 #include "AliRICHSDigit.h"
75 #include "AliRICHDigit.h"
76 #include "AliRICHRawCluster.h"
78 const Int_t kMaxNipx=400, kMaxNipy=800;
80 ClassImp(AliRICHPoints)
82 //_____________________________________________________________________________
83 AliRICHPoints::AliRICHPoints()
86 // Default constructor
91 fMarker[0] = fMarker[1] = fMarker[2]=0;
94 //_____________________________________________________________________________
95 AliRICHPoints::AliRICHPoints(Int_t npoints)
99 // Standard constructor
104 fMarker[0] = fMarker[1] = fMarker[2]=0;
107 //_____________________________________________________________________________
108 AliRICHPoints::~AliRICHPoints()
111 // Default destructor
118 //_____________________________________________________________________________
119 void AliRICHPoints::DumpHit()
122 // Dump hit corresponding to this point
124 AliRICHHit *hit = GetHit();
125 if (hit) hit->Dump();
128 //_____________________________________________________________________________
129 void AliRICHPoints::DumpDigit()
132 // Dump digit corresponding to this point
134 AliRICHDigit *digit = GetDigit();
135 if (digit) digit->Dump();
138 //_____________________________________________________________________________
139 void AliRICHPoints::InspectHit()
142 // Inspect hit corresponding to this point
144 AliRICHHit *hit = GetHit();
145 if (hit) hit->Inspect();
148 //_____________________________________________________________________________
149 void AliRICHPoints::InspectDigit()
152 // Inspect digit corresponding to this point
154 AliRICHDigit *digit = GetDigit();
155 if (digit) digit->Inspect();
158 //_____________________________________________________________________________
159 Int_t AliRICHPoints::GetTrackIndex()
162 // Dump digit corresponding to this point
164 printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
168 //_____________________________________________________________________________
169 TParticle *AliRICHPoints::GetParticle() const
172 // Returns pointer to particle index in AliRun::fParticles
174 if (fIndex < 0 || fIndex >= gAlice->GetNtrack()) return 0;
175 return gAlice->Particle(fIndex);
178 //_____________________________________________________________________________
179 AliRICHHit *AliRICHPoints::GetHit() const
182 // Returns pointer to hit index in AliRun::fParticles
184 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
185 gAlice->TreeH()->GetEvent(fTrackIndex);
186 TClonesArray *pRICHhits = pRICH->Hits();
187 Int_t nhits = pRICHhits->GetEntriesFast();
188 if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
189 return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex);
192 //_____________________________________________________________________________
193 AliRICHDigit *AliRICHPoints::GetDigit() const
196 // Returns pointer to digit index in AliRun::fParticles
199 AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
200 Int_t chamber=display->GetChamber();
201 Int_t cathode=display->GetCathode();
203 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
204 TClonesArray *pRICHdigits = pRICH->DigitsAddress(chamber-1);
205 gAlice->TreeD()->GetEvent(cathode);
206 Int_t ndigits = pRICHdigits->GetEntriesFast();
207 if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
208 return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
210 //----------------------------------------------------------------------------
211 void AliRICHPoints::ShowRing(Int_t highlight) {
214 // Highlights all pads generated by the same mother particle
217 AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH");
218 AliRICHChamber* iChamber;
219 AliSegmentation* segmentation;
222 AliRICHPoints *points = 0;
223 TMarker3DBox *marker = 0;
225 AliRICHHit *mHit = GetHit();
227 printf("Hit %d on chamber: %d\n",fHitIndex, mHit->Chamber());
229 TClonesArray *digits = pRICH->DigitsAddress(mHit->Chamber() - 1);
230 iChamber = &(pRICH->Chamber(mHit->Chamber() - 1));
231 segmentation=iChamber->GetSegmentationModel();
233 Float_t dpx = segmentation->Dpx();
234 Float_t dpy = segmentation->Dpy();
236 int ndigits=digits->GetEntriesFast();
238 printf("Show Ring called with %d digits\n",ndigits);
240 for (int digit=0;digit<ndigits;digit++) {
241 AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
242 points = new AliRICHPoints(1);
244 //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
246 if (!points) continue;
247 if (fTrackIndex == mdig->Track(0)) {
249 printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->Track(0));
251 Int_t charge=mdig->Signal();
252 Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
253 Int_t color=701+index;
254 if (color>722) color=722;
255 points->SetMarkerColor(color);
256 points->SetMarkerStyle(21);
257 points->SetMarkerSize(.5);
258 Float_t xpad, ypad, zpad;
259 segmentation->GetPadC(mdig->PadX(), mdig->PadY(),xpad, ypad, zpad);
260 Float_t vectorLoc[3]={xpad,6.276,ypad};
261 Float_t vectorGlob[3];
262 points->SetParticle(-1);
263 points->SetHitIndex(-1);
264 points->SetTrackIndex(-1);
265 points->SetDigitIndex(digit);
266 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
267 points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
269 segmentation->GetPadC(mdig->PadX(), mdig->PadY(), xpad, ypad, zpad);
270 Float_t theta = iChamber->GetRotMatrix()->GetTheta();
271 Float_t phi = iChamber->GetRotMatrix()->GetPhi();
272 marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
273 dpy/2,0,dpx/2,theta,phi);
274 marker->SetLineColor(highlight);
275 marker->SetFillStyle(1001);
276 marker->SetFillColor(color);
277 marker->SetRefObject((TObject*)points);
278 points->Set3DMarker(0, marker);
280 points->Draw("same");
281 for (Int_t im=0;im<3;im++) {
282 TMarker3DBox *marker=points->GetMarker(im);
286 TParticle *p = gAlice->Particle(fIndex);
287 printf("\nTrack index %d\n",fTrackIndex);
288 printf("Particle ID %d\n",p->GetPdgCode());
289 printf("Parent %d\n",p->GetFirstMother());
290 printf("First child %d\n",p->GetFirstDaughter());
291 printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
296 //_____________________________________________________________________________
297 const Text_t *AliRICHPoints::GetName() const
300 // Return name of the Geant3 particle corresponding to this point
302 TParticle *particle = GetParticle();
303 if (!particle) return "Particle";
304 return particle->GetName();
307 //_____________________________________________________________________________
308 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
311 // Redefines TObject::GetObjectInfo.
312 // Displays the info (particle,etc
313 // corresponding to cursor position px,py
315 static char info[64];
316 sprintf(info,"%s %d",GetName(),fIndex);