210   if( std::fabs(stepLengthCm) <= kCarTolerance/
cm ) 
return 0;
 
  225   if( vpPre.
mag() == vpPre.
z() ) vpPre.
setX( 1.E-6*
MeV );
 
  226   if( vpPost.
mag() == vpPost.
z() ) vpPost.
setX( 1.E-6*
MeV );
 
  232     G4cout << 
"G4EP: vposPre " << vposPre << G4endl
 
  233               << 
"G4EP: vposPost " << vposPost << 
G4endl;
 
  234     G4cout << 
"G4EP: vpPre " << vpPre << G4endl
 
  235               << 
"G4EP: vpPost " << vpPost << 
G4endl;
 
  237     G4cout << 
"G4EP: stepLengthCm " << stepLengthCm << 
G4endl;
 
  241   if( pPre == 0. || pPost == 0 ) 
return 2;
 
  244   G4double deltaPInv = pInvPost - pInvPre;
 
  245   if( 
iverbose >= 2 ) 
G4cout << 
"G4EP:  pInvPre" << pInvPre<< 
"  pInvPost:" << pInvPost<<
"  deltaPInv:" << deltaPInv<<   
G4endl;
 
  250   if( 
iverbose >= 2 ) 
G4cout << 
"G4EP: vpPreNorm " << vpPreNorm << 
" vpPostNorm " << vpPostNorm << 
G4endl;
 
  252   if( 1. - std::fabs(vpPostNorm.
z()) < kCarTolerance ) 
return 4;
 
  264   transf[3][2] = stepLengthCm * sinpPost;
 
  265   transf[4][1] = stepLengthCm;
 
  266   for( 
size_t ii=0;ii < 5; ii++ ){
 
  271     G4cout << 
"G4EP: transf matrix neutral " << transf;
 
  287   G4double pos1[3]; pos1[0] = vposPre.
x()*
cm; pos1[1] = vposPre.
y()*
cm; pos1[2] = vposPre.
z()*
cm;
 
  288   G4double pos2[3]; pos2[0] = vposPost.
x()*
cm; pos2[1] = vposPost.
y()*
cm; pos2[2] = vposPost.
z()*
cm;
 
  292   if( !field ) 
return 0; 
 
  297   if( charge != 0. && field ) {
 
  308              << h1[0] << 
", " << h1[1] << 
", " << h1[2] << 
G4endl;
 
  309       G4cout << 
"G4EP: pos1/mm = " 
  310              << pos1[0] << 
", " << pos1[1] << 
", " << pos1[2] << 
G4endl;
 
  311       G4cout << 
"G4EP: pos2/mm = " 
  312              << pos2[0] << 
", " << pos2[1] << 
", " << pos2[2] << 
G4endl;
 
  313       G4cout << 
"G4EP: B-filed in KGauss HPre " << HPre << G4endl
 
  314          << 
"G4EP: in KGauss HPost " << HPost << 
G4endl;
 
  318   if( magHPre + magHPost != 0. ) {
 
  322     if( magHPost != 0. ){ 
 
  323       gam = HPost * vpPostNorm / magHPost;
 
  325       gam = HPre * vpPreNorm / magHPre;
 
  330     G4double diffHSqr = ( HPre * pInvPre - HPost * pInvPost ).mag2();
 
  334       G4cout << 
" G4EP: gam " << gam << 
" alphaSqr " << alphaSqr
 
  335              << 
" diffHSqr " << diffHSqr << 
G4endl;
 
  339     if( diffHSqr * alphaSqr > delhp6Sqr ) 
return 3;
 
  343     G4double pInvAver = 1./(pInvPre + pInvPost );
 
  346     G4ThreeVector vHAverNorm( (HPre*pInvPre + HPost*pInvPost ) * pInvAver * charge * CFACT8 );
 
  349     vHAverNorm *= invHAver;
 
  351     if( 
iverbose >= 2 ) 
G4cout << 
" G4EP: HaverNorm " << vHAverNorm << 
" magHAver " << HAver << 
" charge " << charge<< 
G4endl;
 
  356     G4double thetaAver = QAver * stepLengthCm;
 
  357     G4double sinThetaAver = std::sin(thetaAver);
 
  358     G4double cosThetaAver = std::cos(thetaAver);
 
  359     G4double gamma = vHAverNorm * vpPostNorm;
 
  363     if( 
iverbose >= 2 ) 
G4cout << 
" G4EP: AN2 " << AN2 << 
"  gamma:"<<gamma<< 
"  theta="<< thetaAver<<
G4endl;
 
  371                       vpPreNorm.
z()*vUPre.x(), 
 
  372                       vpPreNorm.
x()*vUPre.y() - vpPreNorm.
y()*vUPre.x() );
 
  375     AU = 1./vpPostNorm.
perp();
 
  381                        vpPostNorm.z()*vUPost.x(), 
 
  382                        vpPostNorm.x()*vUPost.y() - vpPostNorm.y()*vUPost.x() );
 
  385     if( 
iverbose >= 2 ) 
G4cout << 
" G4EP: AU " << AU << 
" vUPre " << vUPre << 
" vVPre " << vVPre << 
" vUPost " << vUPost << 
" vVPost " << vVPost << 
G4endl;
 
  387     G4Point3D deltaPos( vposPre - vposPost );
 
  395     if( 
iverbose >= 2) 
G4cout << 
" G4EP: QP " << QP << 
" QAver " << QAver << 
" pAver " << pAver << 
G4endl;
 
  397     G4double ANV = -( vHAverNorm.x()*vUPost.x() + vHAverNorm.y()*vUPost.y() );
 
  398     G4double ANU = ( vHAverNorm.x()*vVPost.x() + vHAverNorm.y()*vVPost.y() + vHAverNorm.z()*vVPost.z() );
 
  399     G4double OMcosThetaAver = 1. - cosThetaAver;
 
  401     if( 
iverbose >= 2) 
G4cout << 
"G4EP: OMcosThetaAver " << OMcosThetaAver << 
" cosThetaAver " << cosThetaAver << 
" thetaAver " << thetaAver << 
" QAver " << QAver << 
" stepLengthCm " << stepLengthCm << 
G4endl;
 
  403     G4double TMSINT = thetaAver - sinThetaAver;
 
  409                           vHAverNorm.z() * vUPre.x(),
 
  410                           vHAverNorm.x() * vUPre.y() - vHAverNorm.y() * vUPre.x() );
 
  414     G4ThreeVector vHVPre( vHAverNorm.y() * vVPre.z() - vHAverNorm.z() * vVPre.y(),
 
  415                           vHAverNorm.z() * vVPre.x() - vHAverNorm.x() * vVPre.z(),
 
  416                           vHAverNorm.x() * vVPre.y() - vHAverNorm.y() * vVPre.x() );
 
  424     transf[0][0] = 1.-deltaPInv*pAver*(1.+(vpPostNorm.x()*deltaPos.x()+vpPostNorm.y()*deltaPos.y()+vpPostNorm.z()*deltaPos.z())/stepLengthCm)
 
  427     transf[0][1] =  -deltaPInv/thetaAver*
 
  428       ( TMSINT*gamma*(vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z()) +
 
  429         sinThetaAver*(vVPre.x()*vpPostNorm.x()+vVPre.y()*vpPostNorm.y()+vVPre.z()*vpPostNorm.z()) +
 
  430         OMcosThetaAver*(vHVPre.x()*vpPostNorm.x()+vHVPre.y()*vpPostNorm.y()+vHVPre.z()*vpPostNorm.z()) );
 
  432     transf[0][2] =  -sinpPre*deltaPInv/thetaAver*
 
  433       ( TMSINT*gamma*(vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y()            ) +
 
  434         sinThetaAver*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y()            ) +
 
  435         OMcosThetaAver*(vHUPre.x()*vpPostNorm.x()+vHUPre.y()*vpPostNorm.y()+vHUPre.z()*vpPostNorm.z()) );
 
  437     transf[0][3] =  -deltaPInv/stepLengthCm*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y()            );
 
  439     transf[0][4] =  -deltaPInv/stepLengthCm*(vVPre.x()*vpPostNorm.x()+vVPre.y()*vpPostNorm.y()+vVPre.z()*vpPostNorm.z());
 
  442     transf[1][0] = -QP*ANV*(vpPostNorm.x()*deltaPos.x()+vpPostNorm.y()*deltaPos.y()+vpPostNorm.z()*deltaPos.z())
 
  443       *(1.+deltaPInv*pAver);
 
  445      if(
iverbose >= 3) 
G4cout << 
"ctransf10= " << transf[1][0]  << 
" " <<  -QP<< 
" " << ANV<< 
" " << vpPostNorm.x()<< 
" " << deltaPos.x()<< 
" " << vpPostNorm.y()<< 
" " << deltaPos.y()<< 
" " << vpPostNorm.z()<< 
" " << deltaPos.z()
 
  446       << 
