]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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 | **************************************************************************/ | |
de05461e | 15 | |
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
18 | #include "AliMUONSegmentationV0.h" | |
19 | #include "TArc.h" | |
20 | #include "TMath.h" | |
21 | #include "AliMUONChamber.h" | |
d81db581 | 22 | #include "AliRun.h" |
23 | #include "AliMUON.h" | |
a9e2aefa | 24 | |
25 | ClassImp(AliMUONSegmentationV0) | |
3bf5e9a0 | 26 | AliMUONSegmentationV0::AliMUONSegmentationV0(const AliMUONSegmentationV0& segmentation):AliSegmentation(segmentation) |
27 | { | |
28 | // Dummy copy constructor | |
29 | } | |
a9e2aefa | 30 | |
d81db581 | 31 | void AliMUONSegmentationV0::Init(Int_t chamber) |
a9e2aefa | 32 | { |
33 | // Initialises member data of the segmentation from geometry data | |
34 | // owned by Chamber | |
35 | // | |
d81db581 | 36 | AliMUON *pMUON = (AliMUON *) gAlice->GetModule("MUON"); |
3e1872ed | 37 | fChamber=&(pMUON->Chamber(chamber)); |
d81db581 | 38 | |
a9e2aefa | 39 | // Initialise maximum number of pads in x ans y |
3e1872ed | 40 | fNpx=(Int_t) (fChamber->ROuter()/fDpx+1); |
41 | fNpy=(Int_t) (fChamber->ROuter()/fDpy+1); | |
a9e2aefa | 42 | // Initialize inner and outer radius of the sensitive region |
3e1872ed | 43 | fRmin=fChamber->RInner(); |
44 | fRmax=fChamber->ROuter(); | |
a9e2aefa | 45 | fCorr=0; |
3e1872ed | 46 | fZ=fChamber->Z(); |
aaf4addd | 47 | fId=chamber; |
a9e2aefa | 48 | } |
49 | ||
50 | ||
c3eff6ad | 51 | Float_t AliMUONSegmentationV0::GetAnod(Float_t xhit) const |
a9e2aefa | 52 | { |
53 | // Returns for a hit position xhit the position of the nearest anode wire | |
54 | Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5; | |
55 | return fWireD*wire; | |
56 | } | |
f2ba3c26 | 57 | //____________________________________________________________________________ |
58 | void AliMUONSegmentationV0::GetNParallelAndOffset(Int_t /*iX*/, Int_t /*iY*/, Int_t *Nparallel, Int_t *Offset) | |
59 | { | |
60 | *Nparallel=1; | |
61 | *Offset=0; | |
62 | } | |
63 | ||
a9e2aefa | 64 | |
f2ba3c26 | 65 | //____________________________________________________________________________ |
66 | void AliMUONSegmentationV0::GetPadI(Float_t x, Float_t y , Float_t /*z*/, Int_t &ix, Int_t &iy) | |
67 | { | |
68 | GetPadI(x, y, ix, iy); | |
69 | } | |
70 | //____________________________________________________________________________ | |
71 | void AliMUONSegmentationV0::SetCorrFunc(Int_t /*dum*/, TF1* func) | |
72 | { | |
73 | fCorr=func; | |
74 | } | |
75 | //____________________________________________________________________________ | |
76 | Int_t AliMUONSegmentationV0::Sector(Int_t /*ix*/, Int_t /*iy*/) | |
77 | { | |
78 | return 1; | |
79 | } | |
80 | //____________________________________________________________________________ | |
81 | Int_t AliMUONSegmentationV0::Sector(Float_t /*x*/, Float_t /*y*/) | |
82 | { | |
83 | return 1; | |
84 | } | |
85 | //____________________________________________________________________________ | |
a9e2aefa | 86 | void AliMUONSegmentationV0::SetPadSize(Float_t p1, Float_t p2) |
87 | { | |
88 | // Sets the padsize | |
89 | // | |
90 | fDpx=p1; | |
91 | fDpy=p2; | |
92 | } | |
c3eff6ad | 93 | |
a9e2aefa | 94 | void AliMUONSegmentationV0:: |
c3eff6ad | 95 | GetPadI(Float_t x, Float_t y, Int_t &ix, Int_t &iy) |
a9e2aefa | 96 | { |
97 | // Returns pad coordinates (ix,iy) for given real coordinates (x,y) | |
98 | // | |
99 | ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx)-1; | |
100 | iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1; | |
101 | if (iy > fNpy) iy= fNpy; | |
102 | if (iy < -fNpy) iy=-fNpy; | |
103 | if (ix > fNpx) ix= fNpx; | |
104 | if (ix < -fNpx) ix=-fNpx; | |
105 | } | |
c3eff6ad | 106 | |
a9e2aefa | 107 | void AliMUONSegmentationV0:: |
c3eff6ad | 108 | GetPadC(Int_t ix, Int_t iy, Float_t &x, Float_t &y) |
a9e2aefa | 109 | { |
110 | // Returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
111 | // | |
112 | // Comments and Critics: | |
113 | ||
114 | // The Pad(0,0) does not exist, this causes in the present version errors | |
115 | // during iteration when used with hits close to zero. | |
116 | // Since we have frame crosses at x=0 or y=0 this does not cause any problems | |
117 | // Nevertheless, should be corrected in the next version !! | |
118 | // The name fRmin is misleading although we use this version with | |
119 | // a circular chamber geometry. | |
120 | ||
121 | x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)+fDpx/2.; | |
122 | y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.; | |
123 | } | |
f2ba3c26 | 124 | //______________________________________________________________________ |
125 | void AliMUONSegmentationV0::SetHit(Float_t xhit, Float_t yhit) | |
a9e2aefa | 126 | { |
127 | // | |
128 | // Sets virtual hit position, needed for evaluating pad response | |
129 | // outside the tracking program | |
ecfa008b | 130 | fXhit=xhit; |
131 | fYhit=yhit; | |
a9e2aefa | 132 | } |
f2ba3c26 | 133 | //_______________________________________________________________________ |
134 | void AliMUONSegmentationV0::SetHit(Float_t xhit, Float_t yhit, Float_t /*zhit*/) | |
135 | { | |
136 | SetHit(xhit, yhit); | |
137 | } | |
138 | //_______________________________________________________________________ | |
139 | ||
a9e2aefa | 140 | |
141 | void AliMUONSegmentationV0:: | |
142 | SetPad(Int_t ix, Int_t iy) | |
143 | { | |
144 | // | |
145 | // Sets virtual pad coordinates, needed for evaluating pad response | |
146 | // outside the tracking program | |
ecfa008b | 147 | GetPadC(ix,iy,fX,fY); |
a9e2aefa | 148 | } |
f2ba3c26 | 149 | //____________________________________________________________________________________ |
150 | void AliMUONSegmentationV0::FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy) | |
a9e2aefa | 151 | { |
152 | // Initialises iteration over pads for charge distribution algorithm | |
153 | // | |
154 | // | |
155 | // Find the wire position (center of charge distribution) | |
156 | Float_t x0a=GetAnod(xhit); | |
ecfa008b | 157 | fXhit=x0a; |
158 | fYhit=yhit; | |
a9e2aefa | 159 | // |
160 | // and take fNsigma*sigma around this center | |
161 | Float_t x01=x0a - dx; | |
162 | Float_t x02=x0a + dx; | |
163 | Float_t y01=yhit - dy; | |
164 | Float_t y02=yhit + dy; | |
165 | // | |
166 | // find the pads over which the charge distributes | |
ecfa008b | 167 | GetPadI(x01,y01,fIxmin,fIymin); |
168 | GetPadI(x02,y02,fIxmax,fIymax); | |
a9e2aefa | 169 | // |
170 | // Set current pad to lower left corner | |
ecfa008b | 171 | fIx=fIxmin; |
172 | fIy=fIymin; | |
173 | GetPadC(fIx,fIy,fX,fY); | |
a9e2aefa | 174 | } |
f2ba3c26 | 175 | //________________________________________________________________________ |
176 | void AliMUONSegmentationV0::FirstPad(Float_t xhit, Float_t yhit, Float_t /*zhit*/, Float_t dx, Float_t dy) | |
177 | {FirstPad(xhit, yhit, dx, dy);} | |
178 | ||
a9e2aefa | 179 | |
180 | void AliMUONSegmentationV0::NextPad() | |
181 | { | |
182 | // Stepper for the iteration over pads | |
183 | // | |
184 | // Comments and Critics: | |
185 | // Boundary crossing at x=0 or y=0 not correctly handled ! | |
186 | // Step to next pad in the integration region | |
ecfa008b | 187 | if (fIx != fIxmax) { |
188 | if (fIx==-1) fIx++; | |
189 | fIx++; | |
190 | } else if (fIy != fIymax) { | |
191 | fIx=fIxmin; | |
192 | if (fIy==-1) fIy++; | |
193 | fIy++; | |
a9e2aefa | 194 | } else { |
195 | printf("\n Error: Stepping outside integration region\n "); | |
196 | } | |
ecfa008b | 197 | GetPadC(fIx,fIy,fX,fY); |
a9e2aefa | 198 | } |
199 | ||
200 | Int_t AliMUONSegmentationV0::MorePads() | |
de05461e | 201 | { |
a9e2aefa | 202 | // Stopping condition for the iterator over pads |
203 | // | |
204 | // Are there more pads in the integration region ? | |
de05461e | 205 | |
ecfa008b | 206 | if (fIx == fIxmax && fIy == fIymax) { |
a9e2aefa | 207 | return 0; |
208 | } else { | |
209 | return 1; | |
210 | ||
211 | } | |
212 | } | |
213 | ||
f2ba3c26 | 214 | void AliMUONSegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t /*z*/) |
a9e2aefa | 215 | { |
216 | // | |
217 | // Initialises pad and wire position during stepping | |
ecfa008b | 218 | fXt =x; |
219 | fYt =y; | |
220 | GetPadI(x,y,fIxt,fIyt); | |
221 | fIwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ; | |
a9e2aefa | 222 | } |
c3eff6ad | 223 | |
f2ba3c26 | 224 | Int_t AliMUONSegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t /*z*/) |
a9e2aefa | 225 | { |
226 | // Signal generation condition during stepping | |
227 | // 0: don't generate signal | |
228 | // 1: generate signal | |
229 | // Comments and critics: | |
230 | ||
231 | // Crossing of pad boundary and mid plane between neighbouring wires is checked. | |
232 | // To correctly simulate the dependence of the spatial resolution on the angle | |
233 | // of incidence signal must be generated for constant steps on | |
234 | // the projection of the trajectory along the anode wire. | |
235 | ||
236 | // | |
237 | // Signal will be generated if particle crosses pad boundary or | |
238 | // boundary between two wires. | |
239 | Int_t ixt, iyt; | |
a30a000f | 240 | GetPadI(x,y,ixt,iyt); |
a9e2aefa | 241 | Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1; |
ecfa008b | 242 | if ((ixt != fIxt) || (iyt !=fIyt) || (iwt != fIwt)) { |
a9e2aefa | 243 | return 1; |
244 | } else { | |
245 | return 0; | |
246 | } | |
247 | } | |
248 | void AliMUONSegmentationV0:: | |
249 | IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) | |
250 | { | |
251 | // Returns integration limits for current pad | |
252 | // | |
ecfa008b | 253 | x1=fXhit-fX-fDpx/2.; |
a9e2aefa | 254 | x2=x1+fDpx; |
ecfa008b | 255 | y1=fYhit-fY-fDpy/2.; |
a9e2aefa | 256 | y2=y1+fDpy; |
257 | } | |
258 | ||
259 | void AliMUONSegmentationV0:: | |
c3eff6ad | 260 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) |
a9e2aefa | 261 | { |
262 | // Returns list of next neighbours for given Pad (iX, iY) | |
263 | // | |
264 | // Comments and critics | |
265 | // "Diagonal" neighbours are not passed | |
266 | // Is this ok when we search for local maxima ?? | |
267 | // No test whether neighbours have valid indices id performed | |
268 | *Nlist=4; | |
269 | Xlist[0]=Xlist[1]=iX; | |
270 | Xlist[2]=iX-1; | |
271 | Xlist[3]=iX+1; | |
272 | Ylist[0]=iY-1; | |
273 | Ylist[1]=iY+1; | |
274 | Ylist[2]=Ylist[3]=iY; | |
275 | } | |
276 | ||
277 | Float_t AliMUONSegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y | |
f2ba3c26 | 278 | , Int_t * /*dummy*/) |
de05461e | 279 | { |
a9e2aefa | 280 | // Returns the square of the distance between 1 pad |
281 | // labelled by its Channel numbers and a coordinate | |
de05461e | 282 | |
a9e2aefa | 283 | Float_t x,y; |
a30a000f | 284 | GetPadC(iX,iY,x,y); |
a9e2aefa | 285 | return (x-X)*(x-X) + (y-Y)*(y-Y); |
286 | } | |
287 | ||
288 | ||
c3eff6ad | 289 | void AliMUONSegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) const |
a9e2aefa | 290 | { |
291 | // Returns test point on the pad plane. | |
292 | // Used during determination of the segmoid correction of the COG-method | |
293 | n=1; | |
294 | x[0]=(fRmax+fRmin)/2/TMath::Sqrt(2.); | |
295 | y[0]=x[0]; | |
296 | } | |
297 | ||
c3eff6ad | 298 | void AliMUONSegmentationV0::Draw(const char *) const |
a9e2aefa | 299 | { |
300 | // Draws the segmentation zones | |
301 | // | |
302 | TArc *circle; | |
303 | Float_t scale=0.95/fRmax/2.; | |
304 | ||
305 | ||
306 | circle = new TArc(0.5,0.5,fRmax*scale,0.,360.); | |
307 | circle->SetFillColor(2); | |
308 | circle->Draw(); | |
309 | ||
310 | circle = new TArc(0.5,0.5,fRmin*scale,0.,360.); | |
311 | circle->SetFillColor(1); | |
312 | circle->Draw(); | |
313 | } | |
314 | ||
f2ba3c26 | 315 | AliMUONSegmentationV0& AliMUONSegmentationV0::operator =(const AliMUONSegmentationV0 & /*rhs*/) |
a9e2aefa | 316 | { |
317 | // Dummy assignment operator | |
318 | return *this; | |
319 | } |