]>
Commit | Line | Data |
---|---|---|
4c039060 | 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$ | |
67357bb9 | 18 | Revision 1.3 1999/09/29 09:24:23 fca |
19 | Introduction of the Copyright and cvs Log | |
20 | ||
4c039060 | 21 | */ |
22 | ||
a897a37a | 23 | #include "AliMUONSegResV0.h" |
24 | #include "TMath.h" | |
25 | #include "TRandom.h" | |
26 | #include "TArc.h" | |
27 | #include "AliMUONchamber.h" | |
28 | ClassImp(AliMUONsegmentationV0) | |
29 | void AliMUONsegmentationV0::Init(AliMUONchamber* Chamber) | |
30 | { | |
31 | fNpx=(Int_t) (Chamber->ROuter()/fDpx+1); | |
32 | fNpy=(Int_t) (Chamber->ROuter()/fDpy+1); | |
33 | fRmin=Chamber->RInner(); | |
34 | fRmax=Chamber->ROuter(); | |
35 | fCorr=0; | |
36 | ||
37 | } | |
38 | ||
39 | ||
40 | Float_t AliMUONsegmentationV0::GetAnod(Float_t xhit) | |
41 | { | |
42 | Float_t wire= (xhit>0)? Int_t(xhit/fWireD)+0.5:Int_t(xhit/fWireD)-0.5; | |
43 | return fWireD*wire; | |
44 | } | |
45 | ||
46 | void AliMUONsegmentationV0::SetPADSIZ(Float_t p1, Float_t p2) | |
47 | { | |
48 | fDpx=p1; | |
49 | fDpy=p2; | |
50 | } | |
51 | void AliMUONsegmentationV0:: | |
52 | GetPadIxy(Float_t x, Float_t y, Int_t &ix, Int_t &iy) | |
53 | { | |
54 | // returns pad coordinates (ix,iy) for given real coordinates (x,y) | |
55 | // | |
56 | ix = (x>0)? Int_t(x/fDpx)+1 : Int_t(x/fDpx)-1; | |
57 | iy = (y>0)? Int_t(y/fDpy)+1 : Int_t(y/fDpy)-1; | |
58 | if (iy > fNpy) iy= fNpy; | |
59 | if (iy < -fNpy) iy=-fNpy; | |
60 | if (ix > fNpx) ix= fNpx; | |
61 | if (ix < -fNpx) ix=-fNpx; | |
62 | } | |
63 | void AliMUONsegmentationV0:: | |
64 | GetPadCxy(Int_t ix, Int_t iy, Float_t &x, Float_t &y) | |
65 | { | |
66 | // returns real coordinates (x,y) for given pad coordinates (ix,iy) | |
67 | // | |
68 | x = (ix>0) ? Float_t(ix*fDpx)-fDpx/2. : Float_t(ix*fDpx)+fDpx/2.; | |
69 | y = (iy>0) ? Float_t(iy*fDpy)-fDpy/2. : Float_t(iy*fDpy)+fDpy/2.; | |
70 | } | |
71 | ||
72 | void AliMUONsegmentationV0:: | |
73 | SetHit(Float_t xhit, Float_t yhit) | |
74 | { | |
75 | // | |
76 | // Find the wire position (center of charge distribution) | |
77 | // Float_t x0a=GetAnod(xhit); | |
78 | fxhit=xhit; | |
79 | fyhit=yhit; | |
80 | } | |
81 | ||
82 | void AliMUONsegmentationV0:: | |
83 | SetPad(Int_t ix, Int_t iy) | |
84 | { | |
85 | GetPadCxy(ix,iy,fx,fy); | |
86 | } | |
87 | ||
88 | void AliMUONsegmentationV0:: | |
89 | FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy) | |
90 | { | |
91 | // | |
92 | // Find the wire position (center of charge distribution) | |
93 | Float_t x0a=GetAnod(xhit); | |
94 | fxhit=x0a; | |
95 | fyhit=yhit; | |
96 | // | |
97 | // and take fNsigma*sigma around this center | |
98 | Float_t x01=x0a - dx; | |
99 | Float_t x02=x0a + dx; | |
100 | Float_t y01=yhit - dy; | |
101 | Float_t y02=yhit + dy; | |
102 | // | |
103 | // find the pads over which the charge distributes | |
104 | GetPadIxy(x01,y01,fixmin,fiymin); | |
105 | GetPadIxy(x02,y02,fixmax,fiymax); | |
106 | // printf("\n %f %f %d %d \n",x02,y02,fixmax,fiymax); | |
107 | // printf("\n FirstPad called %f %f \n", fDpx, fDpy); | |
108 | // printf("\n Hit Position %f %f \n",xhit,yhit); | |
109 | // printf("\n Integration limits: %i %i %i %i",fixmin,fixmax,fiymin,fiymax); | |
110 | // printf("\n Integration limits: %f %f %f %f \n",x01,x02,y01,y02); | |
111 | // | |
112 | // Set current pad to lower left corner | |
113 | fix=fixmin; | |
114 | fiy=fiymin; | |
115 | GetPadCxy(fix,fiy,fx,fy); | |
116 | } | |
117 | ||
118 | void AliMUONsegmentationV0::NextPad() | |
119 | { | |
120 | // | |
121 | // Step to next pad in integration region | |
122 | if (fix != fixmax) { | |
123 | if (fix==-1) fix++; | |
124 | fix++; | |
125 | } else if (fiy != fiymax) { | |
126 | fix=fixmin; | |
127 | if (fiy==-1) fiy++; | |
128 | fiy++; | |
129 | } else { | |
130 | printf("\n Error: Stepping outside integration region\n "); | |
131 | } | |
132 | GetPadCxy(fix,fiy,fx,fy); | |
133 | } | |
134 | ||
135 | Int_t AliMUONsegmentationV0::MorePads() | |
136 | // | |
137 | // Are there more pads in the integration region | |
138 | { | |
139 | if (fix == fixmax && fiy == fiymax) { | |
140 | return 0; | |
141 | } else { | |
142 | return 1; | |
143 | ||
144 | } | |
145 | } | |
146 | ||
e3a4d40e | 147 | void AliMUONsegmentationV0::SigGenInit(Float_t x,Float_t y,Float_t) |
a897a37a | 148 | { |
149 | // | |
150 | // Initialises pad and wire position during stepping | |
151 | fxt =x; | |
152 | fyt =y; | |
153 | GetPadIxy(x,y,fixt,fiyt); | |
154 | fiwt= (x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1 ; | |
155 | } | |
156 | ||
e3a4d40e | 157 | Int_t AliMUONsegmentationV0::SigGenCond(Float_t x,Float_t y,Float_t) |
a897a37a | 158 | { |
159 | // | |
160 | // Signal will be generated if particle crosses pad boundary or | |
161 | // boundary between two wires. | |
162 | Int_t ixt, iyt; | |
163 | GetPadIxy(x,y,ixt,iyt); | |
164 | Int_t iwt=(x>0) ? Int_t(x/fWireD)+1 : Int_t(x/fWireD)-1; | |
165 | if ((ixt != fixt) || (iyt !=fiyt) || (iwt != fiwt)) { | |
166 | return 1; | |
167 | } else { | |
168 | return 0; | |
169 | } | |
170 | } | |
171 | void AliMUONsegmentationV0:: | |
172 | IntegrationLimits(Float_t& x1,Float_t& x2,Float_t& y1, Float_t& y2) | |
173 | { | |
174 | // x1=GetAnod(fxt)-fx-fDpx/2.; | |
175 | x1=fxhit-fx-fDpx/2.; | |
176 | x2=x1+fDpx; | |
177 | y1=fyhit-fy-fDpy/2.; | |
178 | y2=y1+fDpy; | |
179 | } | |
180 | ||
181 | void AliMUONsegmentationV0:: | |
67357bb9 | 182 | Neighbours(Int_t iX, Int_t iY, Int_t* Nlist, Int_t Xlist[10], Int_t Ylist[10]) |
a897a37a | 183 | { |
184 | /* | |
185 | *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1; | |
186 | Ylist[0]=iY-1;Ylist[1]=iY+1;Ylist[2]=Ylist[3]=iY; | |
187 | */ | |
188 | *Nlist=8; | |
189 | Xlist[0]=Xlist[1]=iX; | |
190 | Xlist[2]=iX-1; | |
191 | Xlist[3]=iX+1; | |
192 | Ylist[0]=iY-1; | |
193 | Ylist[1]=iY+1; | |
194 | Ylist[2]=Ylist[3]=iY; | |
195 | ||
196 | // Diagonal elements | |
197 | Xlist[4]=iX+1; | |
198 | Ylist[4]=iY+1; | |
199 | ||
200 | Xlist[5]=iX-1; | |
201 | Ylist[5]=iY-1; | |
202 | ||
203 | Xlist[6]=iX-1; | |
204 | Ylist[6]=iY+1; | |
205 | ||
206 | Xlist[7]=iX+1; | |
207 | Ylist[7]=iY-1; | |
208 | } | |
209 | ||
210 | Float_t AliMUONsegmentationV0::Distance2AndOffset(Int_t iX, Int_t iY, Float_t X, Float_t Y | |
e3a4d40e | 211 | , Int_t *) |
a897a37a | 212 | // Returns the square of the distance between 1 pad |
213 | // labelled by its Channel numbers and a coordinate | |
214 | { | |
215 | Float_t x,y; | |
216 | GetPadCxy(iX,iY,x,y); | |
217 | return (x-X)*(x-X) + (y-Y)*(y-Y); | |
218 | } | |
219 | ||
a897a37a | 220 | void AliMUONsegmentationV0::GiveTestPoints(Int_t &n, Float_t *x, Float_t *y) |
221 | { | |
222 | n=1; | |
223 | x[0]=(fRmax+fRmin)/2/TMath::Sqrt(2.); | |
224 | y[0]=x[0]; | |
225 | } | |
226 | ||
e3a4d40e | 227 | void AliMUONsegmentationV0::Draw(Option_t *) |
a897a37a | 228 | { |
229 | TArc *circle; | |
230 | Float_t scale=0.95/fRmax/2.; | |
231 | ||
232 | ||
233 | circle = new TArc(0.5,0.5,fRmax*scale,0.,360.); | |
234 | circle->SetFillColor(2); | |
235 | circle->Draw(); | |
236 | ||
237 | circle = new TArc(0.5,0.5,fRmin*scale,0.,360.); | |
238 | circle->SetFillColor(1); | |
239 | circle->Draw(); | |
240 | } | |
241 | ||
242 | ||
243 | ||
244 | //___________________________________________ | |
245 | ClassImp(AliMUONresponseV0) | |
246 | Float_t AliMUONresponseV0::IntPH(Float_t eloss) | |
247 | { | |
248 | // Get number of electrons and return charge | |
249 | ||
250 | Int_t nel; | |
251 | nel= Int_t(eloss*1.e9/32.); | |
252 | Float_t charge=0; | |
253 | if (nel == 0) nel=1; | |
254 | for (Int_t i=1;i<=nel;i++) { | |
255 | charge -= fChargeSlope*TMath::Log(gRandom->Rndm()); | |
256 | } | |
257 | return charge; | |
258 | } | |
259 | // ------------------------------------------- | |
260 | ||
261 | Float_t AliMUONresponseV0::IntXY(AliMUONsegmentation * segmentation) | |
262 | { | |
263 | ||
264 | const Float_t invpitch = 1/fPitch; | |
265 | // | |
266 | // Integration limits defined by segmentation model | |
267 | // | |
268 | Float_t xi1, xi2, yi1, yi2; | |
269 | segmentation->IntegrationLimits(xi1,xi2,yi1,yi2); | |
270 | xi1=xi1*invpitch; | |
271 | xi2=xi2*invpitch; | |
272 | yi1=yi1*invpitch; | |
273 | yi2=yi2*invpitch; | |
274 | // | |
275 | // The Mathieson function | |
276 | Double_t ux1=fSqrtKx3*TMath::TanH(fKx2*xi1); | |
277 | Double_t ux2=fSqrtKx3*TMath::TanH(fKx2*xi2); | |
278 | ||
279 | Double_t uy1=fSqrtKy3*TMath::TanH(fKy2*yi1); | |
280 | Double_t uy2=fSqrtKy3*TMath::TanH(fKy2*yi2); | |
281 | ||
282 | ||
283 | return Float_t(4.*fKx4*(TMath::ATan(ux2)-TMath::ATan(ux1))* | |
284 | fKy4*(TMath::ATan(uy2)-TMath::ATan(uy1))); | |
285 | } | |
286 | ||
287 | ||
288 | ||
289 | ||
290 | ||
291 | ||
292 | ||
293 | ||
294 |