]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHPoints.cxx
Fixed compiling error for HP (multiple declaration)
[u/mrichter/AliRoot.git] / RICH / AliRICHPoints.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
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  **************************************************************************/
15
16 /*
17   $Log$
18   Revision 1.2  2000/05/18 13:43:54  jbarbosa
19   Added the ShowRing function.
20
21   Revision 1.1  2000/04/19 13:16:47  morsch
22   Minor changes on class names.
23
24 */
25
26
27 ///////////////////////////////////////////////////////////////////////////////
28 //                                                                           //
29 //  This class contains the points for the ALICE event display               //
30 //                                                                           //
31 //Begin_Html
32 /*
33 <img src="gif/AliRICHPointsClass.gif">
34 */
35 //End_Html
36 //                                                                           //
37 //                                                                           //
38 ///////////////////////////////////////////////////////////////////////////////
39 #include <TPad.h>
40 #include <TView.h>
41 #include <TMath.h>
42
43 #include "AliRICHDisplay.h"
44 #include "AliRICHPoints.h"
45 #include "AliRun.h"
46 #include "AliRICHHit.h"
47 #include "AliRICHCerenkov.h"
48 #include "AliRICHPadHit.h"
49 #include "AliRICHDigit.h"
50 #include "AliRICHRawCluster.h"
51 #include "AliRICHRecHit.h"
52
53 const Int_t kMaxNipx=400, kMaxNipy=800;
54  
55 ClassImp(AliRICHPoints)
56
57 //_____________________________________________________________________________
58 AliRICHPoints::AliRICHPoints()
59 {
60   //
61   // Default constructor
62   //
63   fHitIndex = 0;
64   fTrackIndex = 0;
65   fDigitIndex = 0;
66   fMarker[0] = fMarker[1] = fMarker[2]=0;
67 }
68
69 //_____________________________________________________________________________
70 AliRICHPoints::AliRICHPoints(Int_t npoints)
71   :AliPoints(npoints)
72 {
73   //
74   // Standard constructor
75   //
76   fHitIndex = 0;
77   fTrackIndex = 0;
78   fDigitIndex = 0;
79   fMarker[0] = fMarker[1] = fMarker[2]=0;
80 }
81          
82 //_____________________________________________________________________________
83 AliRICHPoints::~AliRICHPoints()
84 {
85   //
86   // Default destructor
87   //
88   fHitIndex = 0;
89   fTrackIndex = 0;
90   fDigitIndex = 0;
91 }
92
93 //_____________________________________________________________________________
94 void AliRICHPoints::DumpHit()
95 {
96   //
97   //   Dump hit corresponding to this point
98   //
99   AliRICHHit *hit = GetHit();
100   if (hit) hit->Dump();
101 }
102
103 //_____________________________________________________________________________
104 void AliRICHPoints::DumpDigit()
105 {
106   //
107   //   Dump digit corresponding to this point
108   //
109   AliRICHDigit *digit = GetDigit();
110   if (digit) digit->Dump();
111 }
112
113 //_____________________________________________________________________________
114 void AliRICHPoints::InspectHit()
115 {
116   //
117   //   Inspect hit corresponding to this point
118   //
119   AliRICHHit *hit = GetHit();
120   if (hit) hit->Inspect();
121 }
122
123 //_____________________________________________________________________________
124 void AliRICHPoints::InspectDigit()
125 {
126   //
127   //   Inspect digit corresponding to this point
128   //
129   AliRICHDigit *digit = GetDigit();
130   if (digit) digit->Inspect();
131 }
132
133 //_____________________________________________________________________________
134 Int_t AliRICHPoints::GetTrackIndex()
135 {
136   //
137   //   Dump digit corresponding to this point
138   //
139   printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
140   this->Inspect();
141   return fTrackIndex;
142 }
143 //_____________________________________________________________________________
144 TParticle *AliRICHPoints::GetParticle() const
145 {
146   //
147   //   Returns pointer to particle index in AliRun::fParticles
148   //
149   TClonesArray *particles = gAlice->Particles();
150   Int_t nparticles = particles->GetEntriesFast();
151   if (fIndex < 0 || fIndex >= nparticles) return 0;
152   return (TParticle*)particles->UncheckedAt(fIndex);
153 }
154
155 //_____________________________________________________________________________
156 AliRICHHit *AliRICHPoints::GetHit() const
157 {
158   //
159   //   Returns pointer to hit index in AliRun::fParticles
160   //
161   AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
162   gAlice->TreeH()->GetEvent(fTrackIndex);
163   TClonesArray *pRICHhits  = pRICH->Hits();
164   Int_t nhits = pRICHhits->GetEntriesFast();
165   if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
166   return (AliRICHHit*)pRICHhits->UncheckedAt(fHitIndex);
167 }
168
169 //_____________________________________________________________________________
170 AliRICHDigit *AliRICHPoints::GetDigit() const
171 {
172   //
173   //   Returns pointer to digit index in AliRun::fParticles
174   //
175
176   AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
177   Int_t chamber=display->GetChamber();
178   Int_t cathode=display->GetCathode();
179    
180   AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
181   TClonesArray *pRICHdigits  = pRICH->DigitsAddress(chamber-1);
182   gAlice->TreeD()->GetEvent(cathode);
183   Int_t ndigits = pRICHdigits->GetEntriesFast();
184   if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
185   return (AliRICHDigit*)pRICHdigits->UncheckedAt(fDigitIndex);
186 }
187 //----------------------------------------------------------------------------
188 void AliRICHPoints::ShowRing(Int_t highlight) {
189
190 //
191 // Highlights all pads generated by the same mother particle
192
193    
194   AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
195   AliRICHChamber*       iChamber;
196   AliRICHSegmentation*  segmentation;
197
198       
199   AliRICHPoints *points = 0;
200   TMarker3DBox  *marker = 0;
201     
202   AliRICHHit *mHit = GetHit();
203
204   printf("Hit %d on chamber: %d\n",fHitIndex, mHit->fChamber);
205
206   TClonesArray *digits  = pRICH->DigitsAddress(mHit->fChamber - 1);
207   iChamber = &(pRICH->Chamber(mHit->fChamber - 1));
208   segmentation=iChamber->GetSegmentationModel();
209
210   Float_t dpx  = segmentation->Dpx();
211   Float_t dpy  = segmentation->Dpy();
212
213   int ndigits=digits->GetEntriesFast();
214   
215   printf("Show Ring called with %d digits\n",ndigits);
216   
217   for (int digit=0;digit<ndigits;digit++) {
218     AliRICHDigit *mdig = (AliRICHDigit*)digits->UncheckedAt(digit);
219     points = new AliRICHPoints(1);
220     
221      //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]);
222
223     if (!points) continue;
224     if (fTrackIndex == mdig->fTracks[0]) {
225
226       printf("Digit %d from particle %d belongs to ring %d \n", digit, fTrackIndex, mdig->fTracks[0]);
227
228       Int_t charge=mdig->fSignal;
229       Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(adc_satm)/22));
230       Int_t color=701+index;
231       if (color>722) color=722;
232       points->SetMarkerColor(color);
233       points->SetMarkerStyle(21);
234       points->SetMarkerSize(.5);
235       Float_t xpad, ypad;
236       segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY,xpad, ypad);
237       Float_t vectorLoc[3]={xpad,6.276,ypad};
238       Float_t  vectorGlob[3];
239       points->SetParticle(-1);
240       points->SetHitIndex(-1);
241       points->SetTrackIndex(-1);
242       points->SetDigitIndex(digit);
243       iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
244       points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
245       
246       segmentation->GetPadCxy(mdig->fPadX, mdig->fPadY, xpad, ypad);
247       Float_t theta = iChamber->GetRotMatrix()->GetTheta();
248       Float_t phi   = iChamber->GetRotMatrix()->GetPhi();          
249       marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2],
250                               dpy/2,0,dpx/2,theta,phi);
251       marker->SetLineColor(highlight);
252       marker->SetFillStyle(1001);
253       marker->SetFillColor(color);
254       marker->SetRefObject((TObject*)points);
255       points->Set3DMarker(0, marker);
256       
257       points->Draw("same");
258       for (Int_t im=0;im<3;im++) {
259         TMarker3DBox *marker=points->GetMarker(im);
260         if (marker)
261           marker->Draw();
262       }
263       TClonesArray *particles=gAlice->Particles();
264       TParticle *p = (TParticle*)particles->UncheckedAt(fIndex);
265       printf("\nTrack index %d\n",fTrackIndex);
266       printf("Particle ID %d\n",p->GetPdgCode());
267       printf("Parent %d\n",p->GetFirstMother());
268       printf("First child %d\n",p->GetFirstDaughter());
269       printf("Px,Py,Pz %f %f %f\n",p->Px(),p->Py(),p->Pz());
270     }
271   }
272 }
273
274 //_____________________________________________________________________________
275 const Text_t *AliRICHPoints::GetName() const
276 {
277   //
278   // Return name of the Geant3 particle corresponding to this point
279   //
280   TParticle *particle = GetParticle();
281   if (!particle) return "Particle";
282   return particle->GetName();
283 }
284
285 //_____________________________________________________________________________
286 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
287 {
288   //
289   //   Redefines TObject::GetObjectInfo.
290   //   Displays the info (particle,etc
291   //   corresponding to cursor position px,py
292   //
293   static char info[64];
294   sprintf(info,"%s %d",GetName(),fIndex);
295   return info;
296 }
297
298
299