]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHPoints.cxx
TOF can't be created without FRAME error corrected
[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 //                                                                           //
18 //  This class contains the points for the ALICE event display               //
19 //                                                                           //
20 //Begin_Html
21 /*
22 <img src="gif/AliRICHPointsClass.gif">
23 */
24 //End_Html
25 //                                                                           //
26 //                                                                           //
27 ///////////////////////////////////////////////////////////////////////////////
28 #include "AliRICHPoints.h"
29 #include "AliRICHDisplay.h"
30 #include "AliRICHChamber.h"
31 #include "AliRICH.h"
32 #include <TPad.h>
33 #include <TTree.h>
34 #include <TView.h>
35 #include <TMath.h>
36 #include <TPolyMarker3D.h>
37 #include <TMarker3DBox.h>
38 #include <TParticle.h>
39 #include <AliRun.h>
40 #include <AliMC.h>
41 #include <TRotMatrix.h>
42
43 const Int_t kMaxNipx=400, kMaxNipy=800;
44  
45 ClassImp(AliRICHPoints)
46
47 //_____________________________________________________________________________
48 AliRICHPoints::AliRICHPoints()
49 {
50   //
51   // Default constructor
52   //
53   fHitIndex = 0;
54   fTrackIndex = 0;
55   fDigitIndex = 0;
56   fMarker[0] = fMarker[1] = fMarker[2]=0;
57 }
58
59 //_____________________________________________________________________________
60 AliRICHPoints::AliRICHPoints(Int_t npoints)
61   :AliPoints(npoints)
62 {
63   //
64   // Standard constructor
65   //
66   fHitIndex = 0;
67   fTrackIndex = 0;
68   fDigitIndex = 0;
69   fMarker[0] = fMarker[1] = fMarker[2]=0;
70 }
71          
72 //_____________________________________________________________________________
73 AliRICHPoints::~AliRICHPoints()
74 {
75   //
76   // Default destructor
77   //
78   fHitIndex = 0;
79   fTrackIndex = 0;
80   fDigitIndex = 0;
81 }
82
83 //_____________________________________________________________________________
84 void AliRICHPoints::DumpHit()
85 {
86   //
87   //   Dump hit corresponding to this point
88   //
89   AliRICHhit *hit = GetHit();
90   if (hit) hit->Dump();
91 }
92
93 //_____________________________________________________________________________
94 void AliRICHPoints::DumpDigit()
95 {
96   //
97   //   Dump digit corresponding to this point
98   //
99   AliRICHdigit *digit = GetDigit();
100   if (digit) digit->Dump();
101 }
102
103 //_____________________________________________________________________________
104 void AliRICHPoints::InspectHit()
105 {
106   //
107   //   Inspect hit corresponding to this point
108   //
109   AliRICHhit *hit = GetHit();
110   if (hit) hit->Inspect();
111 }
112
113 //_____________________________________________________________________________
114 void AliRICHPoints::InspectDigit()
115 {
116   //
117   //   Inspect digit corresponding to this point
118   //
119   AliRICHdigit *digit = GetDigit();
120   if (digit) digit->Inspect();
121 }
122
123 //_____________________________________________________________________________
124 Int_t AliRICHPoints::GetTrackIndex()
125 {
126   //
127   //   Dump digit corresponding to this point
128   //
129   printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex);
130   this->Inspect();
131   return fTrackIndex;
132 }
133 //_____________________________________________________________________________
134 TParticle *AliRICHPoints::GetParticle() const
135 {
136   //
137   //   Returns pointer to particle index in AliRun::fParticles
138   //
139   if (fIndex < 0 || fIndex >= gAlice->GetMCApp()->GetNtrack()) return 0;
140   return gAlice->GetMCApp()->Particle(fIndex);
141 }
142
143 //_____________________________________________________________________________
144 AliRICHhit *AliRICHPoints::GetHit() const
145 {
146   //
147   //   Returns pointer to hit index in AliRun::fParticles
148   //
149   AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
150   pRICH->TreeH()->GetEvent(fTrackIndex);
151   TClonesArray *pRICHhits  = pRICH->Hits();
152   Int_t nhits = pRICHhits->GetEntriesFast();
153   if (fHitIndex < 0 || fHitIndex >= nhits) return 0;
154   return (AliRICHhit*)pRICHhits->UncheckedAt(fHitIndex);
155 }
156
157 //_____________________________________________________________________________
158 AliRICHdigit *AliRICHPoints::GetDigit() const
159 {
160   //
161   //   Returns pointer to digit index in AliRun::fParticles
162   //
163
164   AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display();
165   Int_t chamber=display->GetChamber();
166   Int_t cathode=display->GetCathode();
167    
168   AliRICH *pRICH  = (AliRICH*)gAlice->GetDetector("RICH");
169   TClonesArray *pRICHdigits  = pRICH->Digits(chamber);
170   gAlice->TreeD()->GetEvent(cathode);
171   Int_t ndigits = pRICHdigits->GetEntriesFast();
172   if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0;
173   return (AliRICHdigit*)pRICHdigits->UncheckedAt(fDigitIndex);
174 }
175 //----------------------------------------------------------------------------
176 void AliRICHPoints::ShowRing(Int_t highlight)
177 {
178
179 //
180 // Highlights all pads generated by the same mother particle
181
182   highlight++;   
183   
184
185 }
186
187 //_____________________________________________________________________________
188 const Text_t *AliRICHPoints::GetName() const
189 {
190   //
191   // Return name of the Geant3 particle corresponding to this point
192   //
193   TParticle *particle = GetParticle();
194   if (!particle) return "Particle";
195   return particle->GetName();
196 }
197
198 //_____________________________________________________________________________
199 Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t)
200 {
201   //
202   //   Redefines TObject::GetObjectInfo.
203   //   Displays the info (particle,etc
204   //   corresponding to cursor position px,py
205   //
206   static char info[64];
207   sprintf(info,"%s %d",GetName(),fIndex);
208   return info;
209 }
210
211
212