#include "AliMUONTrackParam.h"
#include "AliMUONConstants.h"
#include "AliMUONReconstructor.h"
-#include "AliMUONRecoParam.h"
-#include "AliMagF.h"
+#include "AliMagF.h"
+#include "AliExternalTrackParam.h"
-#include <TMath.h>
+#include <TGeoGlobalMagField.h>
#include <TGeoManager.h>
+#include <TMath.h>
+#include <TDatabasePDG.h>
#include <Riostream.h>
ClassImp(AliMUONTrackExtrap) // Class implementation in ROOT context
/// \endcond
-const AliMagF* AliMUONTrackExtrap::fgkField = 0x0;
const Double_t AliMUONTrackExtrap::fgkSimpleBPosition = 0.5 * (AliMUONConstants::CoilZ() + AliMUONConstants::YokeZ());
const Double_t AliMUONTrackExtrap::fgkSimpleBLength = 0.5 * (AliMUONConstants::CoilL() + AliMUONConstants::YokeL());
Double_t AliMUONTrackExtrap::fgSimpleBValue = 0.;
const Double_t AliMUONTrackExtrap::fgkRungeKuttaMaxResidue = 0.002;
//__________________________________________________________________________
-void AliMUONTrackExtrap::SetField(const AliMagF* magField)
+void AliMUONTrackExtrap::SetField()
{
- /// set magnetic field
-
- // set field map
- fgkField = magField;
- if (!fgkField) {
- cout<<"E-AliMUONTrackExtrap::SetField: fgkField = 0x0"<<endl;
- return;
- }
-
- // set field on/off flag
- fgFieldON = (fgkField->Factor() == 0.) ? kFALSE : kTRUE;
-
- // set field at the centre of the dipole
- if (fgFieldON) {
- Float_t b[3] = {0.,0.,0.}, x[3] = {50.,50.,(Float_t) fgkSimpleBPosition};
- fgkField->Field(x,b);
- fgSimpleBValue = (Double_t) b[0];
- } else fgSimpleBValue = 0.;
+ /// set field on/off flag;
+ /// set field at the centre of the dipole
+ const Double_t x[3] = {50.,50.,fgkSimpleBPosition};
+ Double_t b[3] = {0.,0.,0.};
+ TGeoGlobalMagField::Instance()->Field(x,b);
+ fgSimpleBValue = b[0];
+ fgFieldON = fgSimpleBValue ? kTRUE : kFALSE;
}
if (bendingMomentum == 0.) return 1.e10;
- if (!fgkField) {
- cout<<"F-AliMUONTrackExtrap::GetField: fgkField = 0x0"<<endl;
- exit(-1);
- }
-
- const Double_t kCorrectionFactor = 0.9; // impact parameter is 10% overestimated
+ const Double_t kCorrectionFactor = 1.1; // impact parameter is 10% underestimated
return kCorrectionFactor * (-0.0003 * fgSimpleBValue * fgkSimpleBLength * fgkSimpleBPosition / bendingMomentum);
}
//__________________________________________________________________________
-Double_t AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(Double_t impactParam)
+Double_t
+AliMUONTrackExtrap::GetBendingMomentumFromImpactParam(Double_t impactParam)
{
/// Returns signed bending momentum in bending plane (GeV/c),
/// the sign being the sign of the charge for particles moving forward in Z,
if (impactParam == 0.) return 1.e10;
- if (!fgkField) {
- cout<<"F-AliMUONTrackExtrap::GetField: fgkField = 0x0"<<endl;
- exit(-1);
- }
-
const Double_t kCorrectionFactor = 1.1; // bending momentum is 10% underestimated
- if (fgFieldON) return kCorrectionFactor * (-0.0003 * fgSimpleBValue * fgkSimpleBLength * fgkSimpleBPosition / impactParam);
- else return AliMUONReconstructor::GetRecoParam()->GetMostProbBendingMomentum();
+ if (fgFieldON)
+ {
+ return kCorrectionFactor * (-0.0003 * fgSimpleBValue * fgkSimpleBLength * fgkSimpleBPosition / impactParam);
+ }
+ else
+ {
+ return AliMUONConstants::GetMostProbBendingMomentum();
+ }
}
//__________________________________________________________________________
-void AliMUONTrackExtrap::LinearExtrapToZ(AliMUONTrackParam* trackParam, Double_t zEnd, Bool_t updatePropagator)
+void AliMUONTrackExtrap::LinearExtrapToZ(AliMUONTrackParam* trackParam, Double_t zEnd)
{
- /// Track parameters (and their covariances if any) linearly extrapolated to the plane at "zEnd".
+ /// Track parameters linearly extrapolated to the plane at "zEnd".
/// On return, results from the extrapolation are updated in trackParam.
if (trackParam->GetZ() == zEnd) return; // nothing to be done if same z
trackParam->SetNonBendingCoor(trackParam->GetNonBendingCoor() + trackParam->GetNonBendingSlope() * dZ);
trackParam->SetBendingCoor(trackParam->GetBendingCoor() + trackParam->GetBendingSlope() * dZ);
trackParam->SetZ(zEnd);
+}
+
+//__________________________________________________________________________
+void AliMUONTrackExtrap::LinearExtrapToZCov(AliMUONTrackParam* trackParam, Double_t zEnd, Bool_t updatePropagator)
+{
+ /// Track parameters and their covariances linearly extrapolated to the plane at "zEnd".
+ /// On return, results from the extrapolation are updated in trackParam.
- // Update track parameters covariances if any
- if (trackParam->CovariancesExist()) {
- TMatrixD paramCov(trackParam->GetCovariances());
- paramCov(0,0) += dZ * dZ * paramCov(1,1) + 2. * dZ * paramCov(0,1);
- paramCov(0,1) += dZ * paramCov(1,1);
- paramCov(1,0) = paramCov(0,1);
- paramCov(2,2) += dZ * dZ * paramCov(3,3) + 2. * dZ * paramCov(2,3);
- paramCov(2,3) += dZ * paramCov(3,3);
- paramCov(3,2) = paramCov(2,3);
- trackParam->SetCovariances(paramCov);
-
- // Update the propagator if required
- if (updatePropagator) {
- TMatrixD jacob(5,5);
- jacob.UnitMatrix();
- jacob(0,1) = dZ;
- jacob(2,3) = dZ;
- trackParam->UpdatePropagator(jacob);
- }
-
+ if (trackParam->GetZ() == zEnd) return; // nothing to be done if same z
+
+ // No need to propagate the covariance matrix if it does not exist
+ if (!trackParam->CovariancesExist()) {
+ cout<<"W-AliMUONTrackExtrap::LinearExtrapToZCov: Covariance matrix does not exist"<<endl;
+ // Extrapolate linearly track parameters to "zEnd"
+ LinearExtrapToZ(trackParam,zEnd);
+ return;
}
+ // Compute track parameters
+ Double_t dZ = zEnd - trackParam->GetZ();
+ trackParam->SetNonBendingCoor(trackParam->GetNonBendingCoor() + trackParam->GetNonBendingSlope() * dZ);
+ trackParam->SetBendingCoor(trackParam->GetBendingCoor() + trackParam->GetBendingSlope() * dZ);
+ trackParam->SetZ(zEnd);
+
+ // Calculate the jacobian related to the track parameters linear extrapolation to "zEnd"
+ TMatrixD jacob(5,5);
+ jacob.UnitMatrix();
+ jacob(0,1) = dZ;
+ jacob(2,3) = dZ;
+
+ // Extrapolate track parameter covariances to "zEnd"
+ TMatrixD tmp(trackParam->GetCovariances(),TMatrixD::kMultTranspose,jacob);
+ TMatrixD tmp2(jacob,TMatrixD::kMult,tmp);
+ trackParam->SetCovariances(tmp2);
+
+ // Update the propagator if required
+ if (updatePropagator) trackParam->UpdatePropagator(jacob);
}
//__________________________________________________________________________
trackParam->SetNonBendingCoor(v3[0]); // X
trackParam->SetBendingCoor(v3[1]); // Y
trackParam->SetZ(v3[2]); // Z
- Double_t pYZ = v3[6] * TMath::Sqrt(1.0 - v3[3] * v3[3]);
+ Double_t pYZ = v3[6] * TMath::Sqrt((1.-v3[3])*(1.+v3[3]));
trackParam->SetInverseBendingMomentum(charge/pYZ);
trackParam->SetBendingSlope(v3[4]/v3[5]);
trackParam->SetNonBendingSlope(v3[3]/v3[5]);
if (trackParam->GetZ() == zEnd) return; // nothing to be done if same z
if (!fgFieldON) { // linear extrapolation if no magnetic field
- AliMUONTrackExtrap::LinearExtrapToZ(trackParam,zEnd,updatePropagator);
+ AliMUONTrackExtrap::LinearExtrapToZCov(trackParam,zEnd,updatePropagator);
return;
}
TMatrixD jacob(5,5);
jacob.Zero();
TMatrixD dParam(5,1);
+ Double_t direction[5] = {-1.,-1.,1.,1.,-1.};
for (Int_t i=0; i<5; i++) {
// Skip jacobian calculation for parameters with no associated error
if (kParamCov(i,i) <= 0.) continue;
for (Int_t j=0; j<5; j++) {
if (j==i) {
dParam(j,0) = TMath::Sqrt(kParamCov(i,i));
- if (j == 4) dParam(j,0) *= TMath::Sign(1.,-paramSave(4,0)); // variation always in the same direction
+ dParam(j,0) *= TMath::Sign(1.,direction[j]*paramSave(j,0)); // variation always in the same direction
} else dParam(j,0) = 0.;
}
Double_t covCorrSlope = alpha2 * (pathLength * f0 - f1);
Double_t varSlop = alpha2 * f0;
- // compute derivative d(q/Pxy) / dSlopeX and d(q/Pxy) / dSlopeX
- Double_t dqPxydSlopeX = inverseBendingMomentum * nonBendingSlope / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
- Double_t dqPxydSlopeY = - inverseBendingMomentum * nonBendingSlope*nonBendingSlope * bendingSlope /
- (1. + bendingSlope*bendingSlope) / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
-
// Set MCS covariance matrix
TMatrixD newParamCov(param->GetCovariances());
// Non bending plane
// Bending plane
newParamCov(2,2) += varCoor; newParamCov(2,3) += covCorrSlope;
newParamCov(3,2) += covCorrSlope; newParamCov(3,3) += varSlop;
- // Inverse bending momentum (due to dependences with bending and non bending slopes)
- newParamCov(4,0) += dqPxydSlopeX * covCorrSlope; newParamCov(0,4) += dqPxydSlopeX * covCorrSlope;
- newParamCov(4,1) += dqPxydSlopeX * varSlop; newParamCov(1,4) += dqPxydSlopeX * varSlop;
- newParamCov(4,2) += dqPxydSlopeY * covCorrSlope; newParamCov(2,4) += dqPxydSlopeY * covCorrSlope;
- newParamCov(4,3) += dqPxydSlopeY * varSlop; newParamCov(3,4) += dqPxydSlopeY * varSlop;
- newParamCov(4,4) += (dqPxydSlopeX*dqPxydSlopeX + dqPxydSlopeY*dqPxydSlopeY) * varSlop;
+
+ // Set momentum related covariances if B!=0
+ if (fgFieldON) {
+ // compute derivative d(q/Pxy) / dSlopeX and d(q/Pxy) / dSlopeY
+ Double_t dqPxydSlopeX = inverseBendingMomentum * nonBendingSlope / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
+ Double_t dqPxydSlopeY = - inverseBendingMomentum * nonBendingSlope*nonBendingSlope * bendingSlope /
+ (1. + bendingSlope*bendingSlope) / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
+ // Inverse bending momentum (due to dependences with bending and non bending slopes)
+ newParamCov(4,0) += dqPxydSlopeX * covCorrSlope; newParamCov(0,4) += dqPxydSlopeX * covCorrSlope;
+ newParamCov(4,1) += dqPxydSlopeX * varSlop; newParamCov(1,4) += dqPxydSlopeX * varSlop;
+ newParamCov(4,2) += dqPxydSlopeY * covCorrSlope; newParamCov(2,4) += dqPxydSlopeY * covCorrSlope;
+ newParamCov(4,3) += dqPxydSlopeY * varSlop; newParamCov(3,4) += dqPxydSlopeY * varSlop;
+ newParamCov(4,4) += (dqPxydSlopeX*dqPxydSlopeX + dqPxydSlopeY*dqPxydSlopeY) * varSlop;
+ }
// Set new covariances
param->SetCovariances(newParamCov);
// Get track parameters and covariances in the Branson plane corrected for magnetic field effect
ExtrapToZCov(param,zVtx);
- LinearExtrapToZ(param,zB);
+ LinearExtrapToZCov(param,zB);
// compute track parameters at vertex
TMatrixD newParam(5,1);
TMatrixD newParamCov(param->GetCovariances());
Cov2CovP(param->GetParameters(),newParamCov);
- // Add effects of energy loss fluctuation to covariances
- newParamCov(4,4) += sigmaELoss2;
-
// Compute new parameters corrected for energy loss
+ Double_t muMass = TDatabasePDG::Instance()->GetParticle("mu-")->Mass(); // GeV
+ Double_t p = param->P();
+ Double_t e = TMath::Sqrt(p*p + muMass*muMass);
+ Double_t eCorr = e + eLoss;
+ Double_t pCorr = TMath::Sqrt(eCorr*eCorr - muMass*muMass);
Double_t nonBendingSlope = param->GetNonBendingSlope();
Double_t bendingSlope = param->GetBendingSlope();
- param->SetInverseBendingMomentum(param->GetCharge() / (param->P() + eLoss) *
+ param->SetInverseBendingMomentum(param->GetCharge() / pCorr *
TMath::Sqrt(1.0 + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope) /
TMath::Sqrt(1.0 + bendingSlope*bendingSlope));
+ // Add effects of energy loss fluctuation to covariances
+ newParamCov(4,4) += eCorr * eCorr / pCorr / pCorr * sigmaELoss2;
+
// Get new parameter covariances in (X, SlopeX, Y, SlopeY, q/Pyz) coordinate system
CovP2Cov(param->GetParameters(),newParamCov);
Double_t varSlop = theta02;
Double_t covCorrSlope = pathLength * theta02 / 2.;
- // compute derivative d(q/Pxy) / dSlopeX and d(q/Pxy) / dSlopeX
- Double_t dqPxydSlopeX = inverseBendingMomentum * nonBendingSlope / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
- Double_t dqPxydSlopeY = - inverseBendingMomentum * nonBendingSlope*nonBendingSlope * bendingSlope /
- (1. + bendingSlope*bendingSlope) / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
-
// Set MCS covariance matrix
TMatrixD newParamCov(param->GetCovariances());
// Non bending plane
// Bending plane
newParamCov(2,2) += varCoor; newParamCov(2,3) += covCorrSlope;
newParamCov(3,2) += covCorrSlope; newParamCov(3,3) += varSlop;
- // Inverse bending momentum (due to dependences with bending and non bending slopes)
- newParamCov(4,0) += dqPxydSlopeX * covCorrSlope; newParamCov(0,4) += dqPxydSlopeX * covCorrSlope;
- newParamCov(4,1) += dqPxydSlopeX * varSlop; newParamCov(1,4) += dqPxydSlopeX * varSlop;
- newParamCov(4,2) += dqPxydSlopeY * covCorrSlope; newParamCov(2,4) += dqPxydSlopeY * covCorrSlope;
- newParamCov(4,3) += dqPxydSlopeY * varSlop; newParamCov(3,4) += dqPxydSlopeY * varSlop;
- newParamCov(4,4) += (dqPxydSlopeX*dqPxydSlopeX + dqPxydSlopeY*dqPxydSlopeY) * varSlop;
+
+ // Set momentum related covariances if B!=0
+ if (fgFieldON) {
+ // compute derivative d(q/Pxy) / dSlopeX and d(q/Pxy) / dSlopeY
+ Double_t dqPxydSlopeX = inverseBendingMomentum * nonBendingSlope / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
+ Double_t dqPxydSlopeY = - inverseBendingMomentum * nonBendingSlope*nonBendingSlope * bendingSlope /
+ (1. + bendingSlope*bendingSlope) / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
+ // Inverse bending momentum (due to dependences with bending and non bending slopes)
+ newParamCov(4,0) += dqPxydSlopeX * covCorrSlope; newParamCov(0,4) += dqPxydSlopeX * covCorrSlope;
+ newParamCov(4,1) += dqPxydSlopeX * varSlop; newParamCov(1,4) += dqPxydSlopeX * varSlop;
+ newParamCov(4,2) += dqPxydSlopeY * covCorrSlope; newParamCov(2,4) += dqPxydSlopeY * covCorrSlope;
+ newParamCov(4,3) += dqPxydSlopeY * varSlop; newParamCov(3,4) += dqPxydSlopeY * varSlop;
+ newParamCov(4,4) += (dqPxydSlopeX*dqPxydSlopeX + dqPxydSlopeY*dqPxydSlopeY) * varSlop;
+ }
// Set new covariances
param->SetCovariances(newParamCov);
trackXYZIn[2] = trackParamIn.GetZ();
}
Double_t pTot = trackParam->P();
- Double_t pathLength, f0, f1, f2, meanRho, deltaP, sigmaDeltaP2;
- if (!GetAbsorberCorrectionParam(trackXYZIn,trackXYZOut,pTot,pathLength,f0,f1,f2,meanRho,deltaP,sigmaDeltaP2)) {
+ Double_t pathLength, f0, f1, f2, meanRho, totalELoss, sigmaELoss2;
+ if (!GetAbsorberCorrectionParam(trackXYZIn,trackXYZOut,pTot,pathLength,f0,f1,f2,meanRho,totalELoss,sigmaELoss2)) {
cout<<"E-AliMUONTrackExtrap::ExtrapToVertex: Unable to take into account the absorber effects"<<endl;
if (trackParam->CovariancesExist()) ExtrapToZCov(trackParam,zVtx);
else ExtrapToZ(trackParam,zVtx);
if (correctForEnergyLoss) {
// Correct for multiple scattering and energy loss
- CorrectELossEffectInAbsorber(trackParam, 0.5*deltaP, 0.5*sigmaDeltaP2);
+ CorrectELossEffectInAbsorber(trackParam, 0.5*totalELoss, 0.5*sigmaELoss2);
CorrectMCSEffectInAbsorber(trackParam, xVtx, yVtx, zVtx, errXVtx, errYVtx,
trackXYZIn[2], pathLength, f0, f1, f2);
- CorrectELossEffectInAbsorber(trackParam, 0.5*deltaP, 0.5*sigmaDeltaP2);
+ CorrectELossEffectInAbsorber(trackParam, 0.5*totalELoss, 0.5*sigmaELoss2);
} else {
if (correctForEnergyLoss) {
// Correct for energy loss add multiple scattering dispersion in covariance matrix
- CorrectELossEffectInAbsorber(trackParam, 0.5*deltaP, 0.5*sigmaDeltaP2);
+ CorrectELossEffectInAbsorber(trackParam, 0.5*totalELoss, 0.5*sigmaELoss2);
AddMCSEffectInAbsorber(trackParam, pathLength, f0, f1, f2);
ExtrapToZCov(trackParam, trackXYZIn[2]);
- CorrectELossEffectInAbsorber(trackParam, 0.5*deltaP, 0.5*sigmaDeltaP2);
+ CorrectELossEffectInAbsorber(trackParam, 0.5*totalELoss, 0.5*sigmaELoss2);
ExtrapToZCov(trackParam, zVtx);
} else {
Double_t pathLength, f0, f1, f2, meanRho, totalELoss, sigmaELoss2;
GetAbsorberCorrectionParam(trackXYZIn,trackXYZOut,pTot,pathLength,f0,f1,f2,meanRho,totalELoss,sigmaELoss2);
- return totalELoss;
+ // total momentum corrected for energy loss
+ Double_t muMass = TDatabasePDG::Instance()->GetParticle("mu-")->Mass(); // GeV
+ Double_t e = TMath::Sqrt(pTot*pTot + muMass*muMass);
+ Double_t eCorr = e + totalELoss;
+ Double_t pTotCorr = TMath::Sqrt(eCorr*eCorr - muMass*muMass);
+
+ return pTotCorr - pTot;
}
//__________________________________________________________________________
{
/// Returns the mean total momentum energy loss of muon with total momentum='pTotal'
/// in the absorber layer of lenght='pathLength', density='rho', A='atomicA' and Z='atomicZ'
- Double_t muMass = 0.105658369; // GeV
- Double_t eMass = 0.510998918e-3; // GeV
- Double_t k = 0.307075e-3; // GeV.g^-1.cm^2
- Double_t i = 9.5e-9; // mean exitation energy per atomic Z (GeV)
- Double_t p2=pTotal*pTotal;
- Double_t beta2=p2/(p2 + muMass*muMass);
-
- Double_t w = k * rho * pathLength * atomicZ / atomicA / beta2;
+ Double_t muMass = TDatabasePDG::Instance()->GetParticle("mu-")->Mass(); // GeV
- if (beta2/(1-beta2)>3.5*3.5)
- return w * (log(2.*eMass*3.5/(i*atomicZ)) + 0.5*log(beta2/(1-beta2)) - beta2);
+ // mean exitation energy (GeV)
+ Double_t i;
+ if (atomicZ < 13) i = (12. * atomicZ + 7.) * 1.e-9;
+ else i = (9.76 * atomicZ + 58.8 * TMath::Power(atomicZ,-0.19)) * 1.e-9;
- return w * (log(2.*eMass*beta2/(1-beta2)/(i*atomicZ)) - beta2);
+ return pathLength * rho * AliExternalTrackParam::BetheBlochGeant(pTotal/muMass, rho, 0.20, 3.00, i, atomicZ/atomicA);
}
//__________________________________________________________________________
{
/// Returns the total momentum energy loss fluctuation of muon with total momentum='pTotal'
/// in the absorber layer of lenght='pathLength', density='rho', A='atomicA' and Z='atomicZ'
- Double_t muMass = 0.105658369; // GeV
+ Double_t muMass = TDatabasePDG::Instance()->GetParticle("mu-")->Mass(); // GeV
//Double_t eMass = 0.510998918e-3; // GeV
Double_t k = 0.307075e-3; // GeV.g^-1.cm^2
Double_t p2=pTotal*pTotal;
xyz[2] = vect[kiz] + 0.5 * step * vect[kipz];
//cmodif: call gufld (xyz, h) changed into:
- GetField (xyz, h);
+ TGeoGlobalMagField::Instance()->Field(xyz,h);
h2xy = h[0]*h[0] + h[1]*h[1];
h[3] = h[2]*h[2]+ h2xy;
rest = step - tl;
if (TMath::Abs(h) > TMath::Abs(rest)) h = rest;
//cmodif: call gufld(vout,f) changed into:
-
- GetField(vout,f);
+ TGeoGlobalMagField::Instance()->Field(vout,f);
// *
// * start of integration
xyzt[2] = zt;
//cmodif: call gufld(xyzt,f) changed into:
- GetField(xyzt,f);
+ TGeoGlobalMagField::Instance()->Field(xyzt,f);
at = a + secxs[0];
bt = b + secys[0];
xyzt[2] = zt;
//cmodif: call gufld(xyzt,f) changed into:
- GetField(xyzt,f);
+ TGeoGlobalMagField::Instance()->Field(xyzt,f);
z = z + (c + (seczs[0] + seczs[1] + seczs[2]) * kthird) * h;
y = y + (b + (secys[0] + secys[1] + secys[2]) * kthird) * h;
return;
}
-//___________________________________________________________
-void AliMUONTrackExtrap::GetField(Double_t *Position, Double_t *Field)
-{
- /// interface for arguments in double precision (Why ? ChF)
- Float_t x[3], b[3];
-
- x[0] = Position[0]; x[1] = Position[1]; x[2] = Position[2];
-
- if (fgkField) fgkField->Field(x,b);
- else {
- cout<<"F-AliMUONTrackExtrap::GetField: fgkField = 0x0"<<endl;
- exit(-1);
- }
-
- Field[0] = b[0]; Field[1] = b[1]; Field[2] = b[2];
-
- return;
-}