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