Geant4-11
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
G4ErrorSurfaceTrajState Class Reference

#include <G4ErrorSurfaceTrajState.hh>

Inheritance diagram for G4ErrorSurfaceTrajState:
G4ErrorTrajState

Public Member Functions

void BuildCharge ()
 
G4ErrorMatrix BuildErrorMatrix (G4ErrorFreeTrajState &tpSC, const G4Vector3D &vecV, const G4Vector3D &vecW)
 
virtual void Dump (std::ostream &out=G4cout) const
 
void DumpPosMomError (std::ostream &out=G4cout) const
 
 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)
 
G4double GetCharge () const
 
G4ErrorTrajErr GetError () const
 
G4Track * GetG4Track () const
 
G4Vector3D GetMomentum () const
 
G4ErrorSurfaceTrajParam GetParameters () const
 
const G4String & GetParticleType () const
 
G4Point3D GetPosition () const
 
virtual G4eTSType GetTSType () const
 
G4Vector3D GetVectorV () const
 
G4Vector3D GetVectorW () const
 
virtual G4int PropagateError (const G4Track *)
 
void SetCharge (G4double ch)
 
void SetData (const G4String &partType, const G4Point3D &pos, const G4Vector3D &mom)
 
virtual void SetError (G4ErrorTrajErr em)
 
void SetG4Track (G4Track *trk)
 
virtual void SetMomentum (const G4Vector3D &mom)
 
void SetParameters (const G4Point3D &pos, const G4Vector3D &mom, const G4Plane3D &plane)
 
void SetParameters (const G4Point3D &pos, const G4Vector3D &mom, const G4Vector3D &vecV, const G4Vector3D &vecW)
 
void SetParticleType (const G4String &partType)
 
virtual void SetPosition (const G4Point3D pos)
 
virtual G4int Update (const G4Track *)
 
void UpdatePosMom (const G4Point3D &pos, const G4Vector3D &mom)
 
 ~G4ErrorSurfaceTrajState ()
 

Protected Attributes

G4double fCharge = 0.
 
G4ErrorTrajErr fError
 
G4Vector3D fMomentum
 
G4String fParticleType
 
G4Point3D fPosition
 
G4int iverbose = 0
 
G4Track * theG4Track = nullptr
 
G4eTSType theTSType
 

Private Member Functions

void Init ()
 

Private Attributes

G4ErrorSurfaceTrajParam fTrajParam
 

Friends

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

Detailed Description

Definition at line 55 of file G4ErrorSurfaceTrajState.hh.

Constructor & Destructor Documentation

◆ G4ErrorSurfaceTrajState() [1/4]

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

Definition at line 56 of file G4ErrorSurfaceTrajState.cc.

61 : G4ErrorTrajState(partType, pos, mom, errmat)
62{
63 Init();
65}
static const G4double pos
G4ErrorSurfaceTrajParam fTrajParam

References fTrajParam, Init(), and pos.

◆ G4ErrorSurfaceTrajState() [2/4]

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 46 of file G4ErrorSurfaceTrajState.cc.

49 : G4ErrorTrajState(partType, pos, mom, errmat)
50{
51 Init();
52 fTrajParam = G4ErrorSurfaceTrajParam(pos, mom, vecU, vecV);
53}

References fTrajParam, Init(), and pos.

◆ G4ErrorSurfaceTrajState() [3/4]

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

Definition at line 68 of file G4ErrorSurfaceTrajState.cc.

71 tpSC.GetMomentum())
72{
73 // fParticleType = tpSC.GetParticleType();
74 // fPosition = tpSC.GetPosition();
75 // fMomentum = tpSC.GetMomentum();
77 Init();
78
79 //----- Get the error matrix in SC coordinates
81}
G4ErrorMatrix BuildErrorMatrix(G4ErrorFreeTrajState &tpSC, const G4Vector3D &vecV, const G4Vector3D &vecW)
G4Vector3D GetMomentum() const
const G4String & GetParticleType() const
G4Point3D GetPosition() const

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

◆ G4ErrorSurfaceTrajState() [4/4]

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

Definition at line 84 of file G4ErrorSurfaceTrajState.cc.

