G4ErrorSurfaceTrajState Class Reference

#include <G4ErrorSurfaceTrajState.hh>

Inheritance diagram for G4ErrorSurfaceTrajState:

G4ErrorTrajState

Public Member Functions

 G4ErrorSurfaceTrajState (const G4String &partType, const G4Point3D &pos, const G4Vector3D &mom, const G4Plane3D &plane, const G4ErrorTrajErr &errmat=G4ErrorTrajErr(5, 0))
 G4ErrorSurfaceTrajState (const G4String &partType, const G4Point3D &pos, const G4Vector3D &mom, const G4Vector3D &vecV, const G4Vector3D &vecW, const G4ErrorTrajErr &errmat=G4ErrorTrajErr(5, 0))
 G4ErrorSurfaceTrajState (G4ErrorFreeTrajState &tpSC, const G4Plane3D &plane)
 G4ErrorSurfaceTrajState (G4ErrorFreeTrajState &tpSC, const G4Vector3D &vecV, const G4Vector3D &vecW, G4ErrorMatrix &transfM)
 ~G4ErrorSurfaceTrajState ()
G4ErrorMatrix BuildErrorMatrix (G4ErrorFreeTrajState &tpSC, const G4Vector3D &vecV, const G4Vector3D &vecW)
virtual void Dump (std::ostream &out=G4cout) const
G4ErrorSurfaceTrajParam GetParameters () const
void SetParameters (const G4Point3D &pos, const G4Vector3D &mom, const G4Vector3D &vecV, const G4Vector3D &vecW)
void SetParameters (const G4Point3D &pos, const G4Vector3D &mom, const G4Plane3D &plane)
G4Vector3D GetVectorV () const
G4Vector3D GetVectorW () const
virtual void SetPosition (const G4Point3D pos)
virtual void SetMomentum (const G4Vector3D &mom)

Friends

std::ostream & operator<< (std::ostream &, const G4ErrorSurfaceTrajState &ts)

Detailed Description

Definition at line 56 of file G4ErrorSurfaceTrajState.hh.


Constructor & Destructor Documentation

G4ErrorSurfaceTrajState::G4ErrorSurfaceTrajState ( const G4String partType,
const G4Point3D pos,
const G4Vector3D mom,
const G4Plane3D plane,
const G4ErrorTrajErr errmat = G4ErrorTrajErr(5, 0) 
)

Definition at line 60 of file G4ErrorSurfaceTrajState.cc.

00063   : G4ErrorTrajState( partType, pos, mom, errmat )
00064 {
00065   Init();
00066   fTrajParam = G4ErrorSurfaceTrajParam( pos, mom, plane );
00067 
00068 }

G4ErrorSurfaceTrajState::G4ErrorSurfaceTrajState ( const G4String partType,
const G4Point3D pos,
const G4Vector3D mom,
const G4Vector3D vecV,
const G4Vector3D vecW,
const G4ErrorTrajErr errmat = G4ErrorTrajErr(5, 0) 
)

Definition at line 48 of file G4ErrorSurfaceTrajState.cc.

00051   : G4ErrorTrajState( partType, pos, mom, errmat )
00052 {
00053   Init();
00054   fTrajParam = G4ErrorSurfaceTrajParam( pos, mom, vecU, vecV );
00055 }

G4ErrorSurfaceTrajState::G4ErrorSurfaceTrajState ( G4ErrorFreeTrajState tpSC,
const G4Plane3D plane 
)

Definition at line 73 of file G4ErrorSurfaceTrajState.cc.

References BuildErrorMatrix(), G4ErrorTrajState::fMomentum, G4ErrorTrajState::fPosition, GetVectorV(), and GetVectorW().

00074   : G4ErrorTrajState( tpSC.GetParticleType(), tpSC.GetPosition(),
00075                       tpSC.GetMomentum() )
00076 {
00077   //  fParticleType = tpSC.GetParticleType();
00078   //  fPosition = tpSC.GetPosition();
00079   //  fMomentum = tpSC.GetMomentum();
00080   fTrajParam = G4ErrorSurfaceTrajParam( fPosition, fMomentum, plane );
00081   Init();
00082 
00083   //----- Get the error matrix in SC coordinates
00084   BuildErrorMatrix( tpSC, GetVectorV(), GetVectorW() );
00085 }

