]>
Commit | Line | Data |
---|---|---|
0279872e | 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 | ||
0279872e | 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 | /////////////////////////////////////////////////////////////////////////////// | |
53fd478b | 28 | #include "AliRICHPoints.h" |
29 | #include "AliRICHDisplay.h" | |
30 | #include "AliRICHChamber.h" | |
31 | #include "AliRICH.h" | |
32 | #include "AliRICHSDigit.h" | |
237c933d | 33 | #include <TPad.h> |
94de3818 | 34 | #include <TTree.h> |
237c933d | 35 | #include <TView.h> |
36 | #include <TMath.h> | |
488e98ba | 37 | #include <TPolyMarker3D.h> |
38 | #include <TMarker3DBox.h> | |
4ad0d8b4 | 39 | #include <TParticle.h> |
aed240d4 | 40 | #include <AliRun.h> |
aed240d4 | 41 | #include <AliMC.h> |
53fd478b | 42 | #include <TRotMatrix.h> |
237c933d | 43 | |
44 | const Int_t kMaxNipx=400, kMaxNipy=800; | |
0279872e | 45 | |
46 | ClassImp(AliRICHPoints) | |
47 | ||
48 | //_____________________________________________________________________________ | |
49 | AliRICHPoints::AliRICHPoints() | |
50 | { | |
51 | // | |
52 | // Default constructor | |
53 | // | |
54 | fHitIndex = 0; | |
55 | fTrackIndex = 0; | |
56 | fDigitIndex = 0; | |
57 | fMarker[0] = fMarker[1] = fMarker[2]=0; | |
58 | } | |
59 | ||
60 | //_____________________________________________________________________________ | |
61 | AliRICHPoints::AliRICHPoints(Int_t npoints) | |
62 | :AliPoints(npoints) | |
63 | { | |
64 | // | |
65 | // Standard constructor | |
66 | // | |
67 | fHitIndex = 0; | |
68 | fTrackIndex = 0; | |
69 | fDigitIndex = 0; | |
70 | fMarker[0] = fMarker[1] = fMarker[2]=0; | |
71 | } | |
72 | ||
73 | //_____________________________________________________________________________ | |
74 | AliRICHPoints::~AliRICHPoints() | |
75 | { | |
76 | // | |
77 | // Default destructor | |
78 | // | |
79 | fHitIndex = 0; | |
80 | fTrackIndex = 0; | |
81 | fDigitIndex = 0; | |
82 | } | |
83 | ||
84 | //_____________________________________________________________________________ | |
85 | void AliRICHPoints::DumpHit() | |
86 | { | |
87 | // | |
88 | // Dump hit corresponding to this point | |
89 | // | |
853634d3 | 90 | AliRICHhit *hit = GetHit(); |
0279872e | 91 | if (hit) hit->Dump(); |
92 | } | |
93 | ||
94 | //_____________________________________________________________________________ | |
95 | void AliRICHPoints::DumpDigit() | |
96 | { | |
97 | // | |
98 | // Dump digit corresponding to this point | |
99 | // | |
aed240d4 | 100 | AliRICHdigit *digit = GetDigit(); |
0279872e | 101 | if (digit) digit->Dump(); |
102 | } | |
103 | ||
104 | //_____________________________________________________________________________ | |
105 | void AliRICHPoints::InspectHit() | |
106 | { | |
107 | // | |
108 | // Inspect hit corresponding to this point | |
109 | // | |
853634d3 | 110 | AliRICHhit *hit = GetHit(); |
0279872e | 111 | if (hit) hit->Inspect(); |
112 | } | |
113 | ||
114 | //_____________________________________________________________________________ | |
115 | void AliRICHPoints::InspectDigit() | |
116 | { | |
117 | // | |
118 | // Inspect digit corresponding to this point | |
119 | // | |
aed240d4 | 120 | AliRICHdigit *digit = GetDigit(); |
0279872e | 121 | if (digit) digit->Inspect(); |
122 | } | |
123 | ||
124 | //_____________________________________________________________________________ | |
125 | Int_t AliRICHPoints::GetTrackIndex() | |
126 | { | |
127 | // | |
128 | // Dump digit corresponding to this point | |
129 | // | |
130 | printf("GetTrackIndex - fTrackIndex %d \n",fTrackIndex); | |
131 | this->Inspect(); | |
132 | return fTrackIndex; | |
133 | } | |
7ea4320b | 134 | //_____________________________________________________________________________ |
135 | TParticle *AliRICHPoints::GetParticle() const | |
136 | { | |
137 | // | |
138 | // Returns pointer to particle index in AliRun::fParticles | |
139 | // | |
5d12ce38 | 140 | if (fIndex < 0 || fIndex >= gAlice->GetMCApp()->GetNtrack()) return 0; |
141 | return gAlice->GetMCApp()->Particle(fIndex); | |
7ea4320b | 142 | } |
0279872e | 143 | |
144 | //_____________________________________________________________________________ | |
853634d3 | 145 | AliRICHhit *AliRICHPoints::GetHit() const |
0279872e | 146 | { |
147 | // | |
148 | // Returns pointer to hit index in AliRun::fParticles | |
149 | // | |
237c933d | 150 | AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); |
88cb7938 | 151 | pRICH->TreeH()->GetEvent(fTrackIndex); |
237c933d | 152 | TClonesArray *pRICHhits = pRICH->Hits(); |
153 | Int_t nhits = pRICHhits->GetEntriesFast(); | |
0279872e | 154 | if (fHitIndex < 0 || fHitIndex >= nhits) return 0; |
853634d3 | 155 | return (AliRICHhit*)pRICHhits->UncheckedAt(fHitIndex); |
0279872e | 156 | } |
157 | ||
158 | //_____________________________________________________________________________ | |
aed240d4 | 159 | AliRICHdigit *AliRICHPoints::GetDigit() const |
0279872e | 160 | { |
161 | // | |
162 | // Returns pointer to digit index in AliRun::fParticles | |
163 | // | |
164 | ||
165 | AliRICHDisplay *display=(AliRICHDisplay*)gAlice->Display(); | |
166 | Int_t chamber=display->GetChamber(); | |
167 | Int_t cathode=display->GetCathode(); | |
168 | ||
237c933d | 169 | AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); |
aed240d4 | 170 | TClonesArray *pRICHdigits = pRICH->Digits(chamber); |
0279872e | 171 | gAlice->TreeD()->GetEvent(cathode); |
237c933d | 172 | Int_t ndigits = pRICHdigits->GetEntriesFast(); |
0279872e | 173 | if (fDigitIndex < 0 || fDigitIndex >= ndigits) return 0; |
aed240d4 | 174 | return (AliRICHdigit*)pRICHdigits->UncheckedAt(fDigitIndex); |
0279872e | 175 | } |
7ea4320b | 176 | //---------------------------------------------------------------------------- |
177 | void AliRICHPoints::ShowRing(Int_t highlight) { | |
237c933d | 178 | |
179 | // | |
180 | // Highlights all pads generated by the same mother particle | |
181 | ||
7ea4320b | 182 | |
237c933d | 183 | AliRICH *pRICH = (AliRICH*)gAlice->GetDetector("RICH"); |
7ea4320b | 184 | AliRICHChamber* iChamber; |
a2f7eaf6 | 185 | AliSegmentation* segmentation; |
7ea4320b | 186 | |
187 | ||
188 | AliRICHPoints *points = 0; | |
189 | TMarker3DBox *marker = 0; | |
190 | ||
853634d3 | 191 | AliRICHhit *mHit = GetHit(); |
7ea4320b | 192 | |
6e585aa2 | 193 | printf("Hit %d on chamber: %d\n",fHitIndex, mHit->Chamber()); |
7ea4320b | 194 | |
aed240d4 | 195 | TClonesArray *digits = pRICH->Digits(mHit->Chamber()); |
6e585aa2 | 196 | iChamber = &(pRICH->Chamber(mHit->Chamber() - 1)); |
7ea4320b | 197 | segmentation=iChamber->GetSegmentationModel(); |
198 | ||
199 | Float_t dpx = segmentation->Dpx(); | |
200 | Float_t dpy = segmentation->Dpy(); | |
201 | ||
202 | int ndigits=digits->GetEntriesFast(); | |
203 | ||
204 | printf("Show Ring called with %d digits\n",ndigits); | |
205 | ||
206 | for (int digit=0;digit<ndigits;digit++) { | |
aed240d4 | 207 | AliRICHdigit *mdig = (AliRICHdigit*)digits->UncheckedAt(digit); |
7ea4320b | 208 | points = new AliRICHPoints(1); |
209 | ||
210 | //printf("Particle %d belongs to ring %d \n", fTrackIndex, mdig->fTracks[1]); | |
211 | ||
212 | if (!points) continue; | |
ed3ceb24 | 213 | if (fTrackIndex == mdig->Tid(0)) { |
7ea4320b | 214 | |
7ea4320b | 215 | |
aed240d4 | 216 | Int_t charge=(Int_t)mdig->Q(); |
a277aaca | 217 | Int_t index=Int_t(TMath::Log(charge)/(TMath::Log(kadc_satm)/22)); |
7ea4320b | 218 | Int_t color=701+index; |
219 | if (color>722) color=722; | |
220 | points->SetMarkerColor(color); | |
221 | points->SetMarkerStyle(21); | |
222 | points->SetMarkerSize(.5); | |
a2f7eaf6 | 223 | Float_t xpad, ypad, zpad; |
aed240d4 | 224 | segmentation->GetPadC(mdig->X(), mdig->Y(),xpad, ypad, zpad); |
237c933d | 225 | Float_t vectorLoc[3]={xpad,6.276,ypad}; |
226 | Float_t vectorGlob[3]; | |
7ea4320b | 227 | points->SetParticle(-1); |
228 | points->SetHitIndex(-1); | |
229 | points->SetTrackIndex(-1); | |
230 | points->SetDigitIndex(digit); | |
237c933d | 231 | iChamber->LocaltoGlobal(vectorLoc,vectorGlob); |
232 | points->SetPoint(0,vectorGlob[0],vectorGlob[1],vectorGlob[2]); | |
7ea4320b | 233 | |
aed240d4 | 234 | segmentation->GetPadC(mdig->X(), mdig->Y(), xpad, ypad, zpad); |
7ea4320b | 235 | Float_t theta = iChamber->GetRotMatrix()->GetTheta(); |
236 | Float_t phi = iChamber->GetRotMatrix()->GetPhi(); | |
237c933d | 237 | marker=new TMarker3DBox(vectorGlob[0],vectorGlob[1],vectorGlob[2], |
7ea4320b | 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); | |
244 | ||
245 | points->Draw("same"); | |
246 | for (Int_t im=0;im<3;im++) { | |
247 | TMarker3DBox *marker=points->GetMarker(im); | |
248 | if (marker) | |
249 | marker->Draw(); | |
250 | } | |
5d12ce38 | 251 | TParticle *p = gAlice->GetMCApp()->Particle(fIndex); |
7ea4320b | 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()); | |
257 | } | |
258 | } | |
259 | } | |
0279872e | 260 | |
261 | //_____________________________________________________________________________ | |
262 | const Text_t *AliRICHPoints::GetName() const | |
263 | { | |
264 | // | |
265 | // Return name of the Geant3 particle corresponding to this point | |
266 | // | |
267 | TParticle *particle = GetParticle(); | |
268 | if (!particle) return "Particle"; | |
269 | return particle->GetName(); | |
270 | } | |
271 | ||
272 | //_____________________________________________________________________________ | |
273 | Text_t *AliRICHPoints::GetObjectInfo(Int_t, Int_t) | |
274 | { | |
275 | // | |
276 | // Redefines TObject::GetObjectInfo. | |
277 | // Displays the info (particle,etc | |
278 | // corresponding to cursor position px,py | |
279 | // | |
280 | static char info[64]; | |
281 | sprintf(info,"%s %d",GetName(),fIndex); | |
282 | return info; | |
283 | } | |
284 | ||
285 | ||
286 |