]>
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 | ||
16 | /* | |
17 | $Log$ | |
9e1a0ddb | 18 | Revision 1.18 2001/04/11 12:33:56 morsch |
19 | Bug in GetPadC in case of staggered planes corrected. (Thanks to J.P. Cussonneau) | |
20 | ||
bdf39337 | 21 | Revision 1.17 2001/01/30 12:17:04 morsch |
22 | Remove obolete print-statement. | |
23 | ||
0998ce75 | 24 | Revision 1.16 2001/01/30 09:23:14 hristov |
25 | Streamers removed (R.Brun) | |
26 | ||
a8a6107b | 27 | Revision 1.15 2001/01/26 21:25:48 morsch |
28 | Empty default constructors and. | |
29 | ||
e9e4cdf2 | 30 | Revision 1.14 2000/12/21 22:12:41 morsch |
31 | Clean-up of coding rule violations, | |
32 | ||
de05461e | 33 | Revision 1.13 2000/12/07 10:41:51 hristov |
34 | fCorr replaced by fCorrA | |
35 | ||
bac96a1c | 36 | Revision 1.12 2000/12/06 11:55:41 morsch |
37 | Introduce SetOffsetY(Float_t off) method as simplified simulation of pad staggering. | |
38 | fOffset is the staggering offset in y. | |
39 | ||
e80ad807 | 40 | Revision 1.11 2000/11/06 09:20:43 morsch |
41 | AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the | |
42 | Draw() method. This avoids code and parameter replication. | |
43 | ||
aaf4addd | 44 | Revision 1.10 2000/10/18 11:42:06 morsch |
45 | - AliMUONRawCluster contains z-position. | |
46 | - Some clean-up of useless print statements during initialisations. | |
47 | ||
3e1872ed | 48 | Revision 1.9 2000/10/18 08:41:32 morsch |
49 | Make NextPad() and MorePads() to iterate until the end. | |
50 | ||
d7d176c9 | 51 | Revision 1.8 2000/10/03 21:48:07 morsch |
52 | Adopt to const declaration of some of the methods in AliSegmentation. | |
53 | ||
c3eff6ad | 54 | Revision 1.7 2000/10/02 21:28:09 fca |
55 | Removal of useless dependecies via forward declarations | |
56 | ||
94de3818 | 57 | Revision 1.6 2000/10/02 16:58:29 egangler |
58 | Cleaning of the code : | |
59 | -> coding conventions | |
60 | -> void Streamers | |
61 | -> some useless includes removed or replaced by "class" statement | |
62 | ||
ecfa008b | 63 | Revision 1.5 2000/07/13 16:19:44 fca |
64 | Mainly coding conventions + some small bug fixes | |
65 | ||
ef42d733 | 66 | Revision 1.4 2000/07/03 11:54:57 morsch |
67 | AliMUONSegmentation and AliMUONHitMap have been replaced by AliSegmentation and AliHitMap in STEER | |
68 | The methods GetPadIxy and GetPadXxy of AliMUONSegmentation have changed name to GetPadI and GetPadC. | |
69 | ||
a30a000f | 70 | Revision 1.3 2000/06/29 12:34:09 morsch |
71 | AliMUONSegmentation class has been made independent of AliMUONChamber. This makes | |
72 | it usable with any other geometry class. The link to the object to which it belongs is | |
73 | established via an index. This assumes that there exists a global geometry manager | |
74 | from which the pointer to the parent object can be obtained (in our case gAlice). | |
75 | ||
d81db581 | 76 | Revision 1.2 2000/06/15 07:58:48 morsch |
77 | Code from MUON-dev joined | |
78 | ||
a9e2aefa | 79 | Revision 1.1.2.1 2000/06/09 21:37:30 morsch |
80 | AliMUONSegmentationV01 code from AliMUONSegResV01.cxx | |
81 | ||
82 | */ | |
83 | ||
84 | ||
85 | ///////////////////////////////////////////////////// | |
86 | // Segmentation and Response classes version 01 // | |
87 | ///////////////////////////////////////////////////// | |
88 | ||
89 | #include <TBox.h> | |
aaf4addd | 90 | #include <TTUBE.h> |
91 | #include <TBRIK.h> | |
92 | #include <TNode.h> | |
93 | #include <TGeometry.h> | |
a9e2aefa | 94 | #include <TF1.h> |
95 | #include <TObjArray.h> | |
96 | #include <iostream.h> | |
97 | ||
98 | #include "AliMUONSegmentationV01.h" | |
99 | #include "AliMUON.h" | |
3e1872ed | 100 | #include "AliMUONChamber.h" |
101 | #include "AliRun.h" | |
a9e2aefa | 102 | |
103 | ||
104 | ||
105 | //___________________________________________ | |
106 | ClassImp(AliMUONSegmentationV01) | |
107 | ||
108 | AliMUONSegmentationV01::AliMUONSegmentationV01(const AliMUONSegmentationV01& segmentation) | |
109 | { | |
110 | // Dummy copy constructor | |
111 | } | |
e9e4cdf2 | 112 | |
a9e2aefa | 113 | AliMUONSegmentationV01::AliMUONSegmentationV01() |
114 | { | |
115 | // Default constructor | |
e9e4cdf2 | 116 | fRSec = 0; |
117 | fNDiv = 0; | |
a8a6107b | 118 | fDpxD = 0; |
119 | fCorrA = 0; | |
e9e4cdf2 | 120 | } |
121 | ||
122 | AliMUONSegmentationV01::AliMUONSegmentationV01(Int_t nsec) | |
123 | { | |
124 | // Non default constructor | |
125 | ||
126 | fNsec = nsec; | |
c3eff6ad | 127 | fRSec = new TArrayF(fNsec); |
128 | fNDiv = new TArrayI(fNsec); | |
129 | fDpxD = new TArrayF(fNsec); | |
e9e4cdf2 | 130 | |
131 | ||
c3eff6ad | 132 | (*fRSec)[0]=(*fRSec)[1]=(*fRSec)[2]=(*fRSec)[3]=0; |
133 | (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0; | |
134 | (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0; | |
bac96a1c | 135 | fCorrA = new TObjArray(3); |
136 | (*fCorrA)[0]=0; | |
137 | (*fCorrA)[1]=0; | |
138 | (*fCorrA)[2]=0; | |
e80ad807 | 139 | fOffsetY=0; |
a9e2aefa | 140 | } |
141 | ||
e9e4cdf2 | 142 | AliMUONSegmentationV01::~AliMUONSegmentationV01() |
143 | { | |
144 | // Destructor | |
145 | if (fRSec) delete fRSec; | |
146 | if (fNDiv) delete fNDiv; | |
147 | if (fDpxD) delete fDpxD; | |
148 | if (fCorrA) { | |
149 | fCorrA->Delete(); | |
150 | delete fCorrA; | |
151 | } | |
152 | } | |
153 | ||
154 | ||
94de3818 | 155 | Float_t AliMUONSegmentationV01::Dpx(Int_t isec) const |
a9e2aefa | 156 | { |
157 | // | |
158 | // Returns x-pad size for given sector isec | |
c3eff6ad | 159 | Float_t dpx = (*fDpxD)[isec]; |
160 | return dpx; | |
a9e2aefa | 161 | } |
162 | ||
94de3818 | 163 | Float_t AliMUONSegmentationV01::Dpy(Int_t isec) const |
a9e2aefa | 164 | { |
165 | // | |
166 | // Returns y-pad size for given sector isec | |
167 | return fDpy; | |
168 | } | |
169 | ||
170 | void AliMUONSegmentationV01::SetSegRadii(Float_t r[4]) | |
171 | { | |
172 | // | |
173 | // Set the radii of the segmentation zones | |
174 | for (Int_t i=0; i<4; i++) { | |
c3eff6ad | 175 | (*fRSec)[i]=r[i]; |
a9e2aefa | 176 | } |
177 | } | |
178 | ||
179 | ||
180 | void AliMUONSegmentationV01::SetPadDivision(Int_t ndiv[4]) | |
181 | { | |
182 | // | |
183 | // Defines the pad size perp. to the anode wire (y) for different sectors. | |
184 | // Pad sizes are defined as integral fractions ndiv of a basis pad size | |
185 | // fDpx | |
186 | // | |
187 | for (Int_t i=0; i<4; i++) { | |
c3eff6ad | 188 | (*fNDiv)[i]=ndiv[i]; |
a9e2aefa | 189 | } |
190 | ndiv[0]=ndiv[1]; | |
191 | } | |
192 | ||
193 | ||
d81db581 | 194 | void AliMUONSegmentationV01::Init(Int_t chamber) |
a9e2aefa | 195 | { |
196 | // | |
197 | // Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector | |
198 | // These arrays help in converting from real to pad co-ordinates and | |
199 | // vice versa. | |
200 | // This version approximates concentric segmentation zones | |
201 | // | |
202 | Int_t isec; | |
9e1a0ddb | 203 | //printf("\n Initialise Segmentation V01\n"); |
e9e4cdf2 | 204 | |
205 | ||
c3eff6ad | 206 | fNpy=Int_t((*fRSec)[fNsec-1]/fDpy)+1; |
a9e2aefa | 207 | |
c3eff6ad | 208 | (*fDpxD)[fNsec-1]=fDpx; |
a9e2aefa | 209 | if (fNsec > 1) { |
210 | for (Int_t i=fNsec-2; i>=0; i--){ | |
c3eff6ad | 211 | (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i]; |
a9e2aefa | 212 | } |
213 | } | |
214 | // | |
215 | // fill the arrays defining the pad segmentation boundaries | |
216 | Float_t ry; | |
217 | Int_t dnx; | |
218 | Int_t add; | |
219 | // | |
220 | // loop over sections | |
221 | for(isec=0; isec<fNsec; isec++) { | |
222 | // | |
223 | // loop over pads along the aode wires | |
224 | for (Int_t iy=1; iy<=fNpy; iy++) { | |
225 | // | |
226 | Float_t x=iy*fDpy-fDpy/2; | |
c3eff6ad | 227 | if (x > (*fRSec)[isec]) { |
a9e2aefa | 228 | fNpxS[isec][iy]=0; |
229 | fCx[isec][iy]=0; | |
230 | } else { | |
c3eff6ad | 231 | ry=TMath::Sqrt((*fRSec)[isec]*(*fRSec)[isec]-x*x); |
a9e2aefa | 232 | if (isec > 1) { |
c3eff6ad | 233 | dnx= Int_t((ry-fCx[isec-1][iy])/(*fDpxD)[isec]); |
a9e2aefa | 234 | if (isec < fNsec-1) { |
235 | if (TMath::Odd((Long_t)dnx)) dnx++; | |
236 | } | |
237 | fNpxS[isec][iy]=fNpxS[isec-1][iy]+dnx; | |
c3eff6ad | 238 | fCx[isec][iy]=fCx[isec-1][iy]+dnx*(*fDpxD)[isec]; |
a9e2aefa | 239 | } else if (isec == 1) { |
c3eff6ad | 240 | dnx= Int_t((ry-fCx[isec-1][iy])/(*fDpxD)[isec]); |
a9e2aefa | 241 | fNpxS[isec][iy]=fNpxS[isec-1][iy]+dnx; |
242 | add=4 - (fNpxS[isec][iy])%4; | |
243 | if (add < 4) fNpxS[isec][iy]+=add; | |
244 | dnx=fNpxS[isec][iy]-fNpxS[isec-1][iy]; | |
c3eff6ad | 245 | fCx[isec][iy]=fCx[isec-1][iy]+dnx*(*fDpxD)[isec]; |
a9e2aefa | 246 | } else { |
c3eff6ad | 247 | dnx=Int_t(ry/(*fDpxD)[isec]); |
a9e2aefa | 248 | fNpxS[isec][iy]=dnx; |
c3eff6ad | 249 | fCx[isec][iy]=dnx*(*fDpxD)[isec]; |
a9e2aefa | 250 | } |
251 | } | |
252 | } // y-pad loop | |
253 | } // sector loop | |
3e1872ed | 254 | // reference to chamber |
255 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); | |
256 | fChamber=&(pMUON->Chamber(chamber)); | |
257 | fZ = fChamber->Z(); | |
aaf4addd | 258 | fId=chamber; |
a9e2aefa | 259 | } |
260 | ||
261 | Int_t AliMUONSegmentationV01::Sector(Int_t ix, Int_t iy) | |
262 | { | |
263 | // Returns sector number for given pad position | |
264 | // | |
265 | Int_t absix=TMath::Abs(ix); | |
266 | Int_t absiy=TMath::Abs(iy); | |
267 | Int_t isec=0; | |
268 | for (Int_t i=0; i<fNsec; i++) { | |
269 | if (absix<=fNpxS[i][absiy]){ | |
270 | isec=i; | |
271 | break; | |
272 | } | |
273 | } | |
274 | return isec; | |
275 | } | |
276 | ||
277 | void AliMUONSegmentationV01:: | |
a30a000f | 278 | GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) |
a9e2aefa | 279 | { |
280 | // Returns pad coordinates (ix,iy) for given real coordinates (x,y) | |
281 | // | |
e80ad807 | 282 | iy = (y-fOffsetY >0)? |
283 | Int_t((y-fOffsetY)/fDpy)+1 | |
284 | : | |
285 | Int_t((y-fOffsetY)/fDpy)-1; | |
286 | ||
a9e2aefa | 287 | if (iy > fNpy) iy= fNpy; |
288 | if (iy < -fNpy) iy=-fNpy; | |
289 | // | |
290 | // Find sector isec | |
291 | Int_t isec=-1; | |
292 | Float_t absx=TMath::Abs(x); | |
293 | Int_t absiy=TMath::Abs(iy); | |
294 | for (Int_t i=0; i < fNsec; i++) { | |
295 | if (absx <= fCx[i][absiy]) { | |
296 | isec=i; | |
297 | break; | |
298 | } | |
299 | } | |
300 | if (isec>0) { | |
c3eff6ad | 301 | ix= Int_t((absx-fCx[isec-1][absiy])/(*fDpxD)[isec]) |
a9e2aefa | 302 | +fNpxS[isec-1][absiy]+1; |
303 | } else if (isec == 0) { | |
c3eff6ad | 304 | ix= Int_t(absx/(*fDpxD)[isec])+1; |
a9e2aefa | 305 | } else { |
306 | ix=fNpxS[fNsec-1][absiy]+1; | |
307 | } | |
308 | ix = (x>0) ? ix:-ix; | |
309 | } | |
310 | ||
311 | void AliMUONSegmentationV01:: | |
a30a000f | 312 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) |
a9e2aefa | 313 | { |
314 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
315 | // | |
bdf39337 | 316 | y = (iy>0) ? |
317 | Float_t(iy*fDpy)-fDpy/2.+fOffsetY | |
318 | : | |
319 | Float_t(iy*fDpy)+fDpy/2.+fOffsetY; | |
320 | ||
a9e2aefa | 321 | // |
322 | // Find sector isec | |
323 | Int_t isec=AliMUONSegmentationV01::Sector(ix,iy); | |
324 | // | |
325 | Int_t absix=TMath::Abs(ix); | |
326 | Int_t absiy=TMath::Abs(iy); | |
327 | if (isec) { | |
c3eff6ad | 328 | x=fCx[isec-1][absiy]+(absix-fNpxS[isec-1][absiy])*(*fDpxD)[isec]; |
329 | x=(ix>0) ? x-(*fDpxD)[isec]/2 : -x+(*fDpxD)[isec]/2; | |
a9e2aefa | 330 | } else { |
331 | x=y=0; | |
332 | } | |
333 | } | |
334 | ||
335 | void AliMUONSegmentationV01:: | |
336 | SetPad(Int_t ix, Int_t iy) | |
337 | { | |
338 | // | |
339 | // Sets virtual pad coordinates, needed for evaluating pad response | |
340 | // outside the tracking program | |
ecfa008b | 341 | GetPadC(ix,iy,fX,fY); |
a9e2aefa | 342 | fSector=Sector(ix,iy); |
343 | } | |
344 | ||
345 | ||
346 | void AliMUONSegmentationV01:: | |
347 | FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy) | |
348 | { | |
349 | // Initialises iteration over pads for charge distribution algorithm | |
350 | // | |
351 | // | |
352 | // Find the wire position (center of charge distribution) | |
353 | Float_t x0a=GetAnod(xhit); | |
ecfa008b | 354 | fXhit=x0a; |
355 | fYhit=yhit; | |
a9e2aefa | 356 | |
357 | // | |
358 | // and take fNsigma*sigma around this center | |
359 | Float_t x01=x0a - dx; | |
360 | Float_t x02=x0a + dx; | |
361 | Float_t y01=yhit - dy; | |
362 | Float_t y02=yhit + dy; | |
363 | // | |
364 | // find the pads over which the charge distributes | |
c3eff6ad | 365 | |
ecfa008b | 366 | GetPadI(x01,y01,fIxmin,fIymin); |
367 | GetPadI(x02,y02,fIxmax,fIymax); | |
368 | fXmin=x01; | |
369 | fXmax=x02; | |
370 | fYmin=y01; | |
371 | fYmax=y02; | |
a9e2aefa | 372 | |
373 | // | |
374 | // Set current pad to lower left corner | |
ecfa008b | 375 | if (fIxmax < fIxmin) fIxmax=fIxmin; |
376 | if (fIymax < fIymin) fIymax=fIymin; | |
377 | fIx=fIxmin; | |
378 | fIy=fIymin; | |
379 | GetPadC(fIx,fIy,fX,fY); | |
a9e2aefa | 380 | } |
381 | ||
382 | ||
383 | void AliMUONSegmentationV01::NextPad() | |
384 | { | |
385 | // Stepper for the iteration over pads | |
386 | // | |
387 | // Step to next pad in the integration region | |
388 | // | |
389 | // Step to next pad in integration region | |
390 | Float_t xc,yc; | |
391 | Int_t iyc; | |
392 | ||
393 | // step from left to right | |
c3eff6ad | 394 | |
ecfa008b | 395 | if (fX < fXmax && fX != 0) { |
396 | if (fIx==-1) fIx++; | |
397 | fIx++; | |
a9e2aefa | 398 | // step up |
ecfa008b | 399 | } else if (fIy != fIymax) { |
400 | if (fIy==-1) fIy++; | |
401 | fIy++; | |
a9e2aefa | 402 | // get y-position of next row (yc), xc not used here |
ecfa008b | 403 | GetPadC(fIx,fIy,xc,yc); |
404 | // get x-pad coordiante for first pad in row (fIx) | |
405 | GetPadI(fXmin,yc,fIx,iyc); | |
a9e2aefa | 406 | } else { |
d7d176c9 | 407 | fIx=-1; |
408 | fIy=-1; | |
a9e2aefa | 409 | } |
ecfa008b | 410 | GetPadC(fIx,fIy,fX,fY); |
411 | fSector=Sector(fIx,fIy); | |
a9e2aefa | 412 | if (MorePads() && |
413 | (fSector ==-1 || fSector==0)) | |
414 | NextPad(); | |
415 | } | |
416 | ||
417 | Int_t AliMUONSegmentationV01::MorePads() | |
de05461e | 418 | |
419 | { | |
a9e2aefa | 420 | // Stopping condition for the iterator over pads |
421 | // | |
422 | // Are there more pads in the integration region | |
d7d176c9 | 423 | return (fIx != -1 || fIy != -1); |
424 | /* | |
ecfa008b | 425 | if ((fX >= fXmax && fIy >= fIymax) || fY==0) { |
a9e2aefa | 426 | return 0; |
427 | } else { | |
428 | return 1; | |
429 | } | |
d7d176c9 | 430 | */ |
a9e2aefa | 431 | } |
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 | ||
aaf4addd | 560 | void AliMUONSegmentationV01::Draw(const char* opt) const |
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 |
bac96a1c | 664 | (*fCorrA)[isec]=func; |
a9e2aefa | 665 | } |
666 | ||
c3eff6ad | 667 | TF1* AliMUONSegmentationV01::CorrFunc(Int_t isec) const |
a9e2aefa | 668 | { |
de05461e | 669 | // Get correction function |
bac96a1c | 670 | return (TF1*) (*fCorrA)[isec]; |
a9e2aefa | 671 | } |
672 | ||
673 | AliMUONSegmentationV01& AliMUONSegmentationV01::operator | |
674 | =(const AliMUONSegmentationV01 & rhs) | |
675 | { | |
676 | // Dummy assignment operator | |
677 | return *this; | |
678 | } | |
de05461e | 679 |