]>
Commit | Line | Data |
---|---|---|
237c933d | 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$ */ |
237c933d | 17 | |
18 | #include "AliRICHSegmentationV1.h" | |
19 | ||
237c933d | 20 | ClassImp(AliRICHSegmentationV1) |
21 | ||
237c933d | 22 | AliRICHSegmentationV1::AliRICHSegmentationV1() |
23 | { | |
24 | ||
25 | // Default constructor for AliRICHSegmantionV1 (with dead zones) | |
26 | ||
ad185d05 | 27 | fNpx=144; // number of pads along X direction |
28 | fNpy=160; // number of pads along Y direction | |
29 | fDeadZone=3.0; // space between CsI photocathods in cm | |
30 | fDpx=0.84; // pad width in cm | |
31 | fDpy=0.80; // pad heights in cm | |
32 | fWireD=0.84/2; | |
33 | fSector=-1; | |
9da0c825 | 34 | Init(0); // ??? remove 0 |
237c933d | 35 | } |
36 | ||
9350cdcb | 37 | void AliRICHSegmentationV1::Init(Int_t id) |
38 | { | |
9da0c825 | 39 | // Recalculates all the values after some of them have been changed |
237c933d | 40 | |
9da0c825 | 41 | Float_t csi_length = fNpy*fDpy + fDeadZone; |
42 | Float_t csi_width = fNpx*fDpx + 2*fDeadZone; | |
9350cdcb | 43 | |
9da0c825 | 44 | fPadPlane_Width = (csi_width - 2*fDeadZone)/3; |
45 | fPadPlane_Length = (csi_length - fDeadZone)/2; | |
9350cdcb | 46 | } |
237c933d | 47 | |
48 | // calculate sector from x-y coordinates | |
49 | ||
9350cdcb | 50 | Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y) |
237c933d | 51 | { |
52 | ||
53 | // Calculate in which sector is the hit | |
6d4af9e4 | 54 | |
237c933d | 55 | fSector=-1; |
56 | ||
6d4af9e4 | 57 | //old numerical definition |
58 | ||
59 | /*if (x<-fDeadZone/2) | |
237c933d | 60 | { |
61 | if (y>22.75) | |
62 | { | |
63 | if (y<63.1) | |
64 | fSector=0; | |
65 | } | |
66 | if (y<20.15) | |
67 | { | |
68 | if (y>(-20.15)) | |
69 | fSector=2; | |
70 | } | |
71 | if (y<(-22.75)) | |
72 | { | |
73 | if (y>(-63.1)) | |
74 | fSector=4; | |
75 | } | |
76 | } | |
6d4af9e4 | 77 | else if (x>fDeadZone/2) |
237c933d | 78 | { |
79 | if (y>22.75) | |
80 | { | |
81 | if (y<63.1) | |
82 | fSector=1; | |
83 | } | |
84 | if (y<20.15) | |
85 | { | |
86 | if (y>(-20.15)) | |
87 | fSector=3; | |
88 | } | |
89 | if (y<(-22.75)) | |
90 | { | |
91 | if (y>(-63.1)) | |
92 | fSector=5; | |
93 | } | |
6d4af9e4 | 94 | }*/ |
95 | ||
9350cdcb | 96 | //Parametrized definition |
6d4af9e4 | 97 | |
9350cdcb | 98 | if (y<-fDeadZone/2) |
6d4af9e4 | 99 | { |
9350cdcb | 100 | if (x> fPadPlane_Width/2 +fDeadZone) |
6d4af9e4 | 101 | { |
9350cdcb | 102 | if ( x<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width) |
6d4af9e4 | 103 | fSector=0; |
104 | } | |
9350cdcb | 105 | if (x< fPadPlane_Width/2) |
6d4af9e4 | 106 | { |
9350cdcb | 107 | if (x> -( fPadPlane_Width/2)) |
6d4af9e4 | 108 | fSector=2; |
109 | } | |
9350cdcb | 110 | if (x< -( fPadPlane_Width/2 +fDeadZone)) |
6d4af9e4 | 111 | { |
9350cdcb | 112 | if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)) |
6d4af9e4 | 113 | fSector=4; |
114 | } | |
115 | } | |
9350cdcb | 116 | else if (y>fDeadZone/2) |
6d4af9e4 | 117 | { |
9350cdcb | 118 | if (x> fPadPlane_Width/2 +fDeadZone) |
6d4af9e4 | 119 | { |
9350cdcb | 120 | if (x< fPadPlane_Width/2 +fDeadZone + fPadPlane_Width) |
121 | fSector=1; | |
6d4af9e4 | 122 | } |
9350cdcb | 123 | if (x< fPadPlane_Width/2) |
6d4af9e4 | 124 | { |
9350cdcb | 125 | if (x> -( fPadPlane_Width/2)) |
126 | fSector=3; | |
6d4af9e4 | 127 | } |
9350cdcb | 128 | if (x< -( fPadPlane_Width/2 +fDeadZone)) |
6d4af9e4 | 129 | { |
9350cdcb | 130 | if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)) |
131 | fSector=5; | |
6d4af9e4 | 132 | } |
237c933d | 133 | } |
9350cdcb | 134 | |
237c933d | 135 | |
136 | //if (fSector==2) | |
137 | //printf("x:%f, y:%f, sector:%d\n",x,y,fSector); | |
138 | ||
139 | return fSector; | |
140 | } | |
141 | ||
142 | ||
a2f7eaf6 | 143 | void AliRICHSegmentationV1::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) |
237c933d | 144 | { |
145 | // returns pad coordinates (ix,iy) for given real coordinates (x,y) | |
146 | // | |
147 | // Please check origin of pad numbering !!! | |
148 | ||
149 | Int_t sector=Sector(x,y); | |
150 | ||
151 | //printf("Sector: %d\n",sector); | |
152 | ||
237c933d | 153 | if (sector==0) |
154 | { | |
155 | //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx); | |
156 | //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy); | |
9350cdcb | 157 | ix = Int_t ((x-fDeadZone)/fDpx); |
158 | iy = Int_t ((y+fDeadZone/2)/fDpy)-1; | |
237c933d | 159 | } |
160 | if (sector==1) | |
161 | { | |
9350cdcb | 162 | ix = Int_t ((x-fDeadZone)/fDpx); |
163 | iy = Int_t ((y-fDeadZone/2)/fDpy); | |
237c933d | 164 | } |
165 | if (sector==2) | |
166 | { | |
9350cdcb | 167 | ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1; |
168 | iy = Int_t ((y+fDeadZone/2)/fDpy)-1; | |
237c933d | 169 | } |
170 | if (sector==3) | |
171 | { | |
9350cdcb | 172 | ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1; |
173 | iy = Int_t ((y-fDeadZone/2)/fDpy); | |
237c933d | 174 | } |
175 | if (sector==4) | |
176 | { | |
9350cdcb | 177 | ix = Int_t ((x+fDeadZone)/fDpx)-1; |
178 | iy = Int_t ((y+fDeadZone/2)/fDpy)-1; | |
237c933d | 179 | } |
180 | if (sector==5) | |
181 | { | |
9350cdcb | 182 | ix = Int_t ((x+fDeadZone)/fDpx)-1; |
183 | iy = Int_t ((y-fDeadZone/2)/fDpy); | |
237c933d | 184 | } |
9350cdcb | 185 | |
237c933d | 186 | |
187 | //ix = Int_t (x/fDpx); | |
188 | //iy = Int_t (y/fDpy); | |
189 | ||
190 | //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx); | |
191 | //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy); | |
192 | ||
193 | if (sector==-1) | |
194 | { | |
72e468a5 | 195 | ix = fIxmax; |
196 | iy = fIymax; | |
237c933d | 197 | } |
198 | ||
199 | if (iy > fNpy) iy= fNpy; | |
200 | if (iy < -fNpy) iy=-fNpy; | |
201 | if (ix > fNpx) ix= fNpx; | |
202 | if (ix < -fNpx) ix=-fNpx; | |
203 | } | |
204 | ||
205 | void AliRICHSegmentationV1:: | |
a2f7eaf6 | 206 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) |
237c933d | 207 | { |
208 | // returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
209 | // | |
210 | ||
211 | //Int_t sector=Sector(ix*.8,iy*.84); | |
212 | ||
213 | Int_t sector=-1; | |
214 | ||
6d4af9e4 | 215 | // old numerical definition |
216 | ||
217 | /*if (ix<=0) | |
237c933d | 218 | { |
219 | if (iy<=72) | |
220 | { | |
221 | if (iy>24) | |
222 | sector=0; | |
223 | } | |
224 | if (iy<=24) | |
225 | { | |
226 | if (iy>-24) | |
227 | sector=2; | |
228 | } | |
229 | if (iy<=-24) | |
230 | { | |
231 | if (iy>-72) | |
232 | sector=4; | |
233 | } | |
234 | } | |
235 | if (ix>0) | |
236 | { | |
237 | if (iy<=72) | |
238 | { | |
239 | if (iy>24) | |
240 | sector=1; | |
241 | } | |
242 | if (iy<=24) | |
243 | { | |
244 | if (iy>-24) | |
245 | sector=3; | |
246 | } | |
247 | if (iy<=-24) | |
248 | { | |
249 | if (iy>-72) | |
250 | sector=5; | |
251 | } | |
6d4af9e4 | 252 | }*/ |
253 | ||
254 | // parametrised definition | |
255 | ||
9350cdcb | 256 | Float_t padplane_width = fNpx/3; |
6d4af9e4 | 257 | |
9350cdcb | 258 | if (iy<0) |
6d4af9e4 | 259 | { |
9350cdcb | 260 | if (ix < fNpx/2) |
6d4af9e4 | 261 | { |
9350cdcb | 262 | if (ix >= padplane_width/2) |
6d4af9e4 | 263 | sector=0; |
264 | } | |
9350cdcb | 265 | if (ix< padplane_width/2) |
6d4af9e4 | 266 | { |
9350cdcb | 267 | if (ix >= -(padplane_width/2)) |
6d4af9e4 | 268 | sector=2; |
269 | } | |
9350cdcb | 270 | if (ix >= -(fNpx/2)) |
6d4af9e4 | 271 | { |
9350cdcb | 272 | if (ix < -(padplane_width/2)) |
6d4af9e4 | 273 | sector=4; |
274 | } | |
275 | } | |
9350cdcb | 276 | if (iy>=0) |
6d4af9e4 | 277 | { |
9350cdcb | 278 | if (ix < fNpx/2) |
6d4af9e4 | 279 | { |
9350cdcb | 280 | if (ix >= padplane_width/2) |
281 | sector=1; | |
6d4af9e4 | 282 | } |
9350cdcb | 283 | if (ix< padplane_width/2) |
6d4af9e4 | 284 | { |
9350cdcb | 285 | if (ix >= -(padplane_width/2)) |
286 | sector=3; | |
6d4af9e4 | 287 | } |
9350cdcb | 288 | if (ix >= -(fNpx/2)) |
6d4af9e4 | 289 | { |
9350cdcb | 290 | if (ix < -(padplane_width/2)) |
291 | sector=5; | |
6d4af9e4 | 292 | } |
293 | } | |
237c933d | 294 | |
295 | if (sector==0) | |
296 | { | |
297 | //x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.; | |
298 | //y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.; | |
9350cdcb | 299 | x = Float_t(ix)*fDpx+fDpx/2+fDeadZone; |
300 | y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2; | |
237c933d | 301 | } |
302 | if (sector==1) | |
303 | { | |
9350cdcb | 304 | x = Float_t(ix)*fDpx+fDpx/2+fDeadZone; |
305 | y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2; | |
237c933d | 306 | } |
307 | if (sector==2) | |
308 | { | |
9350cdcb | 309 | x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2; |
310 | y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2; | |
237c933d | 311 | } |
312 | if (sector==3) | |
313 | { | |
9350cdcb | 314 | x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2; |
315 | y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2; | |
237c933d | 316 | } |
317 | if (sector==4) | |
318 | { | |
9350cdcb | 319 | x = Float_t(ix)*fDpx+fDpx/2-fDeadZone; |
320 | y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2; | |
237c933d | 321 | } |
322 | if (sector==5) | |
323 | { | |
9350cdcb | 324 | x = Float_t(ix)*fDpx+fDpx/2-fDeadZone; |
325 | y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2; | |
237c933d | 326 | } |
9350cdcb | 327 | |
237c933d | 328 | |
329 | //if (sector==2) | |
330 | //printf("fSector:%d x:%f y:%f\n",fSector,x,y); | |
331 | ||
332 | } | |
333 | ||
334 | void AliRICHSegmentationV1:: | |
335 | IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) | |
336 | { | |
337 | ||
338 | // Calculates integration limits | |
339 | ||
340 | /* | |
72e468a5 | 341 | x1=fXt-fX-fDpx/2.; |
237c933d | 342 | x2=x1+fDpx; |
72e468a5 | 343 | y1=fYt-fY-fDpy/2.; |
237c933d | 344 | y2=y1+fDpy; |
345 | */ | |
72e468a5 | 346 | //Int_t sector=Sector(fX,fY); |
237c933d | 347 | |
348 | //printf("Sector:%d\n",sector); | |
349 | ||
72e468a5 | 350 | x1=fXhit-fX-fDpx/2.; |
237c933d | 351 | x2=x1+fDpx; |
72e468a5 | 352 | y1=fYhit-fY-fDpy/2.; |
237c933d | 353 | y2=y1+fDpy; |
354 | } | |
a2f7eaf6 | 355 | |
356 | ||
357 | ||
358 | ||
359 | ||
360 |