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 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 
 44 class G4FieldTrack
 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,
 53                          G4double       charge, 
 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() = default;
 76        // Destructor 
 77 
 78      inline G4FieldTrack( const G4FieldTrack& pFieldTrack ); 
 79      inline G4FieldTrack& operator= ( const G4FieldTrack& rStVec );
 80        // Copy constructor & Assignment operator
 81 
 82      inline G4FieldTrack(G4FieldTrack&& from) noexcept ;
 83      inline G4FieldTrack& operator=(G4FieldTrack&& from) noexcept ;
 84        // Move constructor & operator
 85 
 86      inline void UpdateState( const G4ThreeVector& pPosition, 
 87                                     G4double       LaboratoryTimeOfFlight,
 88                               const G4ThreeVector& pMomentumDirection,
 89                                     G4double       kineticEnergy); 
 90         // Update four-vectors for space/time and momentum/energy
 91         // Also resets curve length.
 92 
 93      inline void UpdateFourMomentum( G4double kineticEnergy, 
 94                                      const G4ThreeVector& momentumDirection ); 
 95         // Update momentum (and direction), and kinetic energy 
 96 
 97      void SetChargeAndMoments(G4double charge, 
 98                               G4double magnetic_dipole_moment = DBL_MAX,
 99                               G4double electric_dipole_moment = DBL_MAX,
100                               G4double magnetic_charge = DBL_MAX );
101         // Set the charges and moments that are not given as DBL_MAX
102 
103      inline void SetPDGSpin(G4double pdgSpin);
104      inline G4double GetPDGSpin();
105 
106      inline G4ThreeVector GetMomentum() const;   
107      inline G4ThreeVector GetPosition() const; 
108      inline const G4ThreeVector& GetMomentumDir() const;
109      inline G4ThreeVector GetMomentumDirection() const;
110      inline G4double      GetCurveLength() const;
111        // Distance along curve of point.
112 
113      inline G4ThreeVector GetPolarization() const; 
114      inline void          SetPolarization( const G4ThreeVector& vecPol );
115 
116      inline const G4ChargeState* GetChargeState() const;
117      inline G4double      GetLabTimeOfFlight() const;
118      inline G4double      GetProperTimeOfFlight() const;
119      inline G4double      GetKineticEnergy() const;
120      inline G4double      GetCharge() const;
121      inline G4double      GetRestMass() const;
122        // Accessors.
123 
124      inline void SetPosition(const G4ThreeVector& nPos); 
125      inline void SetMomentum(const G4ThreeVector& nMomDir);
126        // Does change mom-dir too.
127 
128      inline void SetMomentumDir(const G4ThreeVector& nMomDir);
129        // Does NOT change Momentum or Velocity Vector.
130 
131      inline void SetRestMass(G4double Mass_c2);
132    
133      inline void SetCurveLength(G4double nCurve_s);
134        // Distance along curve.
135      inline void SetKineticEnergy(G4double nEnergy);
136        // Does not modify momentum.
137 
138      inline void SetLabTimeOfFlight(G4double tofLab); 
139      inline void SetProperTimeOfFlight(G4double tofProper);
140        //  Modifiers
141 
142    public: // without description
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      void LoadFromArray(const G4double valArr[ncompSVEC],
149                               G4int noVarsIntegrated);
150      friend  std::ostream&
151              operator<<( std::ostream& os, const G4FieldTrack& SixVec);
152 
153    public:  // Obsolete methods -- due to potential confusion with PDG spin
154 
155      inline void InitialiseSpin( const G4ThreeVector& vecPolarization );
156      inline G4ThreeVector GetSpin() const;
157      inline void SetSpin(const G4ThreeVector& vSpin);
158 
159    private: // Implementation method -- Obsolete
160 
161      inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition, 
162                                       const G4ThreeVector& pMomentum,
163                                             G4double       s_curve );
164    private:
165 
166      G4double SixVector[6];
167      G4double fDistanceAlongCurve;  // distance along curve of point
168      G4double fKineticEnergy;
169      G4double fRestMass_c2;
170      G4double fLabTimeOfFlight;
171      G4double fProperTimeOfFlight;
172      G4ThreeVector fPolarization;
173      G4ThreeVector fMomentumDir;
174      // G4double  fInitialMomentumMag;  // At 'track' creation.
175      // G4double  fLastMomentumMag;     // From last Update (for checking.)
176 
177      G4ChargeState fChargeState;
178 }; 
179 
180 #include "G4FieldTrack.icc"
181 
182 #endif
183