89 tpSC.GetMomentum())
90{
91 Init(); // needed to define charge sign
93 //----- Get the error matrix in SC coordinates
94 transfM = BuildErrorMatrix(tpSC, vecU, vecV);
95}

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

◆ ~G4ErrorSurfaceTrajState()

G4ErrorSurfaceTrajState::~G4ErrorSurfaceTrajState ( )
inline

Definition at line 78 of file G4ErrorSurfaceTrajState.hh.

78{}

Member Function Documentation

◆ BuildCharge()

void G4ErrorTrajState::BuildCharge ( )
inherited

Definition at line 138 of file G4ErrorTrajState.cc.

139{
141 G4ParticleDefinition* particle = particleTable->FindParticle(fParticleType);
142 if(particle == nullptr)
143 {
144 std::ostringstream message;
145 message << "Particle type not defined: " << fParticleType;
146 G4Exception("G4ErrorTrajState::BuildCharge()", "GEANT4e-error",
147 FatalException, message);
148 }
149 else
150 {
151 fCharge = particle->GetPDGCharge();
152 }
153}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
G4double GetPDGCharge() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()

References FatalException, G4ErrorTrajState::fCharge, G4ParticleTable::FindParticle(), G4ErrorTrajState::fParticleType, G4Exception(), G4ParticleTable::GetParticleTable(), and G4ParticleDefinition::GetPDGCharge().

Referenced by G4ErrorFreeTrajState::Init(), Init(), and G4ErrorTrajState::SetData().

◆ BuildErrorMatrix()

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

Definition at line 98 of file G4ErrorSurfaceTrajState.cc.

