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