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