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