100{
101 G4double sclambda = tpSC.GetParameters().GetLambda();
102 G4double scphi = tpSC.GetParameters().GetPhi();
105 {
106 sclambda *= -1;
107 scphi += CLHEP::pi;
108 }
109 G4double cosLambda = std::cos(sclambda);
110 G4double sinLambda = std::sin(sclambda);
111 G4double sinPhi = std::sin(scphi);
112 G4double cosPhi = std::cos(scphi);
113
114#ifdef G4EVERBOSE
115 if(iverbose >= 4)
116 G4cout << " PM " << fMomentum.mag() << " pLambda " << sclambda << " pPhi "
117 << scphi << G4endl;
118#endif
119
120 G4ThreeVector vTN(cosLambda * cosPhi, cosLambda * sinPhi, sinLambda);
121 G4ThreeVector vUN(-sinPhi, cosPhi, 0.);
122 G4ThreeVector vVN(-vTN.z() * vUN.y(), vTN.z() * vUN.x(), cosLambda);
123
124#ifdef G4EVERBOSE
125 if(iverbose >= 4)
126 G4cout << " SC2SD: vTN " << vTN << " vUN " << vUN << " vVN " << vVN
127 << G4endl;
128#endif
129 G4double UJ = vUN * GetVectorV();
130 G4double UK = vUN * GetVectorW();
131 G4double VJ = vVN * GetVectorV();
132 G4double VK = vVN * GetVectorW();
133
134 //--- Get transformation first
135 G4ErrorMatrix transfM(5, 5, 0);
136 //--- Get magnetic field
140
141 G4Vector3D vectorU = GetVectorV().cross(GetVectorW());
142 G4double T1R = 1. / (vTN * vectorU);
143
144#ifdef G4EVERBOSE
145 if(iverbose >= 4)
146 G4cout << "surf vectors:U,V,W " << vectorU << " " << GetVectorV() << " "
147 << GetVectorW() << " T1R:" << T1R << G4endl;
148#endif
149
150 if(fCharge != 0 && field)
151 {
152 G4double pos[3];
153 pos[0] = fPosition.x() * cm;
154 pos[1] = fPosition.y() * cm;
155 pos[2] = fPosition.z() * cm;
156 G4double Hd[3];
157 field->GetFieldValue(pos, Hd);
158 G4ThreeVector H =
159 G4ThreeVector(Hd[0], Hd[1], Hd[2]) / tesla * 10.; // in kilogauus
160 G4double magH = H.mag();
161 G4double invP = 1. / (fMomentum.mag() / GeV);
162 G4double magHM = magH * invP;
163 if(magH != 0.)
164 {
165 G4double magHM2 = fCharge / magH;
166 G4double Q = -magHM * c_light / (km / ns);
167#ifdef G4EVERBOSE
168 if(iverbose >= 4)
169 G4cout << GeV << " Q " << Q << " magHM " << magHM << " c_light/(km/ns) "
170 << c_light / (km / ns) << G4endl;
171#endif
172
173 G4double sinz = -H * vUN * magHM2;
174 G4double cosz = H * vVN * magHM2;
175 G4double T3R = Q * std::pow(T1R, 3);
176 G4double UI = vUN * vectorU;
177 G4double VI = vVN * vectorU;
178#ifdef G4EVERBOSE
179 if(iverbose >= 4)
180 {
181 G4cout << " T1R " << T1R << " T3R " << T3R << G4endl;
182 G4cout << " UI " << UI << " VI " << VI << " vectorU " << vectorU
183 << G4endl;
184 G4cout << " UJ " << UJ << " VJ " << VJ << G4endl;
185 G4cout << " UK " << UK << " VK " << VK << G4endl;
186 }
187#endif
188
189 transfM[1][3] = -UI * (VK * cosz - UK * sinz) * T3R;
190 transfM[1][4] = -VI * (VK * cosz - UK * sinz) * T3R;
191 transfM[2][3] = UI * (VJ * cosz - UJ * sinz) * T3R;
192 transfM[2][4] = VI * (VJ * cosz - UJ * sinz) * T3R;
193 }
194 }
195
196 G4double T2R = T1R * T1R;
197 transfM[0][0] = 1.;
198 transfM[1][1] = -UK * T2R;
199 transfM[1][2] = VK * cosLambda * T2R;
200 transfM[2][1] = UJ * T2R;
201 transfM[2][2] = -VJ * cosLambda * T2R;
202 transfM[3][3] = VK * T1R;
203 transfM[3][4] = -UK * T1R;
204 transfM[4][3] = -VJ * T1R;
205 transfM[4][4] = UJ * T1R;
206
207#ifdef G4EVERBOSE
208 if(iverbose >= 4)
209 G4cout << " SC2SD transf matrix A= " << transfM << G4endl;
210#endif
211 fError = G4ErrorTrajErr(tpSC.GetError().similarity(transfM));
212
213#ifdef G4EVERBOSE
214 if(iverbose >= 1)
215 G4cout << "G4EP: error matrix SC2SD " << fError << G4endl;
216 if(iverbose >= 4)
217 G4cout << "G4ErrorSurfaceTrajState from SC " << *this << G4endl;
218#endif
219
220 return transfM; // want to use trasnfM for the reverse transform
221}
@ G4ErrorMode_PropBackwards
G4ErrorSymMatrix G4ErrorTrajErr
static constexpr double tesla
Definition: G4SIunits.hh:259
static constexpr double km
Definition: G4SIunits.hh:113
static constexpr double GeV
Definition: G4SIunits.hh:203
static constexpr double cm
Definition: G4SIunits.hh:99
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:83
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
double mag() const
G4double GetLambda() const
G4ErrorFreeTrajParam GetParameters() const
static G4ErrorPropagatorData * GetErrorPropagatorData()
G4ErrorSymMatrix similarity(const G4ErrorMatrix &m1) const
G4ErrorTrajErr fError
G4ErrorTrajErr GetError() const
const G4Field * GetDetectorField() const
virtual void GetFieldValue(const G4double Point[4], G4double *fieldArr) const =0
static G4TransportationManager * GetTransportationManager()
G4FieldManager * GetFieldManager() const
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
static constexpr double pi
Definition: SystemOfUnits.h:55
float c_light
Definition: hepunit.py:256
static double Q[]
#define ns
Definition: xmlparse.cc:614

