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