G4FieldTrack.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4FieldTrack.hh 69786 2013-05-15 09:38:51Z gcosmo $
00028 //
00029 //
00030 // class G4FieldTrack
00031 //
00032 // Class description:
00033 //
00034 // Data structure bringing together a magnetic track's state.
00035 // (position, momentum direction & modulus, energy, spin, ... )
00036 // Uses/abilities:
00037 //  - does not maintain any relationship between its data (eg energy/momentum).
00038 //  - for use in Runge-Kutta solver (in passing it the values right now).
00039 
00040 // History
00041 // - First version: Oct 14, 1996  John Apostolakis
00042 // - Modified:      Oct 24, 1996  JA: Added dist_on_curve, deleted constructor
00043 //                  Nov  5, 1998  JA: Added energy, momentum, TOF, spin &
00044 //                                    several constructor, access, set methods
00045 //                  May 10, 2006  JA: Added charge, "default" constructor
00046 // -------------------------------------------------------------------
00047 
00048 #ifndef G4FieldTrack_HH
00049 #define G4FieldTrack_HH
00050 
00051 #include "G4ThreeVector.hh"
00052 
00053 class  G4FieldTrack
00054 {
00055    public:  // with description
00056 
00057      G4FieldTrack( const G4ThreeVector& pPosition, 
00058                          G4double       LaboratoryTimeOfFlight,
00059                    const G4ThreeVector& pMomentumDirection,
00060                          G4double       kineticEnergy,
00061                          G4double       restMass_c2,
00062                          G4double       charge, 
00063                    const G4ThreeVector& pSpin,
00064                          G4double       magnetic_dipole_moment= 0.0,
00065                          G4double       curve_length= 0.0
00066                  );
00067      G4FieldTrack( const G4FieldTrack&   pFieldTrack ); 
00068      G4FieldTrack( char );   //  Almost default constructor
00069 
00070      ~G4FieldTrack();
00071        // End of preferred Constructors / Destructor 
00072 
00073      inline void
00074      UpdateState( const G4ThreeVector& pPosition, 
00075                         G4double       LaboratoryTimeOfFlight,
00076                   const G4ThreeVector& pMomentumDirection,
00077                         G4double       kineticEnergy); 
00078         //  Update four-vectors for space/time and momentum/energy
00079         //    Also resets curve length.
00080      inline
00081      void  UpdateFourMomentum( G4double             kineticEnergy, 
00082                                const G4ThreeVector& momentumDirection ); 
00083         //  Update momentum (and direction), and kinetic energy 
00084 
00085      void SetChargeAndMoments(G4double charge, 
00086                               G4double magnetic_dipole_moment= DBL_MAX,
00087                               G4double electric_dipole_moment= DBL_MAX,
00088                               G4double magnetic_charge=DBL_MAX );
00089         //   Sets all charges and moments
00090 
00091      G4FieldTrack( const G4ThreeVector& pPosition, 
00092                    const G4ThreeVector& pMomentumDirection,
00093                          G4double       curve_length,
00094                          G4double       kineticEnergy,
00095                    const G4double       restMass_c2,
00096                          G4double       velocity,
00097                          G4double       LaboratoryTimeOfFlight=0.0,
00098                          G4double       ProperTimeOfFlight=0.0, 
00099                    const G4ThreeVector* pSpin=0);
00100           // Older constructor
00101           //  --->  Misses charge !!!
00102 
00103      inline G4FieldTrack& operator = ( const G4FieldTrack & rStVec );
00104        // Assignment operator
00105 
00106      inline G4ThreeVector  GetMomentum() const;   
00107      inline G4ThreeVector  GetPosition() const; 
00108      inline const G4ThreeVector& GetMomentumDir() const;
00109      inline G4ThreeVector  GetMomentumDirection() const;
00110      inline G4double       GetCurveLength() const;
00111        // Distance along curve of point.
00112 
00113      inline G4ThreeVector  GetSpin()   const;
00114      inline G4double       GetLabTimeOfFlight() const;
00115      inline G4double       GetProperTimeOfFlight() const;
00116      inline G4double       GetKineticEnergy() const;
00117      inline G4double       GetCharge() const;
00118        // Accessors.
00119 
00120      inline void SetPosition(G4ThreeVector nPos); 
00121      inline void SetMomentum(G4ThreeVector nMomDir);
00122        // Does change mom-dir too.
00123 
00124      inline void SetMomentumDir(G4ThreeVector nMomDir);
00125        // Does NOT change Momentum or Velocity Vector.
00126 
00127      inline void SetRestMass(G4double Mass_c2) { fRestMass_c2= Mass_c2; }
00128    
00129      inline void SetCurveLength(G4double nCurve_s);
00130        // Distance along curve.
00131      inline void SetKineticEnergy(G4double nEnergy);
00132        // Does not modify momentum.
00133 
00134      inline void SetSpin(G4ThreeVector nSpin);
00135      inline void SetLabTimeOfFlight(G4double nTOF); 
00136      inline void SetProperTimeOfFlight(G4double nTOF);
00137        //  Modifiers
00138 
00139    public: // without description
00140      inline void          InitialiseSpin( const G4ThreeVector& Spin );
00141        //  Used to update / initialise the state
00142 
00143      enum { ncompSVEC = 12 };
00144        // Needed and should be used only for RK integration driver
00145 
00146      inline void DumpToArray(G4double valArr[ncompSVEC]) const; 
00147      inline void LoadFromArray(const G4double valArr[ncompSVEC],
00148                                      G4int noVarsIntegrated);
00149      friend  std::ostream&
00150              operator<<( std::ostream& os, const G4FieldTrack& SixVec);
00151 
00152    private: // Implementation method -- Obsolete
00153      inline G4FieldTrack& SetCurvePnt(const G4ThreeVector& pPosition, 
00154                                       const G4ThreeVector& pMomentum,
00155                                       G4double       s_curve );
00156    private:
00157      G4double  SixVector[6];
00158      G4double  fDistanceAlongCurve;  // distance along curve of point
00159      G4double  fKineticEnergy;
00160      G4double  fRestMass_c2;
00161      G4double  fLabTimeOfFlight;
00162      G4double  fProperTimeOfFlight;
00163      G4ThreeVector fSpin;
00164      G4ThreeVector fMomentumDir;
00165      // G4double  fInitialMomentumMag;  // At 'track' creation.
00166      // G4double  fLastMomentumMag;     // From last Update (for checking.)
00167 
00168    private:   //  Implementation detail -- daughter class
00169 
00170        class G4ChargeState  // Charge & moments
00171        {
00172          public:  // without description
00173 
00174            inline G4ChargeState(G4double charge,                       
00175                                 G4double magnetic_dipole_moment= 0.0,  
00176                                 G4double electric_dipole_moment= 0.0,  
00177                                 G4double magnetic_charge= 0.0);  
00178            inline G4ChargeState( const G4ChargeState& right ); 
00179            inline G4ChargeState& operator = ( const G4ChargeState& right );
00180 
00181            inline void SetCharge(G4double charge){ fCharge= charge; }
00182 
00183            // Revise the charge (in units of the positron charge)
00184            // do not change moments
00185 
00186            void SetChargeAndMoments(G4double charge, 
00187                                     G4double magnetic_dipole_moment= DBL_MAX,
00188                                     G4double electric_dipole_moment= DBL_MAX,
00189                                     G4double magnetic_charge=DBL_MAX );
00190            //  Revise the charge and all moments
00191 
00192            G4double GetCharge() const { return fCharge; }  
00193            G4double GetMagneticDipoleMoment() const { return fMagn_dipole; } 
00194            G4double ElectricDipoleMoment() const { return fElec_dipole; } 
00195            G4double MagneticCharge() const { return fMagneticCharge; } 
00196  
00197          private:
00198 
00199            G4double fCharge; 
00200            G4double fMagn_dipole;
00201            G4double fElec_dipole;
00202            G4double fMagneticCharge;  // for magnetic monopole
00203        };
00204 
00205        G4ChargeState fChargeState;
00206 
00207     public: // Access
00208 
00209        const G4ChargeState* GetChargeState() const { return &fChargeState; } 
00210 }; 
00211 
00212 #include "G4FieldTrack.icc"
00213 
00214 #endif  /* End of ifndef G4FieldTrack_HH */

Generated on Mon May 27 17:48:16 2013 for Geant4 by  doxygen 1.4.7