]>
Commit | Line | Data |
---|---|---|
5de7d27f | 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$ | |
fa8037e2 | 18 | Revision 1.17 2001/12/01 20:00:45 hristov |
19 | New protections added | |
20 | ||
25d71048 | 21 | Revision 1.16 2001/10/30 08:25:14 jchudoba |
22 | Small correction to prevent crash when hit is at the edge of a slat | |
23 | ||
67269232 | 24 | Revision 1.15 2001/09/07 08:38:30 hristov |
25 | Pointers initialised to 0 in the default constructors | |
26 | ||
edf34242 | 27 | Revision 1.14 2001/08/30 09:52:12 hristov |
28 | The operator[] is replaced by At() or AddAt() in case of TObjArray. | |
29 | ||
2682e810 | 30 | Revision 1.13 2001/07/20 10:03:14 morsch |
31 | Changes needed to work with Root 3.01 (substitute lhs [] operator). (Jiri Chudoba) | |
32 | ||
cd4df77b | 33 | Revision 1.12 2001/05/16 14:57:17 alibrary |
34 | New files for folders and Stack | |
35 | ||
9e1a0ddb | 36 | Revision 1.11 2001/01/26 21:25:48 morsch |
37 | Empty default constructors and. | |
38 | ||
e9e4cdf2 | 39 | Revision 1.10 2001/01/23 18:58:19 hristov |
40 | Initialisation of some pointers | |
41 | ||
3f5cf0b3 | 42 | Revision 1.9 2001/01/17 20:53:40 hristov |
43 | Destructors corrected to avoid memory leaks | |
44 | ||
c2c0190f | 45 | Revision 1.8 2000/12/21 22:12:41 morsch |
46 | Clean-up of coding rule violations, | |
47 | ||
de05461e | 48 | Revision 1.7 2000/11/08 13:01:40 morsch |
49 | Chamber half-planes of stations 3-5 at different z-positions. | |
50 | ||
e1ad7d45 | 51 | Revision 1.6 2000/11/06 09:20:43 morsch |
52 | AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the | |
53 | Draw() method. This avoids code and parameter replication. | |
54 | ||
aaf4addd | 55 | Revision 1.5 2000/10/23 13:37:40 morsch |
56 | Correct z-position of slat planes. | |
57 | ||
bf61d9e2 | 58 | Revision 1.4 2000/10/22 16:55:43 morsch |
59 | Use only x-symmetry in global to local transformations and delegation. | |
60 | ||
2b202c2e | 61 | Revision 1.3 2000/10/18 11:42:06 morsch |
62 | - AliMUONRawCluster contains z-position. | |
63 | - Some clean-up of useless print statements during initialisations. | |
64 | ||
3e1872ed | 65 | Revision 1.2 2000/10/09 14:06:18 morsch |
66 | Some type cast problems of type (TMath::Sign((Float_t)1.,x)) corrected (P.H.) | |
67 | ||
deba22dc | 68 | Revision 1.1 2000/10/06 09:00:47 morsch |
69 | Segmentation class for chambers built out of slats. | |
70 | ||
5de7d27f | 71 | */ |
72 | ||
73 | #include "AliMUONSegmentationSlat.h" | |
74 | #include "AliMUONSegmentationSlatModule.h" | |
75 | #include "AliMUON.h" | |
76 | #include "AliMUONChamber.h" | |
77 | #include "TArrayI.h" | |
78 | #include "TObjArray.h" | |
79 | #include "AliRun.h" | |
80 | #include <TMath.h> | |
aaf4addd | 81 | #include <TBRIK.h> |
82 | #include <TNode.h> | |
83 | #include <TGeometry.h> | |
5de7d27f | 84 | #include <iostream.h> |
85 | ||
86 | //___________________________________________ | |
87 | ClassImp(AliMUONSegmentationSlat) | |
88 | ||
89 | AliMUONSegmentationSlat::AliMUONSegmentationSlat() | |
90 | { | |
91 | // Default constructor | |
edf34242 | 92 | fChamber = 0; |
93 | fNDiv = 0; | |
94 | fSlats = 0; | |
95 | fCurrentSlat = 0; | |
e9e4cdf2 | 96 | } |
97 | ||
98 | AliMUONSegmentationSlat::AliMUONSegmentationSlat(Int_t nsec) | |
99 | { | |
100 | // Non default constructor | |
5de7d27f | 101 | fSlats=0; |
3f5cf0b3 | 102 | fNDiv = new TArrayI(4); |
103 | fChamber = 0; | |
104 | fCurrentSlat = 0; | |
5de7d27f | 105 | } |
106 | ||
c2c0190f | 107 | AliMUONSegmentationSlat::~AliMUONSegmentationSlat(){ |
108 | //PH Delete TObjArrays | |
109 | if (fSlats) { | |
110 | fSlats->Delete(); | |
111 | delete fSlats; | |
112 | } | |
e9e4cdf2 | 113 | |
114 | if (fNDiv) { | |
115 | delete fNDiv; | |
116 | } | |
117 | ||
c2c0190f | 118 | } |
119 | ||
5de7d27f | 120 | void AliMUONSegmentationSlat::SetPadSize(Float_t p1, Float_t p2) |
121 | { | |
122 | // Sets the pad (strip) size | |
123 | // | |
124 | fDpx=p1; | |
125 | fDpy=p2; | |
126 | } | |
127 | ||
128 | Float_t AliMUONSegmentationSlat::GetAnod(Float_t xhit) const | |
129 | { | |
130 | // Returns for a hit position xhit the position of the nearest anode wire | |
131 | Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5; | |
132 | return fWireD*wire; | |
133 | } | |
134 | ||
135 | Float_t AliMUONSegmentationSlat::Dpx(Int_t isec) const | |
136 | { | |
137 | // | |
138 | // Returns x-pad size for given sector isec | |
139 | // isec = 100*islat+iregion | |
140 | // | |
141 | Int_t islat, iregion; | |
142 | islat = isec/100; | |
143 | iregion = isec%100; | |
144 | return Slat(islat)->Dpx(iregion); | |
145 | } | |
146 | ||
147 | Float_t AliMUONSegmentationSlat::Dpy(Int_t isec) const | |
148 | { | |
149 | // | |
150 | // Returns y-pad (strip) size for given sector isec | |
151 | return fDpy; | |
152 | } | |
153 | ||
154 | void AliMUONSegmentationSlat::SetPadDivision(Int_t ndiv[4]) | |
155 | { | |
156 | // | |
157 | // Defines the pad size perp. to the anode wire (y) for different sectors. | |
158 | // Pad sizes are defined as integral fractions ndiv of a basis pad size | |
159 | // fDpx | |
160 | // | |
161 | for (Int_t i=0; i<4; i++) { | |
162 | (*fNDiv)[i]=ndiv[i]; | |
163 | } | |
164 | } | |
165 | ||
166 | void AliMUONSegmentationSlat::GlobalToLocal( | |
167 | Float_t x, Float_t y, Float_t z, Int_t &islat, Float_t &xlocal, Float_t &ylocal) | |
168 | { | |
169 | // | |
170 | // Perform local to global transformation for space coordinates | |
171 | // | |
172 | Float_t zlocal; | |
173 | Int_t i; | |
174 | Int_t index=-1; | |
fa8037e2 | 175 | Float_t eps = 1.e-4; |
176 | ||
5de7d27f | 177 | // Transform According to slat plane z-position: negative side is shifted down |
178 | // positive side is shifted up | |
179 | // by half the overlap | |
180 | zlocal = z-fChamber->Z(); | |
e1ad7d45 | 181 | zlocal = (x>0) ? zlocal-2.*fDz : zlocal+2.*fDz; |
5de7d27f | 182 | // Set the signs for the symmetry transformation and transform to first quadrant |
2b202c2e | 183 | SetSymmetry(x); |
5de7d27f | 184 | Float_t xabs=TMath::Abs(x); |
185 | ||
2b202c2e | 186 | Int_t ifirst = (zlocal < Float_t(0))? 0:1; |
5de7d27f | 187 | // |
188 | // Find slat number | |
189 | for (i=ifirst; i<fNSlats; i+=2) { | |
190 | index=i; | |
fa8037e2 | 191 | if ((y >= fYPosition[i]-eps) && (y <= fYPosition[i]+fSlatY+eps)) break; |
5de7d27f | 192 | } |
193 | ||
194 | // | |
195 | // Transform to local coordinate system | |
196 | ||
197 | ||
25d71048 | 198 | if (index >= fNSlats || index < 0 ) { |
199 | islat = -1; xlocal=-1; ylocal = -1; } | |
200 | else { | |
201 | ylocal = y -fYPosition[index]; | |
202 | xlocal = xabs-fXPosition[index]; | |
203 | islat = index; | |
204 | } | |
5de7d27f | 205 | } |
206 | ||
207 | void AliMUONSegmentationSlat::GlobalToLocal( | |
208 | Int_t ix, Int_t iy, Int_t &islat, Int_t &ixlocal, Int_t &iylocal) | |
209 | { | |
210 | // | |
211 | // Perform global to local transformation for pad coordinates | |
212 | // | |
2b202c2e | 213 | Int_t iytemp = iy; |
214 | Int_t index = 0; | |
5de7d27f | 215 | |
216 | iylocal = iytemp; | |
217 | ||
218 | // | |
219 | // Find slat number (index) and iylocal | |
220 | for (Int_t i=0; i<fNSlats; i++) { | |
221 | iytemp-=Slat(i)->Npy(); | |
222 | ||
223 | ||
224 | if (iytemp <= 0) break; | |
225 | iylocal = iytemp; | |
226 | index=i+1; | |
227 | } | |
228 | ||
229 | ixlocal=TMath::Abs(ix); | |
230 | islat=index; | |
5de7d27f | 231 | } |
232 | ||
233 | void AliMUONSegmentationSlat:: | |
234 | LocalToGlobal(Int_t islat, Float_t xlocal, Float_t ylocal, Float_t &x, Float_t &y, Float_t &z) | |
235 | { | |
236 | // Transform from local to global space coordinates | |
237 | // | |
238 | // upper plane (y>0) even slat number is shifted down | |
239 | // upper plane (y>0) odd slat number is shifted up | |
240 | // lower plane (y<0) even slat number is shifted up | |
241 | // lower plane (y<0) odd slat number is shifted down | |
242 | // | |
243 | ||
2b202c2e | 244 | x = (xlocal+fXPosition[islat])*fSym; |
245 | y=(ylocal+fYPosition[islat]); | |
5de7d27f | 246 | |
e1ad7d45 | 247 | z = (TMath::Even(islat)) ? -fDz : fDz ; |
248 | z = (x>0) ? z+2.*fDz : z-2.*fDz ; | |
249 | ||
5de7d27f | 250 | z+=fChamber->Z(); |
5de7d27f | 251 | } |
252 | ||
253 | ||
254 | void AliMUONSegmentationSlat::LocalToGlobal( | |
255 | Int_t islat, Int_t ixlocal, Int_t iylocal, Int_t &ix, Int_t &iy) | |
256 | { | |
257 | // Transform from local to global pad coordinates | |
258 | // | |
259 | Int_t i; | |
260 | iy=iylocal; | |
261 | ||
262 | // | |
263 | // Find slat number (index) and iylocal | |
264 | for (i=0; i<islat; i++) iy+=Slat(islat)->Npy(); | |
265 | ||
2b202c2e | 266 | ix=ixlocal*fSym; |
267 | iy=iy; | |
5de7d27f | 268 | } |
269 | ||
270 | ||
2b202c2e | 271 | void AliMUONSegmentationSlat::SetSymmetry(Int_t ix) |
5de7d27f | 272 | { |
273 | // Set set signs for symmetry transformation | |
2b202c2e | 274 | fSym=TMath::Sign(1,ix); |
5de7d27f | 275 | } |
276 | ||
2b202c2e | 277 | void AliMUONSegmentationSlat::SetSymmetry(Float_t x) |
5de7d27f | 278 | { |
279 | // Set set signs for symmetry transformation | |
2b202c2e | 280 | fSym=Int_t (TMath::Sign((Float_t)1.,x)); |
5de7d27f | 281 | } |
282 | ||
283 | void AliMUONSegmentationSlat:: | |
284 | GetPadI(Float_t x, Float_t y, Float_t z, Int_t &ix, Int_t &iy) | |
285 | { | |
286 | // Returns pad coordinates for given set of space coordinates | |
287 | ||
288 | Int_t islat, i; | |
289 | Float_t xlocal, ylocal; | |
290 | ||
291 | GlobalToLocal(x,y,z,islat,xlocal,ylocal); | |
292 | if (islat == -1) { | |
293 | ix=0; iy=0; return; | |
294 | } | |
295 | ||
296 | Slat(islat)->GetPadI(xlocal, ylocal, ix, iy); | |
297 | for (i=0; i<islat; i++) iy+=Slat(islat)->Npy(); | |
298 | ||
deba22dc | 299 | ix=ix*Int_t(TMath::Sign((Float_t)1.,x)); |
5de7d27f | 300 | } |
301 | ||
2b202c2e | 302 | |
5de7d27f | 303 | void AliMUONSegmentationSlat:: |
304 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y, Float_t &z) | |
305 | { | |
306 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
307 | // | |
308 | Int_t islat, ixlocal, iylocal; | |
309 | // | |
310 | // Delegation of transforamtion to slat | |
311 | GlobalToLocal(ix,iy,islat,ixlocal,iylocal); | |
312 | Slat(islat)->GetPadC(ixlocal, iylocal, x, y); | |
313 | // Slat offset | |
314 | x+=fXPosition[islat]; | |
315 | y+=fYPosition[islat]; | |
316 | ||
2b202c2e | 317 | // Symmetry transformation of half planes |
5de7d27f | 318 | x=x*TMath::Sign(1,ix); |
2b202c2e | 319 | |
320 | // z-position | |
e1ad7d45 | 321 | z = (TMath::Even(islat)) ? -fDz : fDz ; |
322 | z = (x>0) ? z+2.*fDz : z-2.*fDz ; | |
2b202c2e | 323 | z += fChamber->Z(); |
5de7d27f | 324 | } |
325 | ||
326 | Int_t AliMUONSegmentationSlat::ISector() | |
327 | { | |
328 | // Returns current sector during tracking | |
329 | Int_t iregion; | |
330 | ||
331 | iregion = fCurrentSlat->ISector(); | |
332 | return 100*fSlatIndex+iregion; | |
333 | } | |
334 | ||
335 | Int_t AliMUONSegmentationSlat::Sector(Int_t ix, Int_t iy) | |
336 | { | |
de05461e | 337 | // Returns sector for pad coordiantes (ix,iy) |
5de7d27f | 338 | Int_t ixlocal, iylocal, iregion, islat; |
339 | ||
340 | GlobalToLocal(ix,iy,islat,ixlocal,iylocal); | |
341 | ||
342 | iregion = Slat(islat)->Sector(ixlocal, iylocal); | |
343 | return 100*islat+iregion; | |
344 | } | |
345 | ||
346 | ||
347 | void AliMUONSegmentationSlat::SetPad(Int_t ix, Int_t iy) | |
348 | { | |
349 | // | |
350 | // Sets virtual pad coordinates, needed for evaluating pad response | |
351 | // outside the tracking program | |
352 | Int_t islat, ixlocal, iylocal; | |
353 | ||
2b202c2e | 354 | SetSymmetry(ix); |
5de7d27f | 355 | |
356 | GlobalToLocal(ix,iy,islat,ixlocal,iylocal); | |
357 | fSlatIndex=islat; | |
358 | fCurrentSlat=Slat(islat); | |
359 | fCurrentSlat->SetPad(ixlocal, iylocal); | |
360 | } | |
361 | ||
362 | void AliMUONSegmentationSlat::SetHit(Float_t xhit, Float_t yhit, Float_t zhit) | |
363 | { // | |
364 | // Sets current hit coordinates | |
365 | ||
366 | Float_t xlocal, ylocal; | |
367 | Int_t islat; | |
368 | ||
369 | ||
370 | ||
371 | GlobalToLocal(xhit,yhit,zhit,islat,xlocal,ylocal); | |
372 | fSlatIndex=islat; | |
373 | if (islat < 0) printf("\n SetHit: %d", islat); | |
374 | ||
375 | fCurrentSlat=Slat(islat); | |
376 | fCurrentSlat->SetHit(xlocal, ylocal); | |
377 | } | |
378 | ||
379 | ||
380 | void AliMUONSegmentationSlat:: | |
381 | FirstPad(Float_t xhit, Float_t yhit, Float_t zhit, Float_t dx, Float_t dy) | |
382 | { | |
383 | // Initialises iteration over pads for charge distribution algorithm | |
384 | // | |
385 | ||
386 | ||
5de7d27f | 387 | Int_t islat; |
388 | Float_t xlocal, ylocal; | |
389 | GlobalToLocal(xhit, yhit, zhit, islat, xlocal, ylocal); | |
390 | fSlatIndex=islat; | |
25d71048 | 391 | if (islat>-1) { |
392 | fCurrentSlat=Slat(islat); | |
393 | fCurrentSlat->FirstPad(xlocal, ylocal, dx, dy); | |
394 | } | |
5de7d27f | 395 | |
396 | } | |
397 | ||
398 | ||
399 | void AliMUONSegmentationSlat::NextPad() | |
400 | { | |
401 | // Stepper for the iteration over pads | |
402 | // | |
403 | fCurrentSlat->NextPad(); | |
404 | } | |
405 | ||
406 | ||
407 | Int_t AliMUONSegmentationSlat::MorePads() | |
408 | // Stopping condition for the iterator over pads | |
409 | // | |
410 | // Are there more pads in the integration region | |
411 | { | |
412 | return fCurrentSlat->MorePads(); | |
413 | } | |
414 | ||
415 | void AliMUONSegmentationSlat:: | |
416 | IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) | |
417 | { | |
418 | // Returns integration limits for current pad | |
419 | // | |
420 | ||
421 | fCurrentSlat->IntegrationLimits(x1, x2, y1, y2); | |
422 | ||
423 | } | |
424 | ||
425 | void AliMUONSegmentationSlat:: | |
426 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) | |
427 | { | |
428 | // Returns list of neighbours of pad with coordinates iX, iY | |
429 | ||
430 | Int_t i, xListLocal[10], yListLocal[10], iXlocal, iYlocal, islat; | |
431 | ||
2b202c2e | 432 | SetSymmetry(iX); |
5de7d27f | 433 | |
434 | GlobalToLocal(iX, iY, islat, iXlocal, iYlocal); | |
435 | ||
436 | Slat(islat)->Neighbours(iXlocal, iYlocal, Nlist, xListLocal, yListLocal); | |
437 | ||
438 | for (i=0; i<*Nlist; i++) LocalToGlobal(islat, xListLocal[i], yListLocal[i], Xlist[i], Ylist[i]); | |
439 | ||
440 | } | |
441 | ||
442 | ||
443 | Int_t AliMUONSegmentationSlat::Ix() | |
444 | { | |
445 | // Return current pad coordinate ix during stepping | |
446 | Int_t ixl,iyl,ix,iy; | |
447 | ixl=fCurrentSlat->Ix(); | |
448 | iyl=fCurrentSlat->Iy(); | |
449 | ||
450 | LocalToGlobal(fSlatIndex, ixl, iyl, ix, iy); | |
451 | Int_t ixc, iyc, isc; | |
452 | Float_t xc, yc; | |
453 | GlobalToLocal(ix, iy, isc, ixc, iyc); | |
454 | Slat(isc)->GetPadC(ixc,iyc,xc,yc); | |
455 | return ix; | |
456 | } | |
457 | ||
458 | ||
459 | Int_t AliMUONSegmentationSlat::Iy() | |
460 | { | |
461 | // Return current pad coordinate iy during stepping | |
462 | Int_t ixl,iyl,ix,iy; | |
463 | ixl=fCurrentSlat->Ix(); | |
464 | iyl=fCurrentSlat->Iy(); | |
465 | LocalToGlobal(fSlatIndex, ixl, iyl, ix, iy); | |
466 | return iy; | |
467 | } | |
468 | ||
469 | ||
470 | ||
471 | // Signal Generation Condition during Stepping | |
472 | Int_t AliMUONSegmentationSlat::SigGenCond(Float_t x, Float_t y, Float_t z) | |
473 | { | |
474 | // | |
475 | // True if signal generation condition fullfilled | |
476 | Float_t xlocal, ylocal; | |
477 | Int_t islat; | |
478 | GlobalToLocal(x, y, z, islat, xlocal, ylocal); | |
479 | return Slat(islat)->SigGenCond(xlocal, ylocal, z); | |
480 | } | |
481 | ||
482 | // Initialise signal generation at coord (x,y,z) | |
483 | void AliMUONSegmentationSlat::SigGenInit(Float_t x, Float_t y, Float_t z) | |
484 | { | |
485 | // Initialize the signal generation condition | |
486 | // | |
487 | Float_t xlocal, ylocal; | |
488 | Int_t islat; | |
489 | ||
490 | GlobalToLocal(x, y, z, islat, xlocal, ylocal); | |
491 | Slat(islat)->SigGenInit(xlocal, ylocal, z); | |
492 | } | |
493 | ||
494 | ||
495 | ||
496 | void AliMUONSegmentationSlat::Init(Int_t chamber) | |
497 | { | |
498 | // | |
499 | // Initialize slat modules of quadrant +/+ | |
500 | // The other three quadrants are handled through symmetry transformations | |
501 | // | |
9e1a0ddb | 502 | //printf("\n Initialise Segmentation Slat \n"); |
5de7d27f | 503 | // |
504 | ||
aaf4addd | 505 | // Initialize Slat modules |
5de7d27f | 506 | Int_t islat, i; |
507 | Int_t ndiv[4]; | |
508 | // Pad division | |
509 | for (i=0; i<4; i++) ndiv[i]=(*fNDiv)[i]; | |
bf61d9e2 | 510 | // |
511 | fDz=0.813; | |
5de7d27f | 512 | // Slat height |
513 | fSlatY=40.; | |
2b202c2e | 514 | for (i=0; i<15; i++) fSlatX[i]=0.; |
5de7d27f | 515 | |
516 | // Initialize array of slats | |
517 | fSlats = new TObjArray(fNSlats); | |
518 | // Maximum number of strips (pads) in x and y | |
519 | fNpy=0; | |
520 | fNpx=0; | |
521 | // for each slat in the quadrant (+,+) | |
522 | for (islat=0; islat<fNSlats; islat++) { | |
cd4df77b | 523 | fSlats->AddAt(CreateSlatModule(),islat); |
5de7d27f | 524 | |
525 | AliMUONSegmentationSlatModule *slat = Slat(islat); | |
526 | // Configure Slat | |
527 | slat->SetId(islat); | |
528 | ||
529 | // Foward pad size | |
530 | slat->SetPadSize(fDpx, fDpy); | |
531 | // Forward wire pitch | |
532 | slat->SetDAnod(fWireD); | |
533 | // Foward segmentation | |
534 | slat->SetPadDivision(ndiv); | |
535 | slat->SetPcbBoards(fPcb[islat]); | |
536 | // Initialize slat module | |
537 | slat->Init(chamber); | |
538 | // y-position of slat module relative to the first (closest to the beam) | |
2b202c2e | 539 | fYPosition[islat]= fYPosOrigin+islat*(fSlatY-2.*fShift); |
5de7d27f | 540 | // |
541 | fNpy+=slat->Npy(); | |
542 | if (slat->Npx() > fNpx) fNpx=slat->Npx(); | |
543 | Int_t isec; | |
544 | for (isec=0; isec< 4; isec++) | |
545 | { | |
546 | fSlatX[islat]+=40.*fPcb[islat][isec]; | |
547 | } | |
548 | ||
549 | } | |
550 | // Set parent chamber number | |
551 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); | |
552 | fChamber=&(pMUON->Chamber(chamber)); | |
aaf4addd | 553 | fId=chamber; |
5de7d27f | 554 | } |
555 | ||
556 | ||
557 | ||
558 | ||
559 | ||
560 | void AliMUONSegmentationSlat::SetNPCBperSector(Int_t *npcb) | |
561 | { | |
562 | // PCB distribution for station 4 (6 rows with 1+3 segmentation regions) | |
563 | for (Int_t islat=0; islat<fNSlats; islat++){ | |
564 | fPcb[islat][0] = *(npcb + 4 * islat); | |
565 | fPcb[islat][1] = *(npcb + 4 * islat + 1); | |
566 | fPcb[islat][2] = *(npcb + 4 * islat + 2); | |
567 | fPcb[islat][3] = *(npcb + 4 * islat + 3); | |
568 | } | |
569 | } | |
570 | ||
571 | ||
572 | void AliMUONSegmentationSlat::SetSlatXPositions(Float_t *xpos) | |
573 | { | |
574 | // Set x-positions of Slats | |
575 | for (Int_t islat=0; islat<fNSlats; islat++) fXPosition[islat]=xpos[islat]; | |
576 | } | |
577 | ||
578 | AliMUONSegmentationSlatModule* AliMUONSegmentationSlat::Slat(Int_t index) const | |
2682e810 | 579 | //PH { return ((AliMUONSegmentationSlatModule*) (*fSlats)[index]);} |
580 | { return ((AliMUONSegmentationSlatModule*) fSlats->At(index));} | |
5de7d27f | 581 | |
582 | ||
583 | AliMUONSegmentationSlatModule* AliMUONSegmentationSlat:: | |
584 | CreateSlatModule() | |
585 | { | |
586 | // Factory method for slat module | |
e9e4cdf2 | 587 | return new AliMUONSegmentationSlatModule(4); |
5de7d27f | 588 | } |
589 | ||
590 | ||
aaf4addd | 591 | void AliMUONSegmentationSlat::Draw(const char* opt) const |
592 | { | |
de05461e | 593 | // Draw method for event display |
594 | // | |
aaf4addd | 595 | if (!strcmp(opt,"eventdisplay")) { |
596 | const int kColorMUON1 = kYellow; | |
597 | const int kColorMUON2 = kBlue; | |
598 | // | |
599 | // Drawing Routines for example for Event Display | |
600 | Int_t i,j; | |
601 | Int_t npcb[15]; | |
602 | char nameChamber[9], nameSlat[9], nameNode[9]; | |
603 | ||
604 | // | |
605 | // Number of modules per slat | |
606 | for (i=0; i<fNSlats; i++) { | |
607 | npcb[i]=0; | |
608 | for (j=0; j<4; j++) npcb[i]+=fPcb[i][j]; | |
609 | } | |
610 | // | |
611 | TNode* top=gAlice->GetGeometry()->GetNode("alice"); | |
612 | sprintf(nameChamber,"C_MUON%d",fId+1); | |
613 | new TBRIK(nameChamber,"Mother","void",340,340,5.); | |
614 | top->cd(); | |
615 | sprintf(nameNode,"MUON%d",100+fId+1); | |
616 | TNode* node = new TNode(nameNode,"Chambernode",nameChamber,0,0,fChamber->Z(),""); | |
617 | ||
618 | node->SetLineColor(kBlack); | |
619 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); | |
620 | (pMUON->Nodes())->Add(node); | |
621 | TNode* nodeSlat; | |
622 | Int_t color; | |
623 | ||
624 | for (j=0; j<fNSlats; j++) | |
625 | { | |
626 | sprintf(nameSlat,"SLAT%d",100*fId+1+j); | |
627 | Float_t dx = 20.*npcb[j]; | |
628 | Float_t dy = 20; | |
629 | new TBRIK(nameSlat,"Slat Module","void",dx,20.,0.25); | |
630 | node->cd(); | |
631 | color = TMath::Even(j) ? kColorMUON1 : kColorMUON2; | |
632 | ||
633 | sprintf(nameNode,"SLAT%d",100*fId+1+j); | |
634 | nodeSlat = | |
635 | new TNode(nameNode,"Slat Module",nameSlat, dx+fXPosition[j],fYPosition[j]+dy,0,""); | |
636 | nodeSlat->SetLineColor(color); | |
637 | node->cd(); | |
638 | sprintf(nameNode,"SLAT%d",100*fId+1+j+fNSlats); | |
639 | nodeSlat = | |
640 | new TNode(nameNode,"Slat Module",nameSlat,-dx-fXPosition[j],fYPosition[j]+dy,0,""); | |
641 | nodeSlat->SetLineColor(color); | |
642 | } | |
643 | } | |
644 | } | |
5de7d27f | 645 | |
646 | ||
647 |