1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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.
22 Revision 1.6 2001/01/24 21:00:29 jbarbosa
23 Redefinition of sectors and pad coordinates/real coordinates transformations.
25 Revision 1.5 2001/01/22 21:37:39 jbarbosa
26 Added parametrised definiton sectors
28 Revision 1.4 2001/01/22 21:35:39 jbarbosa
29 Added deadzone size to data members
31 Revision 1.3 2000/10/03 21:44:09 morsch
32 Use AliSegmentation and AliHit abstract base classes.
34 Revision 1.2 2000/10/02 15:48:55 jbarbosa
35 Fixed coding conventions.
37 Revision 1.1 2000/06/12 15:34:28 jbarbosa
42 #include "AliRICHSegmentationV1.h"
45 //--------------------------------------------------------
46 ClassImp(AliRICHSegmentationV1)
48 //________________________________________________________________________________
49 AliRICHSegmentationV1::AliRICHSegmentationV1()
52 // Default constructor for AliRICHSegmantionV1 (with dead zones)
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
63 void AliRICHSegmentationV1::Init(Int_t id)
66 // Initialisation of chambers
68 //printf("* Initialising SegmentationV1 (dead zones) in chamber %d *\n",id+1);
70 // parametrised definition
72 Float_t csi_length = fNpy*fDpy + fDeadZone;
73 Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
75 fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
76 fPadPlane_Length = (csi_length - fDeadZone)/2;
80 // calculate sector from x-y coordinates
82 Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
85 // Calculate in which sector is the hit
89 //old numerical definition
109 else if (x>fDeadZone/2)
128 //Parametrized definition
132 if (x> fPadPlane_Width/2 +fDeadZone)
134 if ( x<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
137 if (x< fPadPlane_Width/2)
139 if (x> -( fPadPlane_Width/2))
142 if (x< -( fPadPlane_Width/2 +fDeadZone))
144 if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width))
148 else if (y>fDeadZone/2)
150 if (x> fPadPlane_Width/2 +fDeadZone)
152 if (x< fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
155 if (x< fPadPlane_Width/2)
157 if (x> -( fPadPlane_Width/2))
160 if (x< -( fPadPlane_Width/2 +fDeadZone))
162 if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width))
169 //printf("x:%f, y:%f, sector:%d\n",x,y,fSector);
175 void AliRICHSegmentationV1::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
177 // returns pad coordinates (ix,iy) for given real coordinates (x,y)
179 // Please check origin of pad numbering !!!
181 Int_t sector=Sector(x,y);
183 //printf("Sector: %d\n",sector);
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);
189 ix = Int_t ((x-fDeadZone)/fDpx);
190 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
194 ix = Int_t ((x-fDeadZone)/fDpx);
195 iy = Int_t ((y-fDeadZone/2)/fDpy);
199 ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
200 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
204 ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
205 iy = Int_t ((y-fDeadZone/2)/fDpy);
209 ix = Int_t ((x+fDeadZone)/fDpx)-1;
210 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
214 ix = Int_t ((x+fDeadZone)/fDpx)-1;
215 iy = Int_t ((y-fDeadZone/2)/fDpy);
219 //ix = Int_t (x/fDpx);
220 //iy = Int_t (y/fDpy);
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);
231 if (iy > fNpy) iy= fNpy;
232 if (iy < -fNpy) iy=-fNpy;
233 if (ix > fNpx) ix= fNpx;
234 if (ix < -fNpx) ix=-fNpx;
237 void AliRICHSegmentationV1::
238 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
240 // returns real coordinates (x,y) for given pad coordinates (ix,iy)
243 //Int_t sector=Sector(ix*.8,iy*.84);
247 // old numerical definition
286 // parametrised definition
288 Float_t padplane_width = fNpx/3;
294 if (ix >= padplane_width/2)
297 if (ix< padplane_width/2)
299 if (ix >= -(padplane_width/2))
304 if (ix < -(padplane_width/2))
312 if (ix >= padplane_width/2)
315 if (ix< padplane_width/2)
317 if (ix >= -(padplane_width/2))
322 if (ix < -(padplane_width/2))
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.;
331 x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
332 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
336 x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
337 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
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;
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;
351 x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
352 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
356 x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
357 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
362 //printf("fSector:%d x:%f y:%f\n",fSector,x,y);
366 void AliRICHSegmentationV1::
367 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
370 // Calculates integration limits
378 //Int_t sector=Sector(fX,fY);
380 //printf("Sector:%d\n",sector);