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