]>
Commit | Line | Data |
---|---|---|
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 | ||
803d1ab0 | 16 | /* $Id$ */ |
edf34242 | 17 | |
237c933d | 18 | #include "AliRICHSegmentationV0.h" |
19 | ||
20 | ||
21 | ClassImp(AliRICHSegmentationV0) | |
22 | ||
5a0c129b | 23 | //________________________________________________________________________________ |
24 | AliRICHSegmentationV0::AliRICHSegmentationV0() | |
25 | { | |
26 | ||
27 | // Default constructor for AliRICHSegmentationV0 (no dead zones) | |
28 | ||
29 | fNpx=144; | |
30 | fNpy=160; | |
31 | fDeadZone=0; | |
32 | fSector=-1; | |
edf34242 | 33 | fCorr = 0; |
5a0c129b | 34 | } |
35 | ||
a2f7eaf6 | 36 | void AliRICHSegmentationV0::Init(Int_t id) |
237c933d | 37 | { |
38 | ||
39 | // Initialisation of chambers | |
5a0c129b | 40 | |
41 | //printf("* Initialising SegmentationV0 (no dead zones) in chamber %d *\n",id+1); | |
237c933d | 42 | |
5a0c129b | 43 | // parametrised definition |
44 | ||
45 | Float_t csi_length = fNpy*fDpy + fDeadZone; | |
46 | Float_t csi_width = fNpx*fDpx + 2*fDeadZone; | |
47 | ||
48 | fPadPlane_Width = (csi_width - 2*fDeadZone)/3; | |
49 | fPadPlane_Length = (csi_length - fDeadZone)/2; | |
237c933d | 50 | } |
51 | ||
52 | ||
a2f7eaf6 | 53 | Float_t AliRICHSegmentationV0::GetAnod(Float_t xhit) const |
237c933d | 54 | { |
55 | ||
56 | // Get anod wire closer to hit | |
57 | ||
58 | Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5; | |
59 | return fWireD*wire; | |
60 | } | |
61 | ||
62 | void AliRICHSegmentationV0::SetPadSize(Float_t p1, Float_t p2) | |
63 | { | |
64 | ||
65 | // Set the pad size | |
66 | ||
67 | fDpx=p1; | |
68 | fDpy=p2; | |
69 | } | |
a2f7eaf6 | 70 | void AliRICHSegmentationV0::GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) |
237c933d | 71 | { |
72 | // returns pad coordinates (ix,iy) for given real coordinates (x,y) | |
73 | // | |
74 | // Please check origin of pad numbering !!! | |
75 | ||
76 | ||
77 | ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx); | |
78 | iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy); | |
79 | if (iy > fNpy) iy= fNpy; | |
80 | if (iy < -fNpy) iy=-fNpy; | |
81 | if (ix > fNpx) ix= fNpx; | |
82 | if (ix < -fNpx) ix=-fNpx; | |
83 | } | |
84 | void AliRICHSegmentationV0:: | |
a2f7eaf6 | 85 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) |
237c933d | 86 | { |
87 | // returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
88 | // | |
89 | ||
90 | x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)-fDpx/2.; | |
91 | y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)-fDpy/2.; | |
92 | } | |
93 | ||
94 | void AliRICHSegmentationV0:: | |
95 | SetHit(Float_t xhit, Float_t yhit) | |
96 | { | |
97 | // | |
98 | // Find the wire position (center of charge distribution) | |
99 | // Float_t x0a=GetAnod(xhit); | |
72e468a5 | 100 | fXhit=xhit; |
101 | fYhit=yhit; | |
237c933d | 102 | } |
103 | ||
104 | void AliRICHSegmentationV0:: | |
105 | SetPad(Int_t ix, Int_t iy) | |
106 | { | |
107 | ||
108 | // Move to pad ix, iy | |
109 | ||
a2f7eaf6 | 110 | GetPadC(ix,iy,fX,fY); |
237c933d | 111 | } |
112 | ||
113 | ||
114 | ||
115 | void AliRICHSegmentationV0:: | |
116 | FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy) | |
117 | { | |
118 | ||
119 | // | |
120 | // Find the wire position (center of charge distribution) | |
121 | Float_t x0a=GetAnod(xhit); | |
72e468a5 | 122 | fXhit=x0a; |
123 | fYhit=yhit; | |
237c933d | 124 | // |
125 | // and take fNsigma*sigma around this center | |
126 | Float_t x01=x0a - dx; | |
127 | Float_t x02=x0a + dx; | |
128 | Float_t y01=yhit - dy; | |
129 | Float_t y02=yhit + dy; | |
130 | // | |
131 | // find the pads over which the charge distributes | |
a2f7eaf6 | 132 | GetPadI(x01,y01,fIxmin,fIymin); |
133 | GetPadI(x02,y02,fIxmax,fIymax); | |
237c933d | 134 | // |
135 | // Set current pad to lower left corner | |
72e468a5 | 136 | fIx=fIxmin; |
137 | fIy=fIymin; | |
a2f7eaf6 | 138 | GetPadC(fIx,fIy,fX,fY); |
237c933d | 139 | |
140 | //if (fSector==2) | |
72e468a5 | 141 | //printf("fIx: %d, fIy: %d fX: %f, fY: %f\n",fIx,fIy,fX,fY); |
237c933d | 142 | } |
143 | ||
144 | void AliRICHSegmentationV0::NextPad() | |
145 | { | |
146 | //printf("\n Next Pad \n"); | |
147 | ||
148 | // | |
149 | // Step to next pad in integration region | |
72e468a5 | 150 | if (fIx <= fIxmax) { |
151 | // if (fIx==-1) fIx++; | |
152 | fIx++; | |
153 | } else if (fIy <= fIymax) { | |
154 | // if (fIy==-1) fIy++; | |
155 | fIx=fIxmin; | |
156 | fIy++; | |
237c933d | 157 | } else { |
158 | printf("\n Error: Stepping outside integration region\n "); | |
159 | } | |
a2f7eaf6 | 160 | GetPadC(fIx,fIy,fX,fY); |
237c933d | 161 | } |
162 | ||
163 | Int_t AliRICHSegmentationV0::MorePads() | |
164 | ||
165 | { | |
166 | // | |
167 | // Are there more pads in the integration region | |
168 | ||
169 | //printf("\n More Pads ? \n"); | |
170 | ||
171 | ||
72e468a5 | 172 | if (fIx >= fIxmax && fIy >= fIymax) { |
237c933d | 173 | //printf("There are no more pads\n\n\n\n\n"); |
174 | return 0; | |
175 | } else { | |
176 | //printf("There are more pads\n\n"); | |
177 | return 1; | |
178 | } | |
179 | } | |
180 | ||
181 | void AliRICHSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t) | |
182 | { | |
183 | // | |
184 | // Initialises pad and wire position during stepping | |
72e468a5 | 185 | fXt =x; |
186 | fYt =y; | |
a2f7eaf6 | 187 | GetPadI(x,y,fIxt,fIyt); |
72e468a5 | 188 | fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ; |
237c933d | 189 | } |
190 | ||
191 | Int_t AliRICHSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t) | |
192 | { | |
193 | // | |
194 | // Signal will be generated if particle crosses pad boundary or | |
195 | // boundary between two wires. | |
196 | Int_t ixt, iyt; | |
a2f7eaf6 | 197 | GetPadI(x,y,ixt,iyt); |
237c933d | 198 | Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1; |
199 | ||
72e468a5 | 200 | if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) { |
237c933d | 201 | return 1; |
202 | } else { | |
203 | return 0; | |
204 | } | |
205 | } | |
206 | void AliRICHSegmentationV0:: | |
207 | IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) | |
208 | { | |
209 | ||
210 | // Calculate the integration limits | |
211 | ||
212 | /* | |
72e468a5 | 213 | x1=fXt-fX-fDpx/2.; |
237c933d | 214 | x2=x1+fDpx; |
72e468a5 | 215 | y1=fYt-fY-fDpy/2.; |
237c933d | 216 | y2=y1+fDpy; |
217 | */ | |
72e468a5 | 218 | x1=fXhit-fX-fDpx/2.; |
237c933d | 219 | x2=x1+fDpx; |
72e468a5 | 220 | y1=fYhit-fY-fDpy/2.; |
237c933d | 221 | y2=y1+fDpy; |
222 | } | |
223 | ||
224 | void AliRICHSegmentationV0:: | |
225 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[7], Int_t Ylist[7]) | |
226 | { | |
227 | //Is used for the cluster finder, include diagonal elements | |
228 | ||
229 | *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1; | |
230 | Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY; | |
231 | /* | |
232 | *Nlist=8; | |
233 | Xlist[0]=Xlist[1]=iX; | |
234 | Xlist[2]=iX-1; | |
235 | Xlist[3]=iX+1; | |
236 | Ylist[0]=iY-1; | |
237 | Ylist[1]=iY+1; | |
238 | Ylist[2]=Ylist[3]=iY; | |
239 | ||
240 | // Diagonal elements | |
241 | Xlist[4]=iX+1; | |
242 | Ylist[4]=iY+1; | |
243 | ||
244 | Xlist[5]=iX-1; | |
245 | Ylist[5]=iY-1; | |
246 | ||
247 | Xlist[6]=iX-1; | |
248 | Ylist[6]=iY+1; | |
249 | ||
250 | Xlist[7]=iX+1; | |
251 | Ylist[7]=iY-1; | |
252 | */ | |
253 | } | |
254 | ||
255 | Float_t AliRICHSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y | |
256 | , Int_t *dummy) | |
257 | ||
258 | { | |
259 | // Returns the square of the distance between 1 pad | |
260 | // labelled by its Channel numbers and a coordinate | |
261 | ||
262 | Float_t x,y; | |
a2f7eaf6 | 263 | GetPadC(iX,iY,x,y); |
237c933d | 264 | return (x-X)*(x-X) + (y-Y)*(y-Y); |
265 | } | |
266 | ||
267 | ||
a2f7eaf6 | 268 | void AliRICHSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const |
237c933d | 269 | { |
270 | ||
271 | // Test | |
272 | ||
273 | n=1; | |
274 | x[0]=0.; | |
275 | y[0]=x[0]; | |
276 | } | |
277 | ||
a2f7eaf6 | 278 | void AliRICHSegmentationV0::Draw(const char* opt) const |
237c933d | 279 | { |
280 | ||
281 | // Dummy draw routine | |
282 | ||
283 | /* | |
284 | TArc *circle; | |
285 | Float_t scale=0.95/fRmax/2.; | |
286 | ||
287 | ||
288 | circle = new TArc(0.5,0.5,fRmax*scale,0.,360.); | |
289 | circle->SetFillColor(2); | |
290 | circle->Draw(); | |
291 | ||
292 | circle = new TArc(0.5,0.5,fRmin*scale,0.,360.); | |
293 | circle->SetFillColor(1); | |
294 | circle->Draw(); | |
295 | */ | |
296 | ; | |
297 | ||
298 | } |