G4ErrorSurfaceTrajState::G4ErrorSurfaceTrajState ( G4ErrorFreeTrajState tpSC,
const G4Vector3D vecV,
const G4Vector3D vecW,
G4ErrorMatrix transfM 
)

Definition at line 90 of file G4ErrorSurfaceTrajState.cc.

References BuildErrorMatrix(), G4ErrorTrajState::fMomentum, and G4ErrorTrajState::fPosition.

00092   : G4ErrorTrajState( tpSC.GetParticleType(), tpSC.GetPosition(),
00093                       tpSC.GetMomentum() )
00094 {
00095   Init(); // needed to define charge sign 
00096   fTrajParam = G4ErrorSurfaceTrajParam( fPosition, fMomentum, vecU, vecV );
00097   //----- Get the error matrix in SC coordinates
00098   transfM= BuildErrorMatrix( tpSC, vecU, vecV );
00099 }

G4ErrorSurfaceTrajState::~G4ErrorSurfaceTrajState (  )  [inline]

Definition at line 81 of file G4ErrorSurfaceTrajState.hh.

00081 {}


Member Function Documentation

G4ErrorMatrix G4ErrorSurfaceTrajState::BuildErrorMatrix ( G4ErrorFreeTrajState tpSC,
const G4Vector3D vecV,
const G4Vector3D vecW 
)

Definition at line 104 of file G4ErrorSurfaceTrajState.cc.

References G4ErrorTrajState::fCharge, G4ErrorTrajState::fError, G4ErrorTrajState::fMomentum, G4ErrorTrajState::fPosition, G4cout, G4endl, G4ErrorMode_PropBackwards, G4FieldManager::GetDetectorField(), G4ErrorTrajState::GetError(), G4ErrorPropagatorData::GetErrorPropagatorData(), G4TransportationManager::GetFieldManager(), G4Field::GetFieldValue(), G4ErrorFreeTrajParam::GetLambda(), G4ErrorFreeTrajState::GetParameters(), G4ErrorFreeTrajParam::GetPhi(), G4TransportationManager::GetTransportationManager(), GetVectorV(), GetVectorW(), G4ErrorTrajState::iverbose, ns, G4INCL::Math::pi, and G4ErrorSymMatrix::similarity().

Referenced by G4ErrorSurfaceTrajState().

