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 #include "AliRICHSegmentationV1.h"
20 ClassImp(AliRICHSegmentationV1)
22 AliRICHSegmentationV1::AliRICHSegmentationV1()
25 // Default constructor for AliRICHSegmantionV1 (with dead zones)
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
34 Init(0); // ??? remove 0
37 void AliRICHSegmentationV1::Init(Int_t /*id*/)
38 {//Recalculates all the values after some of them have been changed
40 Float_t csi_length = fNpy*fDpy + fDeadZone;
41 Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
43 fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
44 fPadPlane_Length = (csi_length - fDeadZone)/2;
47 // calculate sector from x-y coordinates
49 Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
52 // Calculate in which sector is the hit
56 //old numerical definition
76 else if (x>fDeadZone/2)
95 //Parametrized definition
99 if (x> fPadPlane_Width/2 +fDeadZone)
101 if ( x<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
104 if (x< fPadPlane_Width/2)
106 if (x> -( fPadPlane_Width/2))
109 if (x< -( fPadPlane_Width/2 +fDeadZone))
111 if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width))
115 else if (y>fDeadZone/2)
117 if (x> fPadPlane_Width/2 +fDeadZone)
119 if (x< fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
122 if (x< fPadPlane_Width/2)
124 if (x> -( fPadPlane_Width/2))
127 if (x< -( fPadPlane_Width/2 +fDeadZone))
129 if (x> -( fPadPlane_Width/2 +fDeadZone + fPadPlane_Width))
136 //printf("x:%f, y:%f, sector:%d\n",x,y,fSector);
142 void AliRICHSegmentationV1::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
144 // returns pad coordinates (ix,iy) for given real coordinates (x,y)
146 // Please check origin of pad numbering !!!
148 Int_t sector=Sector(x,y);
150 //printf("Sector: %d\n",sector);
154 //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
155 //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
156 ix = Int_t ((x-fDeadZone)/fDpx);
157 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
161 ix = Int_t ((x-fDeadZone)/fDpx);
162 iy = Int_t ((y-fDeadZone/2)/fDpy);
166 ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
167 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
171 ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
172 iy = Int_t ((y-fDeadZone/2)/fDpy);
176 ix = Int_t ((x+fDeadZone)/fDpx)-1;
177 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
181 ix = Int_t ((x+fDeadZone)/fDpx)-1;
182 iy = Int_t ((y-fDeadZone/2)/fDpy);
186 //ix = Int_t (x/fDpx);
187 //iy = Int_t (y/fDpy);
189 //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
190 //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
198 if (iy > fNpy) iy= fNpy;
199 if (iy < -fNpy) iy=-fNpy;
200 if (ix > fNpx) ix= fNpx;
201 if (ix < -fNpx) ix=-fNpx;
204 void AliRICHSegmentationV1::
205 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
207 // returns real coordinates (x,y) for given pad coordinates (ix,iy)
210 //Int_t sector=Sector(ix*.8,iy*.84);
214 // old numerical definition
253 // parametrised definition
255 Float_t padplane_width = fNpx/3;
261 if (ix >= padplane_width/2)
264 if (ix< padplane_width/2)
266 if (ix >= -(padplane_width/2))
271 if (ix < -(padplane_width/2))
279 if (ix >= padplane_width/2)
282 if (ix< padplane_width/2)
284 if (ix >= -(padplane_width/2))
289 if (ix < -(padplane_width/2))
296 //x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
297 //y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
298 x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
299 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
303 x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
304 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
308 x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
309 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
313 x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
314 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
318 x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
319 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
323 x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
324 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
329 //printf("fSector:%d x:%f y:%f\n",fSector,x,y);
333 void AliRICHSegmentationV1::
334 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
337 // Calculates integration limits
345 //Int_t sector=Sector(fX,fY);
347 //printf("Sector:%d\n",sector);