Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: G4FieldTrack.hh 69699 2013-05-13 08:50:30Z gcosmo $
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 #include "G4ChargeState.hh"
53 
55 {
56  public: // with description
57 
58  G4FieldTrack( const G4ThreeVector& pPosition,
59  G4double LaboratoryTimeOfFlight,
60  const G4ThreeVector& pMomentumDirection,
61  G4double kineticEnergy,
62  G4double restMass_c2,
63  G4double charge,
64  const G4ThreeVector& pSpin,
65  G4double magnetic_dipole_moment= 0.0,
66  G4double curve_length= 0.0
67  );
68  G4FieldTrack( const G4FieldTrack& pFieldTrack );
69  G4FieldTrack( char ); // Almost default constructor
70 
71  ~G4FieldTrack();
72  // End of preferred Constructors / Destructor
73 
74  inline void
75  UpdateState( const G4ThreeVector& pPosition,
76  G4double LaboratoryTimeOfFlight,
77  const G4ThreeVector& pMomentumDirection,
78  G4double kineticEnergy);
79  // Update four-vectors for space/time and momentum/energy
80  // Also resets curve length.
81  inline
82  void UpdateFourMomentum( G4double kineticEnergy,
83  const G4ThreeVector& momentumDirection );
84  // Update momentum (and direction), and kinetic energy
85 
86  void SetChargeAndMoments(G4double charge,
87  G4double magnetic_dipole_moment= DBL_MAX,
88  G4double electric_dipole_moment= DBL_MAX,
89  G4double magnetic_charge=DBL_MAX );
90  // Sets all charges and moments
91 
92  G4FieldTrack( const G4ThreeVector& pPosition,
93  const G4ThreeVector& pMomentumDirection,
94  G4double curve_length,
95  G4double kineticEnergy,
96  const G4double restMass_c2,
97  G4double velocity,
98  G4double LaboratoryTimeOfFlight=0.0,
99  G4double ProperTimeOfFlight=0.0,
100  const G4ThreeVector* pSpin=0);
101  // Older constructor
102  // ---> Misses charge !!!
103 
104  inline G4FieldTrack& operator = ( const G4FieldTrack & rStVec );
105  // Assignment operator
106 
107  inline G4ThreeVector GetMomentum() const;
108  inline G4ThreeVector GetPosition() const;
109  inline const G4ThreeVector& GetMomentumDir() const;
110  inline G4ThreeVector GetMomentumDirection() const;
111  inline G4double GetCurveLength() const;
112  // Distance along curve of point.
113 
114  inline G4ThreeVector GetSpin() const;
115  inline G4double GetLabTimeOfFlight() const;
116  inline G4double GetProperTimeOfFlight() const;
117  inline G4double GetKineticEnergy() const;
118  inline G4double GetCharge() const;
119  // Accessors.
120 
121  inline void SetPosition(G4ThreeVector nPos);
122  inline void SetMomentum(G4ThreeVector nMomDir);
123  // Does change mom-dir too.
124 
125  inline void SetMomentumDir(G4ThreeVector nMomDir);
126  // Does NOT change Momentum or Velocity Vector.
127 
128  inline void SetRestMass(G4double Mass_c2) { fRestMass_c2= Mass_c2; }
129 
130  inline void SetCurveLength(G4double nCurve_s);
131  // Distance along curve.
132  inline void SetKineticEnergy(G4double nEnergy);
133  // Does not modify momentum.
134 
135  inline void SetSpin(G4ThreeVector nSpin);
136  inline void SetLabTimeOfFlight(G4double nTOF);
137  inline void SetProperTimeOfFlight(G4double nTOF);
138  // Modifiers
139 
140  public: // without description
141  inline void InitialiseSpin( const G4ThreeVector& Spin );
142  // Used to update / initialise the state
143 
144  enum { ncompSVEC = 12 };
145  // Needed and should be used only for RK integration driver
146 
147  inline void DumpToArray(G4double valArr[ncompSVEC]) const;
148  inline void LoadFromArray(const G4double valArr[ncompSVEC],
149  G4int noVarsIntegrated);
150  friend std::ostream&
151  operator<<( std::ostream& os, const G4FieldTrack& SixVec);
152 
153  private: // Implementation method -- Obsolete
154  inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
155  const G4ThreeVector& pMomentum,
156  G4double s_curve );
157  private:
158 
159  G4double SixVector[6];
160  G4double fDistanceAlongCurve; // distance along curve of point
161  G4double fKineticEnergy;
162  G4double fRestMass_c2;
163  G4double fLabTimeOfFlight;
164  G4double fProperTimeOfFlight;
165  G4ThreeVector fSpin;
166  G4ThreeVector fMomentumDir;
167  // G4double fInitialMomentumMag; // At 'track' creation.
168  // G4double fLastMomentumMag; // From last Update (for checking.)
169 
170  G4ChargeState fChargeState;
171 
172  public: // Access
173 
174  const G4ChargeState* GetChargeState() const { return &fChargeState; }
175 };
176 
177 #include "G4FieldTrack.icc"
178 
179 #endif /* End of ifndef G4FieldTrack_HH */
void SetPosition(G4ThreeVector nPos)
G4double GetCurveLength() const
G4double GetKineticEnergy() const
void SetCurveLength(G4double nCurve_s)
friend std::ostream & operator<<(std::ostream &os, const G4FieldTrack &SixVec)
Definition: G4FieldTrack.cc:33
G4FieldTrack & operator=(const G4FieldTrack &rStVec)
const G4ThreeVector & GetMomentumDir() const
G4ThreeVector GetSpin() const
void SetSpin(G4ThreeVector nSpin)
void SetRestMass(G4double Mass_c2)
int G4int
Definition: G4Types.hh:78
void UpdateFourMomentum(G4double kineticEnergy, const G4ThreeVector &momentumDirection)
void SetMomentumDir(G4ThreeVector nMomDir)
G4ThreeVector GetPosition() const
void SetKineticEnergy(G4double nEnergy)
void InitialiseSpin(const G4ThreeVector &Spin)
G4double GetProperTimeOfFlight() const
G4FieldTrack(const G4ThreeVector &pPosition, G4double LaboratoryTimeOfFlight, const G4ThreeVector &pMomentumDirection, G4double kineticEnergy, G4double restMass_c2, G4double charge, const G4ThreeVector &pSpin, G4double magnetic_dipole_moment=0.0, G4double curve_length=0.0)
Definition: G4FieldTrack.cc:49
G4double GetCharge() const
void DumpToArray(G4double valArr[ncompSVEC]) const
G4double GetLabTimeOfFlight() const
void SetLabTimeOfFlight(G4double nTOF)
void LoadFromArray(const G4double valArr[ncompSVEC], G4int noVarsIntegrated)
void SetProperTimeOfFlight(G4double nTOF)
G4ThreeVector GetMomentum() const
double G4double
Definition: G4Types.hh:76
void SetMomentum(G4ThreeVector nMomDir)
#define DBL_MAX
Definition: templates.hh:83
void SetChargeAndMoments(G4double charge, G4double magnetic_dipole_moment=DBL_MAX, G4double electric_dipole_moment=DBL_MAX, G4double magnetic_charge=DBL_MAX)
const G4ChargeState * GetChargeState() const
G4ThreeVector GetMomentumDirection() const
void UpdateState(const G4ThreeVector &pPosition, G4double LaboratoryTimeOfFlight, const G4ThreeVector &pMomentumDirection, G4double kineticEnergy)