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.8 2001/01/17 20:53:40 hristov
19 Destructors corrected to avoid memory leaks
21 Revision 1.7 2000/12/21 22:12:41 morsch
22 Clean-up of coding rule violations,
24 Revision 1.6 2000/11/06 09:20:43 morsch
25 AliMUON delegates part of BuildGeometry() to AliMUONSegmentation using the
26 Draw() method. This avoids code and parameter replication.
28 Revision 1.5 2000/10/26 19:32:04 morsch
29 Problem with iteration over y-pads for 2nd cathode corrected.
31 Revision 1.4 2000/10/25 19:56:55 morsch
32 Handle correctly slats with less than 3 segmentation zones.
34 Revision 1.3 2000/10/22 16:56:32 morsch
35 - Store chamber number as slat id.
37 Revision 1.2 2000/10/18 11:42:06 morsch
38 - AliMUONRawCluster contains z-position.
39 - Some clean-up of useless print statements during initialisations.
41 Revision 1.1 2000/10/06 08:59:03 morsch
42 Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch)
46 /////////////////////////////////////////////////////
47 // Segmentation classes for slat modules //
48 // to be used with AluMUONSegmentationSlat //
49 /////////////////////////////////////////////////////
52 #include "AliMUONSegmentationSlatModule.h"
58 #include "AliMUONSegmentationV01.h"
60 //___________________________________________
61 ClassImp(AliMUONSegmentationSlatModule)
63 AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule()
65 // Default constructor
68 AliMUONSegmentationSlatModule::AliMUONSegmentationSlatModule(Int_t nsec)
70 // Non default constructor
72 fNDiv = new TArrayI(fNsec);
73 fDpxD = new TArrayF(fNsec);
74 (*fNDiv)[0]=(*fNDiv)[1]=(*fNDiv)[2]=(*fNDiv)[3]=0;
75 (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0;
78 AliMUONSegmentationSlatModule::~AliMUONSegmentationSlatModule()
81 if (fNDiv) delete fNDiv;
82 if (fDpxD) delete fDpxD;
85 void AliMUONSegmentationSlatModule::SetPcbBoards(Int_t n[4])
88 // Set Pcb Board segmentation zones
89 for (Int_t i=0; i<4; i++) fPcbBoards[i]=n[i];
93 void AliMUONSegmentationSlatModule::SetPadDivision(Int_t ndiv[4])
96 // Defines the pad size perp. to the anode wire (y) for different sectors.
97 // Pad sizes are defined as integral fractions ndiv of a basis pad size
100 for (Int_t i=0; i<4; i++) {
106 Float_t AliMUONSegmentationSlatModule::Dpx(Int_t isec) const
108 // Return x-strip width
109 return (*fDpxD)[isec];
113 Float_t AliMUONSegmentationSlatModule::Dpy(Int_t isec) const
115 // Return y-strip width
121 void AliMUONSegmentationSlatModule::
122 GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
124 // Returns pad coordinates (ix,iy) for given real coordinates (x,y)
126 iy = Int_t(y/fDpy)+1;
127 if (iy > fNpy) iy= fNpy;
132 for (Int_t i=fNsec-1; i > 0; i--) {
135 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
141 ix= Int_t((x-fCx[isec-1])/(*fDpxD)[isec])
143 } else if (isec == 0) {
144 ix= Int_t(x/(*fDpxD)[isec])+1;
151 void AliMUONSegmentationSlatModule::
152 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
154 // Returns real coordinates (x,y) for given pad coordinates (ix,iy)
156 y = Float_t(iy*fDpy)-fDpy/2.;
159 Int_t isec=AliMUONSegmentationSlatModule::Sector(ix,iy);
160 if (isec == -1) printf("\n PadC %d %d %d %d \n ", isec, fId, ix, iy);
163 x = fCx[isec-1]+(ix-fNpxS[isec-1])*(*fDpxD)[isec];
164 x = x-(*fDpxD)[isec]/2;
170 void AliMUONSegmentationSlatModule::
171 SetPad(Int_t ix, Int_t iy)
174 // Sets virtual pad coordinates, needed for evaluating pad response
175 // outside the tracking program
176 GetPadC(ix,iy,fX,fY);
177 fSector=Sector(ix,iy);
180 void AliMUONSegmentationSlatModule::
181 SetHit(Float_t x, Float_t y)
188 if (x < 0) fXhit = 0;
189 if (y < 0) fYhit = 0;
191 if (x >= fCx[fNsec-1]) fXhit = fCx[fNsec-1];
192 if (y >= fDyPCB) fYhit = fDyPCB;
198 void AliMUONSegmentationSlatModule::
199 FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
201 // Initialises iteration over pads for charge distribution algorithm
204 // Find the wire position (center of charge distribution)
205 Float_t x0a=GetAnod(xhit);
209 // and take fNsigma*sigma around this center
210 Float_t x01=x0a - dx;
211 Float_t x02=x0a + dx;
212 Float_t y01=yhit - dy;
213 Float_t y02=yhit + dy;
214 if (x01 < 0) x01 = 0;
215 if (y01 < 0) y01 = 0;
217 if (x02 >= fCx[fNsec-1]) x02 = fCx[fNsec-1];
222 for (Int_t i=fNsec-1; i > 0; i--) {
223 if (x02 >= fCx[i-1]) {
225 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
230 if (y02 >= fDyPCB) y02 = fDyPCB;
233 // find the pads over which the charge distributes
234 GetPadI(x01,y01,fIxmin,fIymin);
235 GetPadI(x02,y02,fIxmax,fIymax);
237 if (fIxmax > fNpx) fIxmax=fNpx;
238 if (fIymax > fNpyS[isec]) fIymax = fNpyS[isec];
246 // Set current pad to lower left corner
247 if (fIxmax < fIxmin) fIxmax=fIxmin;
248 if (fIymax < fIymin) fIymax=fIymin;
252 GetPadC(fIx,fIy,fX,fY);
253 fSector=Sector(fIx,fIy);
255 printf("\n \n First Pad: %d %d %f %f %d %d %d %f" ,
256 fIxmin, fIxmax, fXmin, fXmax, fNpx, fId, isec, Dpy(isec));
257 printf("\n \n First Pad: %d %d %f %f %d %d %d %f",
258 fIymin, fIymax, fYmin, fYmax, fNpyS[isec], fId, isec, Dpy(isec));
262 void AliMUONSegmentationSlatModule::NextPad()
264 // Stepper for the iteration over pads
266 // Step to next pad in the integration region
267 // step from left to right
270 GetPadC(fIx,fIy,fX,fY);
271 fSector=Sector(fIx,fIy);
273 } else if (fIy != fIymax) {
276 GetPadC(fIx,fIy,fX,fY);
277 fSector=Sector(fIx,fIy);
283 // printf("\n Next Pad %d %d %f %f %d %d %d %d %d ",
287 Int_t AliMUONSegmentationSlatModule::MorePads()
289 // Stopping condition for the iterator over pads
291 // Are there more pads in the integration region
293 return (fIx != -1 || fIy != -1);
297 Int_t AliMUONSegmentationSlatModule::Sector(Int_t ix, Int_t iy)
300 // Determine segmentation zone from pad coordinates
303 for (Int_t i=0; i < fNsec; i++) {
304 if (ix <= fNpxS[i]) {
309 if (isec == -1) printf("\n Sector: Attention isec ! %d %d %d %d \n",
310 fId, ix, iy,fNpxS[3]);
316 void AliMUONSegmentationSlatModule::
317 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
319 // Returns integration limits for current pad
322 x1=fXhit-fX-Dpx(fSector)/2.;
324 y1=fYhit-fY-Dpy(fSector)/2.;
326 // printf("\n Integration Limits %f %f %f %f %d %f", x1, x2, y1, y2, fSector, Dpx(fSector));
330 void AliMUONSegmentationSlatModule::
331 Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
333 // Returns list of next neighbours for given Pad (iX, iY)
367 void AliMUONSegmentationSlatModule::Init(Int_t chamber)
370 // Fill the arrays fCx (x-contour) and fNpxS (ix-contour) for each sector
371 // These arrays help in converting from real to pad co-ordinates and
374 // Segmentation is defined by rectangular modules approximating
375 // concentric circles as shown below
377 // PCB module size in cm
378 printf("\n Initialise Segmentation SlatModule \n");
383 // number of pad rows per PCB
385 Int_t nPyPCB=Int_t(fDyPCB/fDpy);
387 // maximum number of pad rows
390 // Calculate padsize along x
391 (*fDpxD)[fNsec-1]=fDpx;
393 for (Int_t i=fNsec-2; i>=0; i--){
394 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
398 // fill the arrays defining the pad segmentation boundaries
401 // Loop over sectors (isec=0 is the dead space surounding the beam pipe)
402 for (Int_t isec=0; isec<4; isec++) {
408 fNpxS[isec]=fNpxS[isec-1] + fPcbBoards[isec]*Int_t(fDxPCB/(*fDpxD)[isec]);
410 fCx[isec]=fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
413 // maximum number of pad rows