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 /////////////////////////////////////////////////////
19 // Segmentation classes for slat modules //
20 // to be used with AluMUONSegmentationSlat //
21 /////////////////////////////////////////////////////
24 #include "AliMUONSegmentationSlatModule.h"
28 #include <Riostream.h>
30 #include "AliMUONSegmentationV01.h"
32 //___________________________________________
33 ClassImp(AliMUONSegmentationSlatModule)
35 AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule()
37 // Default constructor
42 AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule(Int_t nsec)
44 // Non 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 AliMUONSegmentationSlatModule::~AliMUONSegmentationSlatModule()
55 if (fNDiv) delete fNDiv;
56 if (fDpxD) delete fDpxD;
59 void AliMUONSegmentationSlatModule::SetPcbBoards(Int_t n[4])
62 // Set Pcb Board segmentation zones
63 for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
67 void AliMUONSegmentationSlatModule::SetPadDivision(Int_t ndiv[4])
70 // Defines the pad size perp. to the anode wire (y) for different sectors.
71 // Pad sizes are defined as integral fractions ndiv of a basis pad size
74 for (Int_t i=0; i<4; i++) {
80 Float_t AliMUONSegmentationSlatModule::Dpx(Int_t isec) const
82 // Return x-strip width
83 return (*fDpxD)[isec];
87 Float_t AliMUONSegmentationSlatModule::Dpy(Int_t isec) const
89 // Return y-strip width
95 void AliMUONSegmentationSlatModule::
96 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
98 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
100 iy = Int_t(y/fDpy)+1;
101 if (iy > fNpy) iy= fNpy;
106 for (Int_t i=fNsec-1; i > 0; i--) {
109 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
115 ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
117 } else if (isec == 0) {
118 ix= Int_t(x/(*fDpxD)[isec])+1;
125 void AliMUONSegmentationSlatModule::
126 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
128 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
130 y = Float_t(iy*fDpy)-fDpy/2.;
133 Int_t isec=AliMUONSegmentationSlatModule::Sector(ix,iy);
134 if (isec == -1) printf("\n PadC %d %d %d %d \n ", isec, fId, ix, iy);
137 x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec];
138 x = x-(*fDpxD)[isec]/2;
144 void AliMUONSegmentationSlatModule::
145 SetPad(Int_t ix, Int_t iy)
148 // Sets virtual pad coordinates, needed for evaluating pad response
149 // outside the tracking program
150 GetPadC(ix,iy,fX,fY);
151 fSector=Sector(ix,iy);
154 void AliMUONSegmentationSlatModule::
155 SetHit(Float_t x, Float_t y)
162 if (x < 0) fXhit = 0;
163 if (y < 0) fYhit = 0;
165 if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1];
166 if (y >= fDyPCB) fYhit = fDyPCB;
172 void AliMUONSegmentationSlatModule::
173 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
175 // Initialises iteration over pads for charge distribution algorithm
178 // Find the wire position (center of charge distribution)
179 Float_t x0a=GetAnod(xhit);
183 // and take fNsigma*sigma around this center
184 Float_t x01=x0a - dx;
185 Float_t x02=x0a + dx;
186 Float_t y01=yhit - dy;
187 Float_t y02=yhit + dy;
188 if (x01 < 0) x01 = 0;
189 if (y01 < 0) y01 = 0;
191 if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1];
196 for (Int_t i=fNsec-1; i > 0; i--) {
197 if (x02 >= fCx[i-1]) {
199 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
204 if (y02 >= fDyPCB) y02 = fDyPCB;
207 // find the pads over which the charge distributes
208 GetPadI(x01,y01,fIxmin,fIymin);
209 GetPadI(x02,y02,fIxmax,fIymax);
211 if (fIxmax > fNpx) fIxmax=fNpx;
212 if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec];
220 // Set current pad to lower left corner
221 if (fIxmax < fIxmin) fIxmax=fIxmin;
222 if (fIymax < fIymin) fIymax=fIymin;
226 GetPadC(fIx,fIy,fX,fY);
227 fSector=Sector(fIx,fIy);
229 printf("\n \n First Pad: %d %d %f %f %d %d %d %f" ,
230 fIxmin, fIxmax, fXmin, fXmax, fNpx, fId, isec, Dpy(isec));
231 printf("\n \n First Pad: %d %d %f %f %d %d %d %f",
232 fIymin, fIymax, fYmin, fYmax, fNpyS[isec], fId, isec, Dpy(isec));
236 void AliMUONSegmentationSlatModule::NextPad()
238 // Stepper for the iteration over pads
240 // Step to next pad in the integration region
241 // step from left to right
244 GetPadC(fIx,fIy,fX,fY);
245 fSector=Sector(fIx,fIy);
247 } else if (fIy != fIymax) {
250 GetPadC(fIx,fIy,fX,fY);
251 fSector=Sector(fIx,fIy);
257 // printf("\n Next Pad %d %d %f %f %d %d %d %d %d ",
261 Int_t AliMUONSegmentationSlatModule::MorePads()
263 // Stopping condition for the iterator over pads
265 // Are there more pads in the integration region
267 return (fIx != -1 || fIy != -1);
271 Int_t AliMUONSegmentationSlatModule::Sector(Int_t ix, Int_t iy)
274 // Determine segmentation zone from pad coordinates
277 for (Int_t i=0; i < fNsec; i++) {
278 if (ix <= fNpxS[i]) {
283 if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n",
284 fId, ix, iy,fNpxS[3]);
290 void AliMUONSegmentationSlatModule::
291 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
293 // Returns integration limits for current pad
296 x1=fXhit-fX-Dpx(fSector)/2.;
298 y1=fYhit-fY-Dpy(fSector)/2.;
300 // printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
304 void AliMUONSegmentationSlatModule::
305 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
307 // Returns list of next neighbours for given Pad (iX, iY)
341 void AliMUONSegmentationSlatModule::Init(Int_t chamber)
344 // Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector
345 // These arrays help in converting from real to pad co-ordinates and
348 // Segmentation is defined by rectangular modules approximating
349 // concentric circles as shown below
351 // PCB module size in cm
352 // printf("\n Initialise Segmentation SlatModule \n");
357 // number of pad rows per PCB
359 Int_t nPyPCB=Int_t(fDyPCB/fDpy);
361 // maximum number of pad rows
364 // Calculate padsize along x
365 (*fDpxD)[fNsec-1]=fDpx;
367 for (Int_t i=fNsec-2; i>=0; i--){
368 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
372 // fill the arrays defining the pad segmentation boundaries
375 // Loop over sectors (isec=0 is the dead space surounding the beam pipe)
376 for (Int_t isec=0; isec<4; isec++) {
382 fNpxS[isec]=fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]);
384 fCx[isec]=fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
387 // maximum number of pad rows