31 #include "AliExternalTrackParam.h"
33 #include <TGeoGlobalMagField.h>
34 #include <TGeoManager.h>
36 #include <TDatabasePDG.h>
38 #include <Riostream.h>
60 const Double_t x[3] = {50.,50.,fgkSimpleBPosition};
61 Double_t b[3] = {0.,0.,0.};
62 TGeoGlobalMagField::Instance()->Field(x,b);
63 fgSimpleBValue = b[0];
64 fgFieldON = (TMath::Abs(fgSimpleBValue) > 1.e-10) ? kTRUE : kFALSE;
76 if (bendingMomentum == 0.)
return 1.e10;
78 const Double_t kCorrectionFactor = 1.1;
92 if (impactParam == 0.)
return 1.e10;
94 const Double_t kCorrectionFactor = 1.1;
112 if (trackParam->
GetZ() == zEnd)
return;
115 Double_t
dZ = zEnd - trackParam->
GetZ();
118 trackParam->
SetZ(zEnd);
127 if (trackParam->
GetZ() == zEnd)
return;
131 cout<<
"W-AliMUONTrackExtrap::LinearExtrapToZCov: Covariance matrix does not exist"<<endl;
138 Double_t
dZ = zEnd - trackParam->
GetZ();
141 trackParam->
SetZ(zEnd);
150 TMatrixD tmp(trackParam->
GetCovariances(),TMatrixD::kMultTranspose,jacob);
151 TMatrixD tmp2(jacob,TMatrixD::kMult,tmp);
176 if (trackParam->
GetZ() == zEnd)
return kTRUE;
177 Double_t forwardBackward;
178 if (zEnd < trackParam->GetZ()) forwardBackward = 1.0;
179 else forwardBackward = -1.0;
180 Double_t v3[7], v3New[7];
181 Int_t i3, stepNumber;
190 while (((-forwardBackward * (v3[2] - zEnd)) <= 0.0) && (stepNumber <
fgkMaxStepNumber)) {
193 if ((-forwardBackward * (v3New[2] - zEnd)) > 0.0)
break;
195 for (i3 = 0; i3 < 7; i3++) {v3[i3] = v3New[i3];}
200 Double_t dZ12 = v3New[2] - v3[2];
201 if (TMath::Abs(dZ12) > 0) {
202 Double_t dZ1i = zEnd - v3[2];
203 Double_t dZi2 = v3New[2] - zEnd;
204 Double_t xPrime = (v3New[0] - v3[0]) / dZ12;
205 Double_t xSecond = ((v3New[3] / v3New[5]) - (v3[3] / v3[5])) / dZ12;
206 Double_t yPrime = (v3New[1] - v3[1]) / dZ12;
207 Double_t ySecond = ((v3New[4] / v3New[5]) - (v3[4] / v3[5])) / dZ12;
208 v3[0] = v3[0] + xPrime * dZ1i - 0.5 * xSecond * dZ1i * dZi2;
209 v3[1] = v3[1] + yPrime * dZ1i - 0.5 * ySecond * dZ1i * dZi2;
211 Double_t xPrimeI = xPrime - 0.5 * xSecond * (dZi2 - dZ1i);
212 Double_t yPrimeI = yPrime - 0.5 * ySecond * (dZi2 - dZ1i);
214 v3[5] = 1.0 / TMath::Sqrt(1.0 + xPrimeI * xPrimeI + yPrimeI * yPrimeI);
215 v3[3] = xPrimeI * v3[5];
216 v3[4] = yPrimeI * v3[5];
218 cout<<
"W-AliMUONTrackExtrap::ExtrapToZHelix: Extrap. to Z not reached, Z = "<<zEnd<<endl;
230 if (trackParam->
GetZ() == zEnd)
return kTRUE;
231 Double_t forwardBackward;
232 if (zEnd < trackParam->GetZ()) forwardBackward = 1.0;
233 else forwardBackward = -1.0;
237 Double_t v3[7], v3New[7];
239 Int_t stepNumber = 0;
242 Double_t residue = zEnd - trackParam->
GetZ();
243 Bool_t uturn = kFALSE;
244 Bool_t trackingFailed = kFALSE;
245 Bool_t tooManyStep = kFALSE;
248 dZ = zEnd - trackParam->
GetZ();
256 cout<<
"W-AliMUONTrackExtrap::ExtrapToZRungekutta: Too many trials: "<<stepNumber<<endl;
261 step = TMath::Abs(step);
263 trackingFailed = kTRUE;
266 residue = zEnd - v3New[2];
267 step *= dZ/(v3New[2]-trackParam->
GetZ());
270 if (trackingFailed)
break;
271 else if (v3New[5]*v3[5] < 0) {
272 cout<<
"W-AliMUONTrackExtrap::ExtrapToZRungekutta: The track turned around"<<endl;
280 if (trackingFailed || uturn) {
286 Double_t nonBendingSlope = TMath::Sign(TMath::Abs(v3[3]) * v3[6] / pZ, trackParam->
GetNonBendingSlope());
291 trackParam->
SetZ(zEnd);
300 trackParam->
SetZ(zEnd);
316 v3[2] = trackParam->
GetZ();
320 v3[5] = -forwardBackward * pZ / v3[6];
333 trackParam->
SetZ(v3[2]);
334 Double_t pYZ = v3[6] * TMath::Sqrt((1.-v3[3])*(1.+v3[3]));
346 if (trackParam->
GetZ() == zEnd)
return kTRUE;
355 cout<<
"W-AliMUONTrackExtrap::ExtrapToZCov: Covariance matrix does not exist"<<endl;
363 Double_t zBegin = trackParamSave.
GetZ();
370 if (!
ExtrapToZ(trackParam,zEnd))
return kFALSE;
376 Bool_t extrapStatus = kTRUE;
379 TMatrixD dParam(5,1);
380 Double_t direction[5] = {-1.,-1.,1.,1.,-1.};
381 for (Int_t i=0; i<5; i++) {
383 if (kParamCov(i,i) <= 0.)
continue;
386 for (Int_t j=0; j<5; j++) {
388 dParam(j,0) = TMath::Sqrt(kParamCov(i,i));
389 dParam(j,0) *= TMath::Sign(1.,direction[j]*paramSave(j,0));
390 }
else dParam(j,0) = 0.;
396 trackParamSave.
SetZ(zBegin);
400 cout<<
"W-AliMUONTrackExtrap::ExtrapToZCov: Bad covariance matrix"<<endl;
401 extrapStatus = kFALSE;
405 TMatrixD jacobji(trackParamSave.
GetParameters(),TMatrixD::kMinus,extrapParam);
406 jacobji *= 1. / dParam(i,0);
407 jacob.SetSub(0,i,jacobji);
411 TMatrixD tmp(kParamCov,TMatrixD::kMultTranspose,jacob);
412 TMatrixD tmp2(jacob,TMatrixD::kMult,tmp);
431 Double_t alpha2 = 0.0136 * 0.0136 * inverseBendingMomentum * inverseBendingMomentum * (1.0 + bendingSlope * bendingSlope) /
432 (1.0 + bendingSlope *bendingSlope + nonBendingSlope * nonBendingSlope);
433 Double_t pathLength = TMath::Abs(signedPathLength);
434 Double_t varCoor = alpha2 * (pathLength * pathLength * f0 - 2. * pathLength * f1 + f2);
435 Double_t covCorrSlope = TMath::Sign(1.,signedPathLength) * alpha2 * (pathLength * f0 - f1);
436 Double_t varSlop = alpha2 * f0;
441 newParamCov(0,0) += varCoor; newParamCov(0,1) += covCorrSlope;
442 newParamCov(1,0) += covCorrSlope; newParamCov(1,1) += varSlop;
444 newParamCov(2,2) += varCoor; newParamCov(2,3) += covCorrSlope;
445 newParamCov(3,2) += covCorrSlope; newParamCov(3,3) += varSlop;
450 Double_t dqPxydSlopeX = inverseBendingMomentum * nonBendingSlope / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
451 Double_t dqPxydSlopeY = - inverseBendingMomentum * nonBendingSlope*nonBendingSlope * bendingSlope /
452 (1. + bendingSlope*bendingSlope) / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
454 newParamCov(4,0) += dqPxydSlopeX * covCorrSlope; newParamCov(0,4) += dqPxydSlopeX * covCorrSlope;
455 newParamCov(4,1) += dqPxydSlopeX * varSlop; newParamCov(1,4) += dqPxydSlopeX * varSlop;
456 newParamCov(4,2) += dqPxydSlopeY * covCorrSlope; newParamCov(2,4) += dqPxydSlopeY * covCorrSlope;
457 newParamCov(4,3) += dqPxydSlopeY * varSlop; newParamCov(3,4) += dqPxydSlopeY * varSlop;
458 newParamCov(4,4) += (dqPxydSlopeX*dqPxydSlopeX + dqPxydSlopeY*dqPxydSlopeY) * varSlop;
467 Double_t xVtx, Double_t yVtx, Double_t zVtx,
468 Double_t errXVtx, Double_t errYVtx,
469 Double_t absZBeg, Double_t pathLength, Double_t f0, Double_t f1, Double_t f2)
477 Double_t zB = (f1>0.) ? absZBeg - f2/f1 : 0.;
487 TMatrixD newParam(5,1);
488 newParam(0,0) = xVtx;
490 newParam(2,0) = yVtx;
492 newParam(4,0) = param->
GetCharge() / param->
P() *
493 TMath::Sqrt(1.0 + newParam(1,0)*newParam(1,0) + newParam(3,0)*newParam(3,0)) /
494 TMath::Sqrt(1.0 + newParam(3,0)*newParam(3,0));
501 TMatrixD paramCovVtx(5,5);
503 paramCovVtx(0,0) = errXVtx * errXVtx;
504 paramCovVtx(1,1) = paramCovP(0,0);
505 paramCovVtx(2,2) = errYVtx * errYVtx;
506 paramCovVtx(3,3) = paramCovP(2,2);
507 paramCovVtx(4,4) = paramCovP(4,4);
508 paramCovVtx(1,3) = paramCovP(0,2);
509 paramCovVtx(3,1) = paramCovP(2,0);
510 paramCovVtx(1,4) = paramCovP(0,4);
511 paramCovVtx(4,1) = paramCovP(4,0);
512 paramCovVtx(3,4) = paramCovP(2,4);
513 paramCovVtx(4,3) = paramCovP(4,2);
518 jacob(1,0) = - 1. / (zB - zVtx);
519 jacob(1,1) = 1. / (zB - zVtx);
520 jacob(3,2) = - 1. / (zB - zVtx);
521 jacob(3,3) = 1. / (zB - zVtx);
524 TMatrixD tmp(paramCovVtx,TMatrixD::kMultTranspose,jacob);
525 TMatrixD newParamCov(jacob,TMatrixD::kMult,tmp);
546 Double_t muMass = TDatabasePDG::Instance()->GetParticle(
"mu-")->Mass();
547 Double_t p = param->
P();
548 Double_t e = TMath::Sqrt(p*p + muMass*muMass);
549 Double_t eCorr = e + eLoss;
550 Double_t pCorr = TMath::Sqrt(eCorr*eCorr - muMass*muMass);
554 TMath::Sqrt(1.0 + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope) /
555 TMath::Sqrt(1.0 + bendingSlope*bendingSlope));
558 newParamCov(4,4) += eCorr * eCorr / pCorr / pCorr * sigmaELoss2;
569 Double_t &pathLength, Double_t &f0, Double_t &f1, Double_t &f2,
570 Double_t &meanRho, Double_t &totalELoss, Double_t &sigmaELoss2)
592 cout<<
"E-AliMUONTrackExtrap::GetAbsorberCorrectionParam: no TGeo"<<endl;
597 pathLength = TMath::Sqrt((trackXYZOut[0] - trackXYZIn[0])*(trackXYZOut[0] - trackXYZIn[0])+
598 (trackXYZOut[1] - trackXYZIn[1])*(trackXYZOut[1] - trackXYZIn[1])+
599 (trackXYZOut[2] - trackXYZIn[2])*(trackXYZOut[2] - trackXYZIn[2]));
600 if (pathLength < TGeoShape::Tolerance())
return kFALSE;
602 b[0] = (trackXYZOut[0] - trackXYZIn[0]) / pathLength;
603 b[1] = (trackXYZOut[1] - trackXYZIn[1]) / pathLength;
604 b[2] = (trackXYZOut[2] - trackXYZIn[2]) / pathLength;
605 TGeoNode *currentnode = gGeoManager->InitTrack(trackXYZIn, b);
607 cout<<
"E-AliMUONTrackExtrap::GetAbsorberCorrectionParam: start point out of geometry"<<endl;
614 Double_t atomicA = 0.;
615 Double_t atomicZ = 0.;
616 Double_t atomicZoverA = 0.;
617 Double_t localPathLength = 0;
618 Double_t remainingPathLength = pathLength;
619 Double_t sigmaELoss = 0.;
620 Double_t zB = trackXYZIn[2];
621 Double_t zE, dzB, dzE;
624 TGeoMaterial *material = currentnode->GetVolume()->GetMedium()->GetMaterial();
625 rho = material->GetDensity();
626 x0 = material->GetRadLen();
627 atomicA = material->GetA();
628 atomicZ = material->GetZ();
629 if(material->IsMixture()){
630 TGeoMixture * mixture = (TGeoMixture*)material;
633 for (Int_t iel=0;iel<mixture->GetNelements();iel++){
634 sum += mixture->GetWmixt()[iel];
635 atomicZoverA += mixture->GetZmixt()[iel]*mixture->GetWmixt()[iel]/mixture->GetAmixt()[iel];
639 else atomicZoverA = atomicZ/atomicA;
642 gGeoManager->FindNextBoundary(remainingPathLength);
643 localPathLength = gGeoManager->GetStep() + 1.e-6;
645 if (localPathLength >= remainingPathLength) localPathLength = remainingPathLength;
647 currentnode = gGeoManager->Step();
649 cout<<
"E-AliMUONTrackExtrap::GetAbsorberCorrectionParam: navigation failed"<<endl;
650 f0 = f1 = f2 = meanRho = totalELoss = sigmaELoss2 = 0.;
653 if (!gGeoManager->IsEntering()) {
655 gGeoManager->SetStep(0.001);
656 currentnode = gGeoManager->Step();
657 if (!gGeoManager->IsEntering() || !currentnode) {
658 cout<<
"E-AliMUONTrackExtrap::GetAbsorberCorrectionParam: navigation failed"<<endl;
659 f0 = f1 = f2 = meanRho = totalELoss = sigmaELoss2 = 0.;
662 localPathLength += 0.001;
667 zE = b[2] * localPathLength + zB;
668 dzB = zB - trackXYZIn[2];
669 dzE = zE - trackXYZIn[2];
670 f0 += localPathLength / x0;
671 f1 += (dzE*dzE - dzB*dzB) / b[2] / b[2] / x0 / 2.;
672 f2 += (dzE*dzE*dzE - dzB*dzB*dzB) / b[2] / b[2] / b[2] / x0 / 3.;
673 meanRho += localPathLength * rho;
674 totalELoss +=
BetheBloch(pTotal, localPathLength, rho, atomicZ, atomicZoverA);
679 remainingPathLength -= localPathLength;
680 }
while (remainingPathLength > TGeoShape::Tolerance());
682 meanRho /= pathLength;
683 sigmaELoss2 = sigmaELoss*sigmaELoss;
698 (1.0 + bendingSlope * bendingSlope) /
699 (1.0 + bendingSlope *bendingSlope + nonBendingSlope * nonBendingSlope);
701 Double_t pathLength = TMath::Abs(dZ) * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
705 Double_t theta02 = 0.0136 / velo * (1 + 0.038 * TMath::Log(pathLength/x0));
707 return theta02 * theta02 * inverseTotalMomentum2 * pathLength / x0;
722 Double_t inverseTotalMomentum2 = inverseBendingMomentum * inverseBendingMomentum *
723 (1.0 + bendingSlope * bendingSlope) /
724 (1.0 + bendingSlope *bendingSlope + nonBendingSlope * nonBendingSlope);
726 Double_t signedPathLength = dZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
727 Double_t pathLengthOverX0 = (x0 > 0.) ? TMath::Abs(signedPathLength) / x0 : TMath::Abs(signedPathLength);
731 Double_t theta02 = 0.0136 / velo * (1 + 0.038 * TMath::Log(pathLengthOverX0));
732 theta02 *= theta02 * inverseTotalMomentum2 * pathLengthOverX0;
734 Double_t varCoor = (x0 > 0.) ? signedPathLength * signedPathLength * theta02 / 3. : 0.;
735 Double_t varSlop = theta02;
736 Double_t covCorrSlope = (x0 > 0.) ? signedPathLength * theta02 / 2. : 0.;
741 newParamCov(0,0) += varCoor; newParamCov(0,1) += covCorrSlope;
742 newParamCov(1,0) += covCorrSlope; newParamCov(1,1) += varSlop;
744 newParamCov(2,2) += varCoor; newParamCov(2,3) += covCorrSlope;
745 newParamCov(3,2) += covCorrSlope; newParamCov(3,3) += varSlop;
750 Double_t dqPxydSlopeX = inverseBendingMomentum * nonBendingSlope / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
751 Double_t dqPxydSlopeY = - inverseBendingMomentum * nonBendingSlope*nonBendingSlope * bendingSlope /
752 (1. + bendingSlope*bendingSlope) / (1. + nonBendingSlope*nonBendingSlope + bendingSlope*bendingSlope);
754 newParamCov(4,0) += dqPxydSlopeX * covCorrSlope; newParamCov(0,4) += dqPxydSlopeX * covCorrSlope;
755 newParamCov(4,1) += dqPxydSlopeX * varSlop; newParamCov(1,4) += dqPxydSlopeX * varSlop;
756 newParamCov(4,2) += dqPxydSlopeY * covCorrSlope; newParamCov(2,4) += dqPxydSlopeY * covCorrSlope;
757 newParamCov(4,3) += dqPxydSlopeY * varSlop; newParamCov(3,4) += dqPxydSlopeY * varSlop;
758 newParamCov(4,4) += (dqPxydSlopeX*dqPxydSlopeX + dqPxydSlopeY*dqPxydSlopeY) * varSlop;
767 Double_t xVtx, Double_t yVtx, Double_t zVtx,
768 Double_t errXVtx, Double_t errYVtx,
769 Bool_t correctForMCS, Bool_t correctForEnergyLoss)
779 if (trackParam->
GetZ() == zVtx)
return;
781 if (trackParam->
GetZ() > zVtx) {
782 cout<<
"E-AliMUONTrackExtrap::ExtrapToVertex: Starting Z ("<<trackParam->
GetZ()
783 <<
") upstream the vertex (zVtx = "<<zVtx<<
")"<<endl;
789 cout<<
"W-AliMUONTrackExtrap::ExtrapToVertex: Ending Z ("<<zVtx
792 cout<<
"W-AliMUONTrackExtrap::ExtrapToVertex: Ending Z ("<<zVtx
801 cout<<
"W-AliMUONTrackExtrap::ExtrapToVertex: Starting Z ("<<trackParam->
GetZ()
807 cout<<
"W-AliMUONTrackExtrap::ExtrapToVertex: Starting Z ("<<trackParam->
GetZ()
815 Double_t trackXYZOut[3];
818 trackXYZOut[2] = trackParam->
GetZ();
819 Double_t trackXYZIn[3];
822 trackXYZIn[0] = trackXYZOut[0] + (xVtx - trackXYZOut[0]) / (zVtx - trackXYZOut[2]) * (trackXYZIn[2] - trackXYZOut[2]);
823 trackXYZIn[1] = trackXYZOut[1] + (yVtx - trackXYZOut[1]) / (zVtx - trackXYZOut[2]) * (trackXYZIn[2] - trackXYZOut[2]);
829 trackXYZIn[2] = trackParamIn.
GetZ();
831 Double_t pTot = trackParam->
P();
832 Double_t pathLength, f0, f1, f2, meanRho, totalELoss, sigmaELoss2;
834 cout<<
"E-AliMUONTrackExtrap::ExtrapToVertex: Unable to take into account the absorber effects"<<endl;
843 if (correctForEnergyLoss) {
848 trackXYZIn[2], pathLength, f0, f1, f2);
855 trackXYZIn[2], pathLength, f0, f1, f2);
860 if (correctForEnergyLoss) {
883 Double_t xVtx, Double_t yVtx, Double_t zVtx,
884 Double_t errXVtx, Double_t errYVtx)
888 ExtrapToVertex(trackParam, xVtx, yVtx, zVtx, errXVtx, errYVtx, kTRUE, kTRUE);
893 Double_t xVtx, Double_t yVtx, Double_t zVtx,
894 Double_t errXVtx, Double_t errYVtx)
898 ExtrapToVertex(trackParam, xVtx, yVtx, zVtx, errXVtx, errYVtx, kTRUE, kFALSE);
922 if (trackParam->
GetZ() == zVtx)
return 0.;
926 cout<<
"E-AliMUONTrackExtrap::TotalMomentumEnergyLoss: no TGeo"<<endl;
931 Double_t trackXYZOut[3];
934 trackXYZOut[2] = trackParam->
GetZ();
935 Double_t trackXYZIn[3];
936 trackXYZIn[0] = xVtx;
937 trackXYZIn[1] = yVtx;
938 trackXYZIn[2] = zVtx;
939 Double_t pTot = trackParam->
P();
940 Double_t pathLength, f0, f1, f2, meanRho, totalELoss, sigmaELoss2;
944 Double_t muMass = TDatabasePDG::Instance()->GetParticle(
"mu-")->Mass();
945 Double_t e = TMath::Sqrt(pTot*pTot + muMass*muMass);
946 Double_t eCorr = e + totalELoss;
947 Double_t pTotCorr = TMath::Sqrt(eCorr*eCorr - muMass*muMass);
949 return pTotCorr - pTot;
957 Double_t muMass = TDatabasePDG::Instance()->GetParticle(
"mu-")->Mass();
961 if (atomicZ < 13) i = (12. * atomicZ + 7.) * 1.e-9;
962 else i = (9.76 * atomicZ + 58.8 * TMath::Power(atomicZ,-0.19)) * 1.e-9;
964 return pathLength * rho * AliExternalTrackParam::BetheBlochGeant(pTotal/muMass, rho, 0.20, 3.00, i, atomicZoverA);
972 Double_t muMass = TDatabasePDG::Instance()->GetParticle(
"mu-")->Mass();
974 Double_t k = 0.307075e-3;
975 Double_t p2=pTotal*pTotal;
976 Double_t beta2=p2/(p2 + muMass*muMass);
978 Double_t fwhm = 2. * k * rho * pathLength * atomicZoverA / beta2;
979 Double_t sigma = fwhm / TMath::Sqrt(8.*log(2.));
993 Double_t qPTot = TMath::Sqrt(1. + param(1,0)*param(1,0) + param(3,0)*param(3,0)) /
994 TMath::Sqrt(1. + param(3,0)*param(3,0)) / param(4,0);
999 jacob(4,1) = qPTot * param(1,0) / (1. + param(1,0)*param(1,0) + param(3,0)*param(3,0));
1000 jacob(4,3) = - qPTot * param(1,0) * param(1,0) * param(3,0) /
1001 (1. + param(3,0)*param(3,0)) / (1. + param(1,0)*param(1,0) + param(3,0)*param(3,0));
1002 jacob(4,4) = - qPTot / param(4,0);
1005 TMatrixD tmp(cov,TMatrixD::kMultTranspose,jacob);
1006 cov.Mult(jacob,tmp);
1016 Double_t qPTot = TMath::Sqrt(1. + param(1,0)*param(1,0) + param(3,0)*param(3,0)) /
1017 TMath::Sqrt(1. + param(3,0)*param(3,0)) / param(4,0);
1020 TMatrixD jacob(5,5);
1022 jacob(4,1) = param(4,0) * param(1,0) / (1. + param(1,0)*param(1,0) + param(3,0)*param(3,0));
1023 jacob(4,3) = - param(4,0) * param(1,0) * param(1,0) * param(3,0) /
1024 (1. + param(3,0)*param(3,0)) / (1. + param(1,0)*param(1,0) + param(3,0)*param(3,0));
1025 jacob(4,4) = - param(4,0) / qPTot;
1028 TMatrixD tmp(covP,TMatrixD::kMultTranspose,jacob);
1029 covP.Mult(jacob,tmp);
1059 Double_t xyz[3], h[4], hxp[3];
1060 Double_t h2xy, hp, rho, tet;
1061 Double_t sint, sintt, tsint, cos1t;
1062 Double_t f1, f2, f3, f4, f5, f6;
1064 const Int_t kix = 0;
1065 const Int_t kiy = 1;
1066 const Int_t kiz = 2;
1067 const Int_t kipx = 3;
1068 const Int_t kipy = 4;
1069 const Int_t kipz = 5;
1070 const Int_t kipp = 6;
1072 const Double_t kec = 2.9979251e-4;
1078 vout[kipp] = vect[kipp];
1079 if (TMath::Abs(charge) < 0.00001) {
1080 for (Int_t i = 0; i < 3; i++) {
1081 vout[i] = vect[i] + step * vect[i+3];
1082 vout[i+3] = vect[i+3];
1086 xyz[0] = vect[kix] + 0.5 * step * vect[kipx];
1087 xyz[1] = vect[kiy] + 0.5 * step * vect[kipy];
1088 xyz[2] = vect[kiz] + 0.5 * step * vect[kipz];
1091 TGeoGlobalMagField::Instance()->Field(xyz,h);
1093 h2xy = h[0]*h[0] + h[1]*h[1];
1094 h[3] = h[2]*h[2]+ h2xy;
1095 if (h[3] < 1.e-12) {
1096 for (Int_t i = 0; i < 3; i++) {
1097 vout[i] = vect[i] + step * vect[i+3];
1098 vout[i+3] = vect[i+3];
1102 if (h2xy < 1.e-12*h[3]) {
1106 h[3] = TMath::Sqrt(h[3]);
1112 hxp[0] = h[1]*vect[kipz] - h[2]*vect[kipy];
1113 hxp[1] = h[2]*vect[kipx] - h[0]*vect[kipz];
1114 hxp[2] = h[0]*vect[kipy] - h[1]*vect[kipx];
1116 hp = h[0]*vect[kipx] + h[1]*vect[kipy] + h[2]*vect[kipz];
1118 rho = -charge*h[3]/vect[kipp];
1121 if (TMath::Abs(tet) > 0.15) {
1122 sint = TMath::Sin(tet);
1124 tsint = (tet-sint)/tet;
1125 cos1t = 2.*(TMath::Sin(0.5*tet))*(TMath::Sin(0.5*tet))/tet;
1127 tsint = tet*tet/36.;
1128 sintt = (1. - tsint);
1135 f3 = step * tsint * hp;
1138 f6 = tet * cos1t * hp;
1140 vout[kix] = vect[kix] + f1*vect[kipx] + f2*hxp[0] + f3*h[0];
1141 vout[kiy] = vect[kiy] + f1*vect[kipy] + f2*hxp[1] + f3*h[1];
1142 vout[kiz] = vect[kiz] + f1*vect[kipz] + f2*hxp[2] + f3*h[2];
1144 vout[kipx] = vect[kipx] + f4*vect[kipx] + f5*hxp[0] + f6*h[0];
1145 vout[kipy] = vect[kipy] + f4*vect[kipy] + f5*hxp[1] + f6*h[1];
1146 vout[kipz] = vect[kipz] + f4*vect[kipz] + f5*hxp[2] + f6*h[2];
1170 Double_t h4, hp, rho, tet;
1171 Double_t sint, sintt, tsint, cos1t;
1172 Double_t f1, f2, f3, f4, f5, f6;
1174 const Int_t kix = 0;
1175 const Int_t kiy = 1;
1176 const Int_t kiz = 2;
1177 const Int_t kipx = 3;
1178 const Int_t kipy = 4;
1179 const Int_t kipz = 5;
1180 const Int_t kipp = 6;
1182 const Double_t kec = 2.9979251e-4;
1189 vout[kipp] = vect[kipp];
1192 hxp[0] = - vect[kipy];
1193 hxp[1] = + vect[kipx];
1197 rho = -h4/vect[kipp];
1199 if (TMath::Abs(tet) > 0.15) {
1200 sint = TMath::Sin(tet);
1202 tsint = (tet-sint)/tet;
1203 cos1t = 2.* TMath::Sin(0.5*tet) * TMath::Sin(0.5*tet)/tet;
1205 tsint = tet*tet/36.;
1206 sintt = (1. - tsint);
1213 f3 = step * tsint * hp;
1216 f6 = tet * cos1t * hp;
1218 vout[kix] = vect[kix] + f1*vect[kipx] + f2*hxp[0];
1219 vout[kiy] = vect[kiy] + f1*vect[kipy] + f2*hxp[1];
1220 vout[kiz] = vect[kiz] + f1*vect[kipz] + f3;
1222 vout[kipx] = vect[kipx] + f4*vect[kipx] + f5*hxp[0];
1223 vout[kipy] = vect[kipy] + f4*vect[kipy] + f5*hxp[1];
1224 vout[kipz] = vect[kipz] + f4*vect[kipz] + f6;
1256 Double_t h2, h4,
f[4];
1257 Double_t xyzt[3] = {FLT_MAX, FLT_MAX, FLT_MAX};
1258 Double_t a, b, c, ph,ph2;
1259 Double_t secxs[4],secys[4],seczs[4],hxp[3];
1260 Double_t g1, g2, g3, g4, g5, g6, ang2, dxt, dyt, dzt;
1261 Double_t est, at, bt, ct, cba;
1262 Double_t f1, f2, f3, f4, rho, tet, hnorm, hp, rho1, sint, cost;
1272 Double_t maxit = 1992;
1273 Double_t maxcut = 11;
1275 const Double_t kdlt = 1e-4;
1276 const Double_t kdlt32 = kdlt/32.;
1277 const Double_t kthird = 1./3.;
1278 const Double_t khalf = 0.5;
1279 const Double_t kec = 2.9979251e-4;
1281 const Double_t kpisqua = 9.86960440109;
1282 const Int_t kix = 0;
1283 const Int_t kiy = 1;
1284 const Int_t kiz = 2;
1285 const Int_t kipx = 3;
1286 const Int_t kipy = 4;
1287 const Int_t kipz = 5;
1296 for(Int_t j = 0; j < 7; j++)
1299 Double_t pinv = kec * charge / vect[6];
1307 if (TMath::Abs(h) > TMath::Abs(rest)) h = rest;
1309 TGeoGlobalMagField::Instance()->Field(vout,f);
1325 secxs[0] = (b * f[2] - c * f[1]) * ph2;
1326 secys[0] = (c * f[0] - a * f[2]) * ph2;
1327 seczs[0] = (a * f[1] - b * f[0]) * ph2;
1328 ang2 = (secxs[0]*secxs[0] + secys[0]*secys[0] + seczs[0]*seczs[0]);
1329 if (ang2 > kpisqua)
break;
1331 dxt = h2 * a + h4 * secxs[0];
1332 dyt = h2 * b + h4 * secys[0];
1333 dzt = h2 * c + h4 * seczs[0];
1341 est = TMath::Abs(dxt) + TMath::Abs(dyt) + TMath::Abs(dzt);
1343 if (ncut++ > maxcut)
break;
1353 TGeoGlobalMagField::Instance()->Field(xyzt,f);
1359 secxs[1] = (bt * f[2] - ct * f[1]) * ph2;
1360 secys[1] = (ct * f[0] - at * f[2]) * ph2;
1361 seczs[1] = (at * f[1] - bt * f[0]) * ph2;
1365 secxs[2] = (bt * f[2] - ct * f[1]) * ph2;
1366 secys[2] = (ct * f[0] - at * f[2]) * ph2;
1367 seczs[2] = (at * f[1] - bt * f[0]) * ph2;
1368 dxt = h * (a + secxs[2]);
1369 dyt = h * (b + secys[2]);
1370 dzt = h * (c + seczs[2]);
1374 at = a + 2.*secxs[2];
1375 bt = b + 2.*secys[2];
1376 ct = c + 2.*seczs[2];
1378 est = TMath::Abs(dxt)+TMath::Abs(dyt)+TMath::Abs(dzt);
1379 if (est > 2.*TMath::Abs(h)) {
1380 if (ncut++ > maxcut)
break;
1390 TGeoGlobalMagField::Instance()->Field(xyzt,f);
1392 z = z + (c + (seczs[0] + seczs[1] + seczs[2]) * kthird) * h;
1393 y = y + (b + (secys[0] + secys[1] + secys[2]) * kthird) * h;
1394 x = x + (a + (secxs[0] + secxs[1] + secxs[2]) * kthird) * h;
1396 secxs[3] = (bt*f[2] - ct*f[1])* ph2;
1397 secys[3] = (ct*f[0] - at*f[2])* ph2;
1398 seczs[3] = (at*f[1] - bt*f[0])* ph2;
1399 a = a+(secxs[0]+secxs[3]+2. * (secxs[1]+secxs[2])) * kthird;
1400 b = b+(secys[0]+secys[3]+2. * (secys[1]+secys[2])) * kthird;
1401 c = c+(seczs[0]+seczs[3]+2. * (seczs[1]+seczs[2])) * kthird;
1403 est = TMath::Abs(secxs[0]+secxs[3] - (secxs[1]+secxs[2]))
1404 + TMath::Abs(secys[0]+secys[3] - (secys[1]+secys[2]))
1405 + TMath::Abs(seczs[0]+seczs[3] - (seczs[1]+seczs[2]));
1407 if (est > kdlt && TMath::Abs(h) > 1.e-4) {
1408 if (ncut++ > maxcut)
break;
1415 if (iter++ > maxit)
break;
1420 cba = 1./ TMath::Sqrt(a*a + b*b + c*c);
1428 if (step < 0.) rest = -rest;
1429 if (rest < 1.e-5*TMath::Abs(step))
return kTRUE;
1434 cout<<
"W-AliMUONTrackExtrap::ExtrapOneStepRungekutta: Ruge-Kutta failed: switch to helix"<<endl;
1439 f4 = TMath::Sqrt(f1*f1+f2*f2+f3*f3);
1441 cout<<
"E-AliMUONTrackExtrap::ExtrapOneStepRungekutta: magnetic field at (";
1442 cout<<xyzt[0]<<
", "<<xyzt[1]<<
", "<<xyzt[2]<<
") = "<<f4<<
": giving up"<<endl;
1453 hxp[0] = f2*vect[kipz] - f3*vect[kipy];
1454 hxp[1] = f3*vect[kipx] - f1*vect[kipz];
1455 hxp[2] = f1*vect[kipy] - f2*vect[kipx];
1457 hp = f1*vect[kipx] + f2*vect[kipy] + f3*vect[kipz];
1460 sint = TMath::Sin(tet);
1461 cost = 2.*TMath::Sin(khalf*tet)*TMath::Sin(khalf*tet);
1465 g3 = (tet-sint) * hp*rho1;
1470 vout[kix] = vect[kix] + g1*vect[kipx] + g2*hxp[0] + g3*f1;
1471 vout[kiy] = vect[kiy] + g1*vect[kipy] + g2*hxp[1] + g3*f2;
1472 vout[kiz] = vect[kiz] + g1*vect[kipz] + g2*hxp[2] + g3*f3;
1474 vout[kipx] = vect[kipx] + g4*vect[kipx] + g5*hxp[0] + g6*f1;
1475 vout[kipy] = vect[kipy] + g4*vect[kipy] + g5*hxp[1] + g6*f2;
1476 vout[kipz] = vect[kipz] + g4*vect[kipz] + g5*hxp[2] + g6*f3;
static Double_t AbsZEnd()
Return z-position of absorber end.
Double_t GetBendingCoor() const
return bending coordinate (cm)
const TMatrixD & GetParameters() const
return track parameters
TFile f("CalibObjects.root")
Bool_t CovariancesExist() const
return kTRUE if the covariance matrix exist, kFALSE if not
Double_t GetZ() const
return Z coordinate (cm)
Track parameters in ALICE dimuon spectrometer.
void SetNonBendingCoor(Double_t nonBendingCoor)
set non bending coordinate (cm)
void AddParameters(const TMatrixD ¶meters)
add track parameters
Double_t GetInverseBendingMomentum() const
return inverse bending momentum (GeV/c ** -1) times the charge (assumed forward motion) ...
Double_t GetBendingSlope() const
return bending slope (cm ** -1)
void SetBendingSlope(Double_t bendingSlope)
set bending slope (cm ** -1)
static Double_t GetMostProbBendingMomentum()
Return the most probable bending momentum (GeV/c) (used when B = 0)
Double_t GetCharge() const
return the charge (assumed forward motion)
void SetNonBendingSlope(Double_t nonBendingSlope)
set non bending slope (cm ** -1)
void SetParameters(const TMatrixD ¶meters)
set track parameters
void SetInverseBendingMomentum(Double_t inverseBendingMomentum)
set inverse bending momentum (GeV/c ** -1) times the charge (assumed forward motion) ...
void SetBendingCoor(Double_t bendingCoor)
set bending coordinate (cm)
Double_t GetNonBendingCoor() const
return non bending coordinate (cm)
void UpdatePropagator(const TMatrixD &propagator)
void SetCovariances(const TMatrixD &covariances)
void SetZ(Double_t z)
set Z coordinate (cm)
const TMatrixD & GetCovariances() const
static Double_t AbsZBeg()
Return z-position of absorber begining.
Double_t GetNonBendingSlope() const
return non bending slope (cm ** -1)