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