]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationSlatModule.cxx
Correct z-position of slat planes.
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationSlatModule.cxx
CommitLineData
4c503756 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$
de2f6d11 18Revision 1.2 2000/10/18 11:42:06 morsch
19- AliMUONRawCluster contains z-position.
20- Some clean-up of useless print statements during initialisations.
21
3e1872ed 22Revision 1.1 2000/10/06 08:59:03 morsch
23Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch)
24
4c503756 25*/
26
27/////////////////////////////////////////////////////
28// Segmentation classes for slat modules //
29// to be used with AluMUONSegmentationSlat //
30/////////////////////////////////////////////////////
31
32
33#include "AliMUONSegmentationSlatModule.h"
34#include <TMath.h>
35#include <iostream.h>
36
37#include "AliMUONSegmentationV01.h"
38
39//___________________________________________
40ClassImp(AliMUONSegmentationSlatModule)
41
42AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule()
43{
44// Default constructor
45 fNsec=4;
46 fNDiv = new TArrayI(fNsec);
47 fDpxD = new TArrayF(fNsec);
48 (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;
49 (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;
50}
51
52void AliMUONSegmentationSlatModule::SetPcbBoards(Int_t n[4])
53{
54//
55// Set Pcb Board segmentation zones
56 for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
57}
58
59
60void AliMUONSegmentationSlatModule::SetPadDivision(Int_t ndiv[4])
61{
62//
63// Defines the pad size perp. to the anode wire (y) for different sectors.
64// Pad sizes are defined as integral fractions ndiv of a basis pad size
65// fDpx
66//
67 for (Int_t i=0; i<4; i++) {
68 (*fNDiv)[i]=ndiv[i];
69 }
70 ndiv[0]=ndiv[1];
71}
72
73Float_t AliMUONSegmentationSlatModule::Dpx(Int_t isec) const
74{
75// Return x-strip width
76 return (*fDpxD)[isec];
77}
78
79
80Float_t AliMUONSegmentationSlatModule::Dpy(Int_t isec) const
81{
82// Return y-strip width
83
84 return fDpy;
85}
86
87
88void AliMUONSegmentationSlatModule::
89GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
90{
91// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
92//
93 iy = Int_t(y/fDpy)+1;
94 if (iy > fNpy) iy= fNpy;
95//
96// Find sector isec
97
98 Int_t isec=-1;
99 for (Int_t i=fNsec-1; i > 0; i--) {
100 if (x >= fCx[i-1]) {
101 isec=i;
102 break;
103 }
104 }
105
106 if (isec>0) {
107 ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
108 +fNpxS[isec-1]+1;
109 } else if (isec == 0) {
110 ix= Int_t(x/(*fDpxD)[isec])+1;
111 } else {
112 ix=0;
113 iy=0;
114 }
115}
116
117void AliMUONSegmentationSlatModule::
118GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
119{
120// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
121//
122 y = Float_t(iy*fDpy)-fDpy/2.;
123//
124// Find sector isec
125 Int_t isec=AliMUONSegmentationSlatModule::Sector(ix,iy);
de2f6d11 126 if (isec == -1) printf("\n PadC %d %d %d %d \n ", isec, fId, ix, iy);
4c503756 127//
128 if (isec>0) {
129 x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec];
130 x = x-(*fDpxD)[isec]/2;
131 } else {
132 x=y=0;
133 }
134}
135
136void AliMUONSegmentationSlatModule::
137SetPad(Int_t ix, Int_t iy)
138{
139 //
140 // Sets virtual pad coordinates, needed for evaluating pad response
141 // outside the tracking program
142 GetPadC(ix,iy,fX,fY);
143 fSector=Sector(ix,iy);
144}
145
146void AliMUONSegmentationSlatModule::
147SetHit(Float_t x, Float_t y)
148{
149 fXhit = x;
150 fYhit = y;
151
152 if (x < 0) fXhit = 0;
153 if (y < 0) fYhit = 0;
154
155 if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1];
156 if (y >= fDyPCB) fYhit = fDyPCB;
157
158
159}
160
161
162void AliMUONSegmentationSlatModule::
163FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
164{
165// Initialises iteration over pads for charge distribution algorithm
166//
167 //
168 // Find the wire position (center of charge distribution)
169 Float_t x0a=GetAnod(xhit);
170 fXhit=x0a;
171 fYhit=yhit;
172 //
173 // and take fNsigma*sigma around this center
174 Float_t x01=x0a - dx;
175 Float_t x02=x0a + dx;
176 Float_t y01=yhit - dy;
177 Float_t y02=yhit + dy;
178
179 if (x01 < 0) x01 = 0;
180 if (y01 < 0) y01 = 0;
181
182 Int_t isec=-1;
183 for (Int_t i=fNsec-1; i > 0; i--) {
184 if (x02 >= fCx[i-1]) {
185 isec=i;
186 break;
187 }
188 }
189
190 if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1];
191 if (y02 >= fDyPCB) y02 = fDyPCB;
192 //
193 // find the pads over which the charge distributes
194 GetPadI(x01,y01,fIxmin,fIymin);
195 GetPadI(x02,y02,fIxmax,fIymax);
196 if (fIxmax > fNpx) fIxmax=fNpx;
197 if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec];
198 fXmin=x01;
199 fXmax=x02;
200 fYmin=y01;
201 fYmax=y02;
202
203 //
204 // Set current pad to lower left corner
205 if (fIxmax < fIxmin) fIxmax=fIxmin;
206 if (fIymax < fIymin) fIymax=fIymin;
207 fIx=fIxmin;
208 fIy=fIymin;
209
210 GetPadC(fIx,fIy,fX,fY);
211 fSector=Sector(fIx,fIy);
212// printf("\n \n First Pad: %d %d %f %f %d %d %d %f" ,
213// fIxmin, fIxmax, fXmin, fXmax, fNpx, fId, isec, Dpy(isec));
214// printf("\n \n First Pad: %d %d %f %f %d %d %d %f",
215// fIymin, fIymax, fYmin, fYmax, fNpy, fId, isec, Dpy(isec));
216}
217
218void AliMUONSegmentationSlatModule::NextPad()
219{
220// Stepper for the iteration over pads
221//
222// Step to next pad in the integration region
223// step from left to right
224 if (fIx != fIxmax) {
225 fIx++;
226 GetPadC(fIx,fIy,fX,fY);
227 fSector=Sector(fIx,fIy);
228// step up
229 } else if (fIy != fIymax) {
230 fIx=fIxmin;
231 fIy++;
232 GetPadC(fIx,fIy,fX,fY);
233 fSector=Sector(fIx,fIy);
234
235 } else {
236 fIx=-1;
237 fIy=-1;
238 }
239// printf("\n Next Pad %d %d %f %f %d %d %d %d %d ",
240}
241
242
243Int_t AliMUONSegmentationSlatModule::MorePads()
244// Stopping condition for the iterator over pads
245//
246// Are there more pads in the integration region
247{
248
249 return (fIx != -1 || fIy != -1);
250}
251
252
253Int_t AliMUONSegmentationSlatModule::Sector(Int_t ix, Int_t iy)
254{
255//
256// Determine segmentation zone from pad coordinates
257//
258 Int_t isec=-1;
259 for (Int_t i=0; i < fNsec; i++) {
260 if (ix <= fNpxS[i]) {
261 isec=i;
262 break;
263 }
264 }
265 if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n",
266 fId, ix, iy,fNpxS[3]);
267
268 return isec;
269
270}
271
272void AliMUONSegmentationSlatModule::
273IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
274{
275// Returns integration limits for current pad
276//
277
278 x1=fXhit-fX-Dpx(fSector)/2.;
279 x2=x1+Dpx(fSector);
280 y1=fYhit-fY-Dpy(fSector)/2.;
281 y2=y1+Dpy(fSector);
282// printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
283
284}
285
286void AliMUONSegmentationSlatModule::
287Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
288{
289// Returns list of next neighbours for given Pad (iX, iY)
290//
291//
292 Int_t i=0;
293//
294// step right
295 if (iX+1 <= fNpx) {
296 Xlist[i]=iX+1;
297 Ylist[i++]=iY;
298 }
299//
300// step left
301 if (iX-1 > 0) {
302 Xlist[i]=iX-1;
303 Ylist[i++]=iY;
304 }
305
306//
307// step up
308 if (iY+1 <= fNpy) {
309 Xlist[i]=iX;
310 Ylist[i++]=iY+1;
311 }
312//
313// step down
314 if (iY-1 > 0) {
315 Xlist[i]=iX;
316 Ylist[i++]=iY-1;
317 }
318
319 *Nlist=i;
320}
321
322
323void AliMUONSegmentationSlatModule::Init(Int_t chamber)
324{
3e1872ed 325 printf("\n Initialise Segmentation SlatModule \n");
4c503756 326//
327// Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector
328// These arrays help in converting from real to pad co-ordinates and
329// vice versa
330//
331// Segmentation is defined by rectangular modules approximating
332// concentric circles as shown below
333//
334// PCB module size in cm
335 fDxPCB=40;
336 fDyPCB=40;
337//
338// number of pad rows per PCB
339//
340 Int_t nPyPCB=Int_t(fDyPCB/fDpy);
341//
342// maximum number of pad rows
343 fNpy=nPyPCB;
344//
345// Calculate padsize along x
346 (*fDpxD)[fNsec-1]=fDpx;
347 if (fNsec > 1) {
348 for (Int_t i=fNsec-2; i>=0; i--){
349 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
4c503756 350 }
351 }
352//
353// fill the arrays defining the pad segmentation boundaries
354//
355//
356// Loop over sectors (isec=0 is the dead space surounding the beam pipe)
357 for (Int_t isec=0; isec<4; isec++) {
358 if (isec==0) {
359 fNpxS[0] = 0;
360 fNpyS[0] = 0;
361 fCx[0] = 0;
362 } else {
363 fNpxS[isec]=fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]);
364 fNpyS[isec]=fNpy;
365 fCx[isec]=fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
366 }
367 } // sectors
368// maximum number of pad rows
369 fNpy=nPyPCB;
370 fNpx=fNpxS[3];
de2f6d11 371//
372 fId = chamber;
373
4c503756 374}
375
376
377
378
379
380
381
382
383
384
385
386