" " << deltaPInv<< 
" " << pAver << 
G4endl;
 
  449     transf[1][1] = cosThetaAver*(vVPre.x()*vVPost.x()+vVPre.y()*vVPost.y()+vVPre.z()*vVPost.z()) +
 
  450       sinThetaAver*(vHVPre.x()*vVPost.x()+vHVPre.y()*vVPost.y()+vHVPre.z()*vVPost.z()) +
 
  451       OMcosThetaAver*(vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z())*
 
  452       (vHAverNorm.x()*vVPost.x()+vHAverNorm.y()*vVPost.y()+vHAverNorm.z()*vVPost.z()) +
 
  453       ANV*( -sinThetaAver*(vVPre.x()*vpPostNorm.x()+vVPre.y()*vpPostNorm.y()+vVPre.z()*vpPostNorm.z()) +
 
  454             OMcosThetaAver*(vVPre.x()*AN2.
x()+vVPre.y()*AN2.
y()+vVPre.z()*AN2.
z()) -
 
  455             TMSINT*gamma*(vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z()) );
 
  457     transf[1][2] = cosThetaAver*(vUPre.x()*vVPost.x()+vUPre.y()*vVPost.y()            ) +
 
  458       sinThetaAver*(vHUPre.x()*vVPost.x()+vHUPre.y()*vVPost.y()+vHUPre.z()*vVPost.z()) +
 
  459       OMcosThetaAver*(vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y()            )*
 
  460       (vHAverNorm.x()*vVPost.x()+vHAverNorm.y()*vVPost.y()+vHAverNorm.z()*vVPost.z()) +
 
  461       ANV*( -sinThetaAver*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y()            ) +
 
  462             OMcosThetaAver*(vUPre.x()*AN2.
x()+vUPre.y()*AN2.
y()             ) -
 
  463             TMSINT*gamma*(vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y()            ) );
 
  464     transf[1][2] = sinpPre*transf[1][2];
 
  466     transf[1][3] = -QAver*ANV*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y()            );
 
  468     transf[1][4] = -QAver*ANV*(vVPre.x()*vpPostNorm.x()+vVPre.y()*vpPostNorm.y()+vVPre.z()*vpPostNorm.z());
 
  472     transf[2][0] = -QP*ANU*(vpPostNorm.x()*deltaPos.x()+vpPostNorm.y()*deltaPos.y()+vpPostNorm.z()*deltaPos.z())*sinpPostInv
 
  473       *(1.+deltaPInv*pAver);
 
  475    if(
iverbose >= 3)
G4cout <<
"ctransf20= " << transf[2][0] <<
" "<< -QP<<
" "<<ANU<<
" "<<vpPostNorm.x()<<
" "<<deltaPos.x()<<
" "<<vpPostNorm.y()<<
" "<<deltaPos.y()<<
" "<<vpPostNorm.z()<<
" "<<deltaPos.z()<<
" "<<sinpPostInv
 
  476          <<
