Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FieldTrack Class Reference

G4FieldTrack defines a data structure bringing together a magnetic track's state (position, momentum direction & modulus, energy, spin, etc. ). More...

#include <G4FieldTrack.hh>

Public Types

enum  { ncompSVEC = 12 }

Public Member Functions

 G4FieldTrack (const G4ThreeVector &pPosition, G4double LaboratoryTimeOfFlight, const G4ThreeVector &pMomentumDirection, G4double kineticEnergy, G4double restMass_c2, G4double charge, const G4ThreeVector &polarization, G4double magnetic_dipole_moment=0.0, G4double curve_length=0.0, G4double PDGspin=-1.0)
 G4FieldTrack (const G4ThreeVector &pPosition, const G4ThreeVector &pMomentumDirection, G4double curve_length, G4double kineticEnergy, const G4double restMass_c2, G4double velocity, G4double LaboratoryTimeOfFlight=0.0, G4double ProperTimeOfFlight=0.0, const G4ThreeVector *pPolarization=nullptr, G4double PDGspin=-1.0)
 G4FieldTrack (char)
 ~G4FieldTrack ()=default
 G4FieldTrack (const G4FieldTrack &pFieldTrack)
G4FieldTrackoperator= (const G4FieldTrack &rStVec)
 G4FieldTrack (G4FieldTrack &&from) noexcept
G4FieldTrackoperator= (G4FieldTrack &&from) noexcept
void UpdateState (const G4ThreeVector &pPosition, G4double LaboratoryTimeOfFlight, const G4ThreeVector &pMomentumDirection, G4double kineticEnergy)
void UpdateFourMomentum (G4double kineticEnergy, const G4ThreeVector &momentumDirection)
void SetChargeAndMoments (G4double charge, G4double magnetic_dipole_moment=DBL_MAX, G4double electric_dipole_moment=DBL_MAX, G4double magnetic_charge=DBL_MAX)
void SetPDGSpin (G4double pdgSpin)
G4double GetPDGSpin ()
G4ThreeVector GetMomentum () const
G4ThreeVector GetPosition () const
const G4ThreeVectorGetMomentumDir () const
G4ThreeVector GetMomentumDirection () const
G4double GetCurveLength () const
const G4ChargeStateGetChargeState () const
G4double GetLabTimeOfFlight () const
G4double GetProperTimeOfFlight () const
G4double GetKineticEnergy () const
G4double GetCharge () const
G4double GetRestMass () const
G4ThreeVector GetPolarization () const
void SetPolarization (const G4ThreeVector &vecPol)
void SetMomentum (const G4ThreeVector &nMomDir)
void SetMomentumDir (const G4ThreeVector &nMomDir)
void SetPosition (const G4ThreeVector &nPos)
void SetRestMass (G4double Mass_c2)
void SetCurveLength (G4double nCurve_s)
void SetKineticEnergy (G4double nEnergy)
void SetLabTimeOfFlight (G4double tofLab)
void SetProperTimeOfFlight (G4double tofProper)
void DumpToArray (G4double valArr[ncompSVEC]) const
void LoadFromArray (const G4double valArr[ncompSVEC], G4int noVarsIntegrated)
void InitialiseSpin (const G4ThreeVector &vecPolarization)
G4ThreeVector GetSpin () const
void SetSpin (const G4ThreeVector &vSpin)

Friends

std::ostream & operator<< (std::ostream &os, const G4FieldTrack &SixVec)

Detailed Description

G4FieldTrack defines a data structure bringing together a magnetic track's state (position, momentum direction & modulus, energy, spin, etc. ).

Definition at line 49 of file G4FieldTrack.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ncompSVEC 

Definition at line 205 of file G4FieldTrack.hh.

205{ ncompSVEC = 12 }; // Needed; should be used only for RK integration driver

Constructor & Destructor Documentation

◆ G4FieldTrack() [1/5]

G4FieldTrack::G4FieldTrack ( const G4ThreeVector & pPosition,
G4double LaboratoryTimeOfFlight,
const G4ThreeVector & pMomentumDirection,
G4double kineticEnergy,
G4double restMass_c2,
G4double charge,
const G4ThreeVector & polarization,
G4double magnetic_dipole_moment = 0.0,
G4double curve_length = 0.0,
G4double PDGspin = -1.0 )

Constructor for G4FieldTrack.

Parameters
[in]pPositionPosition in Cartesian coordinates.
[in]LaboratoryTimeOfFlightLaboratory time of flight value.
[in]pMomentumDirectionDirection vector.
[in]kineticEnergyKinetic energy value.
[in]restMass_c2Mass at rest.
[in]chargeCharge.
[in]polarizationPolarisation vector.
[in]magnetic_dipole_momentMagnetic dipole moment.
[in]curve_lengthLength of curve.
[in]PDGspinSpin.

