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