" "<<deltaPInv<<
" "<<pAver<< 
G4endl;
 
  478     transf[2][1] = cosThetaAver*(vVPre.x()*vUPost.x()+vVPre.y()*vUPost.y()            ) +
 
  479       sinThetaAver*(vHVPre.x()*vUPost.x()+vHVPre.y()*vUPost.y()             ) +
 
  480       OMcosThetaAver*(vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z())*
 
  481       (vHAverNorm.x()*vUPost.x()+vHAverNorm.y()*vUPost.y()            ) +
 
  482       ANU*( -sinThetaAver*(vVPre.x()*vpPostNorm.x()+vVPre.y()*vpPostNorm.y()+vVPre.z()*vpPostNorm.z()) +
 
  483             OMcosThetaAver*(vVPre.x()*AN2.
x()+vVPre.y()*AN2.
y()+vVPre.z()*AN2.
z()) -
 
  484             TMSINT*gamma*(vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z()) );
 
  485     transf[2][1] = sinpPostInv*transf[2][1];
 
  487     transf[2][2] = cosThetaAver*(vUPre.x()*vUPost.x()+vUPre.y()*vUPost.y()            ) +
 
  488       sinThetaAver*(vHUPre.x()*vUPost.x()+vHUPre.y()*vUPost.y()             ) +
 
  489       OMcosThetaAver*(vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y()            )*
 
  490       (vHAverNorm.x()*vUPost.x()+vHAverNorm.y()*vUPost.y()            ) +
 
  491       ANU*( -sinThetaAver*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y()            ) +
 
  492             OMcosThetaAver*(vUPre.x()*AN2.
x()+vUPre.y()*AN2.
y()             ) -
 
  493             TMSINT*gamma*(vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y()            ) );
 
  494     transf[2][2] = sinpPostInv*sinpPre*transf[2][2];
 
  496     transf[2][3] = -QAver*ANU*(vUPre.x()*vpPostNorm.x()+vUPre.y()*vpPostNorm.y()            )*sinpPostInv;
 
  498     if(
iverbose >= 3)
G4cout <<
"ctransf23= " << transf[2][3] <<
" "<< -QAver<<
" "<<ANU<<
" "<<vUPre.x()<<
" "<<vpPostNorm.x()<<
" "<< vUPre.y()<<
" "<<vpPostNorm.y()<<
" "<<sinpPostInv<<
G4endl;
 
  501     transf[2][4] = -QAver*ANU*(vVPre.x()*vpPostNorm.x()+vVPre.y()*vpPostNorm.y()+vVPre.z()*vpPostNorm.z())*sinpPostInv;
 
  505     transf[3][0] = pAver*(vUPost.x()*deltaPos.x()+vUPost.y()*deltaPos.y() )
 
  506       *(1.+deltaPInv*pAver);
 
  508    if(
iverbose >= 3) 
G4cout <<
"ctransf30= " << transf[3][0] <<
" "<< pAver<<
" "<<vUPost.x()<<
" "<<deltaPos.x()<<
" "<<vUPost.y()<<
" "<<deltaPos.y()  
 
  509       <<