Definition at line 81 of file G4FieldTrack.cc.

91: fDistanceAlongCurve(curve_length),
92 fKineticEnergy(kineticEnergy),
93 fRestMass_c2(restMass_c2),
94 fLabTimeOfFlight(LaboratoryTimeOfFlight),
95 fProperTimeOfFlight(0.),
96 fChargeState( charge, magnetic_dipole_moment, pdgSpin )
97{
98 UpdateFourMomentum( kineticEnergy, pMomentumDirection );
99 // Sets momentum direction as well.
100
101 SetPosition( pPosition );
102 SetPolarization( vecPolarization );
103}
void UpdateFourMomentum(G4double kineticEnergy, const G4ThreeVector &momentumDirection)
void SetPolarization(const G4ThreeVector &vecPol)
void SetPosition(const G4ThreeVector &nPos)

Referenced by G4FieldTrack(), G4FieldTrack(), operator<<, operator=(), operator=(), and SetSpin().

◆ G4FieldTrack() [2/5]

G4FieldTrack::G4FieldTrack ( const G4ThreeVector & pPosition,
const G4ThreeVector & pMomentumDirection,
G4double curve_length,
G4double kineticEnergy,
const G4double restMass_c2,
G4double velocity,
G4double LaboratoryTimeOfFlight = 0.0,
G4double ProperTimeOfFlight = 0.0,
const G4ThreeVector * pPolarization = nullptr,
G4double PDGspin = -1.0 )

Older constructor for G4FieldTrack, similar to above but missing charge.

Parameters
[in]pPositionPosition in Cartesian coordinates.
[in]pMomentumDirectionDirection vector.
[in]curve_lengthLength of curve.
[in]kineticEnergyKinetic energy value.
[in]restMass_c2Mass at rest.
[in]velocityVelocity value - Not used.
[in]LaboratoryTimeOfFlightLaboratory time of flight value.
[in]ProperTimeOfFlightProper time of flight value.
[in]polarizationPolarisation vector.
[in]PDGspinSpin.

Definition at line 105 of file G4FieldTrack.cc.

115 : fDistanceAlongCurve(curve_length),
116 fKineticEnergy(kineticEnergy),
117 fRestMass_c2(restMass_c2),
118 fLabTimeOfFlight(pLaboratoryTimeOfFlight),
119 fProperTimeOfFlight(pProperTimeOfFlight),
120 fChargeState( DBL_MAX, DBL_MAX, -1.0 ) // charge not set
121{
122 UpdateFourMomentum( kineticEnergy, pMomentumDirection );
123 // Sets momentum direction as well.
124
125 SetPosition( pPosition );
126 fChargeState.SetPDGSpin( pdgSpin );
127
128 G4ThreeVector PolarVec(0.0, 0.0, 0.0);
129 if( pPolarization != nullptr ) { PolarVec= *pPolarization; }
130 SetPolarization( PolarVec );
131}
CLHEP::Hep3Vector G4ThreeVector
#define DBL_MAX
Definition templates.hh:62

◆ G4FieldTrack() [3/5]

G4FieldTrack::G4FieldTrack ( char )

Empty init constructor.

Definition at line 133 of file G4FieldTrack.cc.

134 : fKineticEnergy(0.), fRestMass_c2(0.), fLabTimeOfFlight(0.),
135 fProperTimeOfFlight(0.), fChargeState( DBL_MAX , DBL_MAX, -1 )
136{
137 G4ThreeVector Zero(0.0, 0.0, 0.0);
138 SetCurvePnt( Zero, Zero, 0.0 );
139 SetPolarization( Zero );
140}

◆ ~G4FieldTrack()

G4FieldTrack::~G4FieldTrack ( )
default

Default Destructor.

◆ G4FieldTrack() [4/5]

G4FieldTrack::G4FieldTrack ( const G4FieldTrack & pFieldTrack)
inline

Copy constructor and assignment operator.

◆ G4FieldTrack() [5/5]

G4FieldTrack::G4FieldTrack ( G4FieldTrack && from)
inlinenoexcept

Move constructor and move assignment operator.

Member Function Documentation

◆ DumpToArray()

◆ GetCharge()

G4double G4FieldTrack::GetCharge ( ) const
inline

◆ GetChargeState()

const G4ChargeState * G4FieldTrack::GetChargeState ( ) const
inline

◆ GetCurveLength()

◆ GetKineticEnergy()

◆ GetLabTimeOfFlight()

