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