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