]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentationSlatModuleN.cxx
Mostly minor style modifications to be ready for cloning with EMCAL
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentationSlatModuleN.cxx
CommitLineData
4c503756 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17$Log$
9e1a0ddb 18Revision 1.7 2001/01/26 21:25:48 morsch
19Empty default constructors and.
20
e9e4cdf2 21Revision 1.6 2000/12/21 22:12:41 morsch
22Clean-up of coding rule violations,
23
de05461e 24Revision 1.5 2000/10/26 19:32:04 morsch
25Problem with iteration over y-pads for 2nd cathode corrected.
26
d4ee3c3e 27Revision 1.4 2000/10/25 19:56:55 morsch
28Handle correctly slats with less than 3 segmentation zones.
29
f30dea32 30Revision 1.3 2000/10/22 16:56:33 morsch
31- Store chamber number as slat id.
32
de2f6d11 33Revision 1.2 2000/10/18 11:42:06 morsch
34- AliMUONRawCluster contains z-position.
35- Some clean-up of useless print statements during initialisations.
36
3e1872ed 37Revision 1.1 2000/10/06 08:59:03 morsch
38Segmentation classes for bending and non bending plane slat modules (A. de Falco, A. Morsch)
39
4c503756 40*/
41
42/////////////////////////////////////////////////////
43// Segmentation classes for slat modules //
44// to be used with AluMUONSegmentationSlat //
45/////////////////////////////////////////////////////
46
47
48#include "AliMUONSegmentationSlatModuleN.h"
49#include <TMath.h>
50#include <iostream.h>
51
52#include "AliMUONSegmentationV01.h"
53
54//___________________________________________
55ClassImp(AliMUONSegmentationSlatModuleN)
56
57AliMUONSegmentationSlatModuleN::AliMUONSegmentationSlatModuleN()
58{
59// Default constructor
60}
61
e9e4cdf2 62AliMUONSegmentationSlatModuleN::AliMUONSegmentationSlatModuleN(Int_t nsec)
63 : AliMUONSegmentationSlatModule(nsec)
64{
65// Non default constructor
66}
67
4c503756 68
69Float_t AliMUONSegmentationSlatModuleN::Dpx(Int_t isec) const
70{
71//
72// Returns x-pad size for given sector isec
73 return fDpx;
74}
75
76Float_t AliMUONSegmentationSlatModuleN::Dpy(Int_t isec) const
77{
78//
79// Returns y-pad size for given sector isec
80 return (*fDpxD)[isec];
81}
82
83
84void AliMUONSegmentationSlatModuleN::
85GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
86{
87// Returns pad coordinates (ix,iy) for given real coordinates (x,y)
88//
89 ix = Int_t(x/fDpx)+1;
90 if (ix > fNpx) ix= fNpx;
91//
92// Find sector isec
93 Int_t isec=-1;
94 for (Int_t i = fNsec-1; i > 0; i--) {
95 if (x >= fCx[i-1]) {
96 isec=i;
f30dea32 97 if (fCx[isec] == fCx[isec-1] && isec > 1) isec--;
4c503756 98 break;
99 }
100 }
101//
102//
f30dea32 103
4c503756 104 if (isec == -1) {
105 ix = 0;
106 iy = 0;
107 } else {
108 iy = Int_t(y/(*fDpxD)[isec])+1;
109 }
110}
111
112void AliMUONSegmentationSlatModuleN::
113GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
114{
115// Returns real coordinates (x,y) for given pad coordinates (ix,iy)
116//
117 x = Float_t(ix*fDpx)-fDpx/2.;
118//
119// Find sector isec
120 Int_t isec=Sector(ix,iy);
121 if (isec == -1) printf("\n gtpadc2 Warning isec !\n");
122 y = iy*(*fDpxD)[isec]-(*fDpxD)[isec]/2.;
123}
124
125
126void AliMUONSegmentationSlatModuleN::NextPad()
127{
128// Stepper for the iteration over pads
129//
130 Float_t xc,yc;
131 Int_t ixc;
132 // step up
133 if ((fY + Dpy(fSector)) < fYmax) {
134 fIy++;
135 GetPadC(fIx,fIy,fX,fY);
136// step right
137 } else if (fIx != fIxmax) {
138 fIx++;
139// get y-position of next row (yc), xc not used here
140 GetPadC(fIx,fIy,xc,yc);
141// get x-pad coordiante for 1 pad in row (fIx)
142 GetPadI(xc,fYmin,ixc,fIy);
143 GetPadC(fIx,fIy,fX,fY);
144 fSector=Sector(fIx,fIy);
145 } else {
146 fIx=fIy=-1;
147 }
148
149 if (fIy > fNpyS[fSector]) printf("\n this pad %f %f %d %d \n",fX,fY,fIx,fIy);
150 GetPadC(fIx, fIy, xc, yc);
d4ee3c3e 151// printf("\n Next Pad (n)%d %d %f %f %d %f %d ", fIx,fIy,fX,fY,fSector, fYmax, fIxmax);
4c503756 152}
153
154Int_t AliMUONSegmentationSlatModuleN::MorePads()
de05461e 155{
4c503756 156// Stopping condition for the iterator over pads
157//
158//
159// Are there more pads in the integration region
de05461e 160
d4ee3c3e 161 if (fIy == -1) {
4c503756 162 return 0;
163 } else {
164 return 1;
165 }
166}
167
168void AliMUONSegmentationSlatModuleN::
169Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10])
170{
4c503756 171// Returns list of next neighbours for given Pad (iX, iY)
172//
173//
174 Int_t i=0;
175 Float_t x,y;
176 Int_t ix,iy,isec1,isec2;
177 Float_t kEpsil= 0.001;
178
179//
180// step up
181 Int_t isec=Sector(iX, iY);
182
183 if (iY+1 <= fNpyS[isec]) {
184 Xlist[i]=iX;
185 Ylist[i++]=iY+1;
186 }
187//
188// step down
189 if (iY-1 > 0) {
190 Xlist[i]=iX;
191 Ylist[i++]=iY-1;
192 }
193//
194//
195// step right
196
197 if (iX+1 <= fNpx) {
198
199
200 GetPadC(iX, iY, x, y);
201 GetPadI(x+fDpx, y, ix, iy);
202 Xlist[i]=iX+1;
203 Ylist[i++]=iy;
204 }
205//
206// step left
207 if (iX-1 > 0) {
208 isec1=Sector(iX, iY);
209 isec2=Sector(iX-1, iY);
210 if (isec1==isec2) {
211 Xlist[i]=iX-1;
212 Ylist[i++]=iY;
213 } else {
214 GetPadC(iX, iY, x, y);
215 GetPadI(x-fDpx, y+kEpsil, ix, iy);
216 if (ix != -1) {
217 Xlist[i]=iX-1;
218 Ylist[i++]=iy;
219 }
220 GetPadI(x-fDpx, y-kEpsil, ix, iy);
221 if (ix != -1) {
222 Xlist[i]=iX-1;
223 Ylist[i++]=iy;
224 }
225 }
226 }
227 *Nlist=i;
228}
229
230
231void AliMUONSegmentationSlatModuleN::Init(Int_t chamber)
232{
4c503756 233//
234// Fill the arrays fCx (x-contour) for each sector
235// These arrays help in converting from real to pad co-ordinates and
236// vice versa
237//
238// Segmentation is defined by rectangular modules approximating
239// concentric circles as shown below
240//
241// PCB module size in cm
de05461e 242
9e1a0ddb 243 // printf("\n Initialise Segmentation SlatModuleN \n");
de05461e 244
245
4c503756 246 fDxPCB=40;
247 fDyPCB=40;
248//
249// number of pad rows per PCB
250//
251 fNpxPCB = Int_t(fDxPCB/fDpx) ;
252//
253// Calculate padsize along y
254 (*fDpxD)[fNsec-1]=fDpy;
255 if (fNsec > 1) {
256 for (Int_t i=fNsec-2; i>=0; i--){
257 (*fDpxD)[i]=(*fDpxD)[fNsec-1]/(*fNDiv)[i];
4c503756 258 }
259 }
260//
261// fill the arrays defining the pad segmentation boundaries
262//
263//
264// Loop over sectors (isec=0 is the dead space surounding the beam pipe)
265
266 for (Int_t isec=0; isec<4; isec++) {
267 if (isec==0) {
268 fCx[0] = 0;
269 fNpxS[0] = 0;
270 fNpyS[0] = 0;
271 } else {
272 fNpxS[isec] = fNpxS[isec-1] + fPcbBoards[isec]*fNpxPCB;
273 fNpyS[isec] = Int_t(fDyPCB/fDpy)*(*fNDiv)[isec];
4c503756 274 fCx[isec] = fCx[isec-1] + fPcbBoards[isec]*fDxPCB;
275 fNpx += fPcbBoards[isec] * fNpxPCB;
276 }
277 } // sectors
278
279 fNpx=fNpxS[3];
280 fNpy=Int_t(fDyPCB/fDpy)*(*fNDiv)[1];
de2f6d11 281//
282 fId = chamber;
283
4c503756 284}
285
286
287
288
289
290
291
292
293
294
295
296