Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:17

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4FieldTrack
0027 //
0028 // Class description:
0029 //
0030 // Data structure bringing together a magnetic track's state.
0031 // (position, momentum direction & modulus, energy, spin, ... )
0032 // Uses/abilities:
0033 //  - does not maintain any relationship between its data (eg energy/momentum).
0034 //  - for use in Runge-Kutta solver (in passing it the values right now).
0035 
0036 // Author: John Apostolakis, CERN - First version, 14.10.1996
0037 // -------------------------------------------------------------------
0038 #ifndef G4FIELDTRACK_HH
0039 #define G4FIELDTRACK_HH
0040 
0041 #include "G4ThreeVector.hh"
0042 #include "G4ChargeState.hh"
0043 
0044 class G4FieldTrack
0045 {
0046    public:  // with description
0047 
0048      G4FieldTrack( const G4ThreeVector& pPosition, 
0049                          G4double       LaboratoryTimeOfFlight,
0050                    const G4ThreeVector& pMomentumDirection,
0051                          G4double       kineticEnergy,
0052                          G4double       restMass_c2,
0053                          G4double       charge, 
0054                    const G4ThreeVector& polarization,
0055                          G4double       magnetic_dipole_moment = 0.0,
0056                          G4double       curve_length = 0.0,
0057                          G4double       PDGspin = -1.0 );
0058 
0059      G4FieldTrack( char );
0060        // Almost default constructor
0061 
0062      G4FieldTrack( const G4ThreeVector& pPosition, 
0063                    const G4ThreeVector& pMomentumDirection,
0064                          G4double       curve_length,
0065                          G4double       kineticEnergy,
0066                    const G4double       restMass_c2,
0067                          G4double       velocity,
0068                          G4double       LaboratoryTimeOfFlight = 0.0,
0069                          G4double       ProperTimeOfFlight = 0.0, 
0070                    const G4ThreeVector* pPolarization = nullptr,
0071                          G4double       PDGspin = -1.0 );
0072         // Older constructor
0073         // ---> Misses charge !!!
0074 
0075      ~G4FieldTrack();
0076        // Destructor 
0077 
0078      inline G4FieldTrack( const G4FieldTrack& pFieldTrack ); 
0079      inline G4FieldTrack& operator= ( const G4FieldTrack& rStVec );
0080        // Copy constructor & Assignment operator
0081 
0082      inline G4FieldTrack(G4FieldTrack&& from) noexcept ;
0083      inline G4FieldTrack& operator=(G4FieldTrack&& from) noexcept ;
0084        // Move constructor & operator
0085 
0086      inline void UpdateState( const G4ThreeVector& pPosition, 
0087                                     G4double       LaboratoryTimeOfFlight,
0088                               const G4ThreeVector& pMomentumDirection,
0089                                     G4double       kineticEnergy); 
0090         // Update four-vectors for space/time and momentum/energy
0091         // Also resets curve length.
0092 
0093      inline void UpdateFourMomentum( G4double kineticEnergy, 
0094                                      const G4ThreeVector& momentumDirection ); 
0095         // Update momentum (and direction), and kinetic energy 
0096 
0097      void SetChargeAndMoments(G4double charge, 
0098                               G4double magnetic_dipole_moment = DBL_MAX,
0099                               G4double electric_dipole_moment = DBL_MAX,
0100                               G4double magnetic_charge = DBL_MAX );
0101         // Set the charges and moments that are not given as DBL_MAX
0102 
0103      inline void SetPDGSpin(G4double pdgSpin);
0104      inline G4double GetPDGSpin();
0105 
0106      inline G4ThreeVector GetMomentum() const;   
0107      inline G4ThreeVector GetPosition() const; 
0108      inline const G4ThreeVector& GetMomentumDir() const;
0109      inline G4ThreeVector GetMomentumDirection() const;
0110      inline G4double      GetCurveLength() const;
0111        // Distance along curve of point.
0112 
0113      inline G4ThreeVector GetPolarization() const; 
0114      inline void          SetPolarization( const G4ThreeVector& vecPol );
0115 
0116      inline const G4ChargeState* GetChargeState() const;
0117      inline G4double      GetLabTimeOfFlight() const;
0118      inline G4double      GetProperTimeOfFlight() const;
0119      inline G4double      GetKineticEnergy() const;
0120      inline G4double      GetCharge() const;
0121      inline G4double      GetRestMass() const;
0122        // Accessors.
0123 
0124      inline void SetPosition(const G4ThreeVector& nPos); 
0125      inline void SetMomentum(const G4ThreeVector& nMomDir);
0126        // Does change mom-dir too.
0127 
0128      inline void SetMomentumDir(const G4ThreeVector& nMomDir);
0129        // Does NOT change Momentum or Velocity Vector.
0130 
0131      inline void SetRestMass(G4double Mass_c2);
0132    
0133      inline void SetCurveLength(G4double nCurve_s);
0134        // Distance along curve.
0135      inline void SetKineticEnergy(G4double nEnergy);
0136        // Does not modify momentum.
0137 
0138      inline void SetLabTimeOfFlight(G4double tofLab); 
0139      inline void SetProperTimeOfFlight(G4double tofProper);
0140        //  Modifiers
0141 
0142    public: // without description
0143 
0144      enum { ncompSVEC = 12 };
0145        // Needed and should be used only for RK integration driver
0146 
0147      inline void DumpToArray(G4double valArr[ncompSVEC]) const; 
0148      void LoadFromArray(const G4double valArr[ncompSVEC],
0149                               G4int noVarsIntegrated);
0150      friend  std::ostream&
0151              operator<<( std::ostream& os, const G4FieldTrack& SixVec);
0152 
0153    public:  // Obsolete methods -- due to potential confusion with PDG spin
0154 
0155      inline void InitialiseSpin( const G4ThreeVector& vecPolarization );
0156      inline G4ThreeVector GetSpin() const;
0157      inline void SetSpin(const G4ThreeVector& vSpin);
0158 
0159    private: // Implementation method -- Obsolete
0160 
0161      inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition, 
0162                                       const G4ThreeVector& pMomentum,
0163                                             G4double       s_curve );
0164    private:
0165 
0166      G4double SixVector[6];
0167      G4double fDistanceAlongCurve;  // distance along curve of point
0168      G4double fKineticEnergy;
0169      G4double fRestMass_c2;
0170      G4double fLabTimeOfFlight;
0171      G4double fProperTimeOfFlight;
0172      G4ThreeVector fPolarization;
0173      G4ThreeVector fMomentumDir;
0174      // G4double  fInitialMomentumMag;  // At 'track' creation.
0175      // G4double  fLastMomentumMag;     // From last Update (for checking.)
0176 
0177      G4ChargeState fChargeState;
0178 }; 
0179 
0180 #include "G4FieldTrack.icc"
0181 
0182 #endif