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