]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/AliRICHSegmentationV0.cxx
AliRICHTresholdMap removed, ne implimentation ealier in AliRICHParam
[u/mrichter/AliRoot.git] / RICH / AliRICHSegmentationV0.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 #include "AliRICHSegmentationV0.h"
18
19
20 ClassImp(AliRICHSegmentationV0)
21
22 //________________________________________________________________________________
23 AliRICHSegmentationV0::AliRICHSegmentationV0()
24
25
26 // Default constructor for AliRICHSegmentationV0 (no dead zones)
27
28   fNpx=144;
29   fNpy=160;
30   fDeadZone=0;
31   fSector=-1;
32   fCorr = 0;
33 }
34
35 void AliRICHSegmentationV0::Init(Int_t id)
36 {
37
38 // Initialisation of chambers
39   id++;//to remove warning  
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
48 Float_t AliRICHSegmentationV0::GetAnod(Float_t xhit) const
49 {
50
51 // Get anod wire closer to hit
52
53     Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5;
54     return fWireD*wire;
55 }
56
57 void AliRICHSegmentationV0::SetPadSize(Float_t p1, Float_t p2)
58 {
59
60 // Set the pad size
61
62     fDpx=p1;
63     fDpy=p2;
64 }
65 void AliRICHSegmentationV0::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy)
66 {//  returns pad coordinates (ix,iy) for given real coordinates (x,y)
67   ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx);
68   iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy);
69   if (iy >  fNpy) iy= fNpy;
70   if (iy < -fNpy) iy=-fNpy;
71   if (ix >  fNpx) ix= fNpx;
72   if (ix < -fNpx) ix=-fNpx;
73 }
74 void AliRICHSegmentationV0::GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y)
75 {//  returns real coordinates (x,y) for given pad coordinates (ix,iy)
76   x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.;
77   y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.;
78 }
79
80 void AliRICHSegmentationV0::SetHit(Float_t xhit, Float_t yhit)
81 {// Find the wire position (center of charge distribution)
82     fXhit=xhit;
83     fYhit=yhit;
84 }
85
86 void AliRICHSegmentationV0::SetPad(Int_t ix, Int_t iy)
87 {// Move to pad ix, iy
88
89     GetPadC(ix,iy,fX,fY);
90 }
91
92
93
94 void AliRICHSegmentationV0::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy)
95 {
96
97     // Find the wire position (center of charge distribution)
98     Float_t x0a=GetAnod(xhit);
99     fXhit=x0a;
100     fYhit=yhit;
101     // and take fNsigma*sigma around this center
102     Float_t x01=x0a  - dx;
103     Float_t x02=x0a  + dx;
104     Float_t y01=yhit - dy;
105     Float_t y02=yhit + dy;
106     // find the pads over which the charge distributes
107     GetPadI(x01,y01,fIxmin,fIymin);
108     GetPadI(x02,y02,fIxmax,fIymax);    
109     // Set current pad to lower left corner
110     fIx=fIxmin;
111     fIy=fIymin;
112     GetPadC(fIx,fIy,fX,fY);    
113 }
114
115 void AliRICHSegmentationV0::NextPad()
116 {
117     // Step to next pad in integration region
118     if (fIx <= fIxmax) {
119         fIx++;
120     } else if (fIy <= fIymax) {
121         fIx=fIxmin;
122         fIy++;
123     } else {
124         printf("\n Error: Stepping outside integration region\n ");
125     }
126     GetPadC(fIx,fIy,fX,fY);
127 }
128
129 Int_t AliRICHSegmentationV0::MorePads()
130 {// Are there more pads in the integration region   
131   if (fIx >= fIxmax && fIy >= fIymax) {
132     return 0;
133   } else {
134     return 1;
135   }
136 }
137 //__________________________________________________________________________________________________
138 void AliRICHSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t)
139 {//  Initialises pad and wire position during stepping
140     fXt =x;
141     fYt =y;
142     GetPadI(x,y,fIxt,fIyt);
143     fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ;
144 }
145
146 Int_t AliRICHSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t)
147 {//  Signal will be generated if particle crosses pad boundary or
148 //  boundary between two wires. 
149     Int_t ixt, iyt;
150     GetPadI(x,y,ixt,iyt);
151     Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1;
152     
153     if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) {
154       return 1;
155     } else {
156       return 0;
157     }
158 }
159 void AliRICHSegmentationV0::IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2)
160 {// Calculate the integration limits
161   x1=fXhit-fX-fDpx/2.;
162   x2=x1+fDpx;
163   y1=fYhit-fY-fDpy/2.;
164   y2=y1+fDpy;
165 }
166
167 void AliRICHSegmentationV0::Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7])
168 {
169 //Is used for the cluster finder, include diagonal elements
170     
171     *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
172     Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY;
173 }
174
175 Float_t AliRICHSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y,Int_t *dummy)
176 {// Returns the square of the distance between 1 pad labelled by its Channel numbers and a coordinate
177   dummy=0;
178   Float_t x,y;
179   GetPadC(iX,iY,x,y);
180   return (x-X)*(x-X) + (y-Y)*(y-Y);
181 }
182
183 void  AliRICHSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const
184 {
185
186 // Test
187
188     n=1;
189     x[0]=0.;
190     y[0]=x[0];
191 }
192
193 void AliRICHSegmentationV0::Draw(const char* opt) const
194 {
195   Info("Draw","%s",opt);
196     
197 }