]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTrackExtrap.cxx
Return value if the method is not void
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackExtrap.cxx
CommitLineData
c04e3238 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/* $Id$ */
17
56316147 18//-----------------------------------------------------------------------------
19// Class AliMUONTrackExtrap
20// ------------------------
21// Tools for track extrapolation in ALICE dimuon spectrometer
22// Author: Philippe Pillot
23//-----------------------------------------------------------------------------
c04e3238 24
c04e3238 25#include "AliMUONTrackExtrap.h"
26#include "AliMUONTrackParam.h"
27#include "AliMUONConstants.h"
8cde4af5 28
c04e3238 29#include "AliMagF.h"
8cde4af5 30
8cde4af5 31#include <TMath.h>
8cde4af5 32#include <TGeoManager.h>
c04e3238 33
ea94c18b 34#include <Riostream.h>
35
78649106 36/// \cond CLASSIMP
c04e3238 37ClassImp(AliMUONTrackExtrap) // Class implementation in ROOT context
78649106 38/// \endcond
c04e3238 39
40const AliMagF* AliMUONTrackExtrap::fgkField = 0x0;
4284483e 41const Bool_t AliMUONTrackExtrap::fgkUseHelix = kFALSE;
208f139e 42const Int_t AliMUONTrackExtrap::fgkMaxStepNumber = 5000;
4284483e 43const Double_t AliMUONTrackExtrap::fgkHelixStepLength = 6.;
44const Double_t AliMUONTrackExtrap::fgkRungeKuttaMaxResidue = 0.002;
208f139e 45
690d2205 46//__________________________________________________________________________
208f139e 47Double_t AliMUONTrackExtrap::GetImpactParamFromBendingMomentum(Double_t bendingMomentum)
48{
49 /// Returns impact parameter at vertex in bending plane (cm),
50 /// from the signed bending momentum "BendingMomentum" in bending plane (GeV/c),
51 /// using simple values for dipole magnetic field.
52 /// The sign of "BendingMomentum" is the sign of the charge.
53
54 if (bendingMomentum == 0.) return 1.e10;
55
56 Double_t simpleBPosition = 0.5 * (AliMUONConstants::CoilZ() + AliMUONConstants::YokeZ());
57 Double_t simpleBLength = 0.5 * (AliMUONConstants::CoilL() + AliMUONConstants::YokeL());
58 Float_t b[3], x[3] = {0.,0.,(Float_t) simpleBPosition};
59 if (fgkField) fgkField->Field(x,b);
60 else {
61 cout<<"F-AliMUONTrackExtrap::GetField: fgkField = 0x0"<<endl;
62 exit(-1);
63 }
64 Double_t simpleBValue = (Double_t) b[0];
65
66 return (-0.0003 * simpleBValue * simpleBLength * simpleBPosition / bendingMomentum);
67}
68
690d2205 69//__________________________________________________________________________
208f139e 70Double_t AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(Double_t impactParam)
71{
72 /// Returns signed bending momentum in bending plane (GeV/c),
73 /// the sign being the sign of the charge for particles moving forward in Z,
74 /// from the impact parameter "ImpactParam" at vertex in bending plane (cm),
75 /// using simple values for dipole magnetic field.
76
77 if (impactParam == 0.) return 1.e10;
78
79 Double_t simpleBPosition = 0.5 * (AliMUONConstants::CoilZ() + AliMUONConstants::YokeZ());
80 Double_t simpleBLength = 0.5 * (AliMUONConstants::CoilL() + AliMUONConstants::YokeL());
81 Float_t b[3], x[3] = {0.,0.,(Float_t) simpleBPosition};
82 if (fgkField) fgkField->Field(x,b);
83 else {
84 cout<<"F-AliMUONTrackExtrap::GetField: fgkField = 0x0"<<endl;
85 exit(-1);
86 }
87 Double_t simpleBValue = (Double_t) b[0];
88
89 return (-0.0003 * simpleBValue * simpleBLength * simpleBPosition / impactParam);
019df241 90}
91
690d2205 92//__________________________________________________________________________
019df241 93void AliMUONTrackExtrap::LinearExtrapToZ(AliMUONTrackParam* trackParam, Double_t zEnd)
94{
95 /// Track parameters (and their covariances if any) linearly extrapolated to the plane at "zEnd".
96 /// On return, results from the extrapolation are updated in trackParam.
97
98 if (trackParam->GetZ() == zEnd) return; // nothing to be done if same z
99
100 // Compute track parameters
101 Double_t dZ = zEnd - trackParam->GetZ();
102 trackParam->SetNonBendingCoor(trackParam->GetNonBendingCoor() + trackParam->GetNonBendingSlope() * dZ);
103 trackParam->SetBendingCoor(trackParam->GetBendingCoor() + trackParam->GetBendingSlope() * dZ);
104 trackParam->SetZ(zEnd);
105
106 // Update track parameters covariances if any
107 if (trackParam->CovariancesExist()) {
108 TMatrixD paramCov(trackParam->GetCovariances());
109 paramCov(0,0) += dZ * dZ * paramCov(1,1) + 2. * dZ * paramCov(0,1);
110 paramCov(0,1) += dZ * paramCov(1,1);
111 paramCov(1,0) = paramCov(0,1);
112 paramCov(2,2) += dZ * dZ * paramCov(3,3) + 2. * dZ * paramCov(2,3);
113 paramCov(2,3) += dZ * paramCov(3,3);
114 paramCov(3,2) = paramCov(2,3);
115 trackParam->SetCovariances(paramCov);
116 }
117
208f139e 118}
c04e3238 119
690d2205 120//__________________________________________________________________________
c04e3238 121void AliMUONTrackExtrap::ExtrapToZ(AliMUONTrackParam* trackParam, Double_t zEnd)
122{
4284483e 123 /// Interface to track parameter extrapolation to the plane at "Z" using Helix or Rungekutta algorithm.
124 /// On return, the track parameters resulting from the extrapolation are updated in trackParam.
125 if (fgkUseHelix) AliMUONTrackExtrap::ExtrapToZHelix(trackParam,zEnd);
126 else AliMUONTrackExtrap::ExtrapToZRungekutta(trackParam,zEnd);
127}
128
690d2205 129//__________________________________________________________________________
4284483e 130void AliMUONTrackExtrap::ExtrapToZHelix(AliMUONTrackParam* trackParam, Double_t zEnd)
131{
132 /// Track parameter extrapolation to the plane at "Z" using Helix algorithm.
c04e3238 133 /// On return, the track parameters resulting from the extrapolation are updated in trackParam.
134 if (trackParam->GetZ() == zEnd) return; // nothing to be done if same Z
135 Double_t forwardBackward; // +1 if forward, -1 if backward
136 if (zEnd < trackParam->GetZ()) forwardBackward = 1.0; // spectro. z<0
137 else forwardBackward = -1.0;
dade8580 138 Double_t v3[7], v3New[7]; // 7 in parameter ????
139 Int_t i3, stepNumber;
c04e3238 140 // For safety: return kTRUE or kFALSE ????
141 // Parameter vector for calling EXTRAP_ONESTEP
4284483e 142 ConvertTrackParamForExtrap(trackParam, forwardBackward, v3);
c04e3238 143 // sign of charge (sign of fInverseBendingMomentum if forward motion)
144 // must be changed if backward extrapolation
208f139e 145 Double_t chargeExtrap = forwardBackward * TMath::Sign(Double_t(1.0), trackParam->GetInverseBendingMomentum());
c04e3238 146 // Extrapolation loop
147 stepNumber = 0;
208f139e 148 while (((-forwardBackward * (v3[2] - zEnd)) <= 0.0) && (stepNumber < fgkMaxStepNumber)) { // spectro. z<0
c04e3238 149 stepNumber++;
4284483e 150 ExtrapOneStepHelix(chargeExtrap, fgkHelixStepLength, v3, v3New);
dade8580 151 if ((-forwardBackward * (v3New[2] - zEnd)) > 0.0) break; // one is beyond Z spectro. z<0
690d2205 152 // better use TArray ????
208f139e 153 for (i3 = 0; i3 < 7; i3++) {v3[i3] = v3New[i3];}
c04e3238 154 }
208f139e 155 // check fgkMaxStepNumber ????
c04e3238 156 // Interpolation back to exact Z (2nd order)
157 // should be in function ???? using TArray ????
dade8580 158 Double_t dZ12 = v3New[2] - v3[2]; // 1->2
c04e3238 159 if (TMath::Abs(dZ12) > 0) {
dade8580 160 Double_t dZ1i = zEnd - v3[2]; // 1-i
161 Double_t dZi2 = v3New[2] - zEnd; // i->2
162 Double_t xPrime = (v3New[0] - v3[0]) / dZ12;
163 Double_t xSecond = ((v3New[3] / v3New[5]) - (v3[3] / v3[5])) / dZ12;
164 Double_t yPrime = (v3New[1] - v3[1]) / dZ12;
165 Double_t ySecond = ((v3New[4] / v3New[5]) - (v3[4] / v3[5])) / dZ12;
166 v3[0] = v3[0] + xPrime * dZ1i - 0.5 * xSecond * dZ1i * dZi2; // X
167 v3[1] = v3[1] + yPrime * dZ1i - 0.5 * ySecond * dZ1i * dZi2; // Y
168 v3[2] = zEnd; // Z
c04e3238 169 Double_t xPrimeI = xPrime - 0.5 * xSecond * (dZi2 - dZ1i);
170 Double_t yPrimeI = yPrime - 0.5 * ySecond * (dZi2 - dZ1i);
171 // (PX, PY, PZ)/PTOT assuming forward motion
208f139e 172 v3[5] = 1.0 / TMath::Sqrt(1.0 + xPrimeI * xPrimeI + yPrimeI * yPrimeI); // PZ/PTOT
dade8580 173 v3[3] = xPrimeI * v3[5]; // PX/PTOT
174 v3[4] = yPrimeI * v3[5]; // PY/PTOT
c04e3238 175 } else {
4284483e 176 cout<<"W-AliMUONTrackExtrap::ExtrapToZHelix: Extrap. to Z not reached, Z = "<<zEnd<<endl;
c04e3238 177 }
4284483e 178 // Recover track parameters (charge back for forward motion)
dade8580 179 RecoverTrackParam(v3, chargeExtrap * forwardBackward, trackParam);
c04e3238 180}
181
690d2205 182//__________________________________________________________________________
4284483e 183void AliMUONTrackExtrap::ExtrapToZRungekutta(AliMUONTrackParam* trackParam, Double_t zEnd)
184{
185 /// Track parameter extrapolation to the plane at "Z" using Rungekutta algorithm.
186 /// On return, the track parameters resulting from the extrapolation are updated in trackParam.
187 if (trackParam->GetZ() == zEnd) return; // nothing to be done if same Z
188 Double_t forwardBackward; // +1 if forward, -1 if backward
189 if (zEnd < trackParam->GetZ()) forwardBackward = 1.0; // spectro. z<0
190 else forwardBackward = -1.0;
191 // sign of charge (sign of fInverseBendingMomentum if forward motion)
192 // must be changed if backward extrapolation
193 Double_t chargeExtrap = forwardBackward * TMath::Sign(Double_t(1.0), trackParam->GetInverseBendingMomentum());
194 Double_t v3[7], v3New[7];
195 Double_t dZ, step;
196 Int_t stepNumber = 0;
197
198 // Extrapolation loop (until within tolerance)
199 Double_t residue = zEnd - trackParam->GetZ();
200 while (TMath::Abs(residue) > fgkRungeKuttaMaxResidue && stepNumber <= fgkMaxStepNumber) {
201 dZ = zEnd - trackParam->GetZ();
202 // step lenght assuming linear trajectory
203 step = dZ * TMath::Sqrt(1.0 + trackParam->GetBendingSlope()*trackParam->GetBendingSlope() +
690d2205 204 trackParam->GetNonBendingSlope()*trackParam->GetNonBendingSlope());
4284483e 205 ConvertTrackParamForExtrap(trackParam, forwardBackward, v3);
206 do { // reduce step lenght while zEnd oversteped
207 if (stepNumber > fgkMaxStepNumber) {
208 cout<<"W-AliMUONTrackExtrap::ExtrapToZRungekutta: Too many trials: "<<stepNumber<<endl;
209 break;
210 }
211 stepNumber ++;
212 step = TMath::Abs(step);
213 AliMUONTrackExtrap::ExtrapOneStepRungekutta(chargeExtrap,step,v3,v3New);
214 residue = zEnd - v3New[2];
215 step *= dZ/(v3New[2]-trackParam->GetZ());
216 } while (residue*dZ < 0 && TMath::Abs(residue) > fgkRungeKuttaMaxResidue);
217 RecoverTrackParam(v3New, chargeExtrap * forwardBackward, trackParam);
218 }
219
220 // terminate the extropolation with a straight line up to the exact "zEnd" value
221 trackParam->SetNonBendingCoor(trackParam->GetNonBendingCoor() + residue * trackParam->GetNonBendingSlope());
222 trackParam->SetBendingCoor(trackParam->GetBendingCoor() + residue * trackParam->GetBendingSlope());
223 trackParam->SetZ(zEnd);
224}
225
690d2205 226//__________________________________________________________________________
4284483e 227void AliMUONTrackExtrap::ConvertTrackParamForExtrap(AliMUONTrackParam* trackParam, Double_t forwardBackward, Double_t *v3)
c04e3238 228{
dade8580 229 /// Set vector of Geant3 parameters pointed to by "v3" from track parameters in trackParam.
c04e3238 230 /// Since AliMUONTrackParam is only geometry, one uses "forwardBackward"
231 /// to know whether the particle is going forward (+1) or backward (-1).
dade8580 232 v3[0] = trackParam->GetNonBendingCoor(); // X
233 v3[1] = trackParam->GetBendingCoor(); // Y
234 v3[2] = trackParam->GetZ(); // Z
c04e3238 235 Double_t pYZ = TMath::Abs(1.0 / trackParam->GetInverseBendingMomentum());
236 Double_t pZ = pYZ / TMath::Sqrt(1.0 + trackParam->GetBendingSlope() * trackParam->GetBendingSlope());
dade8580 237 v3[6] = TMath::Sqrt(pYZ * pYZ + pZ * pZ * trackParam->GetNonBendingSlope() * trackParam->GetNonBendingSlope()); // PTOT
238 v3[5] = -forwardBackward * pZ / v3[6]; // PZ/PTOT spectro. z<0
239 v3[3] = trackParam->GetNonBendingSlope() * v3[5]; // PX/PTOT
240 v3[4] = trackParam->GetBendingSlope() * v3[5]; // PY/PTOT
c04e3238 241}
242
690d2205 243//__________________________________________________________________________
dade8580 244void AliMUONTrackExtrap::RecoverTrackParam(Double_t *v3, Double_t charge, AliMUONTrackParam* trackParam)
c04e3238 245{
dade8580 246 /// Set track parameters in trackParam from Geant3 parameters pointed to by "v3",
c04e3238 247 /// assumed to be calculated for forward motion in Z.
248 /// "InverseBendingMomentum" is signed with "charge".
dade8580 249 trackParam->SetNonBendingCoor(v3[0]); // X
250 trackParam->SetBendingCoor(v3[1]); // Y
251 trackParam->SetZ(v3[2]); // Z
252 Double_t pYZ = v3[6] * TMath::Sqrt(1.0 - v3[3] * v3[3]);
c04e3238 253 trackParam->SetInverseBendingMomentum(charge/pYZ);
dade8580 254 trackParam->SetBendingSlope(v3[4]/v3[5]);
255 trackParam->SetNonBendingSlope(v3[3]/v3[5]);
208f139e 256}
257
690d2205 258//__________________________________________________________________________
ea94c18b 259void AliMUONTrackExtrap::ExtrapToZCov(AliMUONTrackParam* trackParam, Double_t zEnd, Bool_t updatePropagator)
208f139e 260{
261 /// Track parameters and their covariances extrapolated to the plane at "zEnd".
262 /// On return, results from the extrapolation are updated in trackParam.
263
264 if (trackParam->GetZ() == zEnd) return; // nothing to be done if same z
265
ea94c18b 266 // No need to propagate the covariance matrix if it does not exist
267 if (!trackParam->CovariancesExist()) {
268 cout<<"W-AliMUONTrackExtrap::ExtrapToZCov: Covariance matrix does not exist"<<endl;
269 // Extrapolate track parameters to "zEnd"
270 ExtrapToZ(trackParam,zEnd);
271 return;
272 }
273
208f139e 274 // Save the actual track parameters
275 AliMUONTrackParam trackParamSave(*trackParam);
ea94c18b 276 TMatrixD paramSave(trackParamSave.GetParameters());
277 Double_t zBegin = trackParamSave.GetZ();
278
279 // Get reference to the parameter covariance matrix
280 const TMatrixD& kParamCov = trackParam->GetCovariances();
208f139e 281
282 // Extrapolate track parameters to "zEnd"
283 ExtrapToZ(trackParam,zEnd);
208f139e 284
ea94c18b 285 // Get reference to the extrapolated parameters
286 const TMatrixD& extrapParam = trackParam->GetParameters();
208f139e 287
288 // Calculate the jacobian related to the track parameters extrapolation to "zEnd"
289 TMatrixD jacob(5,5);
ea94c18b 290 jacob.Zero();
291 TMatrixD dParam(5,1);
208f139e 292 for (Int_t i=0; i<5; i++) {
293 // Skip jacobian calculation for parameters with no associated error
18abc511 294 if (kParamCov(i,i) <= 0.) continue;
ea94c18b 295
208f139e 296 // Small variation of parameter i only
297 for (Int_t j=0; j<5; j++) {
298 if (j==i) {
ea94c18b 299 dParam(j,0) = TMath::Sqrt(kParamCov(i,i));
300 if (j == 4) dParam(j,0) *= TMath::Sign(1.,-paramSave(4,0)); // variation always in the same direction
301 } else dParam(j,0) = 0.;
208f139e 302 }
ea94c18b 303
208f139e 304 // Set new parameters
ea94c18b 305 trackParamSave.SetParameters(paramSave);
306 trackParamSave.AddParameters(dParam);
307 trackParamSave.SetZ(zBegin);
308
208f139e 309 // Extrapolate new track parameters to "zEnd"
310 ExtrapToZ(&trackParamSave,zEnd);
ea94c18b 311
208f139e 312 // Calculate the jacobian
ea94c18b 313 TMatrixD jacobji(trackParamSave.GetParameters(),TMatrixD::kMinus,extrapParam);
314 jacobji *= 1. / dParam(i,0);
315 jacob.SetSub(0,i,jacobji);
208f139e 316 }
317
318 // Extrapolate track parameter covariances to "zEnd"
ea94c18b 319 TMatrixD tmp(kParamCov,TMatrixD::kMultTranspose,jacob);
320 TMatrixD tmp2(jacob,TMatrixD::kMult,tmp);
321 trackParam->SetCovariances(tmp2);
322
323 // Update the propagator if required
324 if (updatePropagator) trackParam->UpdatePropagator(jacob);
208f139e 325}
326
690d2205 327//__________________________________________________________________________
8cde4af5 328void AliMUONTrackExtrap::AddMCSEffectInAbsorber(AliMUONTrackParam* param, Double_t pathLength, Double_t f0, Double_t f1, Double_t f2)
329{
330 /// Add to the track parameter covariances the effects of multiple Coulomb scattering
690d2205 331 /// The absorber correction parameters are supposed to be calculated at the current track z-position
8cde4af5 332
333 // absorber related covariance parameters
334 Double_t bendingSlope = param->GetBendingSlope();
335 Double_t nonBendingSlope = param->GetNonBendingSlope();
336 Double_t inverseBendingMomentum = param->GetInverseBendingMomentum();
337 Double_t alpha2 = 0.0136 * 0.0136 * inverseBendingMomentum * inverseBendingMomentum * (1.0 + bendingSlope * bendingSlope) /
690d2205 338 (1.0 + bendingSlope *bendingSlope + nonBendingSlope * nonBendingSlope); // velocity = 1
8cde4af5 339 Double_t varCoor = alpha2 * (pathLength * pathLength * f0 - 2. * pathLength * f1 + f2);
340 Double_t covCorrSlope = alpha2 * (pathLength * f0 - f1);
341 Double_t varSlop = alpha2 * f0;
342
690d2205 343 // compute derivative d(q/Pxy) / dSlopeX and d(q/Pxy) / dSlopeX
344 Double_t dqPxydSlopeX = inverseBendingMomentum * nonBendingSlope / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
345 Double_t dqPxydSlopeY = - inverseBendingMomentum * nonBendingSlope*nonBendingSlope * bendingSlope /
346 (1. + bendingSlope*bendingSlope) / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
347
348 // Set MCS covariance matrix
ea94c18b 349 TMatrixD newParamCov(param->GetCovariances());
8cde4af5 350 // Non bending plane
ea94c18b 351 newParamCov(0,0) += varCoor; newParamCov(0,1) += covCorrSlope;
352 newParamCov(1,0) += covCorrSlope; newParamCov(1,1) += varSlop;
8cde4af5 353 // Bending plane
ea94c18b 354 newParamCov(2,2) += varCoor; newParamCov(2,3) += covCorrSlope;
355 newParamCov(3,2) += covCorrSlope; newParamCov(3,3) += varSlop;
690d2205 356 // Inverse bending momentum (due to dependences with bending and non bending slopes)
357 newParamCov(4,0) += dqPxydSlopeX * covCorrSlope; newParamCov(0,4) += dqPxydSlopeX * covCorrSlope;
358 newParamCov(4,1) += dqPxydSlopeX * varSlop; newParamCov(1,4) += dqPxydSlopeX * varSlop;
359 newParamCov(4,2) += dqPxydSlopeY * covCorrSlope; newParamCov(2,4) += dqPxydSlopeY * covCorrSlope;
360 newParamCov(4,3) += dqPxydSlopeY * varSlop; newParamCov(3,4) += dqPxydSlopeY * varSlop;
361 newParamCov(4,4) += (dqPxydSlopeX*dqPxydSlopeX + dqPxydSlopeY*dqPxydSlopeY) * varSlop;
ea94c18b 362
363 // Set new covariances
364 param->SetCovariances(newParamCov);
690d2205 365}
366
367//__________________________________________________________________________
368void AliMUONTrackExtrap::CorrectMCSEffectInAbsorber(AliMUONTrackParam* param,
369 Double_t xVtx, Double_t yVtx, Double_t zVtx,
370 Double_t errXVtx, Double_t errYVtx,
371 Double_t absZBeg, Double_t pathLength, Double_t f0, Double_t f1, Double_t f2)
372{
373 /// Correct parameters and corresponding covariances using Branson correction
374 /// - input param are parameters and covariances at the end of absorber
375 /// - output param are parameters and covariances at vertex
376 /// Absorber correction parameters are supposed to be calculated at the current track z-position
377
378 // Position of the Branson plane (spectro. (z<0))
379 Double_t zB = (f1>0.) ? absZBeg - f2/f1 : 0.;
380
381 // Add MCS effects to current parameter covariances
382 AddMCSEffectInAbsorber(param, pathLength, f0, f1, f2);
383
384 // Get track parameters and covariances in the Branson plane corrected for magnetic field effect
385 ExtrapToZCov(param,zVtx);
386 LinearExtrapToZ(param,zB);
387
388 // compute track parameters at vertex
389 TMatrixD newParam(5,1);
390 newParam(0,0) = xVtx;
391 newParam(1,0) = (param->GetNonBendingCoor() - xVtx) / (zB - zVtx);
392 newParam(2,0) = yVtx;
393 newParam(3,0) = (param->GetBendingCoor() - yVtx) / (zB - zVtx);
394 newParam(4,0) = param->GetCharge() / param->P() *
395 TMath::Sqrt(1.0 + newParam(1,0)*newParam(1,0) + newParam(3,0)*newParam(3,0)) /
396 TMath::Sqrt(1.0 + newParam(3,0)*newParam(3,0));
397
398 // Get covariances in (X, SlopeX, Y, SlopeY, q*PTot) coordinate system
399 TMatrixD paramCovP(param->GetCovariances());
400 Cov2CovP(param->GetParameters(),paramCovP);
401
402 // Get the covariance matrix in the (XVtx, X, YVtx, Y, q*PTot) coordinate system
403 TMatrixD paramCovVtx(5,5);
404 paramCovVtx.Zero();
405 paramCovVtx(0,0) = errXVtx * errXVtx;
406 paramCovVtx(1,1) = paramCovP(0,0);
407 paramCovVtx(2,2) = errYVtx * errYVtx;
408 paramCovVtx(3,3) = paramCovP(2,2);
409 paramCovVtx(4,4) = paramCovP(4,4);
410 paramCovVtx(1,3) = paramCovP(0,2);
411 paramCovVtx(3,1) = paramCovP(2,0);
412 paramCovVtx(1,4) = paramCovP(0,4);
413 paramCovVtx(4,1) = paramCovP(4,0);
414 paramCovVtx(3,4) = paramCovP(2,4);
415 paramCovVtx(4,3) = paramCovP(4,2);
416
417 // Jacobian of the transformation (XVtx, X, YVtx, Y, q*PTot) -> (XVtx, SlopeXVtx, YVtx, SlopeYVtx, q*PTotVtx)
418 TMatrixD jacob(5,5);
419 jacob.UnitMatrix();
420 jacob(1,0) = - 1. / (zB - zVtx);
421 jacob(1,1) = 1. / (zB - zVtx);
422 jacob(3,2) = - 1. / (zB - zVtx);
423 jacob(3,3) = 1. / (zB - zVtx);
8cde4af5 424
690d2205 425 // Compute covariances at vertex in the (XVtx, SlopeXVtx, YVtx, SlopeYVtx, q*PTotVtx) coordinate system
426 TMatrixD tmp(paramCovVtx,TMatrixD::kMultTranspose,jacob);
427 TMatrixD newParamCov(jacob,TMatrixD::kMult,tmp);
428
429 // Compute covariances at vertex in the (XVtx, SlopeXVtx, YVtx, SlopeYVtx, q/PyzVtx) coordinate system
430 CovP2Cov(newParam,newParamCov);
431
432 // Set parameters and covariances at vertex
433 param->SetParameters(newParam);
434 param->SetZ(zVtx);
435 param->SetCovariances(newParamCov);
8cde4af5 436}
437
690d2205 438//__________________________________________________________________________
439void AliMUONTrackExtrap::CorrectELossEffectInAbsorber(AliMUONTrackParam* param, Double_t eLoss, Double_t sigmaELoss2)
440{
441 /// Correct parameters for energy loss and add energy loss fluctuation effect to covariances
442
443 // Get parameter covariances in (X, SlopeX, Y, SlopeY, q*PTot) coordinate system
444 TMatrixD newParamCov(param->GetCovariances());
445 Cov2CovP(param->GetParameters(),newParamCov);
446
447 // Add effects of energy loss fluctuation to covariances
448 newParamCov(4,4) += sigmaELoss2;
449
450 // Compute new parameters corrected for energy loss
451 Double_t nonBendingSlope = param->GetNonBendingSlope();
452 Double_t bendingSlope = param->GetBendingSlope();
453 param->SetInverseBendingMomentum(param->GetCharge() / (param->P() + eLoss) *
454 TMath::Sqrt(1.0 + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope) /
455 TMath::Sqrt(1.0 + bendingSlope*bendingSlope));
456
457 // Get new parameter covariances in (X, SlopeX, Y, SlopeY, q/Pyz) coordinate system
458 CovP2Cov(param->GetParameters(),newParamCov);
459
460 // Set new parameter covariances
461 param->SetCovariances(newParamCov);
462}
463
464//__________________________________________________________________________
18abc511 465Bool_t AliMUONTrackExtrap::GetAbsorberCorrectionParam(Double_t trackXYZIn[3], Double_t trackXYZOut[3], Double_t pTotal,
466 Double_t &pathLength, Double_t &f0, Double_t &f1, Double_t &f2,
467 Double_t &meanRho, Double_t &totalELoss, Double_t &sigmaELoss2)
8cde4af5 468{
469 /// Parameters used to correct for Multiple Coulomb Scattering and energy loss in absorber
690d2205 470 /// Calculated assuming a linear propagation from trackXYZIn to trackXYZOut (order is important)
8cde4af5 471 // pathLength: path length between trackXYZIn and trackXYZOut (cm)
472 // f0: 0th moment of z calculated with the inverse radiation-length distribution
473 // f1: 1st moment of z calculated with the inverse radiation-length distribution
474 // f2: 2nd moment of z calculated with the inverse radiation-length distribution
475 // meanRho: average density of crossed material (g/cm3)
84f061ef 476 // totalELoss: total energy loss in absorber
8cde4af5 477
478 // Reset absorber's parameters
479 pathLength = 0.;
480 f0 = 0.;
481 f1 = 0.;
482 f2 = 0.;
483 meanRho = 0.;
84f061ef 484 totalELoss = 0.;
690d2205 485 sigmaELoss2 = 0.;
8cde4af5 486
487 // Check whether the geometry is available
488 if (!gGeoManager) {
489 cout<<"E-AliMUONTrackExtrap::GetAbsorberCorrectionParam: no TGeo"<<endl;
18abc511 490 return kFALSE;
8cde4af5 491 }
492
493 // Initialize starting point and direction
494 pathLength = TMath::Sqrt((trackXYZOut[0] - trackXYZIn[0])*(trackXYZOut[0] - trackXYZIn[0])+
495 (trackXYZOut[1] - trackXYZIn[1])*(trackXYZOut[1] - trackXYZIn[1])+
496 (trackXYZOut[2] - trackXYZIn[2])*(trackXYZOut[2] - trackXYZIn[2]));
18abc511 497 if (pathLength < TGeoShape::Tolerance()) return kFALSE;
8cde4af5 498 Double_t b[3];
499 b[0] = (trackXYZOut[0] - trackXYZIn[0]) / pathLength;
500 b[1] = (trackXYZOut[1] - trackXYZIn[1]) / pathLength;
501 b[2] = (trackXYZOut[2] - trackXYZIn[2]) / pathLength;
502 TGeoNode *currentnode = gGeoManager->InitTrack(trackXYZIn, b);
503 if (!currentnode) {
504 cout<<"E-AliMUONTrackExtrap::GetAbsorberCorrectionParam: start point out of geometry"<<endl;
18abc511 505 return kFALSE;
8cde4af5 506 }
507
508 // loop over absorber slices and calculate absorber's parameters
509 Double_t rho = 0.; // material density (g/cm3)
510 Double_t x0 = 0.; // radiation-length (cm-1)
84f061ef 511 Double_t atomicA = 0.; // A of material
512 Double_t atomicZ = 0.; // Z of material
8cde4af5 513 Double_t localPathLength = 0;
514 Double_t remainingPathLength = pathLength;
515 Double_t zB = trackXYZIn[2];
516 Double_t zE, dzB, dzE;
517 do {
518 // Get material properties
519 TGeoMaterial *material = currentnode->GetVolume()->GetMedium()->GetMaterial();
520 rho = material->GetDensity();
521 x0 = material->GetRadLen();
522 if (!material->IsMixture()) x0 /= rho; // different normalization in the modeler for mixture
84f061ef 523 atomicA = material->GetA();
524 atomicZ = material->GetZ();
8cde4af5 525
526 // Get path length within this material
527 gGeoManager->FindNextBoundary(remainingPathLength);
528 localPathLength = gGeoManager->GetStep() + 1.e-6;
529 // Check if boundary within remaining path length. If so, make sure to cross the boundary to prepare the next step
530 if (localPathLength >= remainingPathLength) localPathLength = remainingPathLength;
531 else {
532 currentnode = gGeoManager->Step();
533 if (!currentnode) {
534 cout<<"E-AliMUONTrackExtrap::GetAbsorberCorrectionParam: navigation failed"<<endl;
18abc511 535 f0 = f1 = f2 = meanRho = totalELoss = sigmaELoss2 = 0.;
536 return kFALSE;
8cde4af5 537 }
538 if (!gGeoManager->IsEntering()) {
539 // make another small step to try to enter in new absorber slice
540 gGeoManager->SetStep(0.001);
541 currentnode = gGeoManager->Step();
542 if (!gGeoManager->IsEntering() || !currentnode) {
543 cout<<"E-AliMUONTrackExtrap::GetAbsorberCorrectionParam: navigation failed"<<endl;
18abc511 544 f0 = f1 = f2 = meanRho = totalELoss = sigmaELoss2 = 0.;
545 return kFALSE;
8cde4af5 546 }
547 localPathLength += 0.001;
548 }
549 }
550
551 // calculate absorber's parameters
552 zE = b[2] * localPathLength + zB;
553 dzB = zB - trackXYZIn[2];
554 dzE = zE - trackXYZIn[2];
555 f0 += localPathLength / x0;
556 f1 += (dzE*dzE - dzB*dzB) / b[2] / b[2] / x0 / 2.;
557 f2 += (dzE*dzE*dzE - dzB*dzB*dzB) / b[2] / b[2] / b[2] / x0 / 3.;
558 meanRho += localPathLength * rho;
84f061ef 559 totalELoss += BetheBloch(pTotal, localPathLength, rho, atomicA, atomicZ);
690d2205 560 sigmaELoss2 += EnergyLossFluctuation2(pTotal, localPathLength, rho, atomicA, atomicZ);
8cde4af5 561
562 // prepare next step
563 zB = zE;
564 remainingPathLength -= localPathLength;
565 } while (remainingPathLength > TGeoShape::Tolerance());
566
567 meanRho /= pathLength;
18abc511 568
569 return kTRUE;
8cde4af5 570}
571
690d2205 572//__________________________________________________________________________
ea94c18b 573Double_t AliMUONTrackExtrap::GetMCSAngle2(const AliMUONTrackParam& param, Double_t dZ, Double_t x0)
574{
575 /// Return the angular dispersion square due to multiple Coulomb scattering
576 /// through a material of thickness "dZ" and of radiation length "x0"
577 /// assuming linear propagation and using the small angle approximation.
578
579 Double_t bendingSlope = param.GetBendingSlope();
580 Double_t nonBendingSlope = param.GetNonBendingSlope();
581 Double_t inverseTotalMomentum2 = param.GetInverseBendingMomentum() * param.GetInverseBendingMomentum() *
690d2205 582 (1.0 + bendingSlope * bendingSlope) /
583 (1.0 + bendingSlope *bendingSlope + nonBendingSlope * nonBendingSlope);
ea94c18b 584 // Path length in the material
585 Double_t pathLength = TMath::Abs(dZ) * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
586 // relativistic velocity
587 Double_t velo = 1.;
588 // Angular dispersion square of the track (variance) in a plane perpendicular to the trajectory
589 Double_t theta02 = 0.0136 / velo * (1 + 0.038 * TMath::Log(pathLength/x0));
590
591 return theta02 * theta02 * inverseTotalMomentum2 * pathLength / x0;
592}
593
690d2205 594//__________________________________________________________________________
8cde4af5 595void AliMUONTrackExtrap::AddMCSEffect(AliMUONTrackParam *param, Double_t dZ, Double_t x0)
208f139e 596{
597 /// Add to the track parameter covariances the effects of multiple Coulomb scattering
598 /// through a material of thickness "dZ" and of radiation length "x0"
599 /// assuming linear propagation and using the small angle approximation.
600
601 Double_t bendingSlope = param->GetBendingSlope();
602 Double_t nonBendingSlope = param->GetNonBendingSlope();
690d2205 603 Double_t inverseBendingMomentum = param->GetInverseBendingMomentum();
604 Double_t inverseTotalMomentum2 = inverseBendingMomentum * inverseBendingMomentum *
605 (1.0 + bendingSlope * bendingSlope) /
606 (1.0 + bendingSlope *bendingSlope + nonBendingSlope * nonBendingSlope);
208f139e 607 // Path length in the material
608 Double_t pathLength = TMath::Abs(dZ) * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
609 Double_t pathLength2 = pathLength * pathLength;
610 // relativistic velocity
611 Double_t velo = 1.;
612 // Angular dispersion square of the track (variance) in a plane perpendicular to the trajectory
613 Double_t theta02 = 0.0136 / velo * (1 + 0.038 * TMath::Log(pathLength/x0));
614 theta02 *= theta02 * inverseTotalMomentum2 * pathLength / x0;
615
208f139e 616 Double_t varCoor = pathLength2 * theta02 / 3.;
617 Double_t varSlop = theta02;
618 Double_t covCorrSlope = pathLength * theta02 / 2.;
ea94c18b 619
690d2205 620 // compute derivative d(q/Pxy) / dSlopeX and d(q/Pxy) / dSlopeX
621 Double_t dqPxydSlopeX = inverseBendingMomentum * nonBendingSlope / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
622 Double_t dqPxydSlopeY = - inverseBendingMomentum * nonBendingSlope*nonBendingSlope * bendingSlope /
623 (1. + bendingSlope*bendingSlope) / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
624
625 // Set MCS covariance matrix
ea94c18b 626 TMatrixD newParamCov(param->GetCovariances());
208f139e 627 // Non bending plane
ea94c18b 628 newParamCov(0,0) += varCoor; newParamCov(0,1) += covCorrSlope;
629 newParamCov(1,0) += covCorrSlope; newParamCov(1,1) += varSlop;
208f139e 630 // Bending plane
ea94c18b 631 newParamCov(2,2) += varCoor; newParamCov(2,3) += covCorrSlope;
632 newParamCov(3,2) += covCorrSlope; newParamCov(3,3) += varSlop;
690d2205 633 // Inverse bending momentum (due to dependences with bending and non bending slopes)
634 newParamCov(4,0) += dqPxydSlopeX * covCorrSlope; newParamCov(0,4) += dqPxydSlopeX * covCorrSlope;
635 newParamCov(4,1) += dqPxydSlopeX * varSlop; newParamCov(1,4) += dqPxydSlopeX * varSlop;
636 newParamCov(4,2) += dqPxydSlopeY * covCorrSlope; newParamCov(2,4) += dqPxydSlopeY * covCorrSlope;
637 newParamCov(4,3) += dqPxydSlopeY * varSlop; newParamCov(3,4) += dqPxydSlopeY * varSlop;
638 newParamCov(4,4) += (dqPxydSlopeX*dqPxydSlopeX + dqPxydSlopeY*dqPxydSlopeY) * varSlop;
208f139e 639
ea94c18b 640 // Set new covariances
641 param->SetCovariances(newParamCov);
c04e3238 642}
643
690d2205 644//__________________________________________________________________________
645void AliMUONTrackExtrap::ExtrapToVertex(AliMUONTrackParam* trackParam,
646 Double_t xVtx, Double_t yVtx, Double_t zVtx,
647 Double_t errXVtx, Double_t errYVtx,
648 Bool_t correctForMCS, Bool_t correctForEnergyLoss)
c04e3238 649{
690d2205 650 /// Main method for extrapolation to the vertex:
651 /// Returns the track parameters and covariances resulting from the extrapolation of the current trackParam
652 /// Changes parameters and covariances according to multiple scattering and energy loss corrections:
653 /// if correctForMCS=kTRUE: compute parameters using Branson correction and add correction resolution to covariances
654 /// if correctForMCS=kFALSE: add parameter dispersion due to MCS in parameter covariances
655 /// if correctForEnergyLoss=kTRUE: correct parameters for energy loss and add energy loss fluctuation to covariances
656 /// if correctForEnergyLoss=kFALSE: do nothing about energy loss
c04e3238 657
8cde4af5 658 if (trackParam->GetZ() == zVtx) return; // nothing to be done if already at vertex
c04e3238 659
8cde4af5 660 if (trackParam->GetZ() > zVtx) { // spectro. (z<0)
690d2205 661 cout<<"E-AliMUONTrackExtrap::ExtrapToVertex: Starting Z ("<<trackParam->GetZ()
662 <<") upstream the vertex (zVtx = "<<zVtx<<")"<<endl;
fac70e25 663 return;
664 }
665
8cde4af5 666 // Check the vertex position relatively to the absorber
ea94c18b 667 if (zVtx < AliMUONConstants::AbsZBeg() && zVtx > AliMUONConstants::AbsZEnd()) { // spectro. (z<0)
8cde4af5 668 cout<<"W-AliMUONTrackExtrap::ExtrapToVertex: Ending Z ("<<zVtx
690d2205 669 <<") inside the front absorber ("<<AliMUONConstants::AbsZBeg()<<","<<AliMUONConstants::AbsZEnd()<<")"<<endl;
ea94c18b 670 } else if (zVtx < AliMUONConstants::AbsZEnd() ) { // spectro. (z<0)
8cde4af5 671 cout<<"W-AliMUONTrackExtrap::ExtrapToVertex: Ending Z ("<<zVtx
690d2205 672 <<") downstream the front absorber (zAbsorberEnd = "<<AliMUONConstants::AbsZEnd()<<")"<<endl;
673 if (trackParam->CovariancesExist()) ExtrapToZCov(trackParam,zVtx);
674 else ExtrapToZ(trackParam,zVtx);
8cde4af5 675 return;
676 }
677
678 // Check the track position relatively to the absorber and extrapolate track parameters to the end of the absorber if needed
ea94c18b 679 if (trackParam->GetZ() > AliMUONConstants::AbsZBeg()) { // spectro. (z<0)
8cde4af5 680 cout<<"W-AliMUONTrackExtrap::ExtrapToVertex: Starting Z ("<<trackParam->GetZ()
690d2205 681 <<") upstream the front absorber (zAbsorberBegin = "<<AliMUONConstants::AbsZBeg()<<")"<<endl;
682 if (trackParam->CovariancesExist()) ExtrapToZCov(trackParam,zVtx);
683 else ExtrapToZ(trackParam,zVtx);
8cde4af5 684 return;
ea94c18b 685 } else if (trackParam->GetZ() > AliMUONConstants::AbsZEnd()) { // spectro. (z<0)
8cde4af5 686 cout<<"W-AliMUONTrackExtrap::ExtrapToVertex: Starting Z ("<<trackParam->GetZ()
690d2205 687 <<") inside the front absorber ("<<AliMUONConstants::AbsZBeg()<<","<<AliMUONConstants::AbsZEnd()<<")"<<endl;
c04e3238 688 } else {
690d2205 689 if (trackParam->CovariancesExist()) ExtrapToZCov(trackParam,AliMUONConstants::AbsZEnd());
690 else ExtrapToZ(trackParam,AliMUONConstants::AbsZEnd());
c04e3238 691 }
c04e3238 692
690d2205 693 // Get absorber correction parameters assuming linear propagation in absorber
8cde4af5 694 Double_t trackXYZOut[3];
695 trackXYZOut[0] = trackParam->GetNonBendingCoor();
696 trackXYZOut[1] = trackParam->GetBendingCoor();
697 trackXYZOut[2] = trackParam->GetZ();
698 Double_t trackXYZIn[3];
690d2205 699 if (correctForMCS) { // assume linear propagation until the vertex
700 trackXYZIn[2] = TMath::Min(zVtx, AliMUONConstants::AbsZBeg()); // spectro. (z<0)
701 trackXYZIn[0] = trackXYZOut[0] + (xVtx - trackXYZOut[0]) / (zVtx - trackXYZOut[2]) * (trackXYZIn[2] - trackXYZOut[2]);
702 trackXYZIn[1] = trackXYZOut[1] + (yVtx - trackXYZOut[1]) / (zVtx - trackXYZOut[2]) * (trackXYZIn[2] - trackXYZOut[2]);
703 } else {
704 AliMUONTrackParam trackParamIn(*trackParam);
705 ExtrapToZ(&trackParamIn, TMath::Min(zVtx, AliMUONConstants::AbsZBeg()));
706 trackXYZIn[0] = trackParamIn.GetNonBendingCoor();
707 trackXYZIn[1] = trackParamIn.GetBendingCoor();
708 trackXYZIn[2] = trackParamIn.GetZ();
709 }
84f061ef 710 Double_t pTot = trackParam->P();
18abc511 711 Double_t pathLength, f0, f1, f2, meanRho, deltaP, sigmaDeltaP2;
712 if (!GetAbsorberCorrectionParam(trackXYZIn,trackXYZOut,pTot,pathLength,f0,f1,f2,meanRho,deltaP,sigmaDeltaP2)) {
713 cout<<"E-AliMUONTrackExtrap::ExtrapToVertex: Unable to take into account the absorber effects"<<endl;
714 if (trackParam->CovariancesExist()) ExtrapToZCov(trackParam,zVtx);
715 else ExtrapToZ(trackParam,zVtx);
716 return;
717 }
8cde4af5 718
690d2205 719 // Compute track parameters and covariances at vertex according to correctForMCS and correctForEnergyLoss flags
720 if (correctForMCS) {
fac70e25 721
690d2205 722 if (correctForEnergyLoss) {
723
724 // Correct for multiple scattering and energy loss
725 CorrectELossEffectInAbsorber(trackParam, 0.5*deltaP, 0.5*sigmaDeltaP2);
726 CorrectMCSEffectInAbsorber(trackParam, xVtx, yVtx, zVtx, errXVtx, errYVtx,
727 trackXYZIn[2], pathLength, f0, f1, f2);
728 CorrectELossEffectInAbsorber(trackParam, 0.5*deltaP, 0.5*sigmaDeltaP2);
729
730 } else {
731
732 // Correct for multiple scattering
733 CorrectMCSEffectInAbsorber(trackParam, xVtx, yVtx, zVtx, errXVtx, errYVtx,
734 trackXYZIn[2], pathLength, f0, f1, f2);
735 }
fac70e25 736
fac70e25 737 } else {
690d2205 738
739 if (correctForEnergyLoss) {
740
18abc511 741 // Correct for energy loss add multiple scattering dispersion in covariance matrix
690d2205 742 CorrectELossEffectInAbsorber(trackParam, 0.5*deltaP, 0.5*sigmaDeltaP2);
743 AddMCSEffectInAbsorber(trackParam, pathLength, f0, f1, f2);
744 ExtrapToZCov(trackParam, trackXYZIn[2]);
745 CorrectELossEffectInAbsorber(trackParam, 0.5*deltaP, 0.5*sigmaDeltaP2);
746 ExtrapToZCov(trackParam, zVtx);
747
748 } else {
749
18abc511 750 // add multiple scattering dispersion in covariance matrix
690d2205 751 AddMCSEffectInAbsorber(trackParam, pathLength, f0, f1, f2);
752 ExtrapToZCov(trackParam, zVtx);
753
754 }
755
fac70e25 756 }
8cde4af5 757
fac70e25 758}
759
690d2205 760//__________________________________________________________________________
761void AliMUONTrackExtrap::ExtrapToVertex(AliMUONTrackParam* trackParam,
762 Double_t xVtx, Double_t yVtx, Double_t zVtx,
763 Double_t errXVtx, Double_t errYVtx)
764{
765 /// Extrapolate track parameters to vertex, corrected for multiple scattering and energy loss effects
766 /// Add branson correction resolution and energy loss fluctuation to parameter covariances
767 ExtrapToVertex(trackParam, xVtx, yVtx, zVtx, errXVtx, errYVtx, kTRUE, kTRUE);
768}
769
770//__________________________________________________________________________
771void AliMUONTrackExtrap::ExtrapToVertexWithoutELoss(AliMUONTrackParam* trackParam,
772 Double_t xVtx, Double_t yVtx, Double_t zVtx,
773 Double_t errXVtx, Double_t errYVtx)
774{
775 /// Extrapolate track parameters to vertex, corrected for multiple scattering effects only
776 /// Add branson correction resolution to parameter covariances
777 ExtrapToVertex(trackParam, xVtx, yVtx, zVtx, errXVtx, errYVtx, kTRUE, kFALSE);
778}
779
780//__________________________________________________________________________
781void AliMUONTrackExtrap::ExtrapToVertexWithoutBranson(AliMUONTrackParam* trackParam, Double_t zVtx)
782{
783 /// Extrapolate track parameters to vertex, corrected for energy loss effects only
784 /// Add dispersion due to multiple scattering and energy loss fluctuation to parameter covariances
785 ExtrapToVertex(trackParam, 0., 0., zVtx, 0., 0., kFALSE, kTRUE);
786}
787
788//__________________________________________________________________________
789void AliMUONTrackExtrap::ExtrapToVertexUncorrected(AliMUONTrackParam* trackParam, Double_t zVtx)
790{
791 /// Extrapolate track parameters to vertex without multiple scattering and energy loss corrections
792 /// Add dispersion due to multiple scattering to parameter covariances
793 ExtrapToVertex(trackParam, 0., 0., zVtx, 0., 0., kFALSE, kFALSE);
794}
795
796//__________________________________________________________________________
fac70e25 797Double_t AliMUONTrackExtrap::TotalMomentumEnergyLoss(AliMUONTrackParam* trackParam, Double_t xVtx, Double_t yVtx, Double_t zVtx)
798{
799 /// Calculate the total momentum energy loss in-between the track position and the vertex assuming a linear propagation
800
801 if (trackParam->GetZ() == zVtx) return 0.; // nothing to be done if already at vertex
8cde4af5 802
fac70e25 803 // Check whether the geometry is available
804 if (!gGeoManager) {
805 cout<<"E-AliMUONTrackExtrap::TotalMomentumEnergyLoss: no TGeo"<<endl;
806 return 0.;
807 }
808
809 // Get encountered material correction parameters assuming linear propagation from vertex to the track position
810 Double_t trackXYZOut[3];
811 trackXYZOut[0] = trackParam->GetNonBendingCoor();
812 trackXYZOut[1] = trackParam->GetBendingCoor();
813 trackXYZOut[2] = trackParam->GetZ();
814 Double_t trackXYZIn[3];
815 trackXYZIn[0] = xVtx;
816 trackXYZIn[1] = yVtx;
817 trackXYZIn[2] = zVtx;
84f061ef 818 Double_t pTot = trackParam->P();
18abc511 819 Double_t pathLength, f0, f1, f2, meanRho, totalELoss, sigmaELoss2;
690d2205 820 GetAbsorberCorrectionParam(trackXYZIn,trackXYZOut,pTot,pathLength,f0,f1,f2,meanRho,totalELoss,sigmaELoss2);
fac70e25 821
84f061ef 822 return totalELoss;
c04e3238 823}
824
690d2205 825//__________________________________________________________________________
84f061ef 826Double_t AliMUONTrackExtrap::BetheBloch(Double_t pTotal, Double_t pathLength, Double_t rho, Double_t atomicA, Double_t atomicZ)
c04e3238 827{
84f061ef 828 /// Returns the mean total momentum energy loss of muon with total momentum='pTotal'
829 /// in the absorber layer of lenght='pathLength', density='rho', A='atomicA' and Z='atomicZ'
830 Double_t muMass = 0.105658369; // GeV
831 Double_t eMass = 0.510998918e-3; // GeV
832 Double_t k = 0.307075e-3; // GeV.g^-1.cm^2
833 Double_t i = 9.5e-9; // mean exitation energy per atomic Z (GeV)
8cde4af5 834 Double_t p2=pTotal*pTotal;
835 Double_t beta2=p2/(p2 + muMass*muMass);
8cde4af5 836
84f061ef 837 Double_t w = k * rho * pathLength * atomicZ / atomicA / beta2;
838
8cde4af5 839 if (beta2/(1-beta2)>3.5*3.5)
690d2205 840 return w * (log(2.*eMass*3.5/(i*atomicZ)) + 0.5*log(beta2/(1-beta2)) - beta2);
841
84f061ef 842 return w * (log(2.*eMass*beta2/(1-beta2)/(i*atomicZ)) - beta2);
c04e3238 843}
844
690d2205 845//__________________________________________________________________________
846Double_t AliMUONTrackExtrap::EnergyLossFluctuation2(Double_t pTotal, Double_t pathLength, Double_t rho, Double_t atomicA, Double_t atomicZ)
847{
848 /// Returns the total momentum energy loss fluctuation of muon with total momentum='pTotal'
849 /// in the absorber layer of lenght='pathLength', density='rho', A='atomicA' and Z='atomicZ'
850 Double_t muMass = 0.105658369; // GeV
851 //Double_t eMass = 0.510998918e-3; // GeV
852 Double_t k = 0.307075e-3; // GeV.g^-1.cm^2
853 Double_t p2=pTotal*pTotal;
854 Double_t beta2=p2/(p2 + muMass*muMass);
855
856 Double_t fwhm = 2. * k * rho * pathLength * atomicZ / atomicA / beta2; // FWHM of the energy loss Landau distribution
857 Double_t sigma2 = fwhm * fwhm / (8.*log(2.)); // gaussian: fwmh = 2 * srqt(2*ln(2)) * sigma (i.e. fwmh = 2.35 * sigma)
858
859 //sigma2 = k * rho * pathLength * atomicZ / atomicA * eMass; // sigma2 of the energy loss gaussian distribution
860
861 return sigma2;
862}
863
864//__________________________________________________________________________
865void AliMUONTrackExtrap::Cov2CovP(const TMatrixD &param, TMatrixD &cov)
866{
867 /// change coordinate system: (X, SlopeX, Y, SlopeY, q/Pyz) -> (X, SlopeX, Y, SlopeY, q*PTot)
868 /// parameters (param) are given in the (X, SlopeX, Y, SlopeY, q/Pyz) coordinate system
869
870 // charge * total momentum
871 Double_t qPTot = TMath::Sqrt(1. + param(1,0)*param(1,0) + param(3,0)*param(3,0)) /
872 TMath::Sqrt(1. + param(3,0)*param(3,0)) / param(4,0);
873
874 // Jacobian of the opposite transformation
875 TMatrixD jacob(5,5);
876 jacob.UnitMatrix();
877 jacob(4,1) = qPTot * param(1,0) / (1. + param(1,0)*param(1,0) + param(3,0)*param(3,0));
878 jacob(4,3) = - qPTot * param(1,0) * param(1,0) * param(3,0) /
879 (1. + param(3,0)*param(3,0)) / (1. + param(1,0)*param(1,0) + param(3,0)*param(3,0));
880 jacob(4,4) = - qPTot / param(4,0);
881
882 // compute covariances in new coordinate system
883 TMatrixD tmp(cov,TMatrixD::kMultTranspose,jacob);
884 cov.Mult(jacob,tmp);
885}
886
887//__________________________________________________________________________
888void AliMUONTrackExtrap::CovP2Cov(const TMatrixD &param, TMatrixD &covP)
889{
890 /// change coordinate system: (X, SlopeX, Y, SlopeY, q*PTot) -> (X, SlopeX, Y, SlopeY, q/Pyz)
891 /// parameters (param) are given in the (X, SlopeX, Y, SlopeY, q/Pyz) coordinate system
892
893 // charge * total momentum
894 Double_t qPTot = TMath::Sqrt(1. + param(1,0)*param(1,0) + param(3,0)*param(3,0)) /
895 TMath::Sqrt(1. + param(3,0)*param(3,0)) / param(4,0);
896
897 // Jacobian of the transformation
898 TMatrixD jacob(5,5);
899 jacob.UnitMatrix();
900 jacob(4,1) = param(4,0) * param(1,0) / (1. + param(1,0)*param(1,0) + param(3,0)*param(3,0));
901 jacob(4,3) = - param(4,0) * param(1,0) * param(1,0) * param(3,0) /
902 (1. + param(3,0)*param(3,0)) / (1. + param(1,0)*param(1,0) + param(3,0)*param(3,0));
903 jacob(4,4) = - param(4,0) / qPTot;
904
905 // compute covariances in new coordinate system
906 TMatrixD tmp(covP,TMatrixD::kMultTranspose,jacob);
907 covP.Mult(jacob,tmp);
908}
909
c04e3238 910 //__________________________________________________________________________
911void AliMUONTrackExtrap::ExtrapOneStepHelix(Double_t charge, Double_t step, Double_t *vect, Double_t *vout)
912{
71a2d3aa 913/// <pre>
c04e3238 914/// ******************************************************************
915/// * *
916/// * Performs the tracking of one step in a magnetic field *
917/// * The trajectory is assumed to be a helix in a constant field *
918/// * taken at the mid point of the step. *
919/// * Parameters: *
920/// * input *
921/// * STEP =arc length of the step asked *
922/// * VECT =input vector (position,direction cos and momentum) *
923/// * CHARGE= electric charge of the particle *
924/// * output *
925/// * VOUT = same as VECT after completion of the step *
926/// * *
2060b217 927/// * ==>Called by : USER, GUSWIM *
c04e3238 928/// * Author m.hansroul ********* *
929/// * modified s.egli, s.v.levonian *
930/// * modified v.perevoztchikov
931/// * *
932/// ******************************************************************
71a2d3aa 933/// </pre>
c04e3238 934
935// modif: everything in double precision
936
937 Double_t xyz[3], h[4], hxp[3];
938 Double_t h2xy, hp, rho, tet;
939 Double_t sint, sintt, tsint, cos1t;
940 Double_t f1, f2, f3, f4, f5, f6;
941
942 const Int_t kix = 0;
943 const Int_t kiy = 1;
944 const Int_t kiz = 2;
945 const Int_t kipx = 3;
946 const Int_t kipy = 4;
947 const Int_t kipz = 5;
948 const Int_t kipp = 6;
949
950 const Double_t kec = 2.9979251e-4;
951 //
952 // ------------------------------------------------------------------
953 //
954 // units are kgauss,centimeters,gev/c
955 //
956 vout[kipp] = vect[kipp];
957 if (TMath::Abs(charge) < 0.00001) {
958 for (Int_t i = 0; i < 3; i++) {
959 vout[i] = vect[i] + step * vect[i+3];
960 vout[i+3] = vect[i+3];
961 }
962 return;
963 }
964 xyz[0] = vect[kix] + 0.5 * step * vect[kipx];
965 xyz[1] = vect[kiy] + 0.5 * step * vect[kipy];
966 xyz[2] = vect[kiz] + 0.5 * step * vect[kipz];
967
968 //cmodif: call gufld (xyz, h) changed into:
969 GetField (xyz, h);
970
971 h2xy = h[0]*h[0] + h[1]*h[1];
972 h[3] = h[2]*h[2]+ h2xy;
973 if (h[3] < 1.e-12) {
974 for (Int_t i = 0; i < 3; i++) {
975 vout[i] = vect[i] + step * vect[i+3];
976 vout[i+3] = vect[i+3];
977 }
978 return;
979 }
980 if (h2xy < 1.e-12*h[3]) {
981 ExtrapOneStepHelix3(charge*h[2], step, vect, vout);
982 return;
983 }
984 h[3] = TMath::Sqrt(h[3]);
985 h[0] /= h[3];
986 h[1] /= h[3];
987 h[2] /= h[3];
988 h[3] *= kec;
989
990 hxp[0] = h[1]*vect[kipz] - h[2]*vect[kipy];
991 hxp[1] = h[2]*vect[kipx] - h[0]*vect[kipz];
992 hxp[2] = h[0]*vect[kipy] - h[1]*vect[kipx];
993
994 hp = h[0]*vect[kipx] + h[1]*vect[kipy] + h[2]*vect[kipz];
995
996 rho = -charge*h[3]/vect[kipp];
997 tet = rho * step;
998
999 if (TMath::Abs(tet) > 0.15) {
1000 sint = TMath::Sin(tet);
1001 sintt = (sint/tet);
1002 tsint = (tet-sint)/tet;
1003 cos1t = 2.*(TMath::Sin(0.5*tet))*(TMath::Sin(0.5*tet))/tet;
1004 } else {
1005 tsint = tet*tet/36.;
1006 sintt = (1. - tsint);
1007 sint = tet*sintt;
1008 cos1t = 0.5*tet;
1009 }
1010
1011 f1 = step * sintt;
1012 f2 = step * cos1t;
1013 f3 = step * tsint * hp;
1014 f4 = -tet*cos1t;
1015 f5 = sint;
1016 f6 = tet * cos1t * hp;
1017
1018 vout[kix] = vect[kix] + f1*vect[kipx] + f2*hxp[0] + f3*h[0];
1019 vout[kiy] = vect[kiy] + f1*vect[kipy] + f2*hxp[1] + f3*h[1];
1020 vout[kiz] = vect[kiz] + f1*vect[kipz] + f2*hxp[2] + f3*h[2];
1021
1022 vout[kipx] = vect[kipx] + f4*vect[kipx] + f5*hxp[0] + f6*h[0];
1023 vout[kipy] = vect[kipy] + f4*vect[kipy] + f5*hxp[1] + f6*h[1];
1024 vout[kipz] = vect[kipz] + f4*vect[kipz] + f5*hxp[2] + f6*h[2];
1025
1026 return;
1027}
1028
1029 //__________________________________________________________________________
1030void AliMUONTrackExtrap::ExtrapOneStepHelix3(Double_t field, Double_t step, Double_t *vect, Double_t *vout)
1031{
71a2d3aa 1032/// <pre>
c04e3238 1033/// ******************************************************************
1034/// * *
1035/// * Tracking routine in a constant field oriented *
1036/// * along axis 3 *
1037/// * Tracking is performed with a conventional *
1038/// * helix step method *
1039/// * *
2060b217 1040/// * ==>Called by : USER, GUSWIM *
c04e3238 1041/// * Authors R.Brun, M.Hansroul ********* *
1042/// * Rewritten V.Perevoztchikov
1043/// * *
1044/// ******************************************************************
71a2d3aa 1045/// </pre>
c04e3238 1046
1047 Double_t hxp[3];
1048 Double_t h4, hp, rho, tet;
1049 Double_t sint, sintt, tsint, cos1t;
1050 Double_t f1, f2, f3, f4, f5, f6;
1051
1052 const Int_t kix = 0;
1053 const Int_t kiy = 1;
1054 const Int_t kiz = 2;
1055 const Int_t kipx = 3;
1056 const Int_t kipy = 4;
1057 const Int_t kipz = 5;
1058 const Int_t kipp = 6;
1059
1060 const Double_t kec = 2.9979251e-4;
1061
1062//
1063// ------------------------------------------------------------------
1064//
1065// units are kgauss,centimeters,gev/c
1066//
1067 vout[kipp] = vect[kipp];
1068 h4 = field * kec;
1069
1070 hxp[0] = - vect[kipy];
1071 hxp[1] = + vect[kipx];
1072
1073 hp = vect[kipz];
1074
1075 rho = -h4/vect[kipp];
1076 tet = rho * step;
1077 if (TMath::Abs(tet) > 0.15) {
1078 sint = TMath::Sin(tet);
1079 sintt = (sint/tet);
1080 tsint = (tet-sint)/tet;
1081 cos1t = 2.* TMath::Sin(0.5*tet) * TMath::Sin(0.5*tet)/tet;
1082 } else {
1083 tsint = tet*tet/36.;
1084 sintt = (1. - tsint);
1085 sint = tet*sintt;
1086 cos1t = 0.5*tet;
1087 }
1088
1089 f1 = step * sintt;
1090 f2 = step * cos1t;
1091 f3 = step * tsint * hp;
1092 f4 = -tet*cos1t;
1093 f5 = sint;
1094 f6 = tet * cos1t * hp;
1095
1096 vout[kix] = vect[kix] + f1*vect[kipx] + f2*hxp[0];
1097 vout[kiy] = vect[kiy] + f1*vect[kipy] + f2*hxp[1];
1098 vout[kiz] = vect[kiz] + f1*vect[kipz] + f3;
1099
1100 vout[kipx] = vect[kipx] + f4*vect[kipx] + f5*hxp[0];
1101 vout[kipy] = vect[kipy] + f4*vect[kipy] + f5*hxp[1];
1102 vout[kipz] = vect[kipz] + f4*vect[kipz] + f6;
1103
1104 return;
1105}
8cde4af5 1106
c04e3238 1107 //__________________________________________________________________________
1108void AliMUONTrackExtrap::ExtrapOneStepRungekutta(Double_t charge, Double_t step, Double_t* vect, Double_t* vout)
1109{
71a2d3aa 1110/// <pre>
c04e3238 1111/// ******************************************************************
1112/// * *
1113/// * Runge-Kutta method for tracking a particle through a magnetic *
1114/// * field. Uses Nystroem algorithm (See Handbook Nat. Bur. of *
1115/// * Standards, procedure 25.5.20) *
1116/// * *
1117/// * Input parameters *
1118/// * CHARGE Particle charge *
1119/// * STEP Step size *
1120/// * VECT Initial co-ords,direction cosines,momentum *
1121/// * Output parameters *
1122/// * VOUT Output co-ords,direction cosines,momentum *
1123/// * User routine called *
1124/// * CALL GUFLD(X,F) *
1125/// * *
2060b217 1126/// * ==>Called by : USER, GUSWIM *
c04e3238 1127/// * Authors R.Brun, M.Hansroul ********* *
1128/// * V.Perevoztchikov (CUT STEP implementation) *
1129/// * *
1130/// * *
1131/// ******************************************************************
71a2d3aa 1132/// </pre>
c04e3238 1133
1134 Double_t h2, h4, f[4];
1135 Double_t xyzt[3], a, b, c, ph,ph2;
1136 Double_t secxs[4],secys[4],seczs[4],hxp[3];
1137 Double_t g1, g2, g3, g4, g5, g6, ang2, dxt, dyt, dzt;
1138 Double_t est, at, bt, ct, cba;
1139 Double_t f1, f2, f3, f4, rho, tet, hnorm, hp, rho1, sint, cost;
1140
1141 Double_t x;
1142 Double_t y;
1143 Double_t z;
1144
1145 Double_t xt;
1146 Double_t yt;
1147 Double_t zt;
1148
1149 Double_t maxit = 1992;
1150 Double_t maxcut = 11;
1151
1152 const Double_t kdlt = 1e-4;
1153 const Double_t kdlt32 = kdlt/32.;
1154 const Double_t kthird = 1./3.;
1155 const Double_t khalf = 0.5;
1156 const Double_t kec = 2.9979251e-4;
1157
1158 const Double_t kpisqua = 9.86960440109;
1159 const Int_t kix = 0;
1160 const Int_t kiy = 1;
1161 const Int_t kiz = 2;
1162 const Int_t kipx = 3;
1163 const Int_t kipy = 4;
1164 const Int_t kipz = 5;
1165
1166 // *.
1167 // *. ------------------------------------------------------------------
1168 // *.
1169 // * this constant is for units cm,gev/c and kgauss
1170 // *
1171 Int_t iter = 0;
1172 Int_t ncut = 0;
1173 for(Int_t j = 0; j < 7; j++)
1174 vout[j] = vect[j];
1175
1176 Double_t pinv = kec * charge / vect[6];
1177 Double_t tl = 0.;
1178 Double_t h = step;
1179 Double_t rest;
1180
1181
1182 do {
1183 rest = step - tl;
1184 if (TMath::Abs(h) > TMath::Abs(rest)) h = rest;
1185 //cmodif: call gufld(vout,f) changed into:
1186
1187 GetField(vout,f);
1188
1189 // *
1190 // * start of integration
1191 // *
1192 x = vout[0];
1193 y = vout[1];
1194 z = vout[2];
1195 a = vout[3];
1196 b = vout[4];
1197 c = vout[5];
1198
1199 h2 = khalf * h;
1200 h4 = khalf * h2;
1201 ph = pinv * h;
1202 ph2 = khalf * ph;
1203 secxs[0] = (b * f[2] - c * f[1]) * ph2;
1204 secys[0] = (c * f[0] - a * f[2]) * ph2;
1205 seczs[0] = (a * f[1] - b * f[0]) * ph2;
1206 ang2 = (secxs[0]*secxs[0] + secys[0]*secys[0] + seczs[0]*seczs[0]);
1207 if (ang2 > kpisqua) break;
1208
1209 dxt = h2 * a + h4 * secxs[0];
1210 dyt = h2 * b + h4 * secys[0];
1211 dzt = h2 * c + h4 * seczs[0];
1212 xt = x + dxt;
1213 yt = y + dyt;
1214 zt = z + dzt;
1215 // *
1216 // * second intermediate point
1217 // *
1218
1219 est = TMath::Abs(dxt) + TMath::Abs(dyt) + TMath::Abs(dzt);
1220 if (est > h) {
1221 if (ncut++ > maxcut) break;
1222 h *= khalf;
1223 continue;
1224 }
1225
1226 xyzt[0] = xt;
1227 xyzt[1] = yt;
1228 xyzt[2] = zt;
1229
1230 //cmodif: call gufld(xyzt,f) changed into:
1231 GetField(xyzt,f);
1232
1233 at = a + secxs[0];
1234 bt = b + secys[0];
1235 ct = c + seczs[0];
1236
1237 secxs[1] = (bt * f[2] - ct * f[1]) * ph2;
1238 secys[1] = (ct * f[0] - at * f[2]) * ph2;
1239 seczs[1] = (at * f[1] - bt * f[0]) * ph2;
1240 at = a + secxs[1];
1241 bt = b + secys[1];
1242 ct = c + seczs[1];
1243 secxs[2] = (bt * f[2] - ct * f[1]) * ph2;
1244 secys[2] = (ct * f[0] - at * f[2]) * ph2;
1245 seczs[2] = (at * f[1] - bt * f[0]) * ph2;
1246 dxt = h * (a + secxs[2]);
1247 dyt = h * (b + secys[2]);
1248 dzt = h * (c + seczs[2]);
1249 xt = x + dxt;
1250 yt = y + dyt;
1251 zt = z + dzt;
1252 at = a + 2.*secxs[2];
1253 bt = b + 2.*secys[2];
1254 ct = c + 2.*seczs[2];
1255
1256 est = TMath::Abs(dxt)+TMath::Abs(dyt)+TMath::Abs(dzt);
1257 if (est > 2.*TMath::Abs(h)) {
1258 if (ncut++ > maxcut) break;
1259 h *= khalf;
1260 continue;
1261 }
1262
1263 xyzt[0] = xt;
1264 xyzt[1] = yt;
1265 xyzt[2] = zt;
1266
1267 //cmodif: call gufld(xyzt,f) changed into:
1268 GetField(xyzt,f);
1269
1270 z = z + (c + (seczs[0] + seczs[1] + seczs[2]) * kthird) * h;
1271 y = y + (b + (secys[0] + secys[1] + secys[2]) * kthird) * h;
1272 x = x + (a + (secxs[0] + secxs[1] + secxs[2]) * kthird) * h;
1273
1274 secxs[3] = (bt*f[2] - ct*f[1])* ph2;
1275 secys[3] = (ct*f[0] - at*f[2])* ph2;
1276 seczs[3] = (at*f[1] - bt*f[0])* ph2;
1277 a = a+(secxs[0]+secxs[3]+2. * (secxs[1]+secxs[2])) * kthird;
1278 b = b+(secys[0]+secys[3]+2. * (secys[1]+secys[2])) * kthird;
1279 c = c+(seczs[0]+seczs[3]+2. * (seczs[1]+seczs[2])) * kthird;
1280
1281 est = TMath::Abs(secxs[0]+secxs[3] - (secxs[1]+secxs[2]))
1282 + TMath::Abs(secys[0]+secys[3] - (secys[1]+secys[2]))
1283 + TMath::Abs(seczs[0]+seczs[3] - (seczs[1]+seczs[2]));
1284
1285 if (est > kdlt && TMath::Abs(h) > 1.e-4) {
1286 if (ncut++ > maxcut) break;
1287 h *= khalf;
1288 continue;
1289 }
1290
1291 ncut = 0;
1292 // * if too many iterations, go to helix
1293 if (iter++ > maxit) break;
1294
1295 tl += h;
1296 if (est < kdlt32)
1297 h *= 2.;
1298 cba = 1./ TMath::Sqrt(a*a + b*b + c*c);
1299 vout[0] = x;
1300 vout[1] = y;
1301 vout[2] = z;
1302 vout[3] = cba*a;
1303 vout[4] = cba*b;
1304 vout[5] = cba*c;
1305 rest = step - tl;
1306 if (step < 0.) rest = -rest;
1307 if (rest < 1.e-5*TMath::Abs(step)) return;
1308
1309 } while(1);
1310
1311 // angle too big, use helix
1312
1313 f1 = f[0];
1314 f2 = f[1];
1315 f3 = f[2];
1316 f4 = TMath::Sqrt(f1*f1+f2*f2+f3*f3);
1317 rho = -f4*pinv;
1318 tet = rho * step;
1319
1320 hnorm = 1./f4;
1321 f1 = f1*hnorm;
1322 f2 = f2*hnorm;
1323 f3 = f3*hnorm;
1324
1325 hxp[0] = f2*vect[kipz] - f3*vect[kipy];
1326 hxp[1] = f3*vect[kipx] - f1*vect[kipz];
1327 hxp[2] = f1*vect[kipy] - f2*vect[kipx];
1328
1329 hp = f1*vect[kipx] + f2*vect[kipy] + f3*vect[kipz];
1330
1331 rho1 = 1./rho;
1332 sint = TMath::Sin(tet);
1333 cost = 2.*TMath::Sin(khalf*tet)*TMath::Sin(khalf*tet);
1334
1335 g1 = sint*rho1;
1336 g2 = cost*rho1;
1337 g3 = (tet-sint) * hp*rho1;
1338 g4 = -cost;
1339 g5 = sint;
1340 g6 = cost * hp;
1341
1342 vout[kix] = vect[kix] + g1*vect[kipx] + g2*hxp[0] + g3*f1;
1343 vout[kiy] = vect[kiy] + g1*vect[kipy] + g2*hxp[1] + g3*f2;
1344 vout[kiz] = vect[kiz] + g1*vect[kipz] + g2*hxp[2] + g3*f3;
1345
1346 vout[kipx] = vect[kipx] + g4*vect[kipx] + g5*hxp[0] + g6*f1;
1347 vout[kipy] = vect[kipy] + g4*vect[kipy] + g5*hxp[1] + g6*f2;
1348 vout[kipz] = vect[kipz] + g4*vect[kipz] + g5*hxp[2] + g6*f3;
1349
1350 return;
1351}
8cde4af5 1352
c04e3238 1353//___________________________________________________________
690d2205 1354void AliMUONTrackExtrap::GetField(Double_t *Position, Double_t *Field)
c04e3238 1355{
1356 /// interface for arguments in double precision (Why ? ChF)
1357 Float_t x[3], b[3];
690d2205 1358
c04e3238 1359 x[0] = Position[0]; x[1] = Position[1]; x[2] = Position[2];
690d2205 1360
c04e3238 1361 if (fgkField) fgkField->Field(x,b);
1362 else {
1363 cout<<"F-AliMUONTrackExtrap::GetField: fgkField = 0x0"<<endl;
1364 exit(-1);
1365 }
1366
1367 Field[0] = b[0]; Field[1] = b[1]; Field[2] = b[2];
690d2205 1368
c04e3238 1369 return;
1370}