00106 {
00107   G4double sclambda = tpSC.GetParameters().GetLambda();
00108   G4double scphi = tpSC.GetParameters().GetPhi();
00109   if( G4ErrorPropagatorData::GetErrorPropagatorData()->GetMode() == G4ErrorMode_PropBackwards ){
00110     sclambda *= -1;
00111     scphi += CLHEP::pi;
00112   }
00113   G4double cosLambda = std::cos( sclambda );
00114   G4double sinLambda = std::sin( sclambda );
00115   G4double sinPhi = std::sin( scphi );
00116   G4double cosPhi = std::cos( scphi );
00117 
00118 #ifdef G4EVERBOSE
00119   if( iverbose >= 4) G4cout << " PM " << fMomentum.mag() << " pLambda " << sclambda << " pPhi " << scphi << G4endl;
00120 #endif
00121 
00122   G4ThreeVector vTN( cosLambda*cosPhi, cosLambda*sinPhi,sinLambda );
00123   G4ThreeVector vUN( -sinPhi, cosPhi, 0. );
00124   G4ThreeVector vVN( -vTN.z()*vUN.y(),vTN.z()*vUN.x(), cosLambda );
00125   
00126 #ifdef G4EVERBOSE
00127   if( iverbose >= 4) G4cout << " SC2SD: vTN " << vTN << " vUN " << vUN << " vVN " << vVN << G4endl;
00128 #endif
00129   G4double UJ = vUN*GetVectorV();
00130   G4double UK = vUN*GetVectorW();
00131   G4double VJ = vVN*GetVectorV();
00132   G4double VK = vVN*GetVectorW();
00133 
00134 
00135   //--- Get transformation first
00136   G4ErrorMatrix transfM(5, 5, 0 );
00137   //--- Get magnetic field
00138   const G4Field* field = G4TransportationManager::GetTransportationManager()->GetFieldManager()->GetDetectorField();
00139 
00140   G4Vector3D vectorU = GetVectorV().cross( GetVectorW() );
00141   G4double T1R = 1. / ( vTN * vectorU );
00142 
00143 #ifdef G4EVERBOSE
00144   if( iverbose >= 4) G4cout << "surf vectors:U,V,W " << vectorU << " " <<  GetVectorV() << " " << GetVectorW() << "  T1R:"<<T1R<<G4endl;
00145 #endif
00146 
00147 
00148   if( fCharge != 0 && field ) {
00149     G4double pos[3]; pos[0] = fPosition.x()*cm; pos[1] = fPosition.y()*cm; pos[2] = fPosition.z()*cm;
00150     G4double Hd[3];
00151     field->GetFieldValue( pos, Hd );
00152     G4ThreeVector H = G4ThreeVector( Hd[0], Hd[1], Hd[2] ) / tesla *10.;  //in kilogauus
00153     G4double magH = H.mag();
00154     G4double invP = 1./(fMomentum.mag()/GeV);
00155     G4double magHM = magH * invP;
00156     if( magH != 0. ) {
00157       G4double magHM2 = fCharge / magH;
00158       G4double Q = -magHM * c_light/ (km/ns);
00159 #ifdef G4EVERBOSE
00160       if( iverbose >= 4) G4cout << GeV <<  " Q " << Q << " magHM " << magHM << " c_light/(km/ns) " << c_light/(km/ns) << G4endl;      
00161 #endif
00162 
00163       G4double sinz = -H*vUN * magHM2;
00164       G4double cosz =  H*vVN * magHM2;
00165       G4double T3R = Q * std::pow(T1R,3);
00166       G4double UI = vUN * vectorU;
00167       G4double VI = vVN * vectorU;
00168 #ifdef G4EVERBOSE
00169       if( iverbose >= 4) {
00170         G4cout << " T1R " << T1R << " T3R " << T3R << G4endl;
00171         G4cout << " UI " << UI << " VI " << VI << " vectorU " << vectorU << G4endl;
00172         G4cout << " UJ " << UJ << " VJ " << VJ << G4endl;
00173         G4cout << " UK " << UK << " VK " << VK << G4endl;
00174       }
00175 #endif
00176 
00177       transfM[1][3] = -UI*( VK*cosz-UK*sinz)*T3R;
00178       transfM[1][4] = -VI*( VK*cosz-UK*sinz)*T3R;
00179       transfM[2][3] = UI*( VJ*cosz-UJ*sinz)*T3R;
00180       transfM[2][4] = VI*( VJ*cosz-UJ*sinz)*T3R;
00181     }
00182   }
00183 
00184   G4double T2R = T1R * T1R;
00185   transfM[0][0] = 1.;
00186   transfM[1][1] = -UK*T2R;
00187   transfM[1][2] = VK*cosLambda*T2R;
00188   transfM[2][1] = UJ*T2R;
00189   transfM[2][2] = -VJ*cosLambda*T2R;
00190   transfM[3][3] = VK*T1R;
00191   transfM[3][4] = -UK*T1R;
00192   transfM[4][3] = -VJ*T1R;
00193   transfM[4][4] = UJ*T1R;
00194 
00195 #ifdef G4EVERBOSE
00196   if( iverbose >= 4) G4cout << " SC2SD transf matrix A= " << transfM << G4endl;
00197 #endif
00198   fError = G4ErrorTrajErr( tpSC.GetError().similarity( transfM ) );
00199 
00200 #ifdef G4EVERBOSE
00201   if( iverbose >= 1) G4cout << "G4EP: error matrix SC2SD " << fError << G4endl;
00202   if( iverbose >= 4) G4cout << "G4ErrorSurfaceTrajState from SC " << *this << G4endl;
00203 #endif
00204 
00205   return transfM; // want to use trasnfM for the reverse transform
00206 }

void G4ErrorSurfaceTrajState::Dump ( std::ostream &  out = G4cout  )  const [virtual]

