]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHSegmentationV1.cxx
- Pass (p,E) with PushTrack.
[u/mrichter/AliRoot.git] / RICH / AliRICHSegmentationV1.cxx
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 #include "AliRICHSegmentationV1.h"
17
18 ClassImp(AliRICHSegmentationV1)
19 //__________________________________________________________________________________________________
20 AliRICHSegmentationV1::AliRICHSegmentationV1()
21 {// Default constructor for AliRICHSegmantionV1 (with dead zones)
22
23    fNpx=144;      // number of pads along X direction 
24    fNpy=160;      // number of pads along Y direction 
25    fDeadZone=3.0; // space between CsI photocathods in cm
26    fDpx=0.84;     // pad width in cm
27    fDpy=0.80;     // pad heights in cm
28    fWireD=0.84/2;        
29    fSector=-1;
30    Init(0);       // ??? remove 0
31 }
32 //__________________________________________________________________________________________________
33 void AliRICHSegmentationV1::Init(Int_t /*id*/)
34 {//Recalculates all the values after some of them have been changed
35     
36    Float_t csi_length = fNpy*fDpy + fDeadZone;
37    Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
38
39    fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
40    fPadPlane_Length = (csi_length - fDeadZone)/2;
41 }
42 //__________________________________________________________________________________________________
43 Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
44 {// Calculate in which sector is the hit
45   
46   fSector=-1;
47   
48   //Parametrized definition
49
50   if (y<-fDeadZone/2)
51     {
52       if (x> fPadPlane_Width/2 +fDeadZone)
53         {
54           if ( x<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
55             fSector=0;
56         }
57       if (x< fPadPlane_Width/2)
58         {
59           if (x> -( fPadPlane_Width/2))
60             fSector=2;
61         }
62       if (x< -( fPadPlane_Width/2 +fDeadZone))
63         {
64           if (x> -( fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width))
65             fSector=4;
66         }
67     }
68   else if (y>fDeadZone/2)
69     {
70       if (x> fPadPlane_Width/2 +fDeadZone)
71         {
72           if (x< fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width)
73             fSector=1;
74         }
75       if (x< fPadPlane_Width/2)
76         {
77           if (x> -( fPadPlane_Width/2))
78             fSector=3;
79         }
80       if (x< -( fPadPlane_Width/2 +fDeadZone))
81         {
82           if (x> -( fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width))
83             fSector=5;
84         }
85     }
86
87   return fSector;
88 }//Sector()
89 //__________________________________________________________________________________________________
90 void AliRICHSegmentationV1::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
91 {
92
93   ix=9999; //PH Fake values which should not be returned
94   iy=9999;
95
96   Int_t sector=Sector(x,y);
97
98
99   if (sector==0)
100     {
101       ix = Int_t ((x-fDeadZone)/fDpx);
102       iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
103     }
104   if (sector==1)
105     {
106       ix = Int_t ((x-fDeadZone)/fDpx);
107       iy = Int_t ((y-fDeadZone/2)/fDpy);
108     }
109   if (sector==2)
110     {
111       ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
112       iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
113     }
114   if (sector==3)
115     {
116       ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
117       iy = Int_t ((y-fDeadZone/2)/fDpy);
118     }
119   if (sector==4)
120     {
121       ix = Int_t ((x+fDeadZone)/fDpx)-1;
122       iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
123     }
124   if (sector==5)
125     {
126       ix = Int_t ((x+fDeadZone)/fDpx)-1;
127       iy = Int_t ((y-fDeadZone/2)/fDpy);
128     }
129
130
131   if (sector==-1)
132     {
133       ix = fIxmax;
134       iy = fIymax;
135     }
136
137   if (iy >  fNpy) iy= fNpy;
138   if (iy < -fNpy) iy=-fNpy;
139   if (ix >  fNpx) ix= fNpx;
140   if (ix < -fNpx) ix=-fNpx;
141 }//GetPadI()
142 //__________________________________________________________________________________________________
143 void AliRICHSegmentationV1::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
144 {//  returns real coordinates (x,y) for given pad coordinates (ix,iy)
145   Int_t sector=-1;
146
147
148   Float_t padplane_width = fNpx/3;
149   
150   if (iy<0)
151     {
152       if (ix < fNpx/2)
153         {
154           if (ix >= padplane_width/2)
155             sector=0;
156         }
157       if (ix< padplane_width/2)
158         {
159           if (ix >= -(padplane_width/2))
160             sector=2;
161         }
162       if (ix >= -(fNpx/2))
163         {
164           if (ix < -(padplane_width/2))
165             sector=4;
166         }
167     }
168   if (iy>=0)
169     {
170       if (ix < fNpx/2)
171         {
172           if (ix >= padplane_width/2)
173             sector=1;
174         }
175       if (ix< padplane_width/2)
176         {
177           if (ix >= -(padplane_width/2))
178             sector=3;
179         }
180       if (ix >= -(fNpx/2))
181         {
182           if (ix < -(padplane_width/2))
183             sector=5;
184         }
185     }
186
187   if (sector==0)
188     {
189       //x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
190       //y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
191       x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
192       y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
193     }
194   if (sector==1)
195     {
196       x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
197       y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
198     }
199   if (sector==2)
200     {
201       x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
202       y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
203     }
204   if (sector==3)
205     {
206       x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
207       y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
208     }
209   if (sector==4)
210     {
211       x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
212       y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
213     }
214   if (sector==5)
215     {
216       x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
217       y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
218     }
219 }//GetPadC
220 //__________________________________________________________________________________________________
221 void AliRICHSegmentationV1::IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
222 {
223   x1=fXhit-fX-fDpx/2.;
224   x2=x1+fDpx;
225   y1=fYhit-fY-fDpy/2.;
226   y2=y1+fDpy;
227 }