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