ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4FieldTrack.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4FieldTrack.hh
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 - First version, 14.10.1996
37 // -------------------------------------------------------------------
38 #ifndef G4FIELDTRACK_HH
39 #define G4FIELDTRACK_HH
40 
41 #include "G4ThreeVector.hh"
42 #include "G4ChargeState.hh"
43 
45 {
46  public: // with description
47 
48  G4FieldTrack( const G4ThreeVector& pPosition,
49  G4double LaboratoryTimeOfFlight,
50  const G4ThreeVector& pMomentumDirection,
51  G4double kineticEnergy,
52  G4double restMass_c2,
54  const G4ThreeVector& polarization,
55  G4double magnetic_dipole_moment = 0.0,
56  G4double curve_length = 0.0,
57  G4double PDGspin = -1.0 );
58 
59  G4FieldTrack( char );
60  // Almost default constructor
61 
62  G4FieldTrack( const G4ThreeVector& pPosition,
63  const G4ThreeVector& pMomentumDirection,
64  G4double curve_length,
65  G4double kineticEnergy,
66  const G4double restMass_c2,
67  G4double velocity,
68  G4double LaboratoryTimeOfFlight = 0.0,
69  G4double ProperTimeOfFlight = 0.0,
70  const G4ThreeVector* pPolarization = nullptr,
71  G4double PDGspin = -1.0 );
72  // Older constructor
73  // ---> Misses charge !!!
74 
75  ~G4FieldTrack();
76  // Destructor
77 
78  inline G4FieldTrack( const G4FieldTrack& pFieldTrack );
79  inline G4FieldTrack& operator= ( const G4FieldTrack& rStVec );
80  // Copy constructor & Assignment operator
81 
82  inline void UpdateState( const G4ThreeVector& pPosition,
83  G4double LaboratoryTimeOfFlight,
84  const G4ThreeVector& pMomentumDirection,
85  G4double kineticEnergy);
86  // Update four-vectors for space/time and momentum/energy
87  // Also resets curve length.
88 
89  inline void UpdateFourMomentum( G4double kineticEnergy,
90  const G4ThreeVector& momentumDirection );
91  // Update momentum (and direction), and kinetic energy
92 
93  void SetChargeAndMoments(G4double charge,
94  G4double magnetic_dipole_moment = DBL_MAX,
95  G4double electric_dipole_moment = DBL_MAX,
96  G4double magnetic_charge = DBL_MAX );
97  // Set the charges and moments that are not given as DBL_MAX
98 
99  inline void SetPDGSpin(G4double pdgSpin);
100  inline G4double GetPDGSpin();
101 
102  inline G4ThreeVector GetMomentum() const;
103  inline G4ThreeVector GetPosition() const;
104  inline const G4ThreeVector& GetMomentumDir() const;
105  inline G4ThreeVector GetMomentumDirection() const;
106  inline G4double GetCurveLength() const;
107  // Distance along curve of point.
108 
109  inline G4ThreeVector GetPolarization() const;
110  inline void SetPolarization( const G4ThreeVector& vecPol );
111 
112  inline const G4ChargeState* GetChargeState() const;
113  inline G4double GetLabTimeOfFlight() const;
114  inline G4double GetProperTimeOfFlight() const;
115  inline G4double GetKineticEnergy() const;
116  inline G4double GetCharge() const;
117  inline G4double GetRestMass() 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);
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 SetLabTimeOfFlight(G4double tofLab);
135  inline void SetProperTimeOfFlight(G4double tofProper);
136  // Modifiers
137 
138  public: // without description
139 
140  enum { ncompSVEC = 12 };
141  // Needed and should be used only for RK integration driver
142 
143  inline void DumpToArray(G4double valArr[ncompSVEC]) const;
144  void LoadFromArray(const G4double valArr[ncompSVEC],
145  G4int noVarsIntegrated);
146  friend std::ostream&
147  operator<<( std::ostream& os, const G4FieldTrack& SixVec);
148 
149  public: // Obsolete methods -- due to potential confusion with PDG spin
150 
151  inline void InitialiseSpin( const G4ThreeVector& vecPolarization );
152  inline G4ThreeVector GetSpin() const;
153  inline void SetSpin(G4ThreeVector vSpin);
154 
155  private: // Implementation method -- Obsolete
156 
157  inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
158  const G4ThreeVector& pMomentum,
159  G4double s_curve );
160  private:
161 
163  G4double fDistanceAlongCurve; // distance along curve of point
170  // G4double fInitialMomentumMag; // At 'track' creation.
171  // G4double fLastMomentumMag; // From last Update (for checking.)
172 
174 };
175 
176 #include "G4FieldTrack.icc"
177 
178 #endif