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 ix=9999; //PH Fake values which should not be returned
151 Int_t sector=Sector(x,y);
153 //printf("Sector: %d\n",sector);
157 //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
158 //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
159 ix = Int_t ((x-fDeadZone)/fDpx);
160 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
164 ix = Int_t ((x-fDeadZone)/fDpx);
165 iy = Int_t ((y-fDeadZone/2)/fDpy);
169 ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
170 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
174 ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
175 iy = Int_t ((y-fDeadZone/2)/fDpy);
179 ix = Int_t ((x+fDeadZone)/fDpx)-1;
180 iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
184 ix = Int_t ((x+fDeadZone)/fDpx)-1;
185 iy = Int_t ((y-fDeadZone/2)/fDpy);
189 //ix = Int_t (x/fDpx);
190 //iy = Int_t (y/fDpy);
192 //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
193 //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
201 if (iy > fNpy) iy= fNpy;
202 if (iy < -fNpy) iy=-fNpy;
203 if (ix > fNpx) ix= fNpx;
204 if (ix < -fNpx) ix=-fNpx;
207 void AliRICHSegmentationV1::
208 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
210 // returns real coordinates (x,y) for given pad coordinates (ix,iy)
213 //Int_t sector=Sector(ix*.8,iy*.84);
217 // old numerical definition
256 // parametrised definition
258 Float_t padplane_width = fNpx/3;
264 if (ix >= padplane_width/2)
267 if (ix< padplane_width/2)
269 if (ix >= -(padplane_width/2))
274 if (ix < -(padplane_width/2))
282 if (ix >= padplane_width/2)
285 if (ix< padplane_width/2)
287 if (ix >= -(padplane_width/2))
292 if (ix < -(padplane_width/2))
299 //x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
300 //y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
301 x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
302 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
306 x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
307 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
311 x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
312 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
316 x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
317 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
321 x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
322 y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
326 x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
327 y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
332 //printf("fSector:%d x:%f y:%f\n",fSector,x,y);
336 void AliRICHSegmentationV1::
337 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
340 // Calculates integration limits
348 //Int_t sector=Sector(fX,fY);
350 //printf("Sector:%d\n",sector);