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.2 2000/10/18 11:42:06 morsch
19 - AliMUONRawCluster contains z-position.
20 - Some clean-up of useless print statements during initialisations.
22 Revision 1.1 2000/10/06 08:59:03 morsch
23 Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch)
27 /////////////////////////////////////////////////////
28 // Segmentation classes for slat modules //
29 // to be used with AluMUONSegmentationSlat //
30 /////////////////////////////////////////////////////
33 #include "AliMUONSegmentationSlatModule.h"
37 #include "AliMUONSegmentationV01.h"
39 //___________________________________________
40 ClassImp(AliMUONSegmentationSlatModule)
42 AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule()
44 // Default constructor
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;
52 void AliMUONSegmentationSlatModule::SetPcbBoards(Int_t n[4])
55 // Set Pcb Board segmentation zones
56 for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
60 void AliMUONSegmentationSlatModule::SetPadDivision(Int_t ndiv[4])
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
67 for (Int_t i=0; i<4; i++) {
73 Float_t AliMUONSegmentationSlatModule::Dpx(Int_t isec) const
75 // Return x-strip width
76 return (*fDpxD)[isec];
80 Float_t AliMUONSegmentationSlatModule::Dpy(Int_t isec) const
82 // Return y-strip width
88 void AliMUONSegmentationSlatModule::
89 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
91 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
94 if (iy > fNpy) iy= fNpy;
99 for (Int_t i=fNsec-1; i > 0; i--) {
107 ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
109 } else if (isec == 0) {
110 ix= Int_t(x/(*fDpxD)[isec])+1;
117 void AliMUONSegmentationSlatModule::
118 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
120 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
122 y = Float_t(iy*fDpy)-fDpy/2.;
125 Int_t isec=AliMUONSegmentationSlatModule::Sector(ix,iy);
126 if (isec == -1) printf("\n PadC %d %d %d %d \n ", isec, fId, ix, iy);
129 x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec];
130 x = x-(*fDpxD)[isec]/2;
136 void AliMUONSegmentationSlatModule::
137 SetPad(Int_t ix, Int_t iy)
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);
146 void AliMUONSegmentationSlatModule::
147 SetHit(Float_t x, Float_t y)
152 if (x < 0) fXhit = 0;
153 if (y < 0) fYhit = 0;
155 if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1];
156 if (y >= fDyPCB) fYhit = fDyPCB;
162 void AliMUONSegmentationSlatModule::
163 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
165 // Initialises iteration over pads for charge distribution algorithm
168 // Find the wire position (center of charge distribution)
169 Float_t x0a=GetAnod(xhit);
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;
179 if (x01 < 0) x01 = 0;
180 if (y01 < 0) y01 = 0;
183 for (Int_t i=fNsec-1; i > 0; i--) {
184 if (x02 >= fCx[i-1]) {
190 if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1];
191 if (y02 >= fDyPCB) y02 = fDyPCB;
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];
204 // Set current pad to lower left corner
205 if (fIxmax < fIxmin) fIxmax=fIxmin;
206 if (fIymax < fIymin) fIymax=fIymin;
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));
218 void AliMUONSegmentationSlatModule::NextPad()
220 // Stepper for the iteration over pads
222 // Step to next pad in the integration region
223 // step from left to right
226 GetPadC(fIx,fIy,fX,fY);
227 fSector=Sector(fIx,fIy);
229 } else if (fIy != fIymax) {
232 GetPadC(fIx,fIy,fX,fY);
233 fSector=Sector(fIx,fIy);
239 // printf("\n Next Pad %d %d %f %f %d %d %d %d %d ",
243 Int_t AliMUONSegmentationSlatModule::MorePads()
244 // Stopping condition for the iterator over pads
246 // Are there more pads in the integration region
249 return (fIx != -1 || fIy != -1);
253 Int_t AliMUONSegmentationSlatModule::Sector(Int_t ix, Int_t iy)
256 // Determine segmentation zone from pad coordinates
259 for (Int_t i=0; i < fNsec; i++) {
260 if (ix <= fNpxS[i]) {
265 if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n",
266 fId, ix, iy,fNpxS[3]);
272 void AliMUONSegmentationSlatModule::
273 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
275 // Returns integration limits for current pad
278 x1=fXhit-fX-Dpx(fSector)/2.;
280 y1=fYhit-fY-Dpy(fSector)/2.;
282 // printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
286 void AliMUONSegmentationSlatModule::
287 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
289 // Returns list of next neighbours for given Pad (iX, iY)
323 void AliMUONSegmentationSlatModule::Init(Int_t chamber)
325 printf("\n Initialise Segmentation SlatModule \n");
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
331 // Segmentation is defined by rectangular modules approximating
332 // concentric circles as shown below
334 // PCB module size in cm
338 // number of pad rows per PCB
340 Int_t nPyPCB=Int_t(fDyPCB/fDpy);
342 // maximum number of pad rows
345 // Calculate padsize along x
346 (*fDpxD)[fNsec-1]=fDpx;
348 for (Int_t i=fNsec-2; i>=0; i--){
349 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
353 // fill the arrays defining the pad segmentation boundaries
356 // Loop over sectors (isec=0 is the dead space surounding the beam pipe)
357 for (Int_t isec=0; isec<4; isec++) {
363 fNpxS[isec]=fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]);
365 fCx[isec]=fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
368 // maximum number of pad rows