" "<<deltaPInv<<
" "<<pAver<<
G4endl;
 
  512     transf[3][1] = (   sinThetaAver*(vVPre.x()*vUPost.x()+vVPre.y()*vUPost.y()            ) +
 
  513                        OMcosThetaAver*(vHVPre.x()*vUPost.x()+vHVPre.y()*vUPost.y()             ) +
 
  514                        TMSINT*(vHAverNorm.x()*vUPost.x()+vHAverNorm.y()*vUPost.y()            )*
 
  515                        (vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z()) )/QAver;
 
  517     transf[3][2] = (   sinThetaAver*(vUPre.x()*vUPost.x()+vUPre.y()*vUPost.y()            ) +
 
  518                        OMcosThetaAver*(vHUPre.x()*vUPost.x()+vHUPre.y()*vUPost.y()             ) +
 
  519                        TMSINT*(vHAverNorm.x()*vUPost.x()+vHAverNorm.y()*vUPost.y()            )*
 
  520                        (vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y()            ) )*sinpPre/QAver;
 
  522    if(
iverbose >= 3) 
G4cout <<
"ctransf32= " << transf[3][2] <<
" "<< sinThetaAver<<
" "<<vUPre.x()<<
" "<<vUPost.x()<<
" "<<vUPre.y()<<
" "<<vUPost.y() <<
" "<<
 
  523                        OMcosThetaAver<<
" "<<vHUPre.x()<<
" "<<vUPost.x()<<
" "<<vHUPre.y()<<
" "<<vUPost.y() <<
" "<<
 
  524                        TMSINT<<
" "<<vHAverNorm.x()<<
" "<<vUPost.x()<<
" "<<vHAverNorm.y()<<
" "<<vUPost.y() <<
" "<<
 
  525       vHAverNorm.x()<<
