]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHSegResV1.cxx
Implements all the new classes (JB, AM)
[u/mrichter/AliRoot.git] / RICH / AliRICHSegResV1.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 /*
17   $Log$
18 */
19
20
21 #include "AliRICHSegRes.h"
22 #include "AliRICHSegResV1.h"
23
24
25 //--------------------------------------------------------
26 ClassImp(AliRICHSegmentationV1)
27
28 //________________________________________________________________________________
29 AliRICHSegmentationV1::AliRICHSegmentationV1()
30
31   fNpx=160;
32   fNpy=144;
33   //fNpx=80;
34   //fNpy=48;
35   fSector=-1;
36 }
37
38 //________________________________________________________________________________
39 AliRICHSegmentationV1::~AliRICHSegmentationV1()
40
41 }
42
43
44 // calculate sector from x-y coordinates
45
46 Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
47 {
48
49   fSector=-1;
50   
51   if (x<-1.3)
52     {
53       if (y>22.75)
54         {
55           if (y<63.1)
56             fSector=0;
57         }
58       if (y<20.15)
59         {
60           if (y>(-20.15))
61             fSector=2;
62         }
63       if (y<(-22.75))
64         {
65           if (y>(-63.1))
66             fSector=4;
67         }
68     }
69   else if (x>1.3)
70     {
71       if (y>22.75)
72         {
73           if (y<63.1)
74             fSector=1;
75         }
76       if (y<20.15)
77         {
78           if (y>(-20.15))
79             fSector=3;
80         }
81       if (y<(-22.75))
82         {
83           if (y>(-63.1))
84             fSector=5;
85         }
86     }
87   
88   //if (fSector==2)
89     //printf("x:%f, y:%f, sector:%d\n",x,y,fSector);
90
91   return fSector;
92 }
93
94
95 void AliRICHSegmentationV1::GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
96 {
97 //  returns pad coordinates (ix,iy) for given real coordinates (x,y)
98 //
99 // Please check origin of pad numbering !!!
100
101   Int_t sector=Sector(x,y);
102
103   //printf("Sector: %d\n",sector);
104
105
106   if (sector==0)
107     {
108       //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
109       //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
110       ix = Int_t (x/fDpx+1.3);
111       iy = Int_t (y/fDpy-2.6);
112     }
113   if (sector==1)
114     {
115       ix = Int_t (x/fDpx-1.3);
116       iy = Int_t (y/fDpy-2.6);
117     }
118   if (sector==2)
119     {
120       ix = Int_t (x/fDpx+1.3);
121       iy = Int_t (y/fDpy);
122     }
123   if (sector==3)
124     {
125       ix = Int_t (x/fDpx-1.3);
126       iy = Int_t (y/fDpy);
127     }
128   if (sector==4)
129     {
130       ix = Int_t (x/fDpx+1.3);
131       iy = Int_t (y/fDpy+2.6);
132     }
133   if (sector==5)
134     {
135       ix = Int_t (x/fDpx-1.3);
136       iy = Int_t (y/fDpy+2.6);
137     }
138   
139   //ix = Int_t (x/fDpx);
140   //iy = Int_t (y/fDpy);
141
142   //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
143   //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
144
145   if (sector==-1)
146     {
147       ix = fixmax;
148       iy = fiymax;
149     }
150
151   if (iy >  fNpy) iy= fNpy;
152   if (iy < -fNpy) iy=-fNpy;
153   if (ix >  fNpx) ix= fNpx;
154   if (ix < -fNpx) ix=-fNpx;
155 }
156
157 void AliRICHSegmentationV1::
158 GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
159 {
160 //  returns real coordinates (x,y) for given pad coordinates (ix,iy)
161 //
162
163   //Int_t sector=Sector(ix*.8,iy*.84);
164
165   Int_t sector=-1;
166
167   if (ix<=0)
168     {
169       if (iy<=72)
170         {
171           if (iy>24)
172             sector=0;
173         }
174       if (iy<=24)
175         {
176           if (iy>-24)
177             sector=2;
178         }
179       if (iy<=-24)
180         {
181           if (iy>-72)
182             sector=4;
183         }
184     }
185   if (ix>0)
186     {
187       if (iy<=72)
188         {
189           if (iy>24)
190             sector=1;
191         }
192       if (iy<=24)
193         {
194           if (iy>-24)
195             sector=3;
196         }
197       if (iy<=-24)
198         {
199           if (iy>-72)
200             sector=5;
201         }
202     }
203   
204
205   if (sector==0)
206     {
207       //x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
208       //y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
209       x = Float_t(ix*fDpx)-fDpx/2.-1.3;
210       y = Float_t(iy*fDpy)-fDpy/2.+2.6;
211     }
212   if (sector==1)
213     {
214       x = Float_t(ix*fDpx)-fDpx/2.+1.3;
215       y = Float_t(iy*fDpy)-fDpy/2.+2.6;
216     }
217   if (sector==2)
218     {
219       x = Float_t(ix*fDpx)-fDpx/2.-1.3;
220       y = Float_t(iy*fDpy)-fDpy/2.;
221     }
222   if (sector==3)
223     {
224       x = Float_t(ix*fDpx)-fDpx/2.+1.3;
225       y = Float_t(iy*fDpy)-fDpy/2.;
226     }
227   if (sector==4)
228     {
229       x = Float_t(ix*fDpx)-fDpx/2.-1.3;
230       y = Float_t(iy*fDpy)-fDpy/2.-2.6;
231     }
232   if (sector==5)
233     {
234       x = Float_t(ix*fDpx)-fDpx/2.+1.3;
235       y = Float_t(iy*fDpy)-fDpy/2.-2.6;
236     }
237   
238   //if (sector==2)
239     //printf("fSector:%d x:%f y:%f\n",fSector,x,y);
240   
241 }
242
243 void AliRICHSegmentationV1::
244 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
245 {
246 /*
247   x1=fxt-fx-fDpx/2.;
248   x2=x1+fDpx;
249   y1=fyt-fy-fDpy/2.;
250   y2=y1+fDpy;    
251 */
252   //Int_t sector=Sector(fx,fy);
253
254   //printf("Sector:%d\n",sector);
255
256   x1=fxhit-fx-fDpx/2.;
257   x2=x1+fDpx;
258   y1=fyhit-fy-fDpy/2.;
259   y2=y1+fDpy;
260 }