1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.3 2000/10/22 16:56:32 morsch
19 - Store chamber number as slat id.
21 Revision 1.2 2000/10/18 11:42:06 morsch
22 - AliMUONRawCluster contains z-position.
23 - Some clean-up of useless print statements during initialisations.
25 Revision 1.1 2000/10/06 08:59:03 morsch
26 Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch)
30 /////////////////////////////////////////////////////
31 // Segmentation classes for slat modules //
32 // to be used with AluMUONSegmentationSlat //
33 /////////////////////////////////////////////////////
36 #include "AliMUONSegmentationSlatModule.h"
40 #include "AliMUONSegmentationV01.h"
42 //___________________________________________
43 ClassImp(AliMUONSegmentationSlatModule)
45 AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule()
47 // Default constructor
49 fNDiv = new TArrayI(fNsec);
50 fDpxD = new TArrayF(fNsec);
51 (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;
52 (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;
55 void AliMUONSegmentationSlatModule::SetPcbBoards(Int_t n[4])
58 // Set Pcb Board segmentation zones
59 for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
63 void AliMUONSegmentationSlatModule::SetPadDivision(Int_t ndiv[4])
66 // Defines the pad size perp. to the anode wire (y) for different sectors.
67 // Pad sizes are defined as integral fractions ndiv of a basis pad size
70 for (Int_t i=0; i<4; i++) {
76 Float_t AliMUONSegmentationSlatModule::Dpx(Int_t isec) const
78 // Return x-strip width
79 return (*fDpxD)[isec];
83 Float_t AliMUONSegmentationSlatModule::Dpy(Int_t isec) const
85 // Return y-strip width
91 void AliMUONSegmentationSlatModule::
92 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
94 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
97 if (iy > fNpy) iy= fNpy;
102 for (Int_t i=fNsec-1; i > 0; i--) {
105 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
111 ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
113 } else if (isec == 0) {
114 ix= Int_t(x/(*fDpxD)[isec])+1;
121 void AliMUONSegmentationSlatModule::
122 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
124 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
126 y = Float_t(iy*fDpy)-fDpy/2.;
129 Int_t isec=AliMUONSegmentationSlatModule::Sector(ix,iy);
130 if (isec == -1) printf("\n PadC %d %d %d %d \n ", isec, fId, ix, iy);
133 x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec];
134 x = x-(*fDpxD)[isec]/2;
140 void AliMUONSegmentationSlatModule::
141 SetPad(Int_t ix, Int_t iy)
144 // Sets virtual pad coordinates, needed for evaluating pad response
145 // outside the tracking program
146 GetPadC(ix,iy,fX,fY);
147 fSector=Sector(ix,iy);
150 void AliMUONSegmentationSlatModule::
151 SetHit(Float_t x, Float_t y)
156 if (x < 0) fXhit = 0;
157 if (y < 0) fYhit = 0;
159 if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1];
160 if (y >= fDyPCB) fYhit = fDyPCB;
166 void AliMUONSegmentationSlatModule::
167 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
169 // Initialises iteration over pads for charge distribution algorithm
172 // Find the wire position (center of charge distribution)
173 Float_t x0a=GetAnod(xhit);
177 // and take fNsigma*sigma around this center
178 Float_t x01=x0a - dx;
179 Float_t x02=x0a + dx;
180 Float_t y01=yhit - dy;
181 Float_t y02=yhit + dy;
182 if (x01 < 0) x01 = 0;
183 if (y01 < 0) y01 = 0;
185 if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1];
186 if (y02 >= fDyPCB) y02 = fDyPCB;
190 for (Int_t i=fNsec-1; i > 0; i--) {
191 if (x02 >= fCx[i-1]) {
193 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
199 // find the pads over which the charge distributes
200 GetPadI(x01,y01,fIxmin,fIymin);
201 GetPadI(x02,y02,fIxmax,fIymax);
203 if (fIxmax > fNpx) fIxmax=fNpx;
204 if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec];
211 // Set current pad to lower left corner
212 if (fIxmax < fIxmin) fIxmax=fIxmin;
213 if (fIymax < fIymin) fIymax=fIymin;
217 GetPadC(fIx,fIy,fX,fY);
218 fSector=Sector(fIx,fIy);
219 // printf("\n \n First Pad: %d %d %f %f %d %d %d %f" ,
220 // fIxmin, fIxmax, fXmin, fXmax, fNpx, fId, isec, Dpy(isec));
221 // printf("\n \n First Pad: %d %d %f %f %d %d %d %f",
222 // fIymin, fIymax, fYmin, fYmax, fNpyS[isec], fId, isec, Dpy(isec));
225 void AliMUONSegmentationSlatModule::NextPad()
227 // Stepper for the iteration over pads
229 // Step to next pad in the integration region
230 // step from left to right
233 GetPadC(fIx,fIy,fX,fY);
234 fSector=Sector(fIx,fIy);
236 } else if (fIy != fIymax) {
239 GetPadC(fIx,fIy,fX,fY);
240 fSector=Sector(fIx,fIy);
246 // printf("\n Next Pad %d %d %f %f %d %d %d %d %d ",
250 Int_t AliMUONSegmentationSlatModule::MorePads()
251 // Stopping condition for the iterator over pads
253 // Are there more pads in the integration region
256 return (fIx != -1 || fIy != -1);
260 Int_t AliMUONSegmentationSlatModule::Sector(Int_t ix, Int_t iy)
263 // Determine segmentation zone from pad coordinates
266 for (Int_t i=0; i < fNsec; i++) {
267 if (ix <= fNpxS[i]) {
272 if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n",
273 fId, ix, iy,fNpxS[3]);
279 void AliMUONSegmentationSlatModule::
280 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
282 // Returns integration limits for current pad
285 x1=fXhit-fX-Dpx(fSector)/2.;
287 y1=fYhit-fY-Dpy(fSector)/2.;
289 // printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
293 void AliMUONSegmentationSlatModule::
294 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
296 // Returns list of next neighbours for given Pad (iX, iY)
330 void AliMUONSegmentationSlatModule::Init(Int_t chamber)
332 printf("\n Initialise Segmentation SlatModule \n");
334 // Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector
335 // These arrays help in converting from real to pad co-ordinates and
338 // Segmentation is defined by rectangular modules approximating
339 // concentric circles as shown below
341 // PCB module size in cm
345 // number of pad rows per PCB
347 Int_t nPyPCB=Int_t(fDyPCB/fDpy);
349 // maximum number of pad rows
352 // Calculate padsize along x
353 (*fDpxD)[fNsec-1]=fDpx;
355 for (Int_t i=fNsec-2; i>=0; i--){
356 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
360 // fill the arrays defining the pad segmentation boundaries
363 // Loop over sectors (isec=0 is the dead space surounding the beam pipe)
364 for (Int_t isec=0; isec<4; isec++) {
370 fNpxS[isec]=fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]);
372 fCx[isec]=fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
375 // maximum number of pad rows