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