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