Implements G4ErrorTrajState.

Definition at line 218 of file G4ErrorSurfaceTrajState.cc.

00219 {
00220   out << *this;
00221 }

G4ErrorSurfaceTrajParam G4ErrorSurfaceTrajState::GetParameters (  )  const [inline]

Definition at line 93 of file G4ErrorSurfaceTrajState.hh.

Referenced by G4ErrorFreeTrajState::G4ErrorFreeTrajState().

00094     { return fTrajParam; }

G4Vector3D G4ErrorSurfaceTrajState::GetVectorV (  )  const [inline]

Definition at line 111 of file G4ErrorSurfaceTrajState.hh.

References G4ErrorSurfaceTrajParam::GetVectorV().

Referenced by BuildErrorMatrix(), G4ErrorFreeTrajState::G4ErrorFreeTrajState(), G4ErrorSurfaceTrajState(), SetMomentum(), and SetPosition().

00112     { return fTrajParam.GetVectorV(); }

G4Vector3D G4ErrorSurfaceTrajState::GetVectorW (  )  const [inline]

Definition at line 114 of file G4ErrorSurfaceTrajState.hh.

References G4ErrorSurfaceTrajParam::GetVectorW().

Referenced by BuildErrorMatrix(), G4ErrorFreeTrajState::G4ErrorFreeTrajState(), G4ErrorSurfaceTrajState(), SetMomentum(), and SetPosition().

00115     { return fTrajParam.GetVectorW(); }

virtual void G4ErrorSurfaceTrajState::SetMomentum ( const G4Vector3D mom  )  [inline, virtual]

Reimplemented from G4ErrorTrajState.

Definition at line 120 of file G4ErrorSurfaceTrajState.hh.

References G4ErrorTrajState::fPosition, GetVectorV(), GetVectorW(), and SetParameters().

00121     { SetParameters( fPosition, mom, GetVectorV(), GetVectorW() ); }

void G4ErrorSurfaceTrajState::SetParameters ( const G4Point3D pos,
const G4Vector3D mom,
const G4Plane3D plane 
) [inline]

Definition at line 103 of file G4ErrorSurfaceTrajState.hh.

References G4ErrorTrajState::fMomentum, G4ErrorTrajState::fPosition, and G4ErrorSurfaceTrajParam::SetParameters().

00105     {
00106       fPosition = pos;
00107       fMomentum = mom;
00108       fTrajParam.SetParameters( pos, mom, plane );
00109     }

void G4ErrorSurfaceTrajState::SetParameters ( const G4Point3D pos,
const G4Vector3D mom,
const G4Vector3D vecV,
const G4Vector3D vecW 
) [inline]

Definition at line 95 of file G4ErrorSurfaceTrajState.hh.

References G4ErrorTrajState::fMomentum, G4ErrorTrajState::fPosition, and G4ErrorSurfaceTrajParam::SetParameters().

Referenced by SetMomentum(), and SetPosition().

00097     {
00098       fPosition = pos;
00099       fMomentum = mom;
00100       fTrajParam.SetParameters( pos, mom, vecV, vecW );
00101     }

virtual void G4ErrorSurfaceTrajState::SetPosition ( const G4Point3D  pos  )  [inline, virtual]

Reimplemented from G4ErrorTrajState.

Definition at line 117 of file G4ErrorSurfaceTrajState.hh.

References G4ErrorTrajState::fMomentum, GetVectorV(), GetVectorW(), and SetParameters().

00118     { SetParameters( pos, fMomentum, GetVectorV(), GetVectorW() ); }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const G4ErrorSurfaceTrajState ts 
) [friend]

Definition at line 225 of file G4ErrorSurfaceTrajState.cc.

00226 {
00227   std::ios::fmtflags oldFlags = out.flags();
00228   out.setf(std::ios::fixed,std::ios::floatfield);
00229   
00230   ts.DumpPosMomError( out );
00231  
00232   out << " G4ErrorSurfaceTrajState: Params: " << ts.fTrajParam << G4endl;
00233   out.flags(oldFlags);
00234   return out;
00235 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:51:55 2013 for Geant4 by  doxygen 1.4.7