]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHSegmentationV1.cxx
Code cleaning, all wranings removed with new Makefile options
[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 /* $Id$ */
17
18 #include "AliRICHSegmentationV1.h"
19
20 ClassImp(AliRICHSegmentationV1)
21
22 AliRICHSegmentationV1::AliRICHSegmentationV1()
23
24
25 // Default constructor for AliRICHSegmantionV1 (with dead zones)
26
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
32    fWireD=0.84/2;        
33    fSector=-1;
34    Init(0);       // ??? remove 0
35 }
36
37 void AliRICHSegmentationV1::Init(Int_t /*id*/)
38 {//Recalculates all the values after some of them have been changed
39     
40    Float_t csi_length = fNpy*fDpy + fDeadZone;
41    Float_t csi_width = fNpx*fDpx + 2*fDeadZone;
42
43    fPadPlane_Width = (csi_width - 2*fDeadZone)/3;
44    fPadPlane_Length = (csi_length - fDeadZone)/2;
45 }
46
47 // calculate sector from x-y coordinates
48
49 Int_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   //old numerical definition
57
58   /*if (x<-fDeadZone/2)
59     {
60       if (y>22.75)
61         {
62           if (y<63.1)
63             fSector=0;
64         }
65       if (y<20.15)
66         {
67           if (y>(-20.15))
68             fSector=2;
69         }
70       if (y<(-22.75))
71         {
72           if (y>(-63.1))
73             fSector=4;
74         }
75     }
76   else if (x>fDeadZone/2)
77     {
78       if (y>22.75)
79         {
80           if (y<63.1)
81             fSector=1;
82         }
83       if (y<20.15)
84         {
85           if (y>(-20.15))
86             fSector=3;
87         }
88       if (y<(-22.75))
89         {
90           if (y>(-63.1))
91             fSector=5;
92         }
93     }*/
94
95   //Parametrized definition
96
97   if (y<-fDeadZone/2)
98     {
99       if (x> fPadPlane_Width/2 +fDeadZone)
100         {
101           if ( x<fPadPlane_Width/2 +fDeadZone + fPadPlane_Width)
102             fSector=0;
103         }
104       if (x< fPadPlane_Width/2)
105         {
106           if (x> -( fPadPlane_Width/2))
107             fSector=2;
108         }
109       if (x< -( fPadPlane_Width/2 +fDeadZone))
110         {
111           if (x> -( fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width))
112             fSector=4;
113         }
114     }
115   else if (y>fDeadZone/2)
116     {
117       if (x> fPadPlane_Width/2 +fDeadZone)
118         {
119           if (x< fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width)
120             fSector=1;
121         }
122       if (x< fPadPlane_Width/2)
123         {
124           if (x> -( fPadPlane_Width/2))
125             fSector=3;
126         }
127       if (x< -( fPadPlane_Width/2 +fDeadZone))
128         {
129           if (x> -( fPadPlane_Width/2 +fDeadZone +  fPadPlane_Width))
130             fSector=5;
131         }
132     }
133
134   
135   //if (fSector==2)
136     //printf("x:%f, y:%f, sector:%d\n",x,y,fSector);
137
138   return fSector;
139 }
140
141
142 void AliRICHSegmentationV1::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
143 {
144 //  returns pad coordinates (ix,iy) for given real coordinates (x,y)
145 //
146 // Please check origin of pad numbering !!!
147
148   Int_t sector=Sector(x,y);
149
150   //printf("Sector: %d\n",sector);
151
152   if (sector==0)
153     {
154       //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
155       //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
156       ix = Int_t ((x-fDeadZone)/fDpx);
157       iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
158     }
159   if (sector==1)
160     {
161       ix = Int_t ((x-fDeadZone)/fDpx);
162       iy = Int_t ((y-fDeadZone/2)/fDpy);
163     }
164   if (sector==2)
165     {
166       ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
167       iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
168     }
169   if (sector==3)
170     {
171       ix = (x>=0)? ix = Int_t (x/fDpx) : ix = Int_t (x/fDpx)-1;
172       iy = Int_t ((y-fDeadZone/2)/fDpy);
173     }
174   if (sector==4)
175     {
176       ix = Int_t ((x+fDeadZone)/fDpx)-1;
177       iy = Int_t ((y+fDeadZone/2)/fDpy)-1;
178     }
179   if (sector==5)
180     {
181       ix = Int_t ((x+fDeadZone)/fDpx)-1;
182       iy = Int_t ((y-fDeadZone/2)/fDpy);
183     }
184
185   
186   //ix = Int_t (x/fDpx);
187   //iy = Int_t (y/fDpy);
188
189   //ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
190   //iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
191
192   if (sector==-1)
193     {
194       ix = fIxmax;
195       iy = fIymax;
196     }
197
198   if (iy >  fNpy) iy= fNpy;
199   if (iy < -fNpy) iy=-fNpy;
200   if (ix >  fNpx) ix= fNpx;
201   if (ix < -fNpx) ix=-fNpx;
202 }
203
204 void AliRICHSegmentationV1::
205 GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
206 {
207 //  returns real coordinates (x,y) for given pad coordinates (ix,iy)
208 //
209
210   //Int_t sector=Sector(ix*.8,iy*.84);
211
212   Int_t sector=-1;
213
214  // old numerical definition
215
216  /*if (ix<=0)
217     {
218       if (iy<=72)
219         {
220           if (iy>24)
221             sector=0;
222         }
223       if (iy<=24)
224         {
225           if (iy>-24)
226             sector=2;
227         }
228       if (iy<=-24)
229         {
230           if (iy>-72)
231             sector=4;
232         }
233     }
234   if (ix>0)
235     {
236       if (iy<=72)
237         {
238           if (iy>24)
239             sector=1;
240         }
241       if (iy<=24)
242         {
243           if (iy>-24)
244             sector=3;
245         }
246       if (iy<=-24)
247         {
248           if (iy>-72)
249             sector=5;
250         }
251     }*/
252   
253   //  parametrised definition
254
255   Float_t padplane_width = fNpx/3;
256   
257   if (iy<0)
258     {
259       if (ix < fNpx/2)
260         {
261           if (ix >= padplane_width/2)
262             sector=0;
263         }
264       if (ix< padplane_width/2)
265         {
266           if (ix >= -(padplane_width/2))
267             sector=2;
268         }
269       if (ix >= -(fNpx/2))
270         {
271           if (ix < -(padplane_width/2))
272             sector=4;
273         }
274     }
275   if (iy>=0)
276     {
277       if (ix < fNpx/2)
278         {
279           if (ix >= padplane_width/2)
280             sector=1;
281         }
282       if (ix< padplane_width/2)
283         {
284           if (ix >= -(padplane_width/2))
285             sector=3;
286         }
287       if (ix >= -(fNpx/2))
288         {
289           if (ix < -(padplane_width/2))
290             sector=5;
291         }
292     }
293
294   if (sector==0)
295     {
296       //x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
297       //y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
298       x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
299       y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
300     }
301   if (sector==1)
302     {
303       x = Float_t(ix)*fDpx+fDpx/2+fDeadZone;
304       y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
305     }
306   if (sector==2)
307     {
308       x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
309       y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
310     }
311   if (sector==3)
312     {
313       x = (ix>=0) ? x = Float_t(ix)*fDpx+fDpx/2 : x = Float_t(ix)*fDpx+fDpx/2;
314       y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
315     }
316   if (sector==4)
317     {
318       x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
319       y = Float_t(iy)*fDpy+fDpy/2-fDeadZone/2;
320     }
321   if (sector==5)
322     {
323       x = Float_t(ix)*fDpx+fDpx/2-fDeadZone;
324       y = Float_t(iy)*fDpy+fDpy/2+fDeadZone/2;
325     }
326  
327   
328   //if (sector==2)
329     //printf("fSector:%d x:%f y:%f\n",fSector,x,y);
330   
331 }
332
333 void AliRICHSegmentationV1::
334 IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
335 {
336
337 // Calculates integration limits
338
339 /*
340   x1=fXt-fX-fDpx/2.;
341   x2=x1+fDpx;
342   y1=fYt-fY-fDpy/2.;
343   y2=y1+fDpy;    
344 */
345   //Int_t sector=Sector(fX,fY);
346
347   //printf("Sector:%d\n",sector);
348
349   x1=fXhit-fX-fDpx/2.;
350   x2=x1+fDpx;
351   y1=fYhit-fY-fDpy/2.;
352   y2=y1+fDpy;
353 }
354
355
356
357
358
359