Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-27 09:11:56

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 // G4UniformGravifyField
0027 //
0028 // Class description:
0029 //
0030 // Class for creation of Uniform Gravitation Field.
0031 
0032 // Author: Peter Gumplinger (TRIUMF), 14.06.2011
0033 //         Thanks to P.Fierlinger (PSI), A.Capra and A.Fontana (INFN Pavia)
0034 // -------------------------------------------------------------------
0035 #ifndef G4UNIFORMGRAVITYFIELD_HH
0036 #define G4UNIFORMGRAVITYFIELD_HH
0037 
0038 #include <CLHEP/Units/PhysicalConstants.h>
0039 
0040 #include "G4Types.hh"
0041 #include "G4ThreeVector.hh"
0042 #include "G4Field.hh"
0043 
0044 /**
0045  * @brief G4UniformGravityField is a class for defining a uniform
0046  * gravitation field.
0047  */
0048 
0049 class G4UniformGravityField : public G4Field
0050 {
0051   public:
0052 
0053     /**
0054      * Constructor for G4UniformGravityField, a field with value equal
0055      * to 'FieldVector'.
0056      *  @param[in] FieldVector The field vector value.
0057      */
0058     G4UniformGravityField(const G4ThreeVector& FieldVector );
0059 
0060     /**
0061      * Alternative constructor for G4UniformGravityField.
0062      *  @param[in] gy The gravitation field value (default is the Standard
0063      *             Gravitational field on earth's surface.
0064      */
0065     G4UniformGravityField(const G4double gy = -9.81*CLHEP::m/CLHEP::s/CLHEP::s);
0066 
0067     /**
0068      * Default Destructor.
0069      */
0070     ~G4UniformGravityField() override = default;
0071 
0072     /**
0073      * Copy constructor and assignment operator.
0074      */
0075     G4UniformGravityField(const G4UniformGravityField& p);
0076     G4UniformGravityField& operator=(const G4UniformGravityField& p);
0077 
0078     /**
0079      * The field can change track energy, so returning true.
0080      */
0081     inline G4bool DoesFieldChangeEnergy() const override { return true; }
0082 
0083     /**
0084      * Returns the field value 'field' on given time 'Point'.
0085      */
0086     void GetFieldValue(const G4double Point[4], G4double* field) const override;
0087     
0088     /**
0089      * Returns a pointer to a new allocated clone of this object.
0090      */
0091     G4Field* Clone() const override;
0092 
0093     /**
0094      * Returns the field type ID, 'kGravity'.
0095      */
0096     inline G4FieldType GetFieldType() const override { return kGravity; }
0097 
0098   private:
0099 
0100     G4double fFieldComponents[3];
0101 };
0102 
0103 #endif