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