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 **************************************************************************/
20 /////////////////////////////////////////////////////
21 // Segmentation classes for slat modules //
22 // to be used with AluMUONSegmentationSlat //
23 /////////////////////////////////////////////////////
26 #include "AliMUONSegmentationSlatModule.h"
30 #include "AliMUONSegmentationV01.h"
32 //___________________________________________
33 ClassImp(AliMUONSegmentationSlatModule)
35 AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule()
37 // Default constructor
39 fNDiv = new TArrayI(fNsec);
40 fDpxD = new TArrayF(fNsec);
41 (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;
42 (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;
45 void AliMUONSegmentationSlatModule::SetPcbBoards(Int_t n[4])
48 // Set Pcb Board segmentation zones
49 for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
53 void AliMUONSegmentationSlatModule::SetPadDivision(Int_t ndiv[4])
56 // Defines the pad size perp. to the anode wire (y) for different sectors.
57 // Pad sizes are defined as integral fractions ndiv of a basis pad size
60 for (Int_t i=0; i<4; i++) {
66 Float_t AliMUONSegmentationSlatModule::Dpx(Int_t isec) const
68 // Return x-strip width
69 return (*fDpxD)[isec];
73 Float_t AliMUONSegmentationSlatModule::Dpy(Int_t isec) const
75 // Return y-strip width
81 void AliMUONSegmentationSlatModule::
82 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
84 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
87 if (iy > fNpy) iy= fNpy;
92 for (Int_t i=fNsec-1; i > 0; i--) {
100 ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
102 } else if (isec == 0) {
103 ix= Int_t(x/(*fDpxD)[isec])+1;
110 void AliMUONSegmentationSlatModule::
111 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
113 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
115 y = Float_t(iy*fDpy)-fDpy/2.;
118 Int_t isec=AliMUONSegmentationSlatModule::Sector(ix,iy);
119 if (isec == -1) printf("\n PadC %d %d %d \n ", isec, ix, iy);
122 x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec];
123 x = x-(*fDpxD)[isec]/2;
129 void AliMUONSegmentationSlatModule::
130 SetPad(Int_t ix, Int_t iy)
133 // Sets virtual pad coordinates, needed for evaluating pad response
134 // outside the tracking program
135 GetPadC(ix,iy,fX,fY);
136 fSector=Sector(ix,iy);
139 void AliMUONSegmentationSlatModule::
140 SetHit(Float_t x, Float_t y)
145 if (x < 0) fXhit = 0;
146 if (y < 0) fYhit = 0;
148 if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1];
149 if (y >= fDyPCB) fYhit = fDyPCB;
155 void AliMUONSegmentationSlatModule::
156 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
158 // Initialises iteration over pads for charge distribution algorithm
161 // Find the wire position (center of charge distribution)
162 Float_t x0a=GetAnod(xhit);
166 // and take fNsigma*sigma around this center
167 Float_t x01=x0a - dx;
168 Float_t x02=x0a + dx;
169 Float_t y01=yhit - dy;
170 Float_t y02=yhit + dy;
172 if (x01 < 0) x01 = 0;
173 if (y01 < 0) y01 = 0;
176 for (Int_t i=fNsec-1; i > 0; i--) {
177 if (x02 >= fCx[i-1]) {
183 if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1];
184 if (y02 >= fDyPCB) y02 = fDyPCB;
186 // find the pads over which the charge distributes
187 GetPadI(x01,y01,fIxmin,fIymin);
188 GetPadI(x02,y02,fIxmax,fIymax);
189 if (fIxmax > fNpx) fIxmax=fNpx;
190 if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec];
197 // Set current pad to lower left corner
198 if (fIxmax < fIxmin) fIxmax=fIxmin;
199 if (fIymax < fIymin) fIymax=fIymin;
203 GetPadC(fIx,fIy,fX,fY);
204 fSector=Sector(fIx,fIy);
205 // printf("\n \n First Pad: %d %d %f %f %d %d %d %f" ,
206 // fIxmin, fIxmax, fXmin, fXmax, fNpx, fId, isec, Dpy(isec));
207 // printf("\n \n First Pad: %d %d %f %f %d %d %d %f",
208 // fIymin, fIymax, fYmin, fYmax, fNpy, fId, isec, Dpy(isec));
211 void AliMUONSegmentationSlatModule::NextPad()
213 // Stepper for the iteration over pads
215 // Step to next pad in the integration region
216 // step from left to right
219 GetPadC(fIx,fIy,fX,fY);
220 fSector=Sector(fIx,fIy);
222 } else if (fIy != fIymax) {
225 GetPadC(fIx,fIy,fX,fY);
226 fSector=Sector(fIx,fIy);
232 // printf("\n Next Pad %d %d %f %f %d %d %d %d %d ",
236 Int_t AliMUONSegmentationSlatModule::MorePads()
237 // Stopping condition for the iterator over pads
239 // Are there more pads in the integration region
242 return (fIx != -1 || fIy != -1);
246 Int_t AliMUONSegmentationSlatModule::Sector(Int_t ix, Int_t iy)
249 // Determine segmentation zone from pad coordinates
252 for (Int_t i=0; i < fNsec; i++) {
253 if (ix <= fNpxS[i]) {
258 if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n",
259 fId, ix, iy,fNpxS[3]);
265 void AliMUONSegmentationSlatModule::
266 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
268 // Returns integration limits for current pad
271 x1=fXhit-fX-Dpx(fSector)/2.;
273 y1=fYhit-fY-Dpy(fSector)/2.;
275 // printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
279 void AliMUONSegmentationSlatModule::
280 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
282 // Returns list of next neighbours for given Pad (iX, iY)
316 void AliMUONSegmentationSlatModule::Init(Int_t chamber)
318 printf("\n Initialise segmentation SlatModule \n");
320 // Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector
321 // These arrays help in converting from real to pad co-ordinates and
324 // Segmentation is defined by rectangular modules approximating
325 // concentric circles as shown below
327 // PCB module size in cm
331 // number of pad rows per PCB
333 Int_t nPyPCB=Int_t(fDyPCB/fDpy);
335 // maximum number of pad rows
338 // Calculate padsize along x
339 (*fDpxD)[fNsec-1]=fDpx;
341 for (Int_t i=fNsec-2; i>=0; i--){
342 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
343 printf("\n test ---dx %d %f \n",i,(*fDpxD)[i]);
347 // fill the arrays defining the pad segmentation boundaries
350 // Loop over sectors (isec=0 is the dead space surounding the beam pipe)
351 for (Int_t isec=0; isec<4; isec++) {
357 fNpxS[isec]=fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]);
359 fCx[isec]=fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
362 // maximum number of pad rows