" "<<vUPre.x()<<
" "<<vHAverNorm.y()<<
" "<<vUPre.y() <<
" "<<sinpPre<<
" "<<QAver<<
G4endl;
 
  528     transf[3][3] = (vUPre.x()*vUPost.x()+vUPre.y()*vUPost.y()            );
 
  530     transf[3][4] = (vVPre.x()*vUPost.x()+vVPre.y()*vUPost.y()            );
 
  533     transf[4][0] = pAver*(vVPost.x()*deltaPos.x()+vVPost.y()*deltaPos.y()+vVPost.z()*deltaPos.z())
 
  534       *(1.+deltaPInv*pAver);
 
  536     transf[4][1] = (   sinThetaAver*(vVPre.x()*vVPost.x()+vVPre.y()*vVPost.y()+vVPre.z()*vVPost.z()) +
 
  537                        OMcosThetaAver*(vHVPre.x()*vVPost.x()+vHVPre.y()*vVPost.y()+vHVPre.z()*vVPost.z()) +
 
  538                        TMSINT*(vHAverNorm.x()*vVPost.x()+vHAverNorm.y()*vVPost.y()+vHAverNorm.z()*vVPost.z())*
 
  539                        (vHAverNorm.x()*vVPre.x()+vHAverNorm.y()*vVPre.y()+vHAverNorm.z()*vVPre.z()) )/QAver;
 
  541     if(
iverbose >= 3)
G4cout <<
"ctransf41= " << transf[4][1] <<
" "<< sinThetaAver<<
" "<< OMcosThetaAver <<
" "<<TMSINT<<
" "<< vVPre <<
" "<<vVPost <<
" "<<vHVPre<<
" "<<vHAverNorm <<
" "<< QAver<<
G4endl;
 
  544     transf[4][2] = (   sinThetaAver*(vUPre.x()*vVPost.x()+vUPre.y()*vVPost.y()            ) +
 
  545                        OMcosThetaAver*(vHUPre.x()*vVPost.x()+vHUPre.y()*vVPost.y()+vHUPre.z()*vVPost.z()) +
 
  546                        TMSINT*(vHAverNorm.x()*vVPost.x()+vHAverNorm.y()*vVPost.y()+vHAverNorm.z()*vVPost.z())*
 
  547                        (vHAverNorm.x()*vUPre.x()+vHAverNorm.y()*vUPre.y()            ) )*sinpPre/QAver;
 
  549     transf[4][3] = (vUPre.x()*vVPost.x()+vUPre.y()*vVPost.y()  );
 
  551     transf[4][4] = (vVPre.x()*vVPost.x()+vVPre.y()*vVPost.y()+vVPre.z()*vVPost.z()); 
 
  576     theTransfMat = transf;
 
  580                                   << 
" transf matrix " << theTransfMat.
T() << 
G4endl;
 
  593     PropagateErrorMSC( aTrack );
 
  595     PropagateErrorIoni( aTrack );
 
static constexpr double tesla
 
G4ErrorSymMatrix similarity(const G4ErrorMatrix &m1) const 
 
CLHEP::Hep3Vector G4ThreeVector
 
G4double GetStepLength() const 
 
virtual void GetFieldValue(const double Point[4], double *fieldArr) const =0
 
const G4DynamicParticle * GetDynamicParticle() const 
 
const G4ThreeVector & GetPosition() const 
 
G4double GetSurfaceTolerance() const 
 
G4ThreeVector GetMomentum() const 
 
G4ErrorSymMatrix T() const 
 
const G4Step * GetStep() const 
 
G4StepPoint * GetPreStepPoint() const 
 
G4GLOB_DLL std::ostream G4cout
 
const G4ThreeVector & GetPosition() const 
 
static constexpr double cm
 
G4double GetCharge() const 
 
const G4double kCarTolerance
 
static G4TransportationManager * GetTransportationManager()
 
G4FieldManager * GetFieldManager() const 
 
G4ThreeVector GetMomentum() const 
 
static constexpr double GeV
 
static constexpr double MeV
 
Hep3Vector cross(const Hep3Vector &) const 
 
static G4ErrorPropagatorData * GetErrorPropagatorData()
 
const G4Field * GetDetectorField() const 
 
static G4GeometryTolerance * GetInstance()