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