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