◆ GetMomentum()

◆ GetMomentumDir()

◆ GetMomentumDirection()

◆ GetPDGSpin()

G4double G4FieldTrack::GetPDGSpin ( )
inline

◆ GetPolarization()

G4ThreeVector G4FieldTrack::GetPolarization ( ) const
inline

Getter and setter for polarisation.

Referenced by operator<<.

◆ GetPosition()

◆ GetProperTimeOfFlight()

G4double G4FieldTrack::GetProperTimeOfFlight ( ) const
inline

◆ GetRestMass()

◆ GetSpin()

◆ InitialiseSpin()

void G4FieldTrack::InitialiseSpin ( const G4ThreeVector & vecPolarization)
inline

More setters/getter foe spin, now obsolete.

◆ LoadFromArray()

void G4FieldTrack::LoadFromArray ( const G4double valArr[ncompSVEC],
G4int noVarsIntegrated )

Definition at line 170 of file G4FieldTrack.cc.

172{
173 // Fill the variables not integrated with zero -- so it's clear !!
174 //
175 G4double valArr[ncompSVEC];
176 for(G4int i=0; i<noVarsIntegrated; ++i)
177 {
178 valArr[i] = valArrIn[i];
179 }
180 for(G4int i=noVarsIntegrated; i<ncompSVEC; ++i)
181 {
182 valArr[i] = 0.0;
183 }
184
185 SixVector[0] = valArr[0];
186 SixVector[1] = valArr[1];
187 SixVector[2] = valArr[2];
188 SixVector[3] = valArr[3];
189 SixVector[4] = valArr[4];
190 SixVector[5] = valArr[5];
191
192 G4ThreeVector Momentum(valArr[3],valArr[4],valArr[5]);
193
194 G4double momentum_square= Momentum.mag2();
195 fMomentumDir= Momentum.unit();
196
197 fKineticEnergy = momentum_square
198 / (std::sqrt(momentum_square+fRestMass_c2*fRestMass_c2)
199 + fRestMass_c2 );
200 // The above equation is stable for small and large momenta
201
202 // The following components may or may not be
203 // integrated over -- integration is optional
204 // fKineticEnergy = valArr[6];
205
206 fLabTimeOfFlight = valArr[7];
207 fProperTimeOfFlight = valArr[8];
208 G4ThreeVector vecPolarization= G4ThreeVector(valArr[9],valArr[10],valArr[11]);
209 SetPolarization( vecPolarization );
210
211 // fMomentumDir=G4ThreeVector(valArr[13],valArr[14],valArr[15]);
212 // fDistanceAlongCurve= valArr[];
213}
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85

Referenced by G4BorisDriver::AccurateAdvance(), G4MagInt_Driver::AccurateAdvance(), G4OldMagIntDriver::AccurateAdvance(), G4DriverReporter::PrintStatus(), G4MagInt_Driver::PrintStatus(), G4OldMagIntDriver::PrintStatus(), G4BorisDriver::QuickAdvance(), G4MagInt_Driver::QuickAdvance(), and G4OldMagIntDriver::QuickAdvance().

◆ operator=() [1/2]

G4FieldTrack & G4FieldTrack::operator= ( const G4FieldTrack & rStVec)
inline

◆ operator=() [2/2]

G4FieldTrack & G4FieldTrack::operator= ( G4FieldTrack && from)
inlinenoexcept

◆ SetChargeAndMoments()

void G4FieldTrack::SetChargeAndMoments ( G4double charge,
G4double magnetic_dipole_moment = DBL_MAX,
G4double electric_dipole_moment = DBL_MAX,
G4double magnetic_charge = DBL_MAX )

Sets the charges and moments that are not given as DBL_MAX.

Parameters
[in]chargeCharge value.
[in]magnetic_dipole_momentM agnetic dipole moment.
[in]electric_dipole_momentElectric dipole moment.
[in]magnetic_chargeMagnetic charge.

Definition at line 142 of file G4FieldTrack.cc.

147{
148 fChargeState.SetChargesAndMoments( charge,
149 magnetic_dipole_moment,
150 electric_dipole_moment,
151 magnetic_charge );
152
153 // NOTE: Leaves Spin unchanged !
154 //
155 // G4double pdgSpin= fChargeState.GetSpin();
156 // New Property of ChargeState (not well documented! )
157
158 // IDEA: Improve the implementation using handles
159 // -- and handle to the old one (which can be shared by other copies) and
160 // must not be left to hang loose
161 //
162 // fpChargeState= new G4ChargeState( charge, magnetic_dipole_moment,
163 // electric_dipole_moment, magnetic_charge );
164}

