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