]>
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$ | |
bf61d9e2 | 18 | Revision 1.4 2000/10/22 16:55:43 morsch |
19 | Use only x-symmetry in global to local transformations and delegation. | |
20 | ||
2b202c2e | 21 | Revision 1.3 2000/10/18 11:42:06 morsch |
22 | - AliMUONRawCluster contains z-position. | |
23 | - Some clean-up of useless print statements during initialisations. | |
24 | ||
3e1872ed | 25 | Revision 1.2 2000/10/09 14:06:18 morsch |
26 | Some type cast problems of type (TMath::Sign((Float_t)1.,x)) corrected (P.H.) | |
27 | ||
deba22dc | 28 | Revision 1.1 2000/10/06 09:00:47 morsch |
29 | Segmentation class for chambers built out of slats. | |
30 | ||
5de7d27f | 31 | */ |
32 | ||
33 | #include "AliMUONSegmentationSlat.h" | |
34 | #include "AliMUONSegmentationSlatModule.h" | |
35 | #include "AliMUON.h" | |
36 | #include "AliMUONChamber.h" | |
37 | #include "TArrayI.h" | |
38 | #include "TObjArray.h" | |
39 | #include "AliRun.h" | |
40 | #include <TMath.h> | |
41 | #include <iostream.h> | |
42 | ||
43 | //___________________________________________ | |
44 | ClassImp(AliMUONSegmentationSlat) | |
45 | ||
46 | AliMUONSegmentationSlat::AliMUONSegmentationSlat() | |
47 | { | |
48 | // Default constructor | |
49 | fSlats=0; | |
50 | fNDiv = new TArrayI(4); | |
51 | } | |
52 | ||
53 | void AliMUONSegmentationSlat::SetPadSize(Float_t p1, Float_t p2) | |
54 | { | |
55 | // Sets the pad (strip) size | |
56 | // | |
57 | fDpx=p1; | |
58 | fDpy=p2; | |
59 | } | |
60 | ||
61 | Float_t AliMUONSegmentationSlat::GetAnod(Float_t xhit) const | |
62 | { | |
63 | // Returns for a hit position xhit the position of the nearest anode wire | |
64 | Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5; | |
65 | return fWireD*wire; | |
66 | } | |
67 | ||
68 | Float_t AliMUONSegmentationSlat::Dpx(Int_t isec) const | |
69 | { | |
70 | // | |
71 | // Returns x-pad size for given sector isec | |
72 | // isec = 100*islat+iregion | |
73 | // | |
74 | Int_t islat, iregion; | |
75 | islat = isec/100; | |
76 | iregion = isec%100; | |
77 | return Slat(islat)->Dpx(iregion); | |
78 | } | |
79 | ||
80 | Float_t AliMUONSegmentationSlat::Dpy(Int_t isec) const | |
81 | { | |
82 | // | |
83 | // Returns y-pad (strip) size for given sector isec | |
84 | return fDpy; | |
85 | } | |
86 | ||
87 | void AliMUONSegmentationSlat::SetPadDivision(Int_t ndiv[4]) | |
88 | { | |
89 | // | |
90 | // Defines the pad size perp. to the anode wire (y) for different sectors. | |
91 | // Pad sizes are defined as integral fractions ndiv of a basis pad size | |
92 | // fDpx | |
93 | // | |
94 | for (Int_t i=0; i<4; i++) { | |
95 | (*fNDiv)[i]=ndiv[i]; | |
96 | } | |
97 | } | |
98 | ||
99 | void AliMUONSegmentationSlat::GlobalToLocal( | |
100 | Float_t x, Float_t y, Float_t z, Int_t &islat, Float_t &xlocal, Float_t &ylocal) | |
101 | { | |
102 | // | |
103 | // Perform local to global transformation for space coordinates | |
104 | // | |
105 | Float_t zlocal; | |
106 | Int_t i; | |
107 | Int_t index=-1; | |
108 | // Transform According to slat plane z-position: negative side is shifted down | |
109 | // positive side is shifted up | |
110 | // by half the overlap | |
111 | zlocal = z-fChamber->Z(); | |
5de7d27f | 112 | // Set the signs for the symmetry transformation and transform to first quadrant |
2b202c2e | 113 | SetSymmetry(x); |
5de7d27f | 114 | Float_t xabs=TMath::Abs(x); |
115 | ||
2b202c2e | 116 | Int_t ifirst = (zlocal < Float_t(0))? 0:1; |
5de7d27f | 117 | // |
118 | // Find slat number | |
119 | for (i=ifirst; i<fNSlats; i+=2) { | |
120 | index=i; | |
2b202c2e | 121 | if ((y >= fYPosition[i]) && (y < fYPosition[i]+fSlatY)) break; |
5de7d27f | 122 | } |
123 | ||
124 | // | |
125 | // Transform to local coordinate system | |
126 | ||
127 | ||
2b202c2e | 128 | ylocal = y -fYPosition[index]; |
5de7d27f | 129 | xlocal = xabs-fXPosition[index]; |
130 | islat = index; | |
131 | if (i >= fNSlats) {islat = -1; x=-1; y = -1;} | |
132 | } | |
133 | ||
134 | void AliMUONSegmentationSlat::GlobalToLocal( | |
135 | Int_t ix, Int_t iy, Int_t &islat, Int_t &ixlocal, Int_t &iylocal) | |
136 | { | |
137 | // | |
138 | // Perform global to local transformation for pad coordinates | |
139 | // | |
2b202c2e | 140 | Int_t iytemp = iy; |
141 | Int_t index = 0; | |
5de7d27f | 142 | |
143 | iylocal = iytemp; | |
144 | ||
145 | // | |
146 | // Find slat number (index) and iylocal | |
147 | for (Int_t i=0; i<fNSlats; i++) { | |
148 | iytemp-=Slat(i)->Npy(); | |
149 | ||
150 | ||
151 | if (iytemp <= 0) break; | |
152 | iylocal = iytemp; | |
153 | index=i+1; | |
154 | } | |
155 | ||
156 | ixlocal=TMath::Abs(ix); | |
157 | islat=index; | |
5de7d27f | 158 | } |
159 | ||
160 | void AliMUONSegmentationSlat:: | |
161 | LocalToGlobal(Int_t islat, Float_t xlocal, Float_t ylocal, Float_t &x, Float_t &y, Float_t &z) | |
162 | { | |
163 | // Transform from local to global space coordinates | |
164 | // | |
165 | // upper plane (y>0) even slat number is shifted down | |
166 | // upper plane (y>0) odd slat number is shifted up | |
167 | // lower plane (y<0) even slat number is shifted up | |
168 | // lower plane (y<0) odd slat number is shifted down | |
169 | // | |
170 | ||
2b202c2e | 171 | x = (xlocal+fXPosition[islat])*fSym; |
172 | y=(ylocal+fYPosition[islat]); | |
5de7d27f | 173 | |
2b202c2e | 174 | z = (TMath::Even(islat)) ? -fDz : fDz ; |
5de7d27f | 175 | z+=fChamber->Z(); |
5de7d27f | 176 | } |
177 | ||
178 | ||
179 | void AliMUONSegmentationSlat::LocalToGlobal( | |
180 | Int_t islat, Int_t ixlocal, Int_t iylocal, Int_t &ix, Int_t &iy) | |
181 | { | |
182 | // Transform from local to global pad coordinates | |
183 | // | |
184 | Int_t i; | |
185 | iy=iylocal; | |
186 | ||
187 | // | |
188 | // Find slat number (index) and iylocal | |
189 | for (i=0; i<islat; i++) iy+=Slat(islat)->Npy(); | |
190 | ||
2b202c2e | 191 | ix=ixlocal*fSym; |
192 | iy=iy; | |
5de7d27f | 193 | } |
194 | ||
195 | ||
2b202c2e | 196 | void AliMUONSegmentationSlat::SetSymmetry(Int_t ix) |
5de7d27f | 197 | { |
198 | // Set set signs for symmetry transformation | |
2b202c2e | 199 | fSym=TMath::Sign(1,ix); |
5de7d27f | 200 | } |
201 | ||
2b202c2e | 202 | void AliMUONSegmentationSlat::SetSymmetry(Float_t x) |
5de7d27f | 203 | { |
204 | // Set set signs for symmetry transformation | |
2b202c2e | 205 | fSym=Int_t (TMath::Sign((Float_t)1.,x)); |
5de7d27f | 206 | } |
207 | ||
208 | void AliMUONSegmentationSlat:: | |
209 | GetPadI(Float_t x, Float_t y, Float_t z, Int_t &ix, Int_t &iy) | |
210 | { | |
211 | // Returns pad coordinates for given set of space coordinates | |
212 | ||
213 | Int_t islat, i; | |
214 | Float_t xlocal, ylocal; | |
215 | ||
216 | GlobalToLocal(x,y,z,islat,xlocal,ylocal); | |
217 | if (islat == -1) { | |
218 | ix=0; iy=0; return; | |
219 | } | |
220 | ||
221 | Slat(islat)->GetPadI(xlocal, ylocal, ix, iy); | |
222 | for (i=0; i<islat; i++) iy+=Slat(islat)->Npy(); | |
223 | ||
deba22dc | 224 | ix=ix*Int_t(TMath::Sign((Float_t)1.,x)); |
5de7d27f | 225 | } |
226 | ||
2b202c2e | 227 | |
5de7d27f | 228 | void AliMUONSegmentationSlat:: |
229 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y, Float_t &z) | |
230 | { | |
231 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
232 | // | |
233 | Int_t islat, ixlocal, iylocal; | |
234 | // | |
235 | // Delegation of transforamtion to slat | |
236 | GlobalToLocal(ix,iy,islat,ixlocal,iylocal); | |
237 | Slat(islat)->GetPadC(ixlocal, iylocal, x, y); | |
238 | // Slat offset | |
239 | x+=fXPosition[islat]; | |
240 | y+=fYPosition[islat]; | |
241 | ||
2b202c2e | 242 | // Symmetry transformation of half planes |
5de7d27f | 243 | x=x*TMath::Sign(1,ix); |
2b202c2e | 244 | |
245 | // z-position | |
246 | z = (TMath::Even(islat)) ? -fDz : fDz ; | |
247 | z += fChamber->Z(); | |
5de7d27f | 248 | } |
249 | ||
250 | Int_t AliMUONSegmentationSlat::ISector() | |
251 | { | |
252 | // Returns current sector during tracking | |
253 | Int_t iregion; | |
254 | ||
255 | iregion = fCurrentSlat->ISector(); | |
256 | return 100*fSlatIndex+iregion; | |
257 | } | |
258 | ||
259 | Int_t AliMUONSegmentationSlat::Sector(Int_t ix, Int_t iy) | |
260 | { | |
261 | Int_t ixlocal, iylocal, iregion, islat; | |
262 | ||
263 | GlobalToLocal(ix,iy,islat,ixlocal,iylocal); | |
264 | ||
265 | iregion = Slat(islat)->Sector(ixlocal, iylocal); | |
266 | return 100*islat+iregion; | |
267 | } | |
268 | ||
269 | ||
270 | void AliMUONSegmentationSlat::SetPad(Int_t ix, Int_t iy) | |
271 | { | |
272 | // | |
273 | // Sets virtual pad coordinates, needed for evaluating pad response | |
274 | // outside the tracking program | |
275 | Int_t islat, ixlocal, iylocal; | |
276 | ||
2b202c2e | 277 | SetSymmetry(ix); |
5de7d27f | 278 | |
279 | GlobalToLocal(ix,iy,islat,ixlocal,iylocal); | |
280 | fSlatIndex=islat; | |
281 | fCurrentSlat=Slat(islat); | |
282 | fCurrentSlat->SetPad(ixlocal, iylocal); | |
283 | } | |
284 | ||
285 | void AliMUONSegmentationSlat::SetHit(Float_t xhit, Float_t yhit, Float_t zhit) | |
286 | { // | |
287 | // Sets current hit coordinates | |
288 | ||
289 | Float_t xlocal, ylocal; | |
290 | Int_t islat; | |
291 | ||
292 | ||
293 | ||
294 | GlobalToLocal(xhit,yhit,zhit,islat,xlocal,ylocal); | |
295 | fSlatIndex=islat; | |
296 | if (islat < 0) printf("\n SetHit: %d", islat); | |
297 | ||
298 | fCurrentSlat=Slat(islat); | |
299 | fCurrentSlat->SetHit(xlocal, ylocal); | |
300 | } | |
301 | ||
302 | ||
303 | void AliMUONSegmentationSlat:: | |
304 | FirstPad(Float_t xhit, Float_t yhit, Float_t zhit, Float_t dx, Float_t dy) | |
305 | { | |
306 | // Initialises iteration over pads for charge distribution algorithm | |
307 | // | |
308 | ||
309 | ||
310 | ||
311 | Int_t islat; | |
312 | Float_t xlocal, ylocal; | |
313 | GlobalToLocal(xhit, yhit, zhit, islat, xlocal, ylocal); | |
314 | fSlatIndex=islat; | |
315 | fCurrentSlat=Slat(islat); | |
316 | fCurrentSlat->FirstPad(xlocal, ylocal, dx, dy); | |
317 | ||
318 | } | |
319 | ||
320 | ||
321 | void AliMUONSegmentationSlat::NextPad() | |
322 | { | |
323 | // Stepper for the iteration over pads | |
324 | // | |
325 | fCurrentSlat->NextPad(); | |
326 | } | |
327 | ||
328 | ||
329 | Int_t AliMUONSegmentationSlat::MorePads() | |
330 | // Stopping condition for the iterator over pads | |
331 | // | |
332 | // Are there more pads in the integration region | |
333 | { | |
334 | return fCurrentSlat->MorePads(); | |
335 | } | |
336 | ||
337 | void AliMUONSegmentationSlat:: | |
338 | IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) | |
339 | { | |
340 | // Returns integration limits for current pad | |
341 | // | |
342 | ||
343 | fCurrentSlat->IntegrationLimits(x1, x2, y1, y2); | |
344 | ||
345 | } | |
346 | ||
347 | void AliMUONSegmentationSlat:: | |
348 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) | |
349 | { | |
350 | // Returns list of neighbours of pad with coordinates iX, iY | |
351 | ||
352 | Int_t i, xListLocal[10], yListLocal[10], iXlocal, iYlocal, islat; | |
353 | ||
2b202c2e | 354 | SetSymmetry(iX); |
5de7d27f | 355 | |
356 | GlobalToLocal(iX, iY, islat, iXlocal, iYlocal); | |
357 | ||
358 | Slat(islat)->Neighbours(iXlocal, iYlocal, Nlist, xListLocal, yListLocal); | |
359 | ||
360 | for (i=0; i<*Nlist; i++) LocalToGlobal(islat, xListLocal[i], yListLocal[i], Xlist[i], Ylist[i]); | |
361 | ||
362 | } | |
363 | ||
364 | ||
365 | Int_t AliMUONSegmentationSlat::Ix() | |
366 | { | |
367 | // Return current pad coordinate ix during stepping | |
368 | Int_t ixl,iyl,ix,iy; | |
369 | ixl=fCurrentSlat->Ix(); | |
370 | iyl=fCurrentSlat->Iy(); | |
371 | ||
372 | LocalToGlobal(fSlatIndex, ixl, iyl, ix, iy); | |
373 | Int_t ixc, iyc, isc; | |
374 | Float_t xc, yc; | |
375 | GlobalToLocal(ix, iy, isc, ixc, iyc); | |
376 | Slat(isc)->GetPadC(ixc,iyc,xc,yc); | |
377 | return ix; | |
378 | } | |
379 | ||
380 | ||
381 | Int_t AliMUONSegmentationSlat::Iy() | |
382 | { | |
383 | // Return current pad coordinate iy during stepping | |
384 | Int_t ixl,iyl,ix,iy; | |
385 | ixl=fCurrentSlat->Ix(); | |
386 | iyl=fCurrentSlat->Iy(); | |
387 | LocalToGlobal(fSlatIndex, ixl, iyl, ix, iy); | |
388 | return iy; | |
389 | } | |
390 | ||
391 | ||
392 | ||
393 | // Signal Generation Condition during Stepping | |
394 | Int_t AliMUONSegmentationSlat::SigGenCond(Float_t x, Float_t y, Float_t z) | |
395 | { | |
396 | // | |
397 | // True if signal generation condition fullfilled | |
398 | Float_t xlocal, ylocal; | |
399 | Int_t islat; | |
400 | GlobalToLocal(x, y, z, islat, xlocal, ylocal); | |
401 | return Slat(islat)->SigGenCond(xlocal, ylocal, z); | |
402 | } | |
403 | ||
404 | // Initialise signal generation at coord (x,y,z) | |
405 | void AliMUONSegmentationSlat::SigGenInit(Float_t x, Float_t y, Float_t z) | |
406 | { | |
407 | // Initialize the signal generation condition | |
408 | // | |
409 | Float_t xlocal, ylocal; | |
410 | Int_t islat; | |
411 | ||
412 | GlobalToLocal(x, y, z, islat, xlocal, ylocal); | |
413 | Slat(islat)->SigGenInit(xlocal, ylocal, z); | |
414 | } | |
415 | ||
416 | ||
417 | ||
418 | void AliMUONSegmentationSlat::Init(Int_t chamber) | |
419 | { | |
420 | // | |
421 | // Initialize slat modules of quadrant +/+ | |
422 | // The other three quadrants are handled through symmetry transformations | |
423 | // | |
3e1872ed | 424 | printf("\n Initialise Segmentation Slat \n"); |
5de7d27f | 425 | // |
426 | ||
427 | // Initialize Slat modules | |
428 | Int_t islat, i; | |
429 | Int_t ndiv[4]; | |
430 | // Pad division | |
431 | for (i=0; i<4; i++) ndiv[i]=(*fNDiv)[i]; | |
bf61d9e2 | 432 | // |
433 | fDz=0.813; | |
5de7d27f | 434 | // Slat height |
435 | fSlatY=40.; | |
2b202c2e | 436 | for (i=0; i<15; i++) fSlatX[i]=0.; |
5de7d27f | 437 | |
438 | // Initialize array of slats | |
439 | fSlats = new TObjArray(fNSlats); | |
440 | // Maximum number of strips (pads) in x and y | |
441 | fNpy=0; | |
442 | fNpx=0; | |
443 | // for each slat in the quadrant (+,+) | |
444 | for (islat=0; islat<fNSlats; islat++) { | |
445 | (*fSlats)[islat] = CreateSlatModule(); | |
446 | ||
447 | AliMUONSegmentationSlatModule *slat = Slat(islat); | |
448 | // Configure Slat | |
449 | slat->SetId(islat); | |
450 | ||
451 | // Foward pad size | |
452 | slat->SetPadSize(fDpx, fDpy); | |
453 | // Forward wire pitch | |
454 | slat->SetDAnod(fWireD); | |
455 | // Foward segmentation | |
456 | slat->SetPadDivision(ndiv); | |
457 | slat->SetPcbBoards(fPcb[islat]); | |
458 | // Initialize slat module | |
459 | slat->Init(chamber); | |
460 | // y-position of slat module relative to the first (closest to the beam) | |
2b202c2e | 461 | fYPosition[islat]= fYPosOrigin+islat*(fSlatY-2.*fShift); |
5de7d27f | 462 | // |
463 | fNpy+=slat->Npy(); | |
464 | if (slat->Npx() > fNpx) fNpx=slat->Npx(); | |
465 | Int_t isec; | |
466 | for (isec=0; isec< 4; isec++) | |
467 | { | |
468 | fSlatX[islat]+=40.*fPcb[islat][isec]; | |
469 | } | |
470 | ||
471 | } | |
472 | // Set parent chamber number | |
473 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); | |
474 | fChamber=&(pMUON->Chamber(chamber)); | |
475 | } | |
476 | ||
477 | ||
478 | ||
479 | ||
480 | ||
481 | void AliMUONSegmentationSlat::SetNPCBperSector(Int_t *npcb) | |
482 | { | |
483 | // PCB distribution for station 4 (6 rows with 1+3 segmentation regions) | |
484 | for (Int_t islat=0; islat<fNSlats; islat++){ | |
485 | fPcb[islat][0] = *(npcb + 4 * islat); | |
486 | fPcb[islat][1] = *(npcb + 4 * islat + 1); | |
487 | fPcb[islat][2] = *(npcb + 4 * islat + 2); | |
488 | fPcb[islat][3] = *(npcb + 4 * islat + 3); | |
489 | } | |
490 | } | |
491 | ||
492 | ||
493 | void AliMUONSegmentationSlat::SetSlatXPositions(Float_t *xpos) | |
494 | { | |
495 | // Set x-positions of Slats | |
496 | for (Int_t islat=0; islat<fNSlats; islat++) fXPosition[islat]=xpos[islat]; | |
497 | } | |
498 | ||
499 | AliMUONSegmentationSlatModule* AliMUONSegmentationSlat::Slat(Int_t index) const | |
500 | { return ((AliMUONSegmentationSlatModule*) (*fSlats)[index]);} | |
501 | ||
502 | ||
503 | AliMUONSegmentationSlatModule* AliMUONSegmentationSlat:: | |
504 | CreateSlatModule() | |
505 | { | |
506 | // Factory method for slat module | |
507 | return new AliMUONSegmentationSlatModule(); | |
508 | } | |
509 | ||
510 | ||
511 | ||
512 | ||
513 |