Referenced by G4FieldTrackUpdator::Update().

◆ SetCurveLength()

◆ SetKineticEnergy()

void G4FieldTrack::SetKineticEnergy ( G4double nEnergy)
inline

◆ SetLabTimeOfFlight()

void G4FieldTrack::SetLabTimeOfFlight ( G4double tofLab)
inline

◆ SetMomentum()

void G4FieldTrack::SetMomentum ( const G4ThreeVector & nMomDir)
inline

Setters for momentum. SetMomentumDir() does not change momentum or Velocity Vector.

Referenced by G4MultiLevelLocator::EstimateIntersectionPoint().

◆ SetMomentumDir()

void G4FieldTrack::SetMomentumDir ( const G4ThreeVector & nMomDir)
inline

◆ SetPDGSpin()

void G4FieldTrack::SetPDGSpin ( G4double pdgSpin)
inline

Setter and getter for PDG spin.

Referenced by G4FieldTrackUpdator::Update().

◆ SetPolarization()

void G4FieldTrack::SetPolarization ( const G4ThreeVector & vecPol)
inline

◆ SetPosition()

◆ SetProperTimeOfFlight()

void G4FieldTrack::SetProperTimeOfFlight ( G4double tofProper)
inline

◆ SetRestMass()

void G4FieldTrack::SetRestMass ( G4double Mass_c2)
inline

◆ SetSpin()

void G4FieldTrack::SetSpin ( const G4ThreeVector & vSpin)
inline

◆ UpdateFourMomentum()

void G4FieldTrack::UpdateFourMomentum ( G4double kineticEnergy,
const G4ThreeVector & momentumDirection )
inline

Updates momentum, direction and kinetic energy.

Parameters
[in]kineticEnergyKinetic energy value.
[in]pMomentumDirectionDirection vector.

Referenced by G4FieldTrack(), and G4FieldTrack().

◆ UpdateState()

void G4FieldTrack::UpdateState ( const G4ThreeVector & pPosition,
G4double LaboratoryTimeOfFlight,
const G4ThreeVector & pMomentumDirection,
G4double kineticEnergy )
inline

Updates four-vectors for space/time and momentum/energy, also resets the curve length.

Parameters
[in]pPositionPosition in Cartesian coordinates.
[in]LaboratoryTimeOfFlightLaboratory time of flight value.
[in]pMomentumDirectionDirection vector.
[in]kineticEnergyKinetic energy value.

Referenced by G4FieldTrackUpdator::Update().

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const G4FieldTrack & SixVec )
friend

Streaming operator.

Definition at line 33 of file G4FieldTrack.cc.

34{
35 const G4double* SixV = SixVec.SixVector;
36 const G4int precPos= 9; // For position
37 const G4int precEp= 9; // For Energy / momentum
38 const G4int precLen= 12; // For Length along track
39 const G4int precSpin= 9; // For polarisation
40 const G4int precTime= 6; // For time of flight
41 const G4long oldpr= os.precision(precPos);
42 os << " ( ";
43 os << " X= " << SixV[0] << " " << SixV[1] << " "
44 << SixV[2] << " "; // Position
45 os.precision(precEp);
46 os << " P= " << SixV[3] << " " << SixV[4] << " "
47 << SixV[5] << " "; // Momentum
48 os << " Pmag= "
49 << G4ThreeVector(SixV[3], SixV[4], SixV[5]).mag(); // mom magnitude
50 os << " Ekin= " << SixVec.fKineticEnergy ;
51 os.precision(precLen);
52 os << " l= " << SixVec.GetCurveLength();
53 os.precision(6);
54 os << " m0= " << SixVec.fRestMass_c2;
55 os << " (Pdir-1)= " << SixVec.fMomentumDir.mag()-1.0;
56 if( SixVec.fLabTimeOfFlight > 0.0 )
57 {
58 os.precision(precTime);
59 }
60 else
61 {
62 os.precision(3);
63 }
64 os << " t_lab= " << SixVec.fLabTimeOfFlight;
65 os << " t_proper= " << SixVec.fProperTimeOfFlight ;
66 G4ThreeVector pol= SixVec.GetPolarization();
67 if( pol.mag2() > 0.0 )
68 {
69 os.precision(precSpin);
70 os << " PolV= " << pol; // SixVec.GetPolarization();
71 }
72 else
73 {
74 os << " PolV= (0,0,0) ";
75 }
76 os << " ) ";
77 os.precision(oldpr);
78 return os;
79}
long G4long
Definition G4Types.hh:87
double mag2() const
double mag() const
G4double GetCurveLength() const
G4ThreeVector GetPolarization() const

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