]>
Commit | Line | Data |
---|---|---|
c4ac64b6 | 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 | ||
803d1ab0 | 16 | /* $Id$ */ |
c4ac64b6 | 17 | |
18 | #include "AliRICHSegmentation.h" | |
19 | ||
20 | ||
21 | ClassImp(AliRICHSegmentation) | |
22 | ||
23 | //________________________________________________________________________________ | |
24 | AliRICHSegmentation::AliRICHSegmentation() | |
25 | { | |
26 | fNpx=144; // Number of pads in x direction | |
27 | fNpy=160; // Number of pads in y direction | |
28 | fSector=-1; | |
29 | fDeadZone=3.0; // spacer between photocathod planes cm | |
30 | fDpx=0.84; // Pad x size cm | |
31 | fDpy=0.8; // Pad y size cm | |
32 | fWireD=0.84/2; // cm set by SetDAnod | |
33 | }//AliRICHSegmentation::ctor() | |
34 | ||
35 | void AliRICHSegmentation::Init() | |
36 | { | |
37 | Float_t csi_length = fNpy*fDpy + fDeadZone; | |
38 | Float_t csi_width = fNpx*fDpx + 2*fDeadZone; | |
39 | ||
40 | fPadPlane_Width = (csi_width - 2*fDeadZone)/3; | |
41 | fPadPlane_Length = (csi_length - fDeadZone)/2; | |
42 | }//void AliRICHSegmentation::Init() | |
43 | ||
44 | // calculate sector from x-y coordinates | |
45 | ||
46 | Int_t AliRICHSegmentation::Sector(Float_t x, Float_t y) | |
47 | { | |
48 | // Calculate to which sector does the hit (x,y) belong | |
49 | ||
50 | fSector=-1; | |
51 | ||
52 | //Parametrized definition | |
53 | ||
54 | if (y<-fDeadZone/2) | |
55 | { | |
56 | if (x> fPadPlane_Width/2 +fDeadZone) | |
57 | { | |
58 | if ( x<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width) | |
59 | fSector=0; | |
60 | } | |
61 | if (x< fPadPlane_Width/2) | |
62 | { | |
63 | if (x> -( fPadPlane_Width/2)) | |
64 | fSector=2; | |
65 | } | |
66 | if (x< -( fPadPlane_Width/2 +fDeadZone)) | |
67 | { | |
68 | if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)) | |
69 | fSector=4; | |
70 | } | |
71 | } | |
72 | else if (y>fDeadZone/2) | |
73 | { | |
74 | if (x> fPadPlane_Width/2 +fDeadZone) | |
75 | { | |
76 | if (x< fPadPlane_Width/2 +fDeadZone + fPadPlane_Width) | |
77 | fSector=1; | |
78 | } | |
79 | if (x< fPadPlane_Width/2) | |
80 | { | |
81 | if (x> -( fPadPlane_Width/2)) | |
82 | fSector=3; | |
83 | } | |
84 | if (x< -( fPadPlane_Width/2 +fDeadZone)) | |
85 | { | |
86 | if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)) | |
87 | fSector=5; | |
88 | } | |
89 | } | |
90 | ||
91 | return fSector; | |
92 | }//Int_t AliRICHSegmentation::Sector(Float_t x, Float_t y) | |
93 | ||
94 | ||
95 | void AliRICHSegmentation::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) | |
96 | { | |
97 | // real coordinates (x,y) -> (ix,iy) pad numbers | |
98 | // | |
99 | // Please check origin of pad numbering !!! | |
100 | ||
101 | Int_t sector=Sector(x,y); | |
102 | ||
103 | //printf("Sector: %d\n",sector); | |
104 | ||
105 | if (sector==0) | |
106 | { | |
107 | //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx); | |
108 | //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy); | |
109 | ix = Int_t ((x-fDeadZone)/fDpx); | |
110 | iy = Int_t ((y+fDeadZone/2)/fDpy)-1; | |
111 | } | |
112 | if (sector==1) | |
113 | { | |
114 | ix = Int_t ((x-fDeadZone)/fDpx); | |
115 | iy = Int_t ((y-fDeadZone/2)/fDpy); | |
116 | } | |
117 | if (sector==2) | |
118 | { | |
119 | ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1; | |
120 | iy = Int_t ((y+fDeadZone/2)/fDpy)-1; | |
121 | } | |
122 | if (sector==3) | |
123 | { | |
124 | ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1; | |
125 | iy = Int_t ((y-fDeadZone/2)/fDpy); | |
126 | } | |
127 | if (sector==4) | |
128 | { | |
129 | ix = Int_t ((x+fDeadZone)/fDpx)-1; | |
130 | iy = Int_t ((y+fDeadZone/2)/fDpy)-1; | |
131 | } | |
132 | if (sector==5) | |
133 | { | |
134 | ix = Int_t ((x+fDeadZone)/fDpx)-1; | |
135 | iy = Int_t ((y-fDeadZone/2)/fDpy); | |
136 | } | |
137 | ||
138 | ||
139 | //ix = Int_t (x/fDpx); | |
140 | //iy = Int_t (y/fDpy); | |
141 | ||
142 | //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx); | |
143 | //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy); | |
144 | ||
145 | if (sector==-1) | |
146 | { | |
147 | ix = fIxmax; | |
148 | iy = fIymax; | |
149 | } | |
150 | ||
151 | if (iy > fNpy) iy= fNpy; | |
152 | if (iy < -fNpy) iy=-fNpy; | |
153 | if (ix > fNpx) ix= fNpx; | |
154 | if (ix < -fNpx) ix=-fNpx; | |
155 | }//void AliRICHSegmentation::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) | |
156 | ||
157 | ||
158 | void AliRICHSegmentation::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) | |
159 | { | |
160 | // | |
161 | // pad numbers (ix,iy)->(x,y) real coordinates | |
162 | // | |
163 | ||
164 | Int_t sector=-1; | |
165 | ||
166 | ||
167 | Float_t padplane_width = fNpx/3; | |
168 | ||
169 | if (iy<0) | |
170 | { | |
171 | if (ix < fNpx/2) | |
172 | { | |
173 | if (ix >= padplane_width/2) | |
174 | sector=0; | |
175 | } | |
176 | if (ix< padplane_width/2) | |
177 | { | |
178 | if (ix >= -(padplane_width/2)) | |
179 | sector=2; | |
180 | } | |
181 | if (ix >= -(fNpx/2)) | |
182 | { | |
183 | if (ix < -(padplane_width/2)) | |
184 | sector=4; | |
185 | } | |
186 | } | |
187 | if (iy>=0) | |
188 | { | |
189 | if (ix < fNpx/2) | |
190 | { | |
191 | if (ix >= padplane_width/2) | |
192 | sector=1; | |
193 | } | |
194 | if (ix< padplane_width/2) | |
195 | { | |
196 | if (ix >= -(padplane_width/2)) | |
197 | sector=3; | |
198 | } | |
199 | if (ix >= -(fNpx/2)) | |
200 | { | |
201 | if (ix < -(padplane_width/2)) | |
202 | sector=5; | |
203 | } | |
204 | } | |
205 | ||
206 | if (sector==0) | |
207 | { | |
208 | x = Float_t(ix)*fDpx+fDpx/2+fDeadZone; | |
209 | y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2; | |
210 | } | |
211 | if (sector==1) | |
212 | { | |
213 | x = Float_t(ix)*fDpx+fDpx/2+fDeadZone; | |
214 | y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2; | |
215 | } | |
216 | if (sector==2) | |
217 | { | |
218 | x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2; | |
219 | y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2; | |
220 | } | |
221 | if (sector==3) | |
222 | { | |
223 | x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2; | |
224 | y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2; | |
225 | } | |
226 | if (sector==4) | |
227 | { | |
228 | x = Float_t(ix)*fDpx+fDpx/2-fDeadZone; | |
229 | y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2; | |
230 | } | |
231 | if (sector==5) | |
232 | { | |
233 | x = Float_t(ix)*fDpx+fDpx/2-fDeadZone; | |
234 | y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2; | |
235 | } | |
236 | ||
237 | }//void AliRICHSegmentation::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) | |
238 | ||
239 | ||
240 | void AliRICHSegmentation::IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) | |
241 | { | |
242 | ||
243 | // Calculates integration limits | |
244 | ||
245 | x1=fXhit-fX-fDpx/2.; | |
246 | x2=x1+fDpx; | |
247 | y1=fYhit-fY-fDpy/2.; | |
248 | y2=y1+fDpy; | |
249 | }//void AliRICHSegmentation::IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) | |
250 | ||
251 | ||
252 | Int_t AliRICHSegmentation::SigGenCond(Float_t x,Float_t y,Float_t) | |
253 | { | |
254 | // | |
255 | // Signal will be generated if particle crosses pad boundary or | |
256 | // boundary between two wires. | |
257 | Int_t ixt, iyt; | |
258 | GetPadI(x,y,ixt,iyt); | |
259 | Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1; | |
260 | ||
261 | if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) { | |
262 | return 1; | |
263 | } else { | |
264 | return 0; | |
265 | } | |
266 | } | |
267 | ||
268 | ||
269 | void AliRICHSegmentation::SigGenInit(Float_t x,Float_t y,Float_t) | |
270 | { | |
271 | // | |
272 | // Initialises pad and wire position during stepping | |
273 | fXt =x; | |
274 | fYt =y; | |
275 | GetPadI(x,y,fIxt,fIyt); | |
276 | fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ; | |
277 | } | |
278 | ||
279 | ||
280 | Float_t AliRICHSegmentation::GetAnod(Float_t xhit) const | |
281 | { | |
282 | ||
283 | // Get anod wire closer to hit | |
284 | ||
285 | Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5; | |
286 | return fWireD*wire; | |
287 | } | |
288 | ||
289 | ||
290 | void AliRICHSegmentation::SetHit(Float_t xhit, Float_t yhit) | |
291 | { | |
292 | // | |
293 | // Find the wire position (center of charge distribution) | |
294 | // Float_t x0a=GetAnod(xhit); | |
295 | fXhit=xhit; | |
296 | fYhit=yhit; | |
297 | } | |
298 | ||
299 | void AliRICHSegmentation:: | |
300 | SetPad(Int_t ix, Int_t iy) | |
301 | { | |
302 | ||
303 | // Move to pad ix, iy | |
304 | ||
305 | GetPadC(ix,iy,fX,fY); | |
306 | } | |
307 | ||
308 | ||
309 | ||
310 | void AliRICHSegmentation:: | |
311 | FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy) | |
312 | { | |
313 | ||
314 | // | |
315 | // Find the wire position (center of charge distribution) | |
316 | Float_t x0a=GetAnod(xhit); | |
317 | fXhit=x0a; | |
318 | fYhit=yhit; | |
319 | // | |
320 | // and take fNsigma*sigma around this center | |
321 | Float_t x01=x0a - dx; | |
322 | Float_t x02=x0a + dx; | |
323 | Float_t y01=yhit - dy; | |
324 | Float_t y02=yhit + dy; | |
325 | // | |
326 | // find the pads over which the charge distributes | |
327 | GetPadI(x01,y01,fIxmin,fIymin); | |
328 | GetPadI(x02,y02,fIxmax,fIymax); | |
329 | // | |
330 | // Set current pad to lower left corner | |
331 | fIx=fIxmin; | |
332 | fIy=fIymin; | |
333 | GetPadC(fIx,fIy,fX,fY); | |
334 | ||
335 | //if (fSector==2) | |
336 | //printf("fIx: %d, fIy: %d fX: %f, fY: %f\n",fIx,fIy,fX,fY); | |
337 | } | |
338 | ||
339 | void AliRICHSegmentation::NextPad() | |
340 | { | |
341 | //printf("\n Next Pad \n"); | |
342 | ||
343 | // | |
344 | // Step to next pad in integration region | |
345 | if (fIx <= fIxmax) { | |
346 | // if (fIx==-1) fIx++; | |
347 | fIx++; | |
348 | } else if (fIy <= fIymax) { | |
349 | // if (fIy==-1) fIy++; | |
350 | fIx=fIxmin; | |
351 | fIy++; | |
352 | } else { | |
353 | printf("\n Error: Stepping outside integration region\n "); | |
354 | } | |
355 | GetPadC(fIx,fIy,fX,fY); | |
356 | } | |
357 | ||
358 | Int_t AliRICHSegmentation::MorePads() | |
359 | { | |
360 | // | |
361 | // Are there more pads in the integration region | |
362 | ||
363 | //printf("\n More Pads ? \n"); | |
364 | ||
365 | ||
366 | if (fIx >= fIxmax && fIy >= fIymax) { | |
367 | //printf("There are no more pads\n\n\n\n\n"); | |
368 | return 0; | |
369 | } else { | |
370 | //printf("There are more pads\n\n"); | |
371 | return 1; | |
372 | } | |
373 | } | |
374 | ||
375 | ||
376 | ||
377 | void AliRICHSegmentation::Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7]) | |
378 | { | |
379 | //Is used for the cluster finder, include diagonal elements | |
380 | *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1; | |
381 | Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY; | |
382 | }//void AliRICHSegmentation::Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7]) | |
383 | ||
384 | Float_t AliRICHSegmentation::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y, Int_t *dummy) | |
385 | { | |
386 | // Returns the square of the distance between 1 pad | |
387 | // labelled by its Channel numbers and a coordinate | |
388 | ||
389 | Float_t x,y; | |
390 | GetPadC(iX,iY,x,y); | |
391 | return (x-X)*(x-X) + (y-Y)*(y-Y); | |
392 | }//Float_t AliRICHSegmentation::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y, Int_t *dummy) |