]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHSegmentationV1.cxx
J.Chudoba's changes merged correctly with the HEAD
[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 /*
17   $Log$
18   Revision 1.6  2001/01/24 21:00:29  jbarbosa
19   Redefinition of sectors and pad coordinates/real coordinates transformations.
20
21   Revision 1.5  2001/01/22 21:37:39  jbarbosa
22   Added parametrised definiton sectors
23
24   Revision 1.4  2001/01/22 21:35:39  jbarbosa
25   Added deadzone size to data members
26
27   Revision 1.3  2000/10/03 21:44:09  morsch
28   Use AliSegmentation and AliHit abstract base classes.
29
30   Revision 1.2  2000/10/02 15:48:55  jbarbosa
31   Fixed coding conventions.
32
33   Revision 1.1  2000/06/12 15:34:28  jbarbosa
34   Cleaned up version.
35
36 */
37
38 #include "AliRICHSegmentationV1.h"
39
40
41 //--------------------------------------------------------
42 ClassImp(AliRICHSegmentationV1)
43
44 //________________________________________________________________________________
45 AliRICHSegmentationV1::AliRICHSegmentationV1()
46
47
48 // Default constructor for AliRICHSegmantionV1 (with dead zones)
49
50   fNpx=144;
51   fNpy=160;
52   //fNpx=80;
53   //fNpy=48;
54   fDeadZone=2.6;
55   fSector=-1;
56 }
57
58 void AliRICHSegmentationV1::Init(Int_t id)
59 {
60
61 // Initialisation of chambers
62
63   //printf("*            Initialising SegmentationV1 (dead zones) in chamber %d              *\n",id+1);
64
65   // parametrised definition
66
67   Float_t csi_length = fNpy*fDpy + fDeadZone;
68   Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
69
70   fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
71   fPadPlane_Length = (csi_length - fDeadZone)/2;
72
73 }
74
75 // calculate sector from x-y coordinates
76
77 Int_t AliRICHSegmentationV1::Sector(Float_t x, Float_t y)
78 {
79
80 // Calculate in which sector is the hit
81   
82   fSector=-1;
83   
84   //old numerical definition
85
86   /*if (x<-fDeadZone/2)
87     {
88       if (y>22.75)
89         {
90           if (y<63.1)
91             fSector=0;
92         }
93       if (y<20.15)
94         {
95           if (y>(-20.15))
96             fSector=2;
97         }
98       if (y<(-22.75))
99         {
100           if (y>(-63.1))
101             fSector=4;
102         }
103     }
104   else if (x>fDeadZone/2)
105     {
106       if (y>22.75)
107         {
108           if (y<63.1)
109             fSector=1;
110         }
111       if (y<20.15)
112         {
113           if (y>(-20.15))
114             fSector=3;
115         }
116       if (y<(-22.75))
117         {
118           if (y>(-63.1))
119             fSector=5;
120         }
121     }*/
122
123   //Parametrized definition
124
125   if (y<-fDeadZone/2)
126     {
127       if (x> fPadPlane_Width/2 +fDeadZone)
128         {
129           if ( x<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
130             fSector=0;
131         }
132       if (x< fPadPlane_Width/2)
133         {
134           if (x> -( fPadPlane_Width/2))
135             fSector=2;
136         }
137       if (x< -( fPadPlane_Width/2 +fDeadZone))
138         {
139           if (x> -( fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width))
140             fSector=4;
141         }
142     }
143   else if (y>fDeadZone/2)
144     {
145       if (x> fPadPlane_Width/2 +fDeadZone)
146         {
147           if (x< fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width)
148             fSector=1;
149         }
150       if (x< fPadPlane_Width/2)
151         {
152           if (x> -( fPadPlane_Width/2))
153             fSector=3;
154         }
155       if (x< -( fPadPlane_Width/2 +fDeadZone))
156         {
157           if (x> -( fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width))
158             fSector=5;
159         }
160     }
161
162   
163   //if (fSector==2)
164     //printf("x:%f, y:%f, sector:%d\n",x,y,fSector);
165
166   return fSector;
167 }
168
169
170 void AliRICHSegmentationV1::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
171 {
172 //  returns pad coordinates (ix,iy) for given real coordinates (x,y)
173 //
174 // Please check origin of pad numbering !!!
175
176   Int_t sector=Sector(x,y);
177
178   //printf("Sector: %d\n",sector);
179
180   if (sector==0)
181     {
182       //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
183       //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
184       ix = Int_t ((x-fDeadZone)/fDpx);
185       iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
186     }
187   if (sector==1)
188     {
189       ix = Int_t ((x-fDeadZone)/fDpx);
190       iy = Int_t ((y-fDeadZone/2)/fDpy);
191     }
192   if (sector==2)
193     {
194       ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
195       iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
196     }
197   if (sector==3)
198     {
199       ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
200       iy = Int_t ((y-fDeadZone/2)/fDpy);
201     }
202   if (sector==4)
203     {
204       ix = Int_t ((x+fDeadZone)/fDpx)-1;
205       iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
206     }
207   if (sector==5)
208     {
209       ix = Int_t ((x+fDeadZone)/fDpx)-1;
210       iy = Int_t ((y-fDeadZone/2)/fDpy);
211     }
212
213   
214   //ix = Int_t (x/fDpx);
215   //iy = Int_t (y/fDpy);
216
217   //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
218   //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
219
220   if (sector==-1)
221     {
222       ix = fIxmax;
223       iy = fIymax;
224     }
225
226   if (iy >  fNpy) iy= fNpy;
227   if (iy < -fNpy) iy=-fNpy;
228   if (ix >  fNpx) ix= fNpx;
229   if (ix < -fNpx) ix=-fNpx;
230 }
231
232 void AliRICHSegmentationV1::
233 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
234 {
235 //  returns real coordinates (x,y) for given pad coordinates (ix,iy)
236 //
237
238   //Int_t sector=Sector(ix*.8,iy*.84);
239
240   Int_t sector=-1;
241
242  // old numerical definition
243
244  /*if (ix<=0)
245     {
246       if (iy<=72)
247         {
248           if (iy>24)
249             sector=0;
250         }
251       if (iy<=24)
252         {
253           if (iy>-24)
254             sector=2;
255         }
256       if (iy<=-24)
257         {
258           if (iy>-72)
259             sector=4;
260         }
261     }
262   if (ix>0)
263     {
264       if (iy<=72)
265         {
266           if (iy>24)
267             sector=1;
268         }
269       if (iy<=24)
270         {
271           if (iy>-24)
272             sector=3;
273         }
274       if (iy<=-24)
275         {
276           if (iy>-72)
277             sector=5;
278         }
279     }*/
280   
281   //  parametrised definition
282
283   Float_t padplane_width = fNpx/3;
284   
285   if (iy<0)
286     {
287       if (ix < fNpx/2)
288         {
289           if (ix >= padplane_width/2)
290             sector=0;
291         }
292       if (ix< padplane_width/2)
293         {
294           if (ix >= -(padplane_width/2))
295             sector=2;
296         }
297       if (ix >= -(fNpx/2))
298         {
299           if (ix < -(padplane_width/2))
300             sector=4;
301         }
302     }
303   if (iy>=0)
304     {
305       if (ix < fNpx/2)
306         {
307           if (ix >= padplane_width/2)
308             sector=1;
309         }
310       if (ix< padplane_width/2)
311         {
312           if (ix >= -(padplane_width/2))
313             sector=3;
314         }
315       if (ix >= -(fNpx/2))
316         {
317           if (ix < -(padplane_width/2))
318             sector=5;
319         }
320     }
321
322   if (sector==0)
323     {
324       //x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
325       //y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
326       x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
327       y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
328     }
329   if (sector==1)
330     {
331       x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
332       y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
333     }
334   if (sector==2)
335     {
336       x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
337       y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
338     }
339   if (sector==3)
340     {
341       x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
342       y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
343     }
344   if (sector==4)
345     {
346       x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
347       y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
348     }
349   if (sector==5)
350     {
351       x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
352       y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
353     }
354  
355   
356   //if (sector==2)
357     //printf("fSector:%d x:%f y:%f\n",fSector,x,y);
358   
359 }
360
361 void AliRICHSegmentationV1::
362 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
363 {
364
365 // Calculates integration limits
366
367 /*
368   x1=fXt-fX-fDpx/2.;
369   x2=x1+fDpx;
370   y1=fYt-fY-fDpy/2.;
371   y2=y1+fDpy;    
372 */
373   //Int_t sector=Sector(fX,fY);
374
375   //printf("Sector:%d\n",sector);
376
377   x1=fXhit-fX-fDpx/2.;
378   x2=x1+fDpx;
379   y1=fYhit-fY-fDpy/2.;
380   y2=y1+fDpy;
381 }
382
383
384
385
386
387