References source.hepunit::c_light, cm, HepGeom::BasicVector3D< T >::cross(), 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(), GeV, G4ErrorTrajState::iverbose, km, HepGeom::BasicVector3D< T >::mag(), CLHEP::Hep3Vector::mag(), ns, CLHEP::pi, pos, Q, G4ErrorSymMatrix::similarity(), tesla, HepGeom::BasicVector3D< T >::x(), CLHEP::Hep3Vector::x(), HepGeom::BasicVector3D< T >::y(), CLHEP::Hep3Vector::y(), HepGeom::BasicVector3D< T >::z(), and CLHEP::Hep3Vector::z().

Referenced by G4ErrorSurfaceTrajState().

◆ Dump()

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

Implements G4ErrorTrajState.

Definition at line 231 of file G4ErrorSurfaceTrajState.cc.

231{ out << *this; }

◆ DumpPosMomError()

void G4ErrorTrajState::DumpPosMomError ( std::ostream &  out = G4cout) const
inherited

Definition at line 156 of file G4ErrorTrajState.cc.

157{
158 out << *this;
159}

◆ GetCharge()

G4double G4ErrorTrajState::GetCharge ( ) const
inlineinherited

Definition at line 117 of file G4ErrorTrajState.hh.

117{ return fCharge; }

References G4ErrorTrajState::fCharge.

◆ GetError()

G4ErrorTrajErr G4ErrorTrajState::GetError ( ) const
inlineinherited

Definition at line 111 of file G4ErrorTrajState.hh.

111{ return fError; }

References G4ErrorTrajState::fError.

Referenced by BuildErrorMatrix(), and G4ErrorFreeTrajState::G4ErrorFreeTrajState().

◆ GetG4Track()

G4Track * G4ErrorTrajState::GetG4Track ( ) const
inlineinherited

Definition at line 114 of file G4ErrorTrajState.hh.

114{ return theG4Track; }

References G4ErrorTrajState::theG4Track.

◆ GetMomentum()

G4Vector3D G4ErrorTrajState::GetMomentum ( ) const
inlineinherited

◆ GetParameters()

G4ErrorSurfaceTrajParam G4ErrorSurfaceTrajState::GetParameters ( ) const
inline

Definition at line 91 of file G4ErrorSurfaceTrajState.hh.

91{ return fTrajParam; }

References fTrajParam.

Referenced by G4ErrorFreeTrajState::G4ErrorFreeTrajState().

◆ GetParticleType()

const G4String & G4ErrorTrajState::GetParticleType ( ) const
inlineinherited

◆ GetPosition()

G4Point3D G4ErrorTrajState::GetPosition ( ) const
inlineinherited

◆ GetTSType()

virtual G4eTSType G4ErrorTrajState::GetTSType ( ) const
inlinevirtualinherited

◆ GetVectorV()

G4Vector3D G4ErrorSurfaceTrajState::GetVectorV ( ) const
inline

◆ GetVectorW()

G4Vector3D G4ErrorSurfaceTrajState::GetVectorW ( ) const
inline

◆ Init()

void G4ErrorSurfaceTrajState::Init ( )
private

◆ PropagateError()

G4int G4ErrorTrajState::PropagateError ( const G4Track *  )
virtualinherited

Reimplemented in G4ErrorFreeTrajState.

Definition at line 110 of file G4ErrorTrajState.cc.

111{
112 std::ostringstream message;
113 message << "Wrong trajectory state type !" << G4endl
114 << "Called for trajectory state type: " << G4int(GetTSType());
115 G4Exception("G4ErrorTrajState::PropagateError()", "GEANT4e-Error",
116 FatalException, message);
117 return -1;
118}
int G4int
Definition: G4Types.hh:85
virtual G4eTSType GetTSType() const

References FatalException, G4endl, G4Exception(), and G4ErrorTrajState::GetTSType().

◆ SetCharge()

void G4ErrorTrajState::SetCharge ( G4double  ch)
inlineinherited

Definition at line 118 of file G4ErrorTrajState.hh.

118{ fCharge = ch; }

References G4ErrorTrajState::fCharge.

◆ SetData()

void G4ErrorTrajState::SetData ( const G4String &  partType,
const G4Point3D &  pos,
const G4Vector3D &  mom 
)
inherited

◆ SetError()

