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