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