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