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.8 2001/11/08 19:30:43 dibari
19 initialising of pad size added to ctor
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.
25 Revision 1.6 2001/01/24 21:00:29 jbarbosa
26 Redefinition of sectors and pad coordinates/real coordinates transformations.
28 Revision 1.5 2001/01/22 21:37:39 jbarbosa
29 Added parametrised definiton sectors
31 Revision 1.4 2001/01/22 21:35:39 jbarbosa
32 Added deadzone size to data members
34 Revision 1.3 2000/10/03 21:44:09 morsch
35 Use AliSegmentation and AliHit abstract base classes.
37 Revision 1.2 2000/10/02 15:48:55 jbarbosa
38 Fixed coding conventions.
40 Revision 1.1 2000/06/12 15:34:28 jbarbosa
45 #include "AliRICHSegmentationV1.h"
47 ClassImp(AliRICHSegmentationV1)
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
61 Init(0); // ??? remove 0
64 void AliRICHSegmentationV1::Init(Int_t id)
66 // Recalculates all the values after some of them have been changed
68 Float_t csi_length = fNpy*fDpy + fDeadZone;
69 Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
71 fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
72 fPadPlane_Length = (csi_length - fDeadZone)/2;
75 // calculate sector from x-y coordinates
77 Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
80 // Calculate in which sector is the hit
84 //old numerical definition
104 else if (x>fDeadZone/2)
123 //Parametrized definition
127 if (x> fPadPlane_Width/2 +fDeadZone)
129 if ( x<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
132 if (x< fPadPlane_Width/2)
134 if (x> -( fPadPlane_Width/2))
137 if (x< -( fPadPlane_Width/2 +fDeadZone))
139 if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width))
143 else if (y>fDeadZone/2)
145 if (x> fPadPlane_Width/2 +fDeadZone)
147 if (x< fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
150 if (x< fPadPlane_Width/2)
152 if (x> -( fPadPlane_Width/2))
155 if (x< -( fPadPlane_Width/2 +fDeadZone))
157 if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width))
164 //printf("x:%f, y:%f, sector:%d\n",x,y,fSector);
170 void AliRICHSegmentationV1::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
172 // returns pad coordinates (ix,iy) for given real coordinates (x,y)
174 // Please check origin of pad numbering !!!
176 Int_t sector=Sector(x,y);
178 //printf("Sector: %d\n",sector);
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);
184 ix = Int_t ((x-fDeadZone)/fDpx);
185 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
189 ix = Int_t ((x-fDeadZone)/fDpx);
190 iy = Int_t ((y-fDeadZone/2)/fDpy);
194 ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
195 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
199 ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
200 iy = Int_t ((y-fDeadZone/2)/fDpy);
204 ix = Int_t ((x+fDeadZone)/fDpx)-1;
205 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
209 ix = Int_t ((x+fDeadZone)/fDpx)-1;
210 iy = Int_t ((y-fDeadZone/2)/fDpy);
214 //ix = Int_t (x/fDpx);
215 //iy = Int_t (y/fDpy);
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);
226 if (iy > fNpy) iy= fNpy;
227 if (iy < -fNpy) iy=-fNpy;
228 if (ix > fNpx) ix= fNpx;
229 if (ix < -fNpx) ix=-fNpx;
232 void AliRICHSegmentationV1::
233 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
235 // returns real coordinates (x,y) for given pad coordinates (ix,iy)
238 //Int_t sector=Sector(ix*.8,iy*.84);
242 // old numerical definition
281 // parametrised definition
283 Float_t padplane_width = fNpx/3;
289 if (ix >= padplane_width/2)
292 if (ix< padplane_width/2)
294 if (ix >= -(padplane_width/2))
299 if (ix < -(padplane_width/2))
307 if (ix >= padplane_width/2)
310 if (ix< padplane_width/2)
312 if (ix >= -(padplane_width/2))
317 if (ix < -(padplane_width/2))
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.;
326 x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
327 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
331 x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
332 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
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;
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 = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
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;
357 //printf("fSector:%d x:%f y:%f\n",fSector,x,y);
361 void AliRICHSegmentationV1::
362 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
365 // Calculates integration limits
373 //Int_t sector=Sector(fX,fY);
375 //printf("Sector:%d\n",sector);