virtual void G4ErrorTrajState::SetError ( G4ErrorTrajErr  em)
inlinevirtualinherited

Definition at line 112 of file G4ErrorTrajState.hh.

112{ fError = em; }

References G4ErrorTrajState::fError.

◆ SetG4Track()

void G4ErrorTrajState::SetG4Track ( G4Track *  trk)
inlineinherited

Definition at line 115 of file G4ErrorTrajState.hh.

115{ theG4Track = trk; }

References G4ErrorTrajState::theG4Track.

Referenced by G4ErrorPropagator::InitG4Track().

◆ SetMomentum()

virtual void G4ErrorSurfaceTrajState::SetMomentum ( const G4Vector3D &  mom)
inlinevirtual

Reimplemented from G4ErrorTrajState.

Definition at line 117 of file G4ErrorSurfaceTrajState.hh.

118 {
120 }
void SetParameters(const G4Point3D &pos, const G4Vector3D &mom, const G4Vector3D &vecV, const G4Vector3D &vecW)

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

◆ SetParameters() [1/2]

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

Definition at line 100 of file G4ErrorSurfaceTrajState.hh.

102 {
103 fPosition = pos;
104 fMomentum = mom;
105 fTrajParam.SetParameters(pos, mom, plane);
106 }
void SetParameters(const G4Point3D &pos, const G4Vector3D &mom, const G4Vector3D &vecV, const G4Vector3D &vecW)

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

◆ SetParameters() [2/2]

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

◆ SetParticleType()

void G4ErrorTrajState::SetParticleType ( const G4String &  partType)
inlineinherited

Definition at line 103 of file G4ErrorTrajState.hh.

103{ fParticleType = partType; }

References G4ErrorTrajState::fParticleType.

◆ SetPosition()

virtual void G4ErrorSurfaceTrajState::SetPosition ( const G4Point3D  pos)
inlinevirtual

Reimplemented from G4ErrorTrajState.

Definition at line 112 of file G4ErrorSurfaceTrajState.hh.

113 {
115 }

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

◆ Update()

virtual G4int G4ErrorTrajState::Update ( const G4Track *  )
inlinevirtualinherited

Reimplemented in G4ErrorFreeTrajState.

Definition at line 88 of file G4ErrorTrajState.hh.

88{ return -1; }

◆ UpdatePosMom()

void G4ErrorTrajState::UpdatePosMom ( const G4Point3D &  pos,
const G4Vector3D &  mom 
)
inherited

Definition at line 121 of file G4ErrorTrajState.cc.

122{
123 fPosition = pos;
124 fMomentum = mom;
125}

References G4ErrorTrajState::fMomentum, G4ErrorTrajState::fPosition, and pos.

Referenced by G4ErrorFreeTrajState::Update().

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 234 of file G4ErrorSurfaceTrajState.cc.

235{
236 std::ios::fmtflags oldFlags = out.flags();
237 out.setf(std::ios::fixed, std::ios::floatfield);
238
239 ts.DumpPosMomError(out);
240
241 out << " G4ErrorSurfaceTrajState: Params: " << ts.fTrajParam << G4endl;
242 out.flags(oldFlags);
243 return out;
244}

Field Documentation

◆ fCharge

G4double G4ErrorTrajState::fCharge = 0.
protectedinherited

◆ fError

G4ErrorTrajErr G4ErrorTrajState::fError
protectedinherited

◆ fMomentum

G4Vector3D G4ErrorTrajState::fMomentum
protectedinherited

◆ fParticleType

G4String G4ErrorTrajState::fParticleType
protectedinherited

◆ fPosition

G4Point3D G4ErrorTrajState::fPosition
protectedinherited

◆ fTrajParam

G4ErrorSurfaceTrajParam G4ErrorSurfaceTrajState::fTrajParam
private

◆ iverbose

G4int G4ErrorTrajState::iverbose = 0
protectedinherited

◆ theG4Track

G4Track* G4ErrorTrajState::theG4Track = nullptr
protectedinherited

◆ theTSType

G4eTSType G4ErrorTrajState::theTSType
protectedinherited

The documentation for this class was generated from the following files: