]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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$ */ |
a9e2aefa | 17 | |
18 | ///////////////////////////////////////////////////// | |
19 | // Segmentation and Response classes version 01 // | |
20 | ///////////////////////////////////////////////////// | |
21 | ||
22 | #include <TBox.h> | |
aaf4addd | 23 | #include <TTUBE.h> |
24 | #include <TBRIK.h> | |
25 | #include <TNode.h> | |
26 | #include <TGeometry.h> | |
a9e2aefa | 27 | #include <TF1.h> |
3afc6e30 | 28 | #include <TVector3.h> |
a9e2aefa | 29 | #include <TObjArray.h> |
a9e2aefa | 30 | |
31 | #include "AliMUONSegmentationV01.h" | |
32 | #include "AliMUON.h" | |
3e1872ed | 33 | #include "AliMUONChamber.h" |
34 | #include "AliRun.h" | |
a9e2aefa | 35 | |
36 | ||
30178c30 | 37 | |
a9e2aefa | 38 | //___________________________________________ |
39 | ClassImp(AliMUONSegmentationV01) | |
40 | ||
30178c30 | 41 | AliMUONSegmentationV01::AliMUONSegmentationV01(const AliMUONSegmentationV01& segmentation) |
42 | : AliMUONSegmentationV0(segmentation) | |
a9e2aefa | 43 | { |
30178c30 | 44 | // Protected copy constructor |
45 | ||
46 | Fatal("AliMUONSegmentationV01", "Not implemented."); | |
a9e2aefa | 47 | } |
e9e4cdf2 | 48 | |
a9e2aefa | 49 | AliMUONSegmentationV01::AliMUONSegmentationV01() |
30178c30 | 50 | : AliMUONSegmentationV0() |
a9e2aefa | 51 | { |
52 | // Default constructor | |
e9e4cdf2 | 53 | fRSec = 0; |
54 | fNDiv = 0; | |
a8a6107b | 55 | fDpxD = 0; |
56 | fCorrA = 0; | |
0951fe3d | 57 | fSector = -1; |
e9e4cdf2 | 58 | } |
59 | ||
60 | AliMUONSegmentationV01::AliMUONSegmentationV01(Int_t nsec) | |
30178c30 | 61 | : AliMUONSegmentationV0() |
e9e4cdf2 | 62 | { |
63 | // Non default constructor | |
64 | ||
65 | fNsec = nsec; | |
c3eff6ad | 66 | fRSec = new TArrayF(fNsec); |
67 | fNDiv = new TArrayI(fNsec); | |
68 | fDpxD = new TArrayF(fNsec); | |
e9e4cdf2 | 69 | |
70 | ||
c3eff6ad | 71 | (*fRSec)[0]=(*fRSec)[1]=(*fRSec)[2]=(*fRSec)[3]=0; |
72 | (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0; | |
73 | (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0; | |
bac96a1c | 74 | fCorrA = new TObjArray(3); |
cd4df77b | 75 | fCorrA->AddAt(0,0); |
76 | fCorrA->AddAt(0,1); | |
77 | fCorrA->AddAt(0,2); | |
e80ad807 | 78 | fOffsetY=0; |
0951fe3d | 79 | fSector = -1; |
a9e2aefa | 80 | } |
81 | ||
e9e4cdf2 | 82 | AliMUONSegmentationV01::~AliMUONSegmentationV01() |
83 | { | |
84 | // Destructor | |
85 | if (fRSec) delete fRSec; | |
86 | if (fNDiv) delete fNDiv; | |
87 | if (fDpxD) delete fDpxD; | |
88 | if (fCorrA) { | |
89 | fCorrA->Delete(); | |
90 | delete fCorrA; | |
91 | } | |
92 | } | |
93 | ||
94 | ||
94de3818 | 95 | Float_t AliMUONSegmentationV01::Dpx(Int_t isec) const |
a9e2aefa | 96 | { |
97 | // | |
98 | // Returns x-pad size for given sector isec | |
c3eff6ad | 99 | Float_t dpx = (*fDpxD)[isec]; |
100 | return dpx; | |
a9e2aefa | 101 | } |
102 | ||
b1ad38fa | 103 | Float_t AliMUONSegmentationV01::Dpy(Int_t /*isec*/) const |
a9e2aefa | 104 | { |
105 | // | |
106 | // Returns y-pad size for given sector isec | |
107 | return fDpy; | |
108 | } | |
109 | ||
110 | void AliMUONSegmentationV01::SetSegRadii(Float_t r[4]) | |
111 | { | |
112 | // | |
113 | // Set the radii of the segmentation zones | |
114 | for (Int_t i=0; i<4; i++) { | |
c3eff6ad | 115 | (*fRSec)[i]=r[i]; |
a9e2aefa | 116 | } |
117 | } | |
118 | ||
119 | ||
120 | void AliMUONSegmentationV01::SetPadDivision(Int_t ndiv[4]) | |
121 | { | |
122 | // | |
123 | // Defines the pad size perp. to the anode wire (y) for different sectors. | |
124 | // Pad sizes are defined as integral fractions ndiv of a basis pad size | |
125 | // fDpx | |
126 | // | |
127 | for (Int_t i=0; i<4; i++) { | |
c3eff6ad | 128 | (*fNDiv)[i]=ndiv[i]; |
a9e2aefa | 129 | } |
130 | ndiv[0]=ndiv[1]; | |
131 | } | |
132 | ||
133 | ||
d81db581 | 134 | void AliMUONSegmentationV01::Init(Int_t chamber) |
a9e2aefa | 135 | { |
136 | // | |
137 | // Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector | |
138 | // These arrays help in converting from real to pad co-ordinates and | |
139 | // vice versa. | |
140 | // This version approximates concentric segmentation zones | |
141 | // | |
c9d10ab5 | 142 | |
a9e2aefa | 143 | Int_t isec; |
9e1a0ddb | 144 | //printf("\n Initialise Segmentation V01\n"); |
e9e4cdf2 | 145 | |
146 | ||
c3eff6ad | 147 | fNpy=Int_t((*fRSec)[fNsec-1]/fDpy)+1; |
a9e2aefa | 148 | |
c3eff6ad | 149 | (*fDpxD)[fNsec-1]=fDpx; |
a9e2aefa | 150 | if (fNsec > 1) { |
151 | for (Int_t i=fNsec-2; i>=0; i--){ | |
c3eff6ad | 152 | (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i]; |
a9e2aefa | 153 | } |
154 | } | |
155 | // | |
156 | // fill the arrays defining the pad segmentation boundaries | |
157 | Float_t ry; | |
158 | Int_t dnx; | |
159 | Int_t add; | |
160 | // | |
161 | // loop over sections | |
162 | for(isec=0; isec<fNsec; isec++) { | |
163 | // | |
164 | // loop over pads along the aode wires | |
165 | for (Int_t iy=1; iy<=fNpy; iy++) { | |
166 | // | |
167 | Float_t x=iy*fDpy-fDpy/2; | |
c3eff6ad | 168 | if (x > (*fRSec)[isec]) { |
a9e2aefa | 169 | fNpxS[isec][iy]=0; |
170 | fCx[isec][iy]=0; | |
171 | } else { | |
c3eff6ad | 172 | ry=TMath::Sqrt((*fRSec)[isec]*(*fRSec)[isec]-x*x); |
a9e2aefa | 173 | if (isec > 1) { |
c3eff6ad | 174 | dnx= Int_t((ry-fCx[isec-1][iy])/(*fDpxD)[isec]); |
a9e2aefa | 175 | if (isec < fNsec-1) { |
176 | if (TMath::Odd((Long_t)dnx)) dnx++; | |
177 | } | |
178 | fNpxS[isec][iy]=fNpxS[isec-1][iy]+dnx; | |
c3eff6ad | 179 | fCx[isec][iy]=fCx[isec-1][iy]+dnx*(*fDpxD)[isec]; |
a9e2aefa | 180 | } else if (isec == 1) { |
c3eff6ad | 181 | dnx= Int_t((ry-fCx[isec-1][iy])/(*fDpxD)[isec]); |
a9e2aefa | 182 | fNpxS[isec][iy]=fNpxS[isec-1][iy]+dnx; |
183 | add=4 - (fNpxS[isec][iy])%4; | |
184 | if (add < 4) fNpxS[isec][iy]+=add; | |
185 | dnx=fNpxS[isec][iy]-fNpxS[isec-1][iy]; | |
c3eff6ad | 186 | fCx[isec][iy]=fCx[isec-1][iy]+dnx*(*fDpxD)[isec]; |
a9e2aefa | 187 | } else { |
c3eff6ad | 188 | dnx=Int_t(ry/(*fDpxD)[isec]); |
a9e2aefa | 189 | fNpxS[isec][iy]=dnx; |
c3eff6ad | 190 | fCx[isec][iy]=dnx*(*fDpxD)[isec]; |
a9e2aefa | 191 | } |
192 | } | |
193 | } // y-pad loop | |
194 | } // sector loop | |
c9d10ab5 | 195 | |
3e1872ed | 196 | // reference to chamber |
197 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); | |
198 | fChamber=&(pMUON->Chamber(chamber)); | |
c9d10ab5 | 199 | fRmin=fChamber->RInner(); |
200 | fRmax=fChamber->ROuter(); | |
201 | fCorr=0; | |
3e1872ed | 202 | fZ = fChamber->Z(); |
aaf4addd | 203 | fId=chamber; |
a9e2aefa | 204 | } |
205 | ||
30178c30 | 206 | //______________________________________________________________________ |
a9e2aefa | 207 | Int_t AliMUONSegmentationV01::Sector(Int_t ix, Int_t iy) |
208 | { | |
209 | // Returns sector number for given pad position | |
210 | // | |
211 | Int_t absix=TMath::Abs(ix); | |
212 | Int_t absiy=TMath::Abs(iy); | |
213 | Int_t isec=0; | |
214 | for (Int_t i=0; i<fNsec; i++) { | |
215 | if (absix<=fNpxS[i][absiy]){ | |
216 | isec=i; | |
217 | break; | |
218 | } | |
219 | } | |
220 | return isec; | |
221 | } | |
30178c30 | 222 | |
b1ad38fa | 223 | //______________________________________________________________________ |
224 | void AliMUONSegmentationV01::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) | |
a9e2aefa | 225 | { |
226 | // Returns pad coordinates (ix,iy) for given real coordinates (x,y) | |
227 | // | |
e80ad807 | 228 | iy = (y-fOffsetY >0)? |
229 | Int_t((y-fOffsetY)/fDpy)+1 | |
230 | : | |
231 | Int_t((y-fOffsetY)/fDpy)-1; | |
232 | ||
a9e2aefa | 233 | if (iy > fNpy) iy= fNpy; |
234 | if (iy < -fNpy) iy=-fNpy; | |
235 | // | |
236 | // Find sector isec | |
237 | Int_t isec=-1; | |
238 | Float_t absx=TMath::Abs(x); | |
239 | Int_t absiy=TMath::Abs(iy); | |
240 | for (Int_t i=0; i < fNsec; i++) { | |
241 | if (absx <= fCx[i][absiy]) { | |
242 | isec=i; | |
243 | break; | |
244 | } | |
245 | } | |
246 | if (isec>0) { | |
c3eff6ad | 247 | ix= Int_t((absx-fCx[isec-1][absiy])/(*fDpxD)[isec]) |
a9e2aefa | 248 | +fNpxS[isec-1][absiy]+1; |
249 | } else if (isec == 0) { | |
c3eff6ad | 250 | ix= Int_t(absx/(*fDpxD)[isec])+1; |
a9e2aefa | 251 | } else { |
252 | ix=fNpxS[fNsec-1][absiy]+1; | |
253 | } | |
254 | ix = (x>0) ? ix:-ix; | |
255 | } | |
b1ad38fa | 256 | //________________________________________________________________ |
257 | void AliMUONSegmentationV01::GetPadI(Float_t x, Float_t y , Float_t /*z*/, Int_t &ix, Int_t &iy) | |
258 | { | |
259 | GetPadI(x, y, ix, iy); | |
260 | } | |
261 | //________________________________________________________________ | |
a9e2aefa | 262 | |
263 | void AliMUONSegmentationV01:: | |
a30a000f | 264 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) |
a9e2aefa | 265 | { |
266 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
267 | // | |
bdf39337 | 268 | y = (iy>0) ? |
269 | Float_t(iy*fDpy)-fDpy/2.+fOffsetY | |
270 | : | |
271 | Float_t(iy*fDpy)+fDpy/2.+fOffsetY; | |
272 | ||
a9e2aefa | 273 | // |
274 | // Find sector isec | |
275 | Int_t isec=AliMUONSegmentationV01::Sector(ix,iy); | |
276 | // | |
277 | Int_t absix=TMath::Abs(ix); | |
278 | Int_t absiy=TMath::Abs(iy); | |
279 | if (isec) { | |
c3eff6ad | 280 | x=fCx[isec-1][absiy]+(absix-fNpxS[isec-1][absiy])*(*fDpxD)[isec]; |
281 | x=(ix>0) ? x-(*fDpxD)[isec]/2 : -x+(*fDpxD)[isec]/2; | |
a9e2aefa | 282 | } else { |
283 | x=y=0; | |
284 | } | |
3afc6e30 | 285 | |
286 | } | |
287 | //________________________________________________________________ | |
288 | ||
289 | void AliMUONSegmentationV01:: | |
290 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y, Float_t &z) | |
291 | { | |
292 | // Returns real coordinates (x,y,z) for given pad coordinates (ix,iy) | |
293 | // | |
294 | GetPadC(ix,iy,x,y); | |
295 | ||
296 | // To be properly interfaced with chamber geometry (AliMUONSt1GeometryBuilderV2) ??? | |
297 | TVector3 scale[4]; | |
298 | scale[0] = TVector3( 1, 1, 1); // quadrant I | |
299 | scale[1] = TVector3(-1, 1, -1); // quadrant II | |
300 | scale[2] = TVector3(-1, -1, 1); // quadrant III | |
301 | scale[3] = TVector3( 1, -1, -1); // quadrant IV | |
302 | ||
303 | Int_t iQuadrant; | |
304 | ||
305 | if (ix > 0) { | |
306 | if (iy > 0) { | |
307 | iQuadrant = 0; | |
308 | } else { | |
309 | iQuadrant = 3; | |
310 | } | |
311 | } else { | |
312 | if (iy > 0) { | |
313 | iQuadrant = 1; | |
314 | } else { | |
315 | iQuadrant = 2; | |
316 | } | |
317 | } | |
318 | if (TMath::Abs(fZ) < 600) { | |
319 | z = fZ + scale[iQuadrant].Z()*6.5/2.; // Station 1 | |
320 | } else { | |
321 | z = fZ; // Station 2 | |
322 | } | |
a9e2aefa | 323 | } |
324 | ||
325 | void AliMUONSegmentationV01:: | |
326 | SetPad(Int_t ix, Int_t iy) | |
327 | { | |
328 | // | |
329 | // Sets virtual pad coordinates, needed for evaluating pad response | |
330 | // outside the tracking program | |
ecfa008b | 331 | GetPadC(ix,iy,fX,fY); |
a9e2aefa | 332 | fSector=Sector(ix,iy); |
333 | } | |
334 | ||
b1ad38fa | 335 | //______________________________________________________________________ |
336 | void AliMUONSegmentationV01::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy) | |
a9e2aefa | 337 | { |
338 | // Initialises iteration over pads for charge distribution algorithm | |
339 | // | |
340 | // | |
341 | // Find the wire position (center of charge distribution) | |
342 | Float_t x0a=GetAnod(xhit); | |
ecfa008b | 343 | fXhit=x0a; |
344 | fYhit=yhit; | |
a9e2aefa | 345 | |
346 | // | |
347 | // and take fNsigma*sigma around this center | |
348 | Float_t x01=x0a - dx; | |
349 | Float_t x02=x0a + dx; | |
350 | Float_t y01=yhit - dy; | |
351 | Float_t y02=yhit + dy; | |
352 | // | |
353 | // find the pads over which the charge distributes | |
c3eff6ad | 354 | |
ecfa008b | 355 | GetPadI(x01,y01,fIxmin,fIymin); |
356 | GetPadI(x02,y02,fIxmax,fIymax); | |
357 | fXmin=x01; | |
358 | fXmax=x02; | |
359 | fYmin=y01; | |
360 | fYmax=y02; | |
a9e2aefa | 361 | |
362 | // | |
363 | // Set current pad to lower left corner | |
ecfa008b | 364 | if (fIxmax < fIxmin) fIxmax=fIxmin; |
365 | if (fIymax < fIymin) fIymax=fIymin; | |
366 | fIx=fIxmin; | |
367 | fIy=fIymin; | |
368 | GetPadC(fIx,fIy,fX,fY); | |
30178c30 | 369 | |
0951fe3d | 370 | // added |
371 | if (fSector == -1) { | |
372 | fSector=Sector(fIx,fIy); | |
373 | } | |
a9e2aefa | 374 | } |
375 | ||
376 | ||
377 | void AliMUONSegmentationV01::NextPad() | |
378 | { | |
379 | // Stepper for the iteration over pads | |
380 | // | |
381 | // Step to next pad in the integration region | |
382 | // | |
383 | // Step to next pad in integration region | |
384 | Float_t xc,yc; | |
385 | Int_t iyc; | |
386 | ||
387 | // step from left to right | |
c3eff6ad | 388 | |
ecfa008b | 389 | if (fX < fXmax && fX != 0) { |
390 | if (fIx==-1) fIx++; | |
391 | fIx++; | |
a9e2aefa | 392 | // step up |
ecfa008b | 393 | } else if (fIy != fIymax) { |
394 | if (fIy==-1) fIy++; | |
395 | fIy++; | |
a9e2aefa | 396 | // get y-position of next row (yc), xc not used here |
ecfa008b | 397 | GetPadC(fIx,fIy,xc,yc); |
398 | // get x-pad coordiante for first pad in row (fIx) | |
399 | GetPadI(fXmin,yc,fIx,iyc); | |
a9e2aefa | 400 | } else { |
d7d176c9 | 401 | fIx=-1; |
402 | fIy=-1; | |
a9e2aefa | 403 | } |
ecfa008b | 404 | GetPadC(fIx,fIy,fX,fY); |
405 | fSector=Sector(fIx,fIy); | |
a9e2aefa | 406 | if (MorePads() && |
407 | (fSector ==-1 || fSector==0)) | |
408 | NextPad(); | |
409 | } | |
410 | ||
411 | Int_t AliMUONSegmentationV01::MorePads() | |
de05461e | 412 | |
413 | { | |
a9e2aefa | 414 | // Stopping condition for the iterator over pads |
415 | // | |
416 | // Are there more pads in the integration region | |
d7d176c9 | 417 | return (fIx != -1 || fIy != -1); |
418 | /* | |
ecfa008b | 419 | if ((fX >= fXmax && fIy >= fIymax) || fY==0) { |
a9e2aefa | 420 | return 0; |
421 | } else { | |
422 | return 1; | |
423 | } | |
d7d176c9 | 424 | */ |
a9e2aefa | 425 | } |
b1ad38fa | 426 | //______________________________________________________________________ |
427 | void AliMUONSegmentationV01::FirstPad(Float_t xhit, Float_t yhit, Float_t /*zhit*/, Float_t dx, Float_t dy) | |
428 | { | |
429 | FirstPad(xhit, yhit, dx, dy); | |
430 | } | |
431 | ||
a9e2aefa | 432 | |
433 | void AliMUONSegmentationV01:: | |
434 | IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) | |
435 | { | |
436 | // Returns integration limits for current pad | |
437 | // | |
ecfa008b | 438 | x1=fXhit-fX-Dpx(fSector)/2.; |
a9e2aefa | 439 | x2=x1+Dpx(fSector); |
ecfa008b | 440 | y1=fYhit-fY-Dpy(fSector)/2.; |
a9e2aefa | 441 | y2=y1+Dpy(fSector); |
442 | } | |
443 | ||
444 | void AliMUONSegmentationV01:: | |
445 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) | |
446 | { | |
447 | // Returns list of next neighbours for given Pad (iX, iY) | |
448 | // | |
449 | const Float_t kEpsilon=fDpy/1000; | |
450 | ||
451 | Float_t x,y; | |
452 | Int_t ixx, iyy, isec1; | |
453 | // | |
454 | Int_t isec0=AliMUONSegmentationV01::Sector(iX,iY); | |
455 | Int_t i=0; | |
456 | // | |
457 | // step right | |
458 | Xlist[i]=iX+1; | |
459 | if (Xlist[i]==0) Xlist[i]++; | |
460 | Ylist[i++]=iY; | |
461 | // | |
462 | // step left | |
463 | Xlist[i]=iX-1; | |
464 | if (Xlist[i]==0) Xlist[i]--; | |
465 | Ylist[i++]=iY; | |
466 | // | |
467 | // step up | |
a30a000f | 468 | AliMUONSegmentationV01::GetPadC(iX,iY,x,y); |
469 | AliMUONSegmentationV01::GetPadI(x+kEpsilon,y+fDpy,ixx,iyy); | |
a9e2aefa | 470 | Xlist[i]=ixx; |
471 | Ylist[i++]=iyy; | |
472 | isec1=AliMUONSegmentationV01::Sector(ixx,iyy); | |
473 | if (isec1==isec0) { | |
474 | // | |
475 | // no sector boundary crossing | |
476 | // Xlist[i]=ixx+1; | |
477 | // Ylist[i++]=iY+1; | |
478 | ||
479 | // Xlist[i]=ixx-1; | |
480 | // Ylist[i++]=iY+1; | |
481 | } else if (isec1 < isec0) { | |
482 | // finer segmentation | |
483 | // Xlist[i]=ixx+1; | |
484 | // Ylist[i++]=iY+1; | |
485 | ||
486 | Xlist[i]=ixx-1; | |
487 | Ylist[i++]=iyy; | |
488 | ||
489 | // Xlist[i]=ixx-2; | |
490 | // Ylist[i++]=iY+1; | |
491 | } else { | |
492 | // coarser segmenation | |
493 | /* | |
494 | if (TMath::Odd(iX-fNpxS[isec1-1][iY+1])) { | |
495 | Xlist[i]=ixx-1; | |
496 | Ylist[i++]=iY+1; | |
497 | } else { | |
498 | Xlist[i]=ixx+1; | |
499 | Ylist[i++]=iY+1; | |
500 | } | |
501 | */ | |
502 | } | |
503 | ||
504 | // | |
505 | // step down | |
a30a000f | 506 | AliMUONSegmentationV01::GetPadC(iX,iY,x,y); |
507 | AliMUONSegmentationV01::GetPadI(x+kEpsilon,y-fDpy,ixx,iyy); | |
a9e2aefa | 508 | Xlist[i]=ixx; |
509 | Ylist[i++]=iyy; | |
510 | isec1=AliMUONSegmentationV01::Sector(ixx,iyy); | |
511 | if (isec1==isec0) { | |
512 | // | |
513 | // no sector boundary crossing | |
514 | /* | |
515 | Xlist[i]=ixx+1; | |
516 | Ylist[i++]=iY-1; | |
517 | ||
518 | Xlist[i]=ixx-1; | |
519 | Ylist[i++]=iY-1; | |
520 | */ | |
521 | } else if (isec1 < isec0) { | |
522 | // finer segmentation | |
523 | // Xlist[i]=ixx+1; | |
524 | // Ylist[i++]=iY-1; | |
525 | ||
526 | Xlist[i]=ixx-1; | |
527 | Ylist[i++]=iyy; | |
528 | ||
529 | // Xlist[i]=ixx-2; | |
530 | // Ylist[i++]=iY-1; | |
531 | } else { | |
532 | // coarser segmentation | |
533 | /* | |
534 | if (TMath::Odd(iX-fNpxS[isec1-1][iY-1])) { | |
535 | Xlist[i]=ixx-1; | |
536 | Ylist[i++]=iY-1; | |
537 | } else { | |
538 | Xlist[i]=ixx+1; | |
539 | Ylist[i++]=iY-1; | |
540 | } | |
541 | */ | |
542 | } | |
543 | *Nlist=i; | |
544 | } | |
545 | ||
c3eff6ad | 546 | void AliMUONSegmentationV01::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const |
a9e2aefa | 547 | { |
548 | // Returns test point on the pad plane. | |
549 | // Used during determination of the segmoid correction of the COG-method | |
550 | ||
551 | n=3; | |
c3eff6ad | 552 | x[0]=((*fRSec)[0]+(*fRSec)[1])/2/TMath::Sqrt(2.); |
a9e2aefa | 553 | y[0]=x[0]; |
c3eff6ad | 554 | x[1]=((*fRSec)[1]+(*fRSec)[2])/2/TMath::Sqrt(2.); |
a9e2aefa | 555 | y[1]=x[1]; |
c3eff6ad | 556 | x[2]=((*fRSec)[2]+(*fRSec)[3])/2/TMath::Sqrt(2.); |
a9e2aefa | 557 | y[2]=x[2]; |
558 | } | |
559 | ||
c9d10ab5 | 560 | void AliMUONSegmentationV01::Draw(const char* opt) |
a9e2aefa | 561 | { |
aaf4addd | 562 | |
a9e2aefa | 563 | // Draws the segmentation zones |
564 | // | |
aaf4addd | 565 | if (!strcmp(opt,"eventdisplay")) { |
566 | const int kColorMUON = kBlue; | |
567 | ||
568 | TRotMatrix* rot000 = new TRotMatrix("Rot000"," ", 90, 0, 90, 90, 0, 0); | |
569 | TRotMatrix* rot090 = new TRotMatrix("Rot090"," ", 90, 90, 90,180, 0, 0); | |
570 | TRotMatrix* rot180 = new TRotMatrix("Rot180"," ", 90,180, 90,270, 0, 0); | |
571 | TRotMatrix* rot270 = new TRotMatrix("Rot270"," ", 90,270, 90, 0, 0, 0); | |
572 | ||
573 | char nameChamber[9], nameSense[9], nameFrame[9], nameNode[9]; | |
574 | char nameSense1[9], nameSense2[9]; | |
575 | TNode *node, *nodeF; | |
576 | ||
577 | sprintf(nameChamber,"C_MUON%d",fId+1); | |
578 | sprintf(nameSense,"S_MUON%d",fId+1); | |
579 | sprintf(nameSense1,"S1_MUON%d",fId+1); | |
580 | sprintf(nameSense2,"S2_MUON%d",fId+1); | |
581 | sprintf(nameFrame,"F_MUON%d",fId+1); | |
582 | ||
583 | TNode* top=gAlice->GetGeometry()->GetNode("alice"); | |
584 | ||
585 | Float_t rmin = (*fRSec)[0]-3; | |
586 | Float_t rmax = (*fRSec)[3]+3; | |
587 | new TTUBE(nameChamber,"Mother","void",rmin,rmax,0.25,1.); | |
588 | rmin = (*fRSec)[0]; | |
589 | rmax = (*fRSec)[3]; | |
590 | new TTUBE(nameSense,"Sens. region","void",rmin,rmax,0.25, 1.); | |
591 | Float_t dx=(rmax-rmin)/2; | |
592 | Float_t dy=3.; | |
593 | Float_t dz=0.25; | |
594 | TBRIK* frMUON = new TBRIK(nameFrame,"Frame","void",dx,dy,dz); | |
595 | top->cd(); | |
596 | sprintf(nameNode,"MUON%d",100+fId+1); | |
597 | node = new TNode(nameNode,"ChamberNode",nameChamber,0,0,fChamber->Z(),""); | |
598 | node->SetLineColor(kColorMUON); | |
599 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); | |
600 | (pMUON->Nodes())->Add(node); | |
601 | node->cd(); | |
602 | sprintf(nameNode,"MUON%d",200+fId+1); | |
603 | node = new TNode(nameNode,"Sens. Region Node",nameSense,0,0,0,""); | |
604 | node->SetLineColor(kColorMUON); | |
605 | node->cd(); | |
606 | Float_t dr=dx+rmin; | |
607 | sprintf(nameNode,"MUON%d",300+fId+1); | |
608 | nodeF = new TNode(nameNode,"Frame0",frMUON,dr, 0, 0,rot000,""); | |
609 | nodeF->SetLineColor(kColorMUON); | |
610 | node->cd(); | |
611 | sprintf(nameNode,"MUON%d",400+fId+1); | |
612 | nodeF = new TNode(nameNode,"Frame1",frMUON,0 ,dr,0,rot090,""); | |
613 | nodeF->SetLineColor(kColorMUON); | |
614 | node->cd(); | |
615 | sprintf(nameNode,"MUON%d",500+fId+1); | |
616 | nodeF = new TNode(nameNode,"Frame2",frMUON,-dr,0,0,rot180,""); | |
617 | nodeF->SetLineColor(kColorMUON); | |
618 | node ->cd(); | |
619 | sprintf(nameNode,"MUON%d",600+fId+1); | |
620 | nodeF = new TNode(nameNode,"Frame3",frMUON,0,-dr,0,rot270,""); | |
621 | nodeF->SetLineColor(kColorMUON); | |
622 | } else { | |
a9e2aefa | 623 | TBox *box; |
624 | ||
625 | Float_t dx=0.95/fCx[3][1]/2; | |
626 | Float_t dy=0.95/(Float_t(Npy()))/2; | |
627 | Float_t x0,y0,x1,y1; | |
628 | Float_t xc=0.5; | |
629 | Float_t yc=0.5; | |
630 | ||
aaf4addd | 631 | for (Int_t iy=1; iy<Npy(); iy++) { |
632 | for (Int_t isec=0; isec<4; isec++) { | |
633 | if (isec==0) { | |
634 | x0=0; | |
635 | x1=fCx[isec][iy]*dx; | |
636 | } else { | |
637 | x0=fCx[isec-1][iy]*dx; | |
638 | x1=fCx[isec][iy]*dx; | |
a9e2aefa | 639 | } |
aaf4addd | 640 | y0=Float_t(iy-1)*dy; |
641 | y1=y0+dy; | |
642 | box=new TBox(x0+xc,y0+yc,x1+xc,y1+yc); | |
643 | box->SetFillColor(isec+1); | |
644 | box->Draw(); | |
645 | ||
646 | box=new TBox(-x1+xc,y0+yc,-x0+xc,y1+yc); | |
647 | box->SetFillColor(isec+1); | |
648 | box->Draw(); | |
649 | ||
650 | box=new TBox(x0+xc,-y1+yc,x1+xc,-y0+yc); | |
651 | box->SetFillColor(isec+1); | |
652 | box->Draw(); | |
653 | ||
654 | box=new TBox(-x1+xc,-y1+yc,-x0+xc,-y0+yc); | |
655 | box->SetFillColor(isec+1); | |
656 | box->Draw(); | |
657 | } | |
a9e2aefa | 658 | } |
aaf4addd | 659 | } |
a9e2aefa | 660 | } |
661 | void AliMUONSegmentationV01::SetCorrFunc(Int_t isec, TF1* func) | |
662 | { | |
de05461e | 663 | // Set the correction function |
cd4df77b | 664 | fCorrA->AddAt(func,isec); |
a9e2aefa | 665 | } |
666 | ||
c3eff6ad | 667 | TF1* AliMUONSegmentationV01::CorrFunc(Int_t isec) const |
a9e2aefa | 668 | { |
de05461e | 669 | // Get correction function |
2682e810 | 670 | //PH return (TF1*) (*fCorrA)[isec]; |
671 | return (TF1*) fCorrA->At(isec); | |
a9e2aefa | 672 | } |
673 | ||
30178c30 | 674 | AliMUONSegmentationV01& |
675 | AliMUONSegmentationV01::operator =(const AliMUONSegmentationV01 & rhs) | |
a9e2aefa | 676 | { |
30178c30 | 677 | // Protected assignement operator |
678 | ||
679 | if (this == &rhs) return *this; | |
680 | ||
681 | Fatal("operator=", "Not implemented."); | |
682 | ||
683 | return *this; | |
a9e2aefa | 684 | } |
de05461e | 685 |