00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "G4ErrorTrajState.hh"
00034 #include "G4ParticleTable.hh"
00035 #include "G4ParticleDefinition.hh"
00036 #include "G4ErrorPropagatorData.hh"
00037
00038 #include <iomanip>
00039
00040
00041 G4ErrorTrajState::G4ErrorTrajState( const G4String& partType,
00042 const G4Point3D& pos,
00043 const G4Vector3D& mom,
00044 const G4ErrorTrajErr& errmat)
00045 : fParticleType(partType), fPosition(pos), fMomentum(mom), fCharge(0.),
00046 fError(errmat), theTSType(G4eTS_FREE), theG4Track(0)
00047 {
00048 iverbose = G4ErrorPropagatorData::verbose();
00049 }
00050
00051
00052
00053 G4int G4ErrorTrajState::PropagateError( const G4Track* )
00054 {
00055 G4cerr << "ERROR - G4ErrorTrajState::PropagateError()" << G4endl
00056 << " Called for trajectory state type "
00057 << G4int(GetTSType()) << G4endl;
00058 G4Exception("G4ErrorTrajState::PropagateError", "GEANT4e-Error",
00059 FatalException, "Wrong trajectory state type");
00060 return -1;
00061 }
00062
00063
00064
00065 void G4ErrorTrajState::UpdatePosMom( const G4Point3D& pos,
00066 const G4Vector3D& mom )
00067 {
00068 fPosition = pos;
00069 fMomentum = mom;
00070 }
00071
00072
00073
00074 void G4ErrorTrajState::SetData( const G4String& partType,
00075 const G4Point3D& pos, const G4Vector3D& mom )
00076 {
00077 fParticleType = partType;
00078 BuildCharge();
00079 fPosition = pos;
00080 fMomentum = mom;
00081 }
00082
00083
00084
00085 void G4ErrorTrajState::BuildCharge()
00086 {
00087 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
00088 G4ParticleDefinition* particle = particleTable->FindParticle(fParticleType);
00089 if( particle == 0)
00090 {
00091 G4cerr << "ERROR - G4ErrorTrajState::BuildCharge()" << G4endl
00092 << " Particle type not defined: " << fParticleType << G4endl;
00093 G4Exception( "G4ErrorTrajState::BuildCharge()", "GEANT4e-error",
00094 FatalException, "Particle type not defined!");
00095 }
00096 else
00097 {
00098 fCharge = particle->GetPDGCharge();
00099 }
00100 }
00101
00102
00103
00104 void G4ErrorTrajState::DumpPosMomError( std::ostream& out ) const
00105 {
00106 out << *this;
00107 }
00108
00109
00110
00111 std::ostream& operator<<(std::ostream& out, const G4ErrorTrajState& ts)
00112 {
00113
00114 out
00115 << " G4ErrorTrajState of type " << ts.theTSType << " : partycle: "
00116 << ts.fParticleType << " position: " << std::setw(6) << ts.fPosition
00117 << " momentum: " << ts.fMomentum
00118 << " error matrix ";
00119 G4cout << ts.fError << G4endl;
00120
00121 return out;
00122 }
00123