Geant4 9.6.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//
27// $Id$
28//
29//
30// class G4FieldTrack
31//
32// Class description:
33//
34// Data structure bringing together a magnetic track's state.
35// (position, momentum direction & modulus, energy, spin, ... )
36// Uses/abilities:
37// - does not maintain any relationship between its data (eg energy/momentum).
38// - for use in Runge-Kutta solver (in passing it the values right now).
39
40// History
41// - First version: Oct 14, 1996 John Apostolakis
42// - Modified: Oct 24, 1996 JA: Added dist_on_curve, deleted constructor
43// Nov 5, 1998 JA: Added energy, momentum, TOF, spin &
44// several constructor, access, set methods
45// May 10, 2006 JA: Added charge, "default" constructor
46// -------------------------------------------------------------------
47
48#ifndef G4FieldTrack_HH
49#define G4FieldTrack_HH
50
51#include "G4ThreeVector.hh"
52
54{
55 public: // with description
56
57 G4FieldTrack( const G4ThreeVector& pPosition,
58 G4double LaboratoryTimeOfFlight,
59 const G4ThreeVector& pMomentumDirection,
60 G4double kineticEnergy,
61 G4double restMass_c2,
62 G4double charge,
63 const G4ThreeVector& pSpin,
64 G4double magnetic_dipole_moment= 0.0,
65 G4double curve_length= 0.0
66 );
67 G4FieldTrack( const G4FieldTrack& pFieldTrack );
68 G4FieldTrack( char ); // Almost default constructor
69
71 // End of preferred Constructors / Destructor
72
73 inline void
74 UpdateState( const G4ThreeVector& pPosition,
75 G4double LaboratoryTimeOfFlight,
76 const G4ThreeVector& pMomentumDirection,
77 G4double kineticEnergy);
78 // Update four-vectors for space/time and momentum/energy
79 // Also resets curve length.
80 inline
81 void UpdateFourMomentum( G4double kineticEnergy,
82 const G4ThreeVector& momentumDirection );
83 // Update momentum (and direction), and kinetic energy
84
85 void SetChargeAndMoments(G4double charge,
86 G4double magnetic_dipole_moment= DBL_MAX,
87 G4double electric_dipole_moment= DBL_MAX,
88 G4double magnetic_charge=DBL_MAX );
89 // Sets all charges and moments
90
91 G4FieldTrack( const G4ThreeVector& pPosition,
92 const G4ThreeVector& pMomentumDirection,
93 G4double curve_length,
94 G4double kineticEnergy,
95 const G4double restMass_c2,
96 G4double velocity,
97 G4double LaboratoryTimeOfFlight=0.0,
98 G4double ProperTimeOfFlight=0.0,
99 const G4ThreeVector* pSpin=0);
100 // Older constructor
101 // ---> Misses charge !!!
102
103 inline G4FieldTrack& operator = ( const G4FieldTrack & rStVec );
104 // Assignment operator
105
106 inline G4ThreeVector GetMomentum() const;
107 inline G4ThreeVector GetPosition() const;
108 inline const G4ThreeVector& GetMomentumDir() const;
110 inline G4double GetCurveLength() const;
111 // Distance along curve of point.
112
113 inline G4ThreeVector GetSpin() const;
117 inline G4double GetCharge() const;
118 // Accessors.
119
120 inline void SetPosition(G4ThreeVector nPos);
121 inline void SetMomentum(G4ThreeVector nMomDir);
122 // Does change mom-dir too.
123
124 inline void SetMomentumDir(G4ThreeVector nMomDir);
125 // Does NOT change Momentum or Velocity Vector.
126
127 inline void SetRestMass(G4double Mass_c2) { fRestMass_c2= Mass_c2; }
128
129 inline void SetCurveLength(G4double nCurve_s);
130 // Distance along curve.
131 inline void SetKineticEnergy(G4double nEnergy);
132 // Does not modify momentum.
133
134 inline void SetSpin(G4ThreeVector nSpin);
135 inline void SetLabTimeOfFlight(G4double nTOF);
137 // Modifiers
138
139 public: // without description
140 inline void InitialiseSpin( const G4ThreeVector& Spin );
141 // Used to update / initialise the state
142
143 enum { ncompSVEC = 12 };
144 // Needed and should be used only for RK integration driver
145
146 inline void DumpToArray(G4double valArr[ncompSVEC]) const;
147 inline void LoadFromArray(const G4double valArr[ncompSVEC],
148 G4int noVarsIntegrated);
149 friend std::ostream&
150 operator<<( std::ostream& os, const G4FieldTrack& SixVec);
151
152 private: // Implementation method -- Obsolete
153 inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
154 const G4ThreeVector& pMomentum,
155 G4double s_curve );
156 private:
157 G4double SixVector[6];
158 G4double fDistanceAlongCurve; // distance along curve of point
159 G4double fKineticEnergy;
160 G4double fRestMass_c2;
161 G4double fLabTimeOfFlight;
162 G4double fProperTimeOfFlight;
163 G4ThreeVector fSpin;
164 G4ThreeVector fMomentumDir;
165 // G4double fInitialMomentumMag; // At 'track' creation.
166 // G4double fLastMomentumMag; // From last Update (for checking.)
167
168 private: // Implementation detail -- daughter class
169
170 class G4ChargeState // Charge & moments
171 {
172 public: // without description
173
174 inline G4ChargeState(G4double charge,
175 G4double magnetic_dipole_moment= 0.0,
176 G4double electric_dipole_moment= 0.0,
177 G4double magnetic_charge= 0.0);
178 inline G4ChargeState( const G4ChargeState& right );
179 inline G4ChargeState& operator = ( const G4ChargeState& right );
180
181 inline void SetCharge(G4double charge){ fCharge= charge; }
182
183 // Revise the charge (in units of the positron charge)
184 // do not change moments
185
186 void SetChargeAndMoments(G4double charge,
187 G4double magnetic_dipole_moment= DBL_MAX,
188 G4double electric_dipole_moment= DBL_MAX,
189 G4double magnetic_charge=DBL_MAX );
190 // Revise the charge and all moments
191
192 G4double GetCharge() const { return fCharge; }
193 G4double GetMagneticDipoleMoment() const { return fMagn_dipole; }
194 G4double ElectricDipoleMoment() const { return fElec_dipole; }
195 G4double MagneticCharge() const { return fMagneticCharge; }
196
197 private:
198
199 G4double fCharge;
200 G4double fMagn_dipole;
201 G4double fElec_dipole;
202 G4double fMagneticCharge; // for magnetic monopole
203 };
204
205 G4ChargeState fChargeState;
206
207 public: // Access
208
209 const G4ChargeState* GetChargeState() const { return &fChargeState; }
210};
211
212#include "G4FieldTrack.icc"
213
214#endif /* End of ifndef G4FieldTrack_HH */
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
const G4ThreeVector & GetMomentumDir() const
void SetMomentum(G4ThreeVector nMomDir)
G4FieldTrack(const G4FieldTrack &pFieldTrack)
void UpdateFourMomentum(G4double kineticEnergy, const G4ThreeVector &momentumDirection)
void InitialiseSpin(const G4ThreeVector &Spin)
G4FieldTrack & operator=(const G4FieldTrack &rStVec)
void SetMomentumDir(G4ThreeVector nMomDir)
const G4ChargeState * GetChargeState() const
G4double GetCurveLength() const
G4ThreeVector GetMomentumDirection() const
G4double GetProperTimeOfFlight() const
G4double GetCharge() const
void SetProperTimeOfFlight(G4double nTOF)
void SetCurveLength(G4double nCurve_s)
void SetSpin(G4ThreeVector nSpin)
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 SetPosition(G4ThreeVector nPos)
void SetLabTimeOfFlight(G4double nTOF)
G4ThreeVector GetSpin() const
void UpdateState(const G4ThreeVector &pPosition, G4double LaboratoryTimeOfFlight, const G4ThreeVector &pMomentumDirection, G4double kineticEnergy)
void DumpToArray(G4double valArr[ncompSVEC]) const
void SetRestMass(G4double Mass_c2)
G4double GetLabTimeOfFlight() const
void LoadFromArray(const G4double valArr[ncompSVEC], G4int noVarsIntegrated)
void SetKineticEnergy(G4double nEnergy)
friend std::ostream & operator<<(std::ostream &os, const G4FieldTrack &SixVec)
Definition: G4FieldTrack.cc:33
G4ThreeVector GetMomentum() const
#define DBL_MAX
Definition: templates.hh:83