Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FieldTrack.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// G4FieldTrack
27//
28// Class description:
29//
30// Data structure bringing together a magnetic track's state
31// (position, momentum direction & modulus, energy, spin, ... ).
32// Uses/abilities:
33// - does not maintain any relationship between its data (eg energy/momentum).
34// - for use in Runge-Kutta solver (in passing it the values right now).
35
36// Author: John Apostolakis (CERN), 14.10.1996 - First version
37// -------------------------------------------------------------------
38#ifndef G4FIELDTRACK_HH
39#define G4FIELDTRACK_HH
40
41#include "G4ThreeVector.hh"
42#include "G4ChargeState.hh"
43
44/**
45 * @brief G4FieldTrack defines a data structure bringing together a magnetic
46 * track's state (position, momentum direction & modulus, energy, spin, etc. ).
47 */
48
50{
51 public:
52
53 /**
54 * Constructor for G4FieldTrack.
55 * @param[in] pPosition Position in Cartesian coordinates.
56 * @param[in] LaboratoryTimeOfFlight Laboratory time of flight value.
57 * @param[in] pMomentumDirection Direction vector.
58 * @param[in] kineticEnergy Kinetic energy value.
59 * @param[in] restMass_c2 Mass at rest.
60 * @param[in] charge Charge.
61 * @param[in] polarization Polarisation vector.
62 * @param[in] magnetic_dipole_moment Magnetic dipole moment.
63 * @param[in] curve_length Length of curve.
64 * @param[in] PDGspin Spin.
65 */
66 G4FieldTrack( const G4ThreeVector& pPosition,
67 G4double LaboratoryTimeOfFlight,
68 const G4ThreeVector& pMomentumDirection,
69 G4double kineticEnergy,
70 G4double restMass_c2,
71 G4double charge,
72 const G4ThreeVector& polarization,
73 G4double magnetic_dipole_moment = 0.0,
74 G4double curve_length = 0.0,
75 G4double PDGspin = -1.0 );
76
77 /**
78 * Older constructor for G4FieldTrack, similar to above but missing charge.
79 * @param[in] pPosition Position in Cartesian coordinates.
80 * @param[in] pMomentumDirection Direction vector.
81 * @param[in] curve_length Length of curve.
82 * @param[in] kineticEnergy Kinetic energy value.
83 * @param[in] restMass_c2 Mass at rest.
84 * @param[in] velocity Velocity value - Not used.
85 * @param[in] LaboratoryTimeOfFlight Laboratory time of flight value.
86 * @param[in] ProperTimeOfFlight Proper time of flight value.
87 * @param[in] polarization Polarisation vector.
88 * @param[in] PDGspin Spin.
89 */
90 G4FieldTrack( const G4ThreeVector& pPosition,
91 const G4ThreeVector& pMomentumDirection,
92 G4double curve_length,
93 G4double kineticEnergy,
94 const G4double restMass_c2,
95 G4double velocity,
96 G4double LaboratoryTimeOfFlight = 0.0,
97 G4double ProperTimeOfFlight = 0.0,
98 const G4ThreeVector* pPolarization = nullptr,
99 G4double PDGspin = -1.0 );
100
101 /**
102 * Empty init constructor.
103 */
104 G4FieldTrack( char );
105
106 /**
107 * Default Destructor.
108 */
109 ~G4FieldTrack() = default;
110
111 /**
112 * Copy constructor and assignment operator.
113 */
114 inline G4FieldTrack( const G4FieldTrack& pFieldTrack );
115 inline G4FieldTrack& operator= ( const G4FieldTrack& rStVec );
116
117 /**
118 * Move constructor and move assignment operator.
119 */
120 inline G4FieldTrack(G4FieldTrack&& from) noexcept ;
121 inline G4FieldTrack& operator=(G4FieldTrack&& from) noexcept ;
122
123 /**
124 * Streaming operator.
125 */
126 friend std::ostream& operator<<(std::ostream& os, const G4FieldTrack& SixVec);
127
128 /**
129 * Updates four-vectors for space/time and momentum/energy, also
130 * resets the curve length.
131 * @param[in] pPosition Position in Cartesian coordinates.
132 * @param[in] LaboratoryTimeOfFlight Laboratory time of flight value.
133 * @param[in] pMomentumDirection Direction vector.
134 * @param[in] kineticEnergy Kinetic energy value.
135 */
136 inline void UpdateState( const G4ThreeVector& pPosition,
137 G4double LaboratoryTimeOfFlight,
138 const G4ThreeVector& pMomentumDirection,
139 G4double kineticEnergy);
140
141 /**
142 * Updates momentum, direction and kinetic energy.
143 * @param[in] kineticEnergy Kinetic energy value.
144 * @param[in] pMomentumDirection Direction vector.
145 */
146 inline void UpdateFourMomentum( G4double kineticEnergy,
147 const G4ThreeVector& momentumDirection );
148
149 /**
150 * Sets the charges and moments that are not given as DBL_MAX.
151 * @param[in] charge Charge value.
152 * @param[in] magnetic_dipole_moment M agnetic dipole moment.
153 * @param[in] electric_dipole_moment Electric dipole moment.
154 * @param[in] magnetic_charge Magnetic charge.
155 */
156 void SetChargeAndMoments(G4double charge,
157 G4double magnetic_dipole_moment = DBL_MAX,
158 G4double electric_dipole_moment = DBL_MAX,
159 G4double magnetic_charge = DBL_MAX );
160
161 /**
162 * Setter and getter for PDG spin.
163 */
164 inline void SetPDGSpin(G4double pdgSpin);
166
167 /**
168 * Accessors.
169 */
170 inline G4ThreeVector GetMomentum() const;
171 inline G4ThreeVector GetPosition() const;
172 inline const G4ThreeVector& GetMomentumDir() const;
174 inline G4double GetCurveLength() const;
175 inline const G4ChargeState* GetChargeState() const;
179 inline G4double GetCharge() const;
180 inline G4double GetRestMass() const;
181
182 /**
183 * Getter and setter for polarisation.
184 */
186 inline void SetPolarization( const G4ThreeVector& vecPol );
187
188 /**
189 * Setters for momentum. SetMomentumDir() does not change momentum
190 * or Velocity Vector.
191 */
192 inline void SetMomentum(const G4ThreeVector& nMomDir);
193 inline void SetMomentumDir(const G4ThreeVector& nMomDir);
194
195 /**
196 * Modifiers.
197 */
198 inline void SetPosition(const G4ThreeVector& nPos);
199 inline void SetRestMass(G4double Mass_c2);
200 inline void SetCurveLength(G4double nCurve_s); // Distance along curve.
201 inline void SetKineticEnergy(G4double nEnergy); // Does not modify momentum.
202 inline void SetLabTimeOfFlight(G4double tofLab);
203 inline void SetProperTimeOfFlight(G4double tofProper);
204
205 enum { ncompSVEC = 12 }; // Needed; should be used only for RK integration driver
206
207 /**
208 * Dumps/loads values to/from a provided array 'valArray'.
209 */
210 inline void DumpToArray(G4double valArr[ncompSVEC]) const;
211 void LoadFromArray(const G4double valArr[ncompSVEC],
212 G4int noVarsIntegrated);
213
214 /**
215 * More setters/getter foe spin, now obsolete.
216 */
217 inline void InitialiseSpin( const G4ThreeVector& vecPolarization );
218 inline G4ThreeVector GetSpin() const;
219 inline void SetSpin(const G4ThreeVector& vSpin);
220
221 private:
222
223 /**
224 * Implementation method. Obsolete.
225 */
226 inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
227 const G4ThreeVector& pMomentum,
228 G4double s_curve );
229 private:
230
231 G4double SixVector[6];
232 G4double fDistanceAlongCurve; // distance along curve of point
233 G4double fKineticEnergy;
234 G4double fRestMass_c2;
235 G4double fLabTimeOfFlight;
236 G4double fProperTimeOfFlight;
237 G4ThreeVector fPolarization;
238 G4ThreeVector fMomentumDir;
239 G4ChargeState fChargeState;
240};
241
242#include "G4FieldTrack.icc"
243
244#endif
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
G4ChargeState is a container for magnetic charge and moments.
const G4ThreeVector & GetMomentumDir() const
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)
G4double GetPDGSpin()
G4FieldTrack(const G4FieldTrack &pFieldTrack)
void SetProperTimeOfFlight(G4double tofProper)
~G4FieldTrack()=default
void UpdateFourMomentum(G4double kineticEnergy, const G4ThreeVector &momentumDirection)
G4FieldTrack & operator=(const G4FieldTrack &rStVec)
const G4ChargeState * GetChargeState() const
G4double GetCurveLength() const
G4ThreeVector GetPolarization() const
G4ThreeVector GetMomentumDirection() const
void SetMomentum(const G4ThreeVector &nMomDir)
void SetPolarization(const G4ThreeVector &vecPol)
G4double GetProperTimeOfFlight() const
void SetPosition(const G4ThreeVector &nPos)
void SetLabTimeOfFlight(G4double tofLab)
void SetPDGSpin(G4double pdgSpin)
G4double GetCharge() const
void SetCurveLength(G4double nCurve_s)
void SetChargeAndMoments(G4double charge, G4double magnetic_dipole_moment=DBL_MAX, G4double electric_dipole_moment=DBL_MAX, G4double magnetic_charge=DBL_MAX)
G4double GetKineticEnergy() const
G4ThreeVector GetPosition() const
void SetMomentumDir(const G4ThreeVector &nMomDir)
G4FieldTrack(G4FieldTrack &&from) noexcept
G4double GetRestMass() const
G4ThreeVector GetSpin() const
void UpdateState(const G4ThreeVector &pPosition, G4double LaboratoryTimeOfFlight, const G4ThreeVector &pMomentumDirection, G4double kineticEnergy)
void SetSpin(const G4ThreeVector &vSpin)
void DumpToArray(G4double valArr[ncompSVEC]) const
void SetRestMass(G4double Mass_c2)
G4double GetLabTimeOfFlight() const
void LoadFromArray(const G4double valArr[ncompSVEC], G4int noVarsIntegrated)
G4FieldTrack & operator=(G4FieldTrack &&from) noexcept
void InitialiseSpin(const G4ThreeVector &vecPolarization)
void SetKineticEnergy(G4double nEnergy)
friend std::ostream & operator<<(std::ostream &os, const G4FieldTrack &SixVec)
G4ThreeVector GetMomentum() const
#define DBL_MAX
Definition templates.hh:62