| 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,v 1.21 2006/11/13 18:24:35 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // class G4FieldTrack
|
|---|
| 32 | //
|
|---|
| 33 | // Class description:
|
|---|
| 34 | //
|
|---|
| 35 | // Data structure bringing together a magnetic track's state.
|
|---|
| 36 | // (position, momentum direction & modulus, energy, spin, ... )
|
|---|
| 37 | // Uses/abilities:
|
|---|
| 38 | // - does not maintain any relationship between its data (eg energy/momentum).
|
|---|
| 39 | // - for use in Runge-Kutta solver (in passing it the values right now).
|
|---|
| 40 |
|
|---|
| 41 | // History
|
|---|
| 42 | // - First version: Oct 14, 1996 John Apostolakis
|
|---|
| 43 | // - Modified: Oct 24, 1996 JA: Added dist_on_curve, deleted constructor
|
|---|
| 44 | // Nov 5, 1998 JA: Added energy, momentum, TOF, spin &
|
|---|
| 45 | // several constructor, access, set methods
|
|---|
| 46 | // May 10, 2006 JA: Added charge, "default" constructor
|
|---|
| 47 | // -------------------------------------------------------------------
|
|---|
| 48 |
|
|---|
| 49 | #ifndef G4FieldTrack_HH
|
|---|
| 50 | #define G4FieldTrack_HH
|
|---|
| 51 |
|
|---|
| 52 | #include "G4ThreeVector.hh"
|
|---|
| 53 |
|
|---|
| 54 | class G4FieldTrack
|
|---|
| 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 SetCurveLength(G4double nCurve_s);
|
|---|
| 129 | // Distance along curve.
|
|---|
| 130 | inline void SetKineticEnergy(G4double nEnergy);
|
|---|
| 131 | // Does not modify momentum.
|
|---|
| 132 |
|
|---|
| 133 | inline void SetSpin(G4ThreeVector nSpin);
|
|---|
| 134 | inline void SetLabTimeOfFlight(G4double nTOF);
|
|---|
| 135 | inline void SetProperTimeOfFlight(G4double nTOF);
|
|---|
| 136 | // Modifiers
|
|---|
| 137 |
|
|---|
| 138 | public: // without description
|
|---|
| 139 |
|
|---|
| 140 | inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition,
|
|---|
| 141 | const G4ThreeVector& pMomentum,
|
|---|
| 142 | G4double s_curve );
|
|---|
| 143 | inline void InitialiseSpin( const G4ThreeVector& Spin );
|
|---|
| 144 | // Used to update / initialise the state
|
|---|
| 145 |
|
|---|
| 146 | enum { ncompSVEC = 12 };
|
|---|
| 147 | // Needed and should be used only for RK integration driver
|
|---|
| 148 |
|
|---|
| 149 | inline void DumpToArray(G4double valArr[ncompSVEC]) const;
|
|---|
| 150 | inline void LoadFromArray(const G4double valArr[ncompSVEC],
|
|---|
| 151 | G4int noVarsIntegrated);
|
|---|
| 152 | friend std::ostream&
|
|---|
| 153 | operator<<( std::ostream& os, const G4FieldTrack& SixVec);
|
|---|
| 154 |
|
|---|
| 155 | private:
|
|---|
| 156 |
|
|---|
| 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 |
|
|---|
| 166 | private: // Implementation detail -- daughter class
|
|---|
| 167 |
|
|---|
| 168 | class G4ChargeState // Charge & moments
|
|---|
| 169 | {
|
|---|
| 170 | public: // without description
|
|---|
| 171 |
|
|---|
| 172 | inline G4ChargeState(G4double charge,
|
|---|
| 173 | G4double magnetic_dipole_moment= 0.0,
|
|---|
| 174 | G4double electric_dipole_moment= 0.0,
|
|---|
| 175 | G4double magnetic_charge= 0.0);
|
|---|
| 176 | inline G4ChargeState( const G4ChargeState& right );
|
|---|
| 177 |
|
|---|
| 178 | inline void SetCharge(G4double charge){ fCharge= charge; }
|
|---|
| 179 |
|
|---|
| 180 | // Revise the charge (in units of the positron charge)
|
|---|
| 181 | // do not change moments
|
|---|
| 182 |
|
|---|
| 183 | void SetChargeAndMoments(G4double charge,
|
|---|
| 184 | G4double magnetic_dipole_moment= DBL_MAX,
|
|---|
| 185 | G4double electric_dipole_moment= DBL_MAX,
|
|---|
| 186 | G4double magnetic_charge=DBL_MAX );
|
|---|
| 187 | // Revise the charge and all moments
|
|---|
| 188 |
|
|---|
| 189 | G4double GetCharge() const { return fCharge; }
|
|---|
| 190 | G4double GetMagneticDipoleMoment() const { return fMagn_dipole; }
|
|---|
| 191 | G4double ElectricDipoleMoment() const { return fElec_dipole; }
|
|---|
| 192 | G4double MagneticCharge() const { return fMagneticCharge; }
|
|---|
| 193 |
|
|---|
| 194 | private:
|
|---|
| 195 |
|
|---|
| 196 | G4double fCharge;
|
|---|
| 197 | G4double fMagn_dipole;
|
|---|
| 198 | G4double fElec_dipole;
|
|---|
| 199 | G4double fMagneticCharge; // for magnetic monopole
|
|---|
| 200 | };
|
|---|
| 201 |
|
|---|
| 202 | G4ChargeState fChargeState;
|
|---|
| 203 |
|
|---|
| 204 | public: // Access
|
|---|
| 205 |
|
|---|
| 206 | const G4ChargeState* GetChargeState() const { return &fChargeState; }
|
|---|
| 207 | };
|
|---|
| 208 |
|
|---|
| 209 | #include "G4FieldTrack.icc"
|
|---|
| 210 |
|
|---|
| 211 | #endif /* End of ifndef G4FieldTrack_HH */
|
|---|