]>
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 | ||
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
3831f268 | 18 | /////////////////////////////////////////////////// |
19 | // | |
20 | // Track parameters | |
21 | // in | |
22 | // ALICE | |
23 | // dimuon | |
24 | // spectrometer | |
a9e2aefa | 25 | // |
3831f268 | 26 | /////////////////////////////////////////////////// |
a9e2aefa | 27 | |
58443fe3 | 28 | //#include <Riostream.h> |
3831f268 | 29 | #include "AliMUON.h" |
a9e2aefa | 30 | #include "AliMUONTrackParam.h" |
06c11448 | 31 | #include "AliMUONConstants.h" |
a9e2aefa | 32 | #include "AliRun.h" |
94de3818 | 33 | #include "AliMagF.h" |
8c343c7c | 34 | #include "AliLog.h" |
a9e2aefa | 35 | |
36 | ClassImp(AliMUONTrackParam) // Class implementation in ROOT context | |
37 | ||
61adb9bd | 38 | //_________________________________________________________________________ |
30178c30 | 39 | AliMUONTrackParam::AliMUONTrackParam() |
40 | : TObject() | |
41 | { | |
42 | // Constructor | |
43 | ||
44 | fInverseBendingMomentum = 0; | |
45 | fBendingSlope = 0; | |
46 | fNonBendingSlope = 0; | |
47 | fZ = 0; | |
48 | fBendingCoor = 0; | |
49 | fNonBendingCoor = 0; | |
50 | } | |
61adb9bd | 51 | |
30178c30 | 52 | //_________________________________________________________________________ |
53 | AliMUONTrackParam& | |
54 | AliMUONTrackParam::operator=(const AliMUONTrackParam& theMUONTrackParam) | |
61adb9bd | 55 | { |
58443fe3 | 56 | // Asignment operator |
30178c30 | 57 | if (this == &theMUONTrackParam) |
61adb9bd | 58 | return *this; |
59 | ||
30178c30 | 60 | // base class assignement |
61 | TObject::operator=(theMUONTrackParam); | |
62 | ||
63 | fInverseBendingMomentum = theMUONTrackParam.fInverseBendingMomentum; | |
64 | fBendingSlope = theMUONTrackParam.fBendingSlope; | |
65 | fNonBendingSlope = theMUONTrackParam.fNonBendingSlope; | |
66 | fZ = theMUONTrackParam.fZ; | |
67 | fBendingCoor = theMUONTrackParam.fBendingCoor; | |
68 | fNonBendingCoor = theMUONTrackParam.fNonBendingCoor; | |
61adb9bd | 69 | |
70 | return *this; | |
71 | } | |
72 | //_________________________________________________________________________ | |
30178c30 | 73 | AliMUONTrackParam::AliMUONTrackParam(const AliMUONTrackParam& theMUONTrackParam) |
74 | : TObject(theMUONTrackParam) | |
61adb9bd | 75 | { |
58443fe3 | 76 | // Copy constructor |
30178c30 | 77 | fInverseBendingMomentum = theMUONTrackParam.fInverseBendingMomentum; |
78 | fBendingSlope = theMUONTrackParam.fBendingSlope; | |
79 | fNonBendingSlope = theMUONTrackParam.fNonBendingSlope; | |
80 | fZ = theMUONTrackParam.fZ; | |
81 | fBendingCoor = theMUONTrackParam.fBendingCoor; | |
82 | fNonBendingCoor = theMUONTrackParam.fNonBendingCoor; | |
61adb9bd | 83 | } |
a9e2aefa | 84 | |
a9e2aefa | 85 | //__________________________________________________________________________ |
86 | void AliMUONTrackParam::ExtrapToZ(Double_t Z) | |
87 | { | |
88 | // Track parameter extrapolation to the plane at "Z". | |
89 | // On return, the track parameters resulting from the extrapolation | |
90 | // replace the current track parameters. | |
a9e2aefa | 91 | if (this->fZ == Z) return; // nothing to be done if same Z |
92 | Double_t forwardBackward; // +1 if forward, -1 if backward | |
5b64e914 | 93 | if (Z < this->fZ) forwardBackward = 1.0; // spectro. z<0 |
a9e2aefa | 94 | else forwardBackward = -1.0; |
a6f03ddb | 95 | Double_t vGeant3[7], vGeant3New[7]; // 7 in parameter ???? |
a9e2aefa | 96 | Int_t iGeant3, stepNumber; |
97 | Int_t maxStepNumber = 5000; // in parameter ???? | |
98 | // For safety: return kTRUE or kFALSE ???? | |
a6f03ddb | 99 | // Parameter vector for calling EXTRAP_ONESTEP |
a9e2aefa | 100 | SetGeant3Parameters(vGeant3, forwardBackward); |
956019b6 | 101 | // sign of charge (sign of fInverseBendingMomentum if forward motion) |
a6f03ddb | 102 | // must be changed if backward extrapolation |
956019b6 | 103 | Double_t chargeExtrap = forwardBackward * |
104 | TMath::Sign(Double_t(1.0), this->fInverseBendingMomentum); | |
a9e2aefa | 105 | Double_t stepLength = 6.0; // in parameter ???? |
106 | // Extrapolation loop | |
107 | stepNumber = 0; | |
5b64e914 | 108 | while (((-forwardBackward * (vGeant3[2] - Z)) <= 0.0) && // spectro. z<0 |
a9e2aefa | 109 | (stepNumber < maxStepNumber)) { |
110 | stepNumber++; | |
a6f03ddb | 111 | // Option for switching between helix and Runge-Kutta ???? |
4d03a78e | 112 | //ExtrapOneStepRungekutta(chargeExtrap, stepLength, vGeant3, vGeant3New); |
113 | ExtrapOneStepHelix(chargeExtrap, stepLength, vGeant3, vGeant3New); | |
5b64e914 | 114 | if ((-forwardBackward * (vGeant3New[2] - Z)) > 0.0) break; // one is beyond Z spectro. z<0 |
a9e2aefa | 115 | // better use TArray ???? |
116 | for (iGeant3 = 0; iGeant3 < 7; iGeant3++) | |
117 | {vGeant3[iGeant3] = vGeant3New[iGeant3];} | |
118 | } | |
119 | // check maxStepNumber ???? | |
a9e2aefa | 120 | // Interpolation back to exact Z (2nd order) |
121 | // should be in function ???? using TArray ???? | |
122 | Double_t dZ12 = vGeant3New[2] - vGeant3[2]; // 1->2 | |
1e2b8bb7 | 123 | if (TMath::Abs(dZ12) > 0) { |
124 | Double_t dZ1i = Z - vGeant3[2]; // 1-i | |
125 | Double_t dZi2 = vGeant3New[2] - Z; // i->2 | |
126 | Double_t xPrime = (vGeant3New[0] - vGeant3[0]) / dZ12; | |
127 | Double_t xSecond = | |
128 | ((vGeant3New[3] / vGeant3New[5]) - (vGeant3[3] / vGeant3[5])) / dZ12; | |
129 | Double_t yPrime = (vGeant3New[1] - vGeant3[1]) / dZ12; | |
130 | Double_t ySecond = | |
131 | ((vGeant3New[4] / vGeant3New[5]) - (vGeant3[4] / vGeant3[5])) / dZ12; | |
132 | vGeant3[0] = vGeant3[0] + xPrime * dZ1i - 0.5 * xSecond * dZ1i * dZi2; // X | |
133 | vGeant3[1] = vGeant3[1] + yPrime * dZ1i - 0.5 * ySecond * dZ1i * dZi2; // Y | |
134 | vGeant3[2] = Z; // Z | |
135 | Double_t xPrimeI = xPrime - 0.5 * xSecond * (dZi2 - dZ1i); | |
136 | Double_t yPrimeI = yPrime - 0.5 * ySecond * (dZi2 - dZ1i); | |
137 | // (PX, PY, PZ)/PTOT assuming forward motion | |
138 | vGeant3[5] = | |
139 | 1.0 / TMath::Sqrt(1.0 + xPrimeI * xPrimeI + yPrimeI * yPrimeI); // PZ/PTOT | |
140 | vGeant3[3] = xPrimeI * vGeant3[5]; // PX/PTOT | |
141 | vGeant3[4] = yPrimeI * vGeant3[5]; // PY/PTOT | |
142 | } else { | |
143 | AliWarning(Form("Extrap. to Z not reached, Z = %f",Z)); | |
144 | } | |
956019b6 | 145 | // Track parameters from Geant3 parameters, |
146 | // with charge back for forward motion | |
147 | GetFromGeant3Parameters(vGeant3, chargeExtrap * forwardBackward); | |
a9e2aefa | 148 | } |
149 | ||
150 | //__________________________________________________________________________ | |
151 | void AliMUONTrackParam::SetGeant3Parameters(Double_t *VGeant3, Double_t ForwardBackward) | |
152 | { | |
153 | // Set vector of Geant3 parameters pointed to by "VGeant3" | |
154 | // from track parameters in current AliMUONTrackParam. | |
155 | // Since AliMUONTrackParam is only geometry, one uses "ForwardBackward" | |
156 | // to know whether the particle is going forward (+1) or backward (-1). | |
157 | VGeant3[0] = this->fNonBendingCoor; // X | |
158 | VGeant3[1] = this->fBendingCoor; // Y | |
159 | VGeant3[2] = this->fZ; // Z | |
160 | Double_t pYZ = TMath::Abs(1.0 / this->fInverseBendingMomentum); | |
161 | Double_t pZ = | |
162 | pYZ / TMath::Sqrt(1.0 + this->fBendingSlope * this->fBendingSlope); | |
163 | VGeant3[6] = | |
164 | TMath::Sqrt(pYZ * pYZ + | |
165 | pZ * pZ * this->fNonBendingSlope * this->fNonBendingSlope); // PTOT | |
5b64e914 | 166 | VGeant3[5] = -ForwardBackward * pZ / VGeant3[6]; // PZ/PTOT spectro. z<0 |
a9e2aefa | 167 | VGeant3[3] = this->fNonBendingSlope * VGeant3[5]; // PX/PTOT |
168 | VGeant3[4] = this->fBendingSlope * VGeant3[5]; // PY/PTOT | |
169 | } | |
170 | ||
171 | //__________________________________________________________________________ | |
172 | void AliMUONTrackParam::GetFromGeant3Parameters(Double_t *VGeant3, Double_t Charge) | |
173 | { | |
174 | // Get track parameters in current AliMUONTrackParam | |
956019b6 | 175 | // from Geant3 parameters pointed to by "VGeant3", |
176 | // assumed to be calculated for forward motion in Z. | |
a9e2aefa | 177 | // "InverseBendingMomentum" is signed with "Charge". |
178 | this->fNonBendingCoor = VGeant3[0]; // X | |
179 | this->fBendingCoor = VGeant3[1]; // Y | |
180 | this->fZ = VGeant3[2]; // Z | |
181 | Double_t pYZ = VGeant3[6] * TMath::Sqrt(1.0 - VGeant3[3] * VGeant3[3]); | |
182 | this->fInverseBendingMomentum = Charge / pYZ; | |
183 | this->fBendingSlope = VGeant3[4] / VGeant3[5]; | |
184 | this->fNonBendingSlope = VGeant3[3] / VGeant3[5]; | |
185 | } | |
186 | ||
187 | //__________________________________________________________________________ | |
188 | void AliMUONTrackParam::ExtrapToStation(Int_t Station, AliMUONTrackParam *TrackParam) | |
189 | { | |
190 | // Track parameters extrapolated from current track parameters ("this") | |
191 | // to both chambers of the station(0..) "Station" | |
192 | // are returned in the array (dimension 2) of track parameters | |
193 | // pointed to by "TrackParam" (index 0 and 1 for first and second chambers). | |
194 | Double_t extZ[2], z1, z2; | |
ecfa008b | 195 | Int_t i1 = -1, i2 = -1; // = -1 to avoid compilation warnings |
a9e2aefa | 196 | // range of Station to be checked ???? |
06c11448 | 197 | z1 = AliMUONConstants::DefaultChamberZ(2 * Station); |
198 | z2 = AliMUONConstants::DefaultChamberZ(2 * Station + 1); | |
a9e2aefa | 199 | // First and second Z to extrapolate at |
200 | if ((z1 > this->fZ) && (z2 > this->fZ)) {i1 = 0; i2 = 1;} | |
201 | else if ((z1 < this->fZ) && (z2 < this->fZ)) {i1 = 1; i2 = 0;} | |
202 | else { | |
8c343c7c | 203 | AliError(Form("Starting Z (%f) in between z1 (%f) and z2 (%f) of station(0..)%d",this->fZ,z1,z2,Station)); |
204 | // cout << "ERROR in AliMUONTrackParam::CreateExtrapSegmentInStation" << endl; | |
205 | // cout << "Starting Z (" << this->fZ << ") in between z1 (" << z1 << | |
206 | // ") and z2 (" << z2 << ") of station(0..) " << Station << endl; | |
a9e2aefa | 207 | } |
208 | extZ[i1] = z1; | |
209 | extZ[i2] = z2; | |
210 | // copy of track parameters | |
211 | TrackParam[i1] = *this; | |
212 | // first extrapolation | |
213 | (&(TrackParam[i1]))->ExtrapToZ(extZ[0]); | |
214 | TrackParam[i2] = TrackParam[i1]; | |
215 | // second extrapolation | |
216 | (&(TrackParam[i2]))->ExtrapToZ(extZ[1]); | |
217 | return; | |
218 | } | |
219 | ||
04b5ea16 | 220 | //__________________________________________________________________________ |
889a0215 | 221 | void AliMUONTrackParam::ExtrapToVertex(Double_t xVtx, Double_t yVtx, Double_t zVtx) |
04b5ea16 | 222 | { |
223 | // Extrapolation to the vertex. | |
224 | // Returns the track parameters resulting from the extrapolation, | |
225 | // in the current TrackParam. | |
956019b6 | 226 | // Changes parameters according to Branson correction through the absorber |
04b5ea16 | 227 | |
5b64e914 | 228 | Double_t zAbsorber = -503.0; // to be coherent with the Geant absorber geometry !!!! |
229 | // spectro. (z<0) | |
04b5ea16 | 230 | // Extrapolates track parameters upstream to the "Z" end of the front absorber |
b45fd22b | 231 | ExtrapToZ(zAbsorber); // !!! |
5b64e914 | 232 | // Makes Branson correction (multiple scattering + energy loss) |
889a0215 | 233 | BransonCorrection(xVtx,yVtx,zVtx); |
5b64e914 | 234 | // Makes a simple magnetic field correction through the absorber |
b45fd22b | 235 | FieldCorrection(zAbsorber); |
04b5ea16 | 236 | } |
237 | ||
43af2cb6 | 238 | |
239 | // Keep this version for future developments | |
04b5ea16 | 240 | //__________________________________________________________________________ |
43af2cb6 | 241 | // void AliMUONTrackParam::BransonCorrection() |
242 | // { | |
243 | // // Branson correction of track parameters | |
244 | // // the entry parameters have to be calculated at the end of the absorber | |
245 | // Double_t zEndAbsorber, zBP, xBP, yBP; | |
246 | // Double_t pYZ, pX, pY, pZ, pTotal, xEndAbsorber, yEndAbsorber, radiusEndAbsorber2, pT, theta; | |
247 | // Int_t sign; | |
248 | // // Would it be possible to calculate all that from Geant configuration ???? | |
249 | // // and to get the Branson parameters from a function in ABSO module ???? | |
250 | // // with an eventual contribution from other detectors like START ???? | |
251 | // // Radiation lengths outer part theta > 3 degres | |
252 | // static Double_t x01[9] = { 18.8, // C (cm) | |
253 | // 10.397, // Concrete (cm) | |
254 | // 0.56, // Plomb (cm) | |
255 | // 47.26, // Polyethylene (cm) | |
256 | // 0.56, // Plomb (cm) | |
257 | // 47.26, // Polyethylene (cm) | |
258 | // 0.56, // Plomb (cm) | |
259 | // 47.26, // Polyethylene (cm) | |
260 | // 0.56 }; // Plomb (cm) | |
261 | // // inner part theta < 3 degres | |
262 | // static Double_t x02[3] = { 18.8, // C (cm) | |
263 | // 10.397, // Concrete (cm) | |
264 | // 0.35 }; // W (cm) | |
265 | // // z positions of the materials inside the absober outer part theta > 3 degres | |
266 | // static Double_t z1[10] = { 90, 315, 467, 472, 477, 482, 487, 492, 497, 502 }; | |
267 | // // inner part theta < 3 degres | |
268 | // static Double_t z2[4] = { 90, 315, 467, 503 }; | |
269 | // static Bool_t first = kTRUE; | |
270 | // static Double_t zBP1, zBP2, rLimit; | |
271 | // // Calculates z positions of the Branson's planes: zBP1 for outer part and zBP2 for inner part (only at the first call) | |
272 | // if (first) { | |
273 | // first = kFALSE; | |
274 | // Double_t aNBP = 0.0; | |
275 | // Double_t aDBP = 0.0; | |
276 | // Int_t iBound; | |
277 | ||
278 | // for (iBound = 0; iBound < 9; iBound++) { | |
279 | // aNBP = aNBP + | |
280 | // (z1[iBound+1] * z1[iBound+1] * z1[iBound+1] - | |
281 | // z1[iBound] * z1[iBound] * z1[iBound] ) / x01[iBound]; | |
282 | // aDBP = aDBP + | |
283 | // (z1[iBound+1] * z1[iBound+1] - z1[iBound] * z1[iBound] ) / x01[iBound]; | |
284 | // } | |
285 | // zBP1 = (2.0 * aNBP) / (3.0 * aDBP); | |
286 | // aNBP = 0.0; | |
287 | // aDBP = 0.0; | |
288 | // for (iBound = 0; iBound < 3; iBound++) { | |
289 | // aNBP = aNBP + | |
290 | // (z2[iBound+1] * z2[iBound+1] * z2[iBound+1] - | |
291 | // z2[iBound] * z2[iBound ] * z2[iBound] ) / x02[iBound]; | |
292 | // aDBP = aDBP + | |
293 | // (z2[iBound+1] * z2[iBound+1] - z2[iBound] * z2[iBound]) / x02[iBound]; | |
294 | // } | |
295 | // zBP2 = (2.0 * aNBP) / (3.0 * aDBP); | |
296 | // rLimit = z2[3] * TMath::Tan(3.0 * (TMath::Pi()) / 180.); | |
297 | // } | |
298 | ||
299 | // pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
300 | // sign = 1; | |
301 | // if (fInverseBendingMomentum < 0) sign = -1; | |
302 | // pZ = pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope)); | |
303 | // pX = pZ * fNonBendingSlope; | |
304 | // pY = pZ * fBendingSlope; | |
305 | // pTotal = TMath::Sqrt(pYZ *pYZ + pX * pX); | |
306 | // xEndAbsorber = fNonBendingCoor; | |
307 | // yEndAbsorber = fBendingCoor; | |
308 | // radiusEndAbsorber2 = xEndAbsorber * xEndAbsorber + yEndAbsorber * yEndAbsorber; | |
309 | ||
310 | // if (radiusEndAbsorber2 > rLimit*rLimit) { | |
311 | // zEndAbsorber = z1[9]; | |
312 | // zBP = zBP1; | |
313 | // } else { | |
314 | // zEndAbsorber = z2[3]; | |
315 | // zBP = zBP2; | |
316 | // } | |
317 | ||
318 | // xBP = xEndAbsorber - (pX / pZ) * (zEndAbsorber - zBP); | |
319 | // yBP = yEndAbsorber - (pY / pZ) * (zEndAbsorber - zBP); | |
320 | ||
321 | // // new parameters after Branson and energy loss corrections | |
322 | // pZ = pTotal * zBP / TMath::Sqrt(xBP * xBP + yBP * yBP + zBP * zBP); | |
323 | // pX = pZ * xBP / zBP; | |
324 | // pY = pZ * yBP / zBP; | |
325 | // fBendingSlope = pY / pZ; | |
326 | // fNonBendingSlope = pX / pZ; | |
327 | ||
328 | // pT = TMath::Sqrt(pX * pX + pY * pY); | |
329 | // theta = TMath::ATan2(pT, pZ); | |
330 | // pTotal = | |
331 | // TotalMomentumEnergyLoss(rLimit, pTotal, theta, xEndAbsorber, yEndAbsorber); | |
332 | ||
333 | // fInverseBendingMomentum = (sign / pTotal) * | |
334 | // TMath::Sqrt(1.0 + | |
335 | // fBendingSlope * fBendingSlope + | |
336 | // fNonBendingSlope * fNonBendingSlope) / | |
337 | // TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope); | |
338 | ||
339 | // // vertex position at (0,0,0) | |
340 | // // should be taken from vertex measurement ??? | |
341 | // fBendingCoor = 0.0; | |
342 | // fNonBendingCoor = 0; | |
343 | // fZ= 0; | |
344 | // } | |
345 | ||
889a0215 | 346 | void AliMUONTrackParam::BransonCorrection(Double_t xVtx,Double_t yVtx,Double_t zVtx) |
04b5ea16 | 347 | { |
348 | // Branson correction of track parameters | |
349 | // the entry parameters have to be calculated at the end of the absorber | |
43af2cb6 | 350 | // simplified version: the z positions of Branson's planes are no longer calculated |
351 | // but are given as inputs. One can use the macros MUONTestAbso.C and DrawTestAbso.C | |
352 | // to test this correction. | |
04b5ea16 | 353 | // Would it be possible to calculate all that from Geant configuration ???? |
956019b6 | 354 | // and to get the Branson parameters from a function in ABSO module ???? |
355 | // with an eventual contribution from other detectors like START ???? | |
889a0215 | 356 | //change to take into account the vertex postition (real, reconstruct,....) |
357 | ||
43af2cb6 | 358 | Double_t zBP, xBP, yBP; |
359 | Double_t pYZ, pX, pY, pZ, pTotal, xEndAbsorber, yEndAbsorber, radiusEndAbsorber2, pT, theta; | |
360 | Int_t sign; | |
04b5ea16 | 361 | static Bool_t first = kTRUE; |
b45fd22b | 362 | static Double_t zBP1, zBP2, rLimit, thetaLimit, zEndAbsorber; |
43af2cb6 | 363 | // zBP1 for outer part and zBP2 for inner part (only at the first call) |
04b5ea16 | 364 | if (first) { |
365 | first = kFALSE; | |
43af2cb6 | 366 | |
5b64e914 | 367 | zEndAbsorber = -503; // spectro (z<0) |
b45fd22b | 368 | thetaLimit = 3.0 * (TMath::Pi()) / 180.; |
5b64e914 | 369 | rLimit = TMath::Abs(zEndAbsorber) * TMath::Tan(thetaLimit); |
370 | zBP1 = -450; // values close to those calculated with EvalAbso.C | |
371 | zBP2 = -480; | |
04b5ea16 | 372 | } |
373 | ||
374 | pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
375 | sign = 1; | |
b8dc484b | 376 | if (fInverseBendingMomentum < 0) sign = -1; |
377 | pZ = Pz(); | |
378 | pX = Px(); | |
379 | pY = Py(); | |
04b5ea16 | 380 | pTotal = TMath::Sqrt(pYZ *pYZ + pX * pX); |
381 | xEndAbsorber = fNonBendingCoor; | |
382 | yEndAbsorber = fBendingCoor; | |
383 | radiusEndAbsorber2 = xEndAbsorber * xEndAbsorber + yEndAbsorber * yEndAbsorber; | |
384 | ||
385 | if (radiusEndAbsorber2 > rLimit*rLimit) { | |
04b5ea16 | 386 | zBP = zBP1; |
387 | } else { | |
04b5ea16 | 388 | zBP = zBP2; |
389 | } | |
390 | ||
391 | xBP = xEndAbsorber - (pX / pZ) * (zEndAbsorber - zBP); | |
392 | yBP = yEndAbsorber - (pY / pZ) * (zEndAbsorber - zBP); | |
393 | ||
394 | // new parameters after Branson and energy loss corrections | |
b45fd22b | 395 | // Float_t zSmear = zBP - gRandom->Gaus(0.,2.); // !!! possible smearing of Z vertex position |
889a0215 | 396 | |
397 | Float_t zSmear = zBP ; | |
b45fd22b | 398 | |
889a0215 | 399 | pZ = pTotal * (zSmear-zVtx) / TMath::Sqrt((xBP-xVtx) * (xBP-xVtx) + (yBP-yVtx) * (yBP-yVtx) +( zSmear-zVtx) * (zSmear-zVtx) ); |
400 | pX = pZ * (xBP - xVtx)/ (zSmear-zVtx); | |
401 | pY = pZ * (yBP - yVtx) / (zSmear-zVtx); | |
04b5ea16 | 402 | fBendingSlope = pY / pZ; |
403 | fNonBendingSlope = pX / pZ; | |
5b64e914 | 404 | |
04b5ea16 | 405 | |
406 | pT = TMath::Sqrt(pX * pX + pY * pY); | |
5b64e914 | 407 | theta = TMath::ATan2(pT, TMath::Abs(pZ)); |
b45fd22b | 408 | pTotal = TotalMomentumEnergyLoss(thetaLimit, pTotal, theta); |
04b5ea16 | 409 | |
410 | fInverseBendingMomentum = (sign / pTotal) * | |
411 | TMath::Sqrt(1.0 + | |
412 | fBendingSlope * fBendingSlope + | |
413 | fNonBendingSlope * fNonBendingSlope) / | |
414 | TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope); | |
415 | ||
416 | // vertex position at (0,0,0) | |
417 | // should be taken from vertex measurement ??? | |
889a0215 | 418 | |
419 | fBendingCoor = xVtx; | |
420 | fNonBendingCoor = yVtx; | |
421 | fZ= zVtx; | |
422 | ||
04b5ea16 | 423 | } |
b45fd22b | 424 | |
04b5ea16 | 425 | //__________________________________________________________________________ |
b45fd22b | 426 | Double_t AliMUONTrackParam::TotalMomentumEnergyLoss(Double_t thetaLimit, Double_t pTotal, Double_t theta) |
04b5ea16 | 427 | { |
428 | // Returns the total momentum corrected from energy loss in the front absorber | |
43af2cb6 | 429 | // One can use the macros MUONTestAbso.C and DrawTestAbso.C |
430 | // to test this correction. | |
b45fd22b | 431 | // Momentum energy loss behaviour evaluated with the simulation of single muons (april 2002) |
04b5ea16 | 432 | Double_t deltaP, pTotalCorrected; |
433 | ||
b45fd22b | 434 | // Parametrization to be redone according to change of absorber material ???? |
956019b6 | 435 | // See remark in function BransonCorrection !!!! |
04b5ea16 | 436 | // The name is not so good, and there are many arguments !!!! |
b45fd22b | 437 | if (theta < thetaLimit ) { |
438 | if (pTotal < 20) { | |
439 | deltaP = 2.5938 + 0.0570 * pTotal - 0.001151 * pTotal * pTotal; | |
04b5ea16 | 440 | } else { |
b45fd22b | 441 | deltaP = 3.0714 + 0.011767 *pTotal; |
04b5ea16 | 442 | } |
96a96c2b | 443 | deltaP *= 0.75; // AZ |
04b5ea16 | 444 | } else { |
b45fd22b | 445 | if (pTotal < 20) { |
446 | deltaP = 2.1207 + 0.05478 * pTotal - 0.00145079 * pTotal * pTotal; | |
04b5ea16 | 447 | } else { |
b45fd22b | 448 | deltaP = 2.6069 + 0.0051705 * pTotal; |
04b5ea16 | 449 | } |
96a96c2b | 450 | deltaP *= 0.9; // AZ |
04b5ea16 | 451 | } |
452 | pTotalCorrected = pTotal + deltaP / TMath::Cos(theta); | |
453 | return pTotalCorrected; | |
454 | } | |
455 | ||
b45fd22b | 456 | //__________________________________________________________________________ |
457 | void AliMUONTrackParam::FieldCorrection(Double_t Z) | |
458 | { | |
459 | // | |
460 | // Correction of the effect of the magnetic field in the absorber | |
461 | // Assume a constant field along Z axis. | |
462 | ||
463 | Float_t b[3],x[3]; | |
464 | Double_t bZ; | |
465 | Double_t pYZ,pX,pY,pZ,pT; | |
466 | Double_t pXNew,pYNew; | |
467 | Double_t c; | |
468 | ||
469 | pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
470 | c = TMath::Sign(1.0,fInverseBendingMomentum); // particle charge | |
471 | ||
b8dc484b | 472 | pZ = Pz(); |
473 | pX = Px(); | |
474 | pY = Py(); | |
b45fd22b | 475 | pT = TMath::Sqrt(pX*pX+pY*pY); |
476 | ||
5b64e914 | 477 | if (TMath::Abs(pZ) <= 0) return; |
b45fd22b | 478 | x[2] = Z/2; |
479 | x[0] = x[2]*fNonBendingSlope; | |
480 | x[1] = x[2]*fBendingSlope; | |
481 | ||
482 | // Take magn. field value at position x. | |
483 | gAlice->Field()->Field(x, b); | |
484 | bZ = b[2]; | |
485 | ||
486 | // Transverse momentum rotation | |
487 | // Parameterized with the study of DeltaPhi = phiReco - phiGen as a function of pZ. | |
5b64e914 | 488 | Double_t phiShift = c*0.436*0.0003*bZ*Z/pZ; |
b45fd22b | 489 | // Rotate momentum around Z axis. |
490 | pXNew = pX*TMath::Cos(phiShift) - pY*TMath::Sin(phiShift); | |
491 | pYNew = pX*TMath::Sin(phiShift) + pY*TMath::Cos(phiShift); | |
492 | ||
493 | fBendingSlope = pYNew / pZ; | |
494 | fNonBendingSlope = pXNew / pZ; | |
495 | ||
496 | fInverseBendingMomentum = c / TMath::Sqrt(pYNew*pYNew+pZ*pZ); | |
497 | ||
b8dc484b | 498 | } |
499 | //__________________________________________________________________________ | |
500 | Double_t AliMUONTrackParam::Px() | |
501 | { | |
502 | // return px from track paramaters | |
503 | Double_t pYZ, pZ, pX; | |
504 | pYZ = 0; | |
505 | if ( TMath::Abs(fInverseBendingMomentum) > 0 ) | |
506 | pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
507 | pZ = -pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope)); // spectro. (z<0) | |
508 | pX = pZ * fNonBendingSlope; | |
509 | return pX; | |
510 | } | |
511 | //__________________________________________________________________________ | |
512 | Double_t AliMUONTrackParam::Py() | |
513 | { | |
514 | // return px from track paramaters | |
515 | Double_t pYZ, pZ, pY; | |
516 | pYZ = 0; | |
517 | if ( TMath::Abs(fInverseBendingMomentum) > 0 ) | |
518 | pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
519 | pZ = -pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope)); // spectro. (z<0) | |
520 | pY = pZ * fBendingSlope; | |
521 | return pY; | |
522 | } | |
523 | //__________________________________________________________________________ | |
524 | Double_t AliMUONTrackParam::Pz() | |
525 | { | |
526 | // return px from track paramaters | |
527 | Double_t pYZ, pZ; | |
528 | pYZ = 0; | |
529 | if ( TMath::Abs(fInverseBendingMomentum) > 0 ) | |
530 | pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
531 | pZ = -pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope)); // spectro. (z<0) | |
532 | return pZ; | |
533 | } | |
534 | //__________________________________________________________________________ | |
535 | Double_t AliMUONTrackParam::P() | |
536 | { | |
537 | // return p from track paramaters | |
538 | Double_t pYZ, pZ, p; | |
539 | pYZ = 0; | |
540 | if ( TMath::Abs(fInverseBendingMomentum) > 0 ) | |
541 | pYZ = TMath::Abs(1.0 / fInverseBendingMomentum); | |
542 | pZ = -pYZ / (TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope)); // spectro. (z<0) | |
543 | p = TMath::Abs(pZ) * | |
544 | TMath::Sqrt(1.0 + fBendingSlope * fBendingSlope + fNonBendingSlope * fNonBendingSlope); | |
545 | return p; | |
546 | ||
b45fd22b | 547 | } |
4d03a78e | 548 | //__________________________________________________________________________ |
549 | void AliMUONTrackParam::ExtrapOneStepHelix(Double_t charge, Double_t step, | |
f161a467 | 550 | Double_t *vect, Double_t *vout) const |
4d03a78e | 551 | { |
552 | // ****************************************************************** | |
553 | // * * | |
554 | // * Performs the tracking of one step in a magnetic field * | |
555 | // * The trajectory is assumed to be a helix in a constant field * | |
556 | // * taken at the mid point of the step. * | |
557 | // * Parameters: * | |
558 | // * input * | |
559 | // * STEP =arc length of the step asked * | |
560 | // * VECT =input vector (position,direction cos and momentum) * | |
561 | // * CHARGE= electric charge of the particle * | |
562 | // * output * | |
563 | // * VOUT = same as VECT after completion of the step * | |
564 | // * * | |
565 | // * ==>Called by : <USER>, GUSWIM * | |
566 | // * Author m.hansroul ********* * | |
567 | // * modified s.egli, s.v.levonian * | |
568 | // * modified v.perevoztchikov | |
569 | // * * | |
570 | // ****************************************************************** | |
571 | // | |
572 | ||
573 | // modif: everything in double precision | |
574 | ||
575 | Double_t xyz[3], h[4], hxp[3]; | |
576 | Double_t h2xy, hp, rho, tet; | |
577 | Double_t sint, sintt, tsint, cos1t; | |
578 | Double_t f1, f2, f3, f4, f5, f6; | |
579 | ||
58443fe3 | 580 | const Int_t kix = 0; |
581 | const Int_t kiy = 1; | |
582 | const Int_t kiz = 2; | |
583 | const Int_t kipx = 3; | |
584 | const Int_t kipy = 4; | |
585 | const Int_t kipz = 5; | |
586 | const Int_t kipp = 6; | |
4d03a78e | 587 | |
58443fe3 | 588 | const Double_t kec = 2.9979251e-4; |
4d03a78e | 589 | // |
590 | // ------------------------------------------------------------------ | |
591 | // | |
592 | // units are kgauss,centimeters,gev/c | |
593 | // | |
58443fe3 | 594 | vout[kipp] = vect[kipp]; |
4d03a78e | 595 | if (TMath::Abs(charge) < 0.00001) { |
596 | for (Int_t i = 0; i < 3; i++) { | |
597 | vout[i] = vect[i] + step * vect[i+3]; | |
598 | vout[i+3] = vect[i+3]; | |
599 | } | |
600 | return; | |
601 | } | |
58443fe3 | 602 | xyz[0] = vect[kix] + 0.5 * step * vect[kipx]; |
603 | xyz[1] = vect[kiy] + 0.5 * step * vect[kipy]; | |
604 | xyz[2] = vect[kiz] + 0.5 * step * vect[kipz]; | |
4d03a78e | 605 | |
606 | //cmodif: call gufld (xyz, h) changed into: | |
607 | GetField (xyz, h); | |
608 | ||
609 | h2xy = h[0]*h[0] + h[1]*h[1]; | |
610 | h[3] = h[2]*h[2]+ h2xy; | |
611 | if (h[3] < 1.e-12) { | |
612 | for (Int_t i = 0; i < 3; i++) { | |
613 | vout[i] = vect[i] + step * vect[i+3]; | |
614 | vout[i+3] = vect[i+3]; | |
615 | } | |
616 | return; | |
617 | } | |
618 | if (h2xy < 1.e-12*h[3]) { | |
619 | ExtrapOneStepHelix3(charge*h[2], step, vect, vout); | |
620 | return; | |
621 | } | |
622 | h[3] = TMath::Sqrt(h[3]); | |
623 | h[0] /= h[3]; | |
624 | h[1] /= h[3]; | |
625 | h[2] /= h[3]; | |
58443fe3 | 626 | h[3] *= kec; |
4d03a78e | 627 | |
58443fe3 | 628 | hxp[0] = h[1]*vect[kipz] - h[2]*vect[kipy]; |
629 | hxp[1] = h[2]*vect[kipx] - h[0]*vect[kipz]; | |
630 | hxp[2] = h[0]*vect[kipy] - h[1]*vect[kipx]; | |
4d03a78e | 631 | |
58443fe3 | 632 | hp = h[0]*vect[kipx] + h[1]*vect[kipy] + h[2]*vect[kipz]; |
4d03a78e | 633 | |
58443fe3 | 634 | rho = -charge*h[3]/vect[kipp]; |
4d03a78e | 635 | tet = rho * step; |
636 | ||
637 | if (TMath::Abs(tet) > 0.15) { | |
638 | sint = TMath::Sin(tet); | |
639 | sintt = (sint/tet); | |
640 | tsint = (tet-sint)/tet; | |
641 | cos1t = 2.*(TMath::Sin(0.5*tet))*(TMath::Sin(0.5*tet))/tet; | |
642 | } else { | |
643 | tsint = tet*tet/36.; | |
644 | sintt = (1. - tsint); | |
645 | sint = tet*sintt; | |
646 | cos1t = 0.5*tet; | |
647 | } | |
648 | ||
649 | f1 = step * sintt; | |
650 | f2 = step * cos1t; | |
651 | f3 = step * tsint * hp; | |
652 | f4 = -tet*cos1t; | |
653 | f5 = sint; | |
654 | f6 = tet * cos1t * hp; | |
655 | ||
58443fe3 | 656 | vout[kix] = vect[kix] + f1*vect[kipx] + f2*hxp[0] + f3*h[0]; |
657 | vout[kiy] = vect[kiy] + f1*vect[kipy] + f2*hxp[1] + f3*h[1]; | |
658 | vout[kiz] = vect[kiz] + f1*vect[kipz] + f2*hxp[2] + f3*h[2]; | |
4d03a78e | 659 | |
58443fe3 | 660 | vout[kipx] = vect[kipx] + f4*vect[kipx] + f5*hxp[0] + f6*h[0]; |
661 | vout[kipy] = vect[kipy] + f4*vect[kipy] + f5*hxp[1] + f6*h[1]; | |
662 | vout[kipz] = vect[kipz] + f4*vect[kipz] + f5*hxp[2] + f6*h[2]; | |
4d03a78e | 663 | |
664 | return; | |
665 | } | |
666 | ||
667 | //__________________________________________________________________________ | |
668 | void AliMUONTrackParam::ExtrapOneStepHelix3(Double_t field, Double_t step, | |
f161a467 | 669 | Double_t *vect, Double_t *vout) const |
4d03a78e | 670 | { |
671 | // | |
672 | // ****************************************************************** | |
673 | // * * | |
674 | // * Tracking routine in a constant field oriented * | |
675 | // * along axis 3 * | |
676 | // * Tracking is performed with a conventional * | |
677 | // * helix step method * | |
678 | // * * | |
679 | // * ==>Called by : <USER>, GUSWIM * | |
680 | // * Authors R.Brun, M.Hansroul ********* * | |
681 | // * Rewritten V.Perevoztchikov | |
682 | // * * | |
683 | // ****************************************************************** | |
684 | // | |
685 | ||
686 | Double_t hxp[3]; | |
687 | Double_t h4, hp, rho, tet; | |
688 | Double_t sint, sintt, tsint, cos1t; | |
689 | Double_t f1, f2, f3, f4, f5, f6; | |
690 | ||
58443fe3 | 691 | const Int_t kix = 0; |
692 | const Int_t kiy = 1; | |
693 | const Int_t kiz = 2; | |
694 | const Int_t kipx = 3; | |
695 | const Int_t kipy = 4; | |
696 | const Int_t kipz = 5; | |
697 | const Int_t kipp = 6; | |
4d03a78e | 698 | |
58443fe3 | 699 | const Double_t kec = 2.9979251e-4; |
4d03a78e | 700 | |
701 | // | |
702 | // ------------------------------------------------------------------ | |
703 | // | |
704 | // units are kgauss,centimeters,gev/c | |
705 | // | |
58443fe3 | 706 | vout[kipp] = vect[kipp]; |
707 | h4 = field * kec; | |
4d03a78e | 708 | |
58443fe3 | 709 | hxp[0] = - vect[kipy]; |
710 | hxp[1] = + vect[kipx]; | |
4d03a78e | 711 | |
58443fe3 | 712 | hp = vect[kipz]; |
4d03a78e | 713 | |
58443fe3 | 714 | rho = -h4/vect[kipp]; |
4d03a78e | 715 | tet = rho * step; |
716 | if (TMath::Abs(tet) > 0.15) { | |
717 | sint = TMath::Sin(tet); | |
718 | sintt = (sint/tet); | |
719 | tsint = (tet-sint)/tet; | |
720 | cos1t = 2.* TMath::Sin(0.5*tet) * TMath::Sin(0.5*tet)/tet; | |
721 | } else { | |
722 | tsint = tet*tet/36.; | |
723 | sintt = (1. - tsint); | |
724 | sint = tet*sintt; | |
725 | cos1t = 0.5*tet; | |
726 | } | |
727 | ||
728 | f1 = step * sintt; | |
729 | f2 = step * cos1t; | |
730 | f3 = step * tsint * hp; | |
731 | f4 = -tet*cos1t; | |
732 | f5 = sint; | |
733 | f6 = tet * cos1t * hp; | |
734 | ||
58443fe3 | 735 | vout[kix] = vect[kix] + f1*vect[kipx] + f2*hxp[0]; |
736 | vout[kiy] = vect[kiy] + f1*vect[kipy] + f2*hxp[1]; | |
737 | vout[kiz] = vect[kiz] + f1*vect[kipz] + f3; | |
4d03a78e | 738 | |
58443fe3 | 739 | vout[kipx] = vect[kipx] + f4*vect[kipx] + f5*hxp[0]; |
740 | vout[kipy] = vect[kipy] + f4*vect[kipy] + f5*hxp[1]; | |
741 | vout[kipz] = vect[kipz] + f4*vect[kipz] + f6; | |
4d03a78e | 742 | |
743 | return; | |
744 | } | |
745 | //__________________________________________________________________________ | |
746 | void AliMUONTrackParam::ExtrapOneStepRungekutta(Double_t charge, Double_t step, | |
f161a467 | 747 | Double_t* vect, Double_t* vout) const |
4d03a78e | 748 | { |
749 | // | |
750 | // ****************************************************************** | |
751 | // * * | |
752 | // * Runge-Kutta method for tracking a particle through a magnetic * | |
753 | // * field. Uses Nystroem algorithm (See Handbook Nat. Bur. of * | |
754 | // * Standards, procedure 25.5.20) * | |
755 | // * * | |
756 | // * Input parameters * | |
757 | // * CHARGE Particle charge * | |
758 | // * STEP Step size * | |
759 | // * VECT Initial co-ords,direction cosines,momentum * | |
760 | // * Output parameters * | |
761 | // * VOUT Output co-ords,direction cosines,momentum * | |
762 | // * User routine called * | |
763 | // * CALL GUFLD(X,F) * | |
764 | // * * | |
765 | // * ==>Called by : <USER>, GUSWIM * | |
766 | // * Authors R.Brun, M.Hansroul ********* * | |
767 | // * V.Perevoztchikov (CUT STEP implementation) * | |
768 | // * * | |
769 | // * * | |
770 | // ****************************************************************** | |
771 | // | |
772 | ||
773 | Double_t h2, h4, f[4]; | |
774 | Double_t xyzt[3], a, b, c, ph,ph2; | |
775 | Double_t secxs[4],secys[4],seczs[4],hxp[3]; | |
776 | Double_t g1, g2, g3, g4, g5, g6, ang2, dxt, dyt, dzt; | |
777 | Double_t est, at, bt, ct, cba; | |
778 | Double_t f1, f2, f3, f4, rho, tet, hnorm, hp, rho1, sint, cost; | |
779 | ||
780 | Double_t x; | |
781 | Double_t y; | |
782 | Double_t z; | |
783 | ||
784 | Double_t xt; | |
785 | Double_t yt; | |
786 | Double_t zt; | |
787 | ||
788 | Double_t maxit = 1992; | |
789 | Double_t maxcut = 11; | |
790 | ||
58443fe3 | 791 | const Double_t kdlt = 1e-4; |
792 | const Double_t kdlt32 = kdlt/32.; | |
793 | const Double_t kthird = 1./3.; | |
794 | const Double_t khalf = 0.5; | |
795 | const Double_t kec = 2.9979251e-4; | |
796 | ||
797 | const Double_t kpisqua = 9.86960440109; | |
798 | const Int_t kix = 0; | |
799 | const Int_t kiy = 1; | |
800 | const Int_t kiz = 2; | |
801 | const Int_t kipx = 3; | |
802 | const Int_t kipy = 4; | |
803 | const Int_t kipz = 5; | |
4d03a78e | 804 | |
805 | // *. | |
806 | // *. ------------------------------------------------------------------ | |
807 | // *. | |
808 | // * this constant is for units cm,gev/c and kgauss | |
809 | // * | |
810 | Int_t iter = 0; | |
811 | Int_t ncut = 0; | |
812 | for(Int_t j = 0; j < 7; j++) | |
813 | vout[j] = vect[j]; | |
814 | ||
58443fe3 | 815 | Double_t pinv = kec * charge / vect[6]; |
4d03a78e | 816 | Double_t tl = 0.; |
817 | Double_t h = step; | |
818 | Double_t rest; | |
819 | ||
820 | ||
821 | do { | |
822 | rest = step - tl; | |
823 | if (TMath::Abs(h) > TMath::Abs(rest)) h = rest; | |
824 | //cmodif: call gufld(vout,f) changed into: | |
825 | ||
826 | GetField(vout,f); | |
827 | ||
828 | // * | |
829 | // * start of integration | |
830 | // * | |
831 | x = vout[0]; | |
832 | y = vout[1]; | |
833 | z = vout[2]; | |
834 | a = vout[3]; | |
835 | b = vout[4]; | |
836 | c = vout[5]; | |
837 | ||
58443fe3 | 838 | h2 = khalf * h; |
839 | h4 = khalf * h2; | |
4d03a78e | 840 | ph = pinv * h; |
58443fe3 | 841 | ph2 = khalf * ph; |
4d03a78e | 842 | secxs[0] = (b * f[2] - c * f[1]) * ph2; |
843 | secys[0] = (c * f[0] - a * f[2]) * ph2; | |
844 | seczs[0] = (a * f[1] - b * f[0]) * ph2; | |
845 | ang2 = (secxs[0]*secxs[0] + secys[0]*secys[0] + seczs[0]*seczs[0]); | |
58443fe3 | 846 | if (ang2 > kpisqua) break; |
4d03a78e | 847 | |
848 | dxt = h2 * a + h4 * secxs[0]; | |
849 | dyt = h2 * b + h4 * secys[0]; | |
850 | dzt = h2 * c + h4 * seczs[0]; | |
851 | xt = x + dxt; | |
852 | yt = y + dyt; | |
853 | zt = z + dzt; | |
854 | // * | |
855 | // * second intermediate point | |
856 | // * | |
857 | ||
858 | est = TMath::Abs(dxt) + TMath::Abs(dyt) + TMath::Abs(dzt); | |
859 | if (est > h) { | |
860 | if (ncut++ > maxcut) break; | |
58443fe3 | 861 | h *= khalf; |
4d03a78e | 862 | continue; |
863 | } | |
864 | ||
865 | xyzt[0] = xt; | |
866 | xyzt[1] = yt; | |
867 | xyzt[2] = zt; | |
868 | ||
869 | //cmodif: call gufld(xyzt,f) changed into: | |
870 | GetField(xyzt,f); | |
871 | ||
872 | at = a + secxs[0]; | |
873 | bt = b + secys[0]; | |
874 | ct = c + seczs[0]; | |
875 | ||
876 | secxs[1] = (bt * f[2] - ct * f[1]) * ph2; | |
877 | secys[1] = (ct * f[0] - at * f[2]) * ph2; | |
878 | seczs[1] = (at * f[1] - bt * f[0]) * ph2; | |
879 | at = a + secxs[1]; | |
880 | bt = b + secys[1]; | |
881 | ct = c + seczs[1]; | |
882 | secxs[2] = (bt * f[2] - ct * f[1]) * ph2; | |
883 | secys[2] = (ct * f[0] - at * f[2]) * ph2; | |
884 | seczs[2] = (at * f[1] - bt * f[0]) * ph2; | |
885 | dxt = h * (a + secxs[2]); | |
886 | dyt = h * (b + secys[2]); | |
887 | dzt = h * (c + seczs[2]); | |
888 | xt = x + dxt; | |
889 | yt = y + dyt; | |
890 | zt = z + dzt; | |
891 | at = a + 2.*secxs[2]; | |
892 | bt = b + 2.*secys[2]; | |
893 | ct = c + 2.*seczs[2]; | |
894 | ||
895 | est = TMath::Abs(dxt)+TMath::Abs(dyt)+TMath::Abs(dzt); | |
896 | if (est > 2.*TMath::Abs(h)) { | |
897 | if (ncut++ > maxcut) break; | |
58443fe3 | 898 | h *= khalf; |
4d03a78e | 899 | continue; |
900 | } | |
901 | ||
902 | xyzt[0] = xt; | |
903 | xyzt[1] = yt; | |
904 | xyzt[2] = zt; | |
905 | ||
906 | //cmodif: call gufld(xyzt,f) changed into: | |
907 | GetField(xyzt,f); | |
908 | ||
58443fe3 | 909 | z = z + (c + (seczs[0] + seczs[1] + seczs[2]) * kthird) * h; |
910 | y = y + (b + (secys[0] + secys[1] + secys[2]) * kthird) * h; | |
911 | x = x + (a + (secxs[0] + secxs[1] + secxs[2]) * kthird) * h; | |
4d03a78e | 912 | |
913 | secxs[3] = (bt*f[2] - ct*f[1])* ph2; | |
914 | secys[3] = (ct*f[0] - at*f[2])* ph2; | |
915 | seczs[3] = (at*f[1] - bt*f[0])* ph2; | |
58443fe3 | 916 | a = a+(secxs[0]+secxs[3]+2. * (secxs[1]+secxs[2])) * kthird; |
917 | b = b+(secys[0]+secys[3]+2. * (secys[1]+secys[2])) * kthird; | |
918 | c = c+(seczs[0]+seczs[3]+2. * (seczs[1]+seczs[2])) * kthird; | |
4d03a78e | 919 | |
920 | est = TMath::Abs(secxs[0]+secxs[3] - (secxs[1]+secxs[2])) | |
921 | + TMath::Abs(secys[0]+secys[3] - (secys[1]+secys[2])) | |
922 | + TMath::Abs(seczs[0]+seczs[3] - (seczs[1]+seczs[2])); | |
923 | ||
58443fe3 | 924 | if (est > kdlt && TMath::Abs(h) > 1.e-4) { |
4d03a78e | 925 | if (ncut++ > maxcut) break; |
58443fe3 | 926 | h *= khalf; |
4d03a78e | 927 | continue; |
928 | } | |
929 | ||
930 | ncut = 0; | |
931 | // * if too many iterations, go to helix | |
932 | if (iter++ > maxit) break; | |
933 | ||
934 | tl += h; | |
58443fe3 | 935 | if (est < kdlt32) |
4d03a78e | 936 | h *= 2.; |
937 | cba = 1./ TMath::Sqrt(a*a + b*b + c*c); | |
938 | vout[0] = x; | |
939 | vout[1] = y; | |
940 | vout[2] = z; | |
941 | vout[3] = cba*a; | |
942 | vout[4] = cba*b; | |
943 | vout[5] = cba*c; | |
944 | rest = step - tl; | |
945 | if (step < 0.) rest = -rest; | |
946 | if (rest < 1.e-5*TMath::Abs(step)) return; | |
947 | ||
948 | } while(1); | |
949 | ||
950 | // angle too big, use helix | |
951 | ||
952 | f1 = f[0]; | |
953 | f2 = f[1]; | |
954 | f3 = f[2]; | |
955 | f4 = TMath::Sqrt(f1*f1+f2*f2+f3*f3); | |
956 | rho = -f4*pinv; | |
957 | tet = rho * step; | |
958 | ||
959 | hnorm = 1./f4; | |
960 | f1 = f1*hnorm; | |
961 | f2 = f2*hnorm; | |
962 | f3 = f3*hnorm; | |
963 | ||
58443fe3 | 964 | hxp[0] = f2*vect[kipz] - f3*vect[kipy]; |
965 | hxp[1] = f3*vect[kipx] - f1*vect[kipz]; | |
966 | hxp[2] = f1*vect[kipy] - f2*vect[kipx]; | |
4d03a78e | 967 | |
58443fe3 | 968 | hp = f1*vect[kipx] + f2*vect[kipy] + f3*vect[kipz]; |
4d03a78e | 969 | |
970 | rho1 = 1./rho; | |
971 | sint = TMath::Sin(tet); | |
58443fe3 | 972 | cost = 2.*TMath::Sin(khalf*tet)*TMath::Sin(khalf*tet); |
4d03a78e | 973 | |
974 | g1 = sint*rho1; | |
975 | g2 = cost*rho1; | |
976 | g3 = (tet-sint) * hp*rho1; | |
977 | g4 = -cost; | |
978 | g5 = sint; | |
979 | g6 = cost * hp; | |
980 | ||
58443fe3 | 981 | vout[kix] = vect[kix] + g1*vect[kipx] + g2*hxp[0] + g3*f1; |
982 | vout[kiy] = vect[kiy] + g1*vect[kipy] + g2*hxp[1] + g3*f2; | |
983 | vout[kiz] = vect[kiz] + g1*vect[kipz] + g2*hxp[2] + g3*f3; | |
4d03a78e | 984 | |
58443fe3 | 985 | vout[kipx] = vect[kipx] + g4*vect[kipx] + g5*hxp[0] + g6*f1; |
986 | vout[kipy] = vect[kipy] + g4*vect[kipy] + g5*hxp[1] + g6*f2; | |
987 | vout[kipz] = vect[kipz] + g4*vect[kipz] + g5*hxp[2] + g6*f3; | |
4d03a78e | 988 | |
989 | return; | |
990 | } | |
991 | //___________________________________________________________ | |
f161a467 | 992 | void AliMUONTrackParam::GetField(Double_t *Position, Double_t *Field) const |
4d03a78e | 993 | { |
994 | // interface to "gAlice->Field()->Field" for arguments in double precision | |
995 | ||
996 | Float_t x[3], b[3]; | |
997 | ||
998 | x[0] = Position[0]; x[1] = Position[1]; x[2] = Position[2]; | |
999 | ||
1000 | gAlice->Field()->Field(x, b); | |
1001 | Field[0] = b[0]; Field[1] = b[1]; Field[2] = b[2]; | |
1002 | ||
1003 | return; | |
1004 | } |