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.10 2001/05/16 14:57:17 alibrary
19 New files for folders and Stack
21 Revision 1.9 2001/01/26 21:25:48 morsch
22 Empty default constructors and.
24 Revision 1.8 2001/01/17 20:53:40 hristov
25 Destructors corrected to avoid memory leaks
27 Revision 1.7 2000/12/21 22:12:41 morsch
28 Clean-up of coding rule violations,
30 Revision 1.6 2000/11/06 09:20:43 morsch
31 AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the
32 Draw() method. This avoids code and parameter replication.
34 Revision 1.5 2000/10/26 19:32:04 morsch
35 Problem with iteration over y-pads for 2nd cathode corrected.
37 Revision 1.4 2000/10/25 19:56:55 morsch
38 Handle correctly slats with less than 3 segmentation zones.
40 Revision 1.3 2000/10/22 16:56:32 morsch
41 - Store chamber number as slat id.
43 Revision 1.2 2000/10/18 11:42:06 morsch
44 - AliMUONRawCluster contains z-position.
45 - Some clean-up of useless print statements during initialisations.
47 Revision 1.1 2000/10/06 08:59:03 morsch
48 Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch)
52 /////////////////////////////////////////////////////
53 // Segmentation classes for slat modules //
54 // to be used with AluMUONSegmentationSlat //
55 /////////////////////////////////////////////////////
58 #include "AliMUONSegmentationSlatModule.h"
64 #include "AliMUONSegmentationV01.h"
66 //___________________________________________
67 ClassImp(AliMUONSegmentationSlatModule)
69 AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule()
71 // Default constructor
76 AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule(Int_t nsec)
78 // Non default constructor
80 fNDiv = new TArrayI(fNsec);
81 fDpxD = new TArrayF(fNsec);
82 (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;
83 (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;
86 AliMUONSegmentationSlatModule::~AliMUONSegmentationSlatModule()
89 if (fNDiv) delete fNDiv;
90 if (fDpxD) delete fDpxD;
93 void AliMUONSegmentationSlatModule::SetPcbBoards(Int_t n[4])
96 // Set Pcb Board segmentation zones
97 for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
101 void AliMUONSegmentationSlatModule::SetPadDivision(Int_t ndiv[4])
104 // Defines the pad size perp. to the anode wire (y) for different sectors.
105 // Pad sizes are defined as integral fractions ndiv of a basis pad size
108 for (Int_t i=0; i<4; i++) {
114 Float_t AliMUONSegmentationSlatModule::Dpx(Int_t isec) const
116 // Return x-strip width
117 return (*fDpxD)[isec];
121 Float_t AliMUONSegmentationSlatModule::Dpy(Int_t isec) const
123 // Return y-strip width
129 void AliMUONSegmentationSlatModule::
130 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
132 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
134 iy = Int_t(y/fDpy)+1;
135 if (iy > fNpy) iy= fNpy;
140 for (Int_t i=fNsec-1; i > 0; i--) {
143 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
149 ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
151 } else if (isec == 0) {
152 ix= Int_t(x/(*fDpxD)[isec])+1;
159 void AliMUONSegmentationSlatModule::
160 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
162 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
164 y = Float_t(iy*fDpy)-fDpy/2.;
167 Int_t isec=AliMUONSegmentationSlatModule::Sector(ix,iy);
168 if (isec == -1) printf("\n PadC %d %d %d %d \n ", isec, fId, ix, iy);
171 x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec];
172 x = x-(*fDpxD)[isec]/2;
178 void AliMUONSegmentationSlatModule::
179 SetPad(Int_t ix, Int_t iy)
182 // Sets virtual pad coordinates, needed for evaluating pad response
183 // outside the tracking program
184 GetPadC(ix,iy,fX,fY);
185 fSector=Sector(ix,iy);
188 void AliMUONSegmentationSlatModule::
189 SetHit(Float_t x, Float_t y)
196 if (x < 0) fXhit = 0;
197 if (y < 0) fYhit = 0;
199 if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1];
200 if (y >= fDyPCB) fYhit = fDyPCB;
206 void AliMUONSegmentationSlatModule::
207 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
209 // Initialises iteration over pads for charge distribution algorithm
212 // Find the wire position (center of charge distribution)
213 Float_t x0a=GetAnod(xhit);
217 // and take fNsigma*sigma around this center
218 Float_t x01=x0a - dx;
219 Float_t x02=x0a + dx;
220 Float_t y01=yhit - dy;
221 Float_t y02=yhit + dy;
222 if (x01 < 0) x01 = 0;
223 if (y01 < 0) y01 = 0;
225 if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1];
230 for (Int_t i=fNsec-1; i > 0; i--) {
231 if (x02 >= fCx[i-1]) {
233 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
238 if (y02 >= fDyPCB) y02 = fDyPCB;
241 // find the pads over which the charge distributes
242 GetPadI(x01,y01,fIxmin,fIymin);
243 GetPadI(x02,y02,fIxmax,fIymax);
245 if (fIxmax > fNpx) fIxmax=fNpx;
246 if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec];
254 // Set current pad to lower left corner
255 if (fIxmax < fIxmin) fIxmax=fIxmin;
256 if (fIymax < fIymin) fIymax=fIymin;
260 GetPadC(fIx,fIy,fX,fY);
261 fSector=Sector(fIx,fIy);
263 printf("\n \n First Pad: %d %d %f %f %d %d %d %f" ,
264 fIxmin, fIxmax, fXmin, fXmax, fNpx, fId, isec, Dpy(isec));
265 printf("\n \n First Pad: %d %d %f %f %d %d %d %f",
266 fIymin, fIymax, fYmin, fYmax, fNpyS[isec], fId, isec, Dpy(isec));
270 void AliMUONSegmentationSlatModule::NextPad()
272 // Stepper for the iteration over pads
274 // Step to next pad in the integration region
275 // step from left to right
278 GetPadC(fIx,fIy,fX,fY);
279 fSector=Sector(fIx,fIy);
281 } else if (fIy != fIymax) {
284 GetPadC(fIx,fIy,fX,fY);
285 fSector=Sector(fIx,fIy);
291 // printf("\n Next Pad %d %d %f %f %d %d %d %d %d ",
295 Int_t AliMUONSegmentationSlatModule::MorePads()
297 // Stopping condition for the iterator over pads
299 // Are there more pads in the integration region
301 return (fIx != -1 || fIy != -1);
305 Int_t AliMUONSegmentationSlatModule::Sector(Int_t ix, Int_t iy)
308 // Determine segmentation zone from pad coordinates
311 for (Int_t i=0; i < fNsec; i++) {
312 if (ix <= fNpxS[i]) {
317 if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n",
318 fId, ix, iy,fNpxS[3]);
324 void AliMUONSegmentationSlatModule::
325 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
327 // Returns integration limits for current pad
330 x1=fXhit-fX-Dpx(fSector)/2.;
332 y1=fYhit-fY-Dpy(fSector)/2.;
334 // printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
338 void AliMUONSegmentationSlatModule::
339 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
341 // Returns list of next neighbours for given Pad (iX, iY)
375 void AliMUONSegmentationSlatModule::Init(Int_t chamber)
378 // Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector
379 // These arrays help in converting from real to pad co-ordinates and
382 // Segmentation is defined by rectangular modules approximating
383 // concentric circles as shown below
385 // PCB module size in cm
386 // printf("\n Initialise Segmentation SlatModule \n");
391 // number of pad rows per PCB
393 Int_t nPyPCB=Int_t(fDyPCB/fDpy);
395 // maximum number of pad rows
398 // Calculate padsize along x
399 (*fDpxD)[fNsec-1]=fDpx;
401 for (Int_t i=fNsec-2; i>=0; i--){
402 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
406 // fill the arrays defining the pad segmentation boundaries
409 // Loop over sectors (isec=0 is the dead space surounding the beam pipe)
410 for (Int_t isec=0; isec<4; isec++) {
416 fNpxS[isec]=fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]);
418 fCx[isec]=fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
421 // maximum number of pad rows