G4UniformGravityField.cc

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 // Class for creation of Uniform Gravitation Field.
00028 //
00029 
00030 // History:
00031 // - 14.06.11 P.Gumplinger, Created.
00032 // -------------------------------------------------------------------
00033 // Adopted from G4UniformElectricField.hh
00034 //
00035 // Thanks to Peter Fierlinger (PSI) and
00036 // A. Capra and A. Fontana (INFN Pavia)
00037 // -------------------------------------------------------------------
00038 //
00039 #include "G4UniformGravityField.hh"
00040 #include "G4PhysicalConstants.hh"
00041 #include "G4SystemOfUnits.hh"
00042 
00043 // Construct from a 3-vector
00044 G4UniformGravityField::G4UniformGravityField(const G4ThreeVector FieldVector)
00045   : G4Field ( true ) //  Gravity flag *on*
00046 {
00047       fFieldComponents[0] = FieldVector.x();
00048       fFieldComponents[1] = FieldVector.y();
00049       fFieldComponents[2] = FieldVector.z();
00050 }
00051 
00052 // Construct from a double > default = -9.81 m*s^-2
00053 G4UniformGravityField::G4UniformGravityField(const G4double gy )
00054   : G4Field ( true ) 
00055 {
00056       fFieldComponents[0] = 0.0;
00057       fFieldComponents[1] = gy;
00058       fFieldComponents[2] = 0.0;
00059 }
00060 
00061 G4UniformGravityField::~G4UniformGravityField()
00062 {
00063 }
00064 
00065 G4UniformGravityField::G4UniformGravityField (const G4UniformGravityField &p)
00066    : G4Field(p)
00067 {
00068    for (G4int i=0; i<3; i++)
00069       fFieldComponents[i] = p.fFieldComponents[i];
00070 }
00071 
00072 G4UniformGravityField&
00073 G4UniformGravityField::operator = (const G4UniformGravityField &p)
00074 {
00075    // G4Field::SetGravityActive( p.IsGravityActive ); 
00076 
00077    for (G4int i=0; i<3; i++)
00078       fFieldComponents[i] = p.fFieldComponents[i];
00079    return *this;
00080 }
00081 
00082 // -------------------------------------------------------------------
00083 
00084 void G4UniformGravityField::GetFieldValue (const G4double [4],
00085                                                  G4double *G ) const
00086 {
00087    G[0]= fFieldComponents[0] ;
00088    G[1]= fFieldComponents[1] ;
00089    G[2]= fFieldComponents[2] ;
00090 }

Generated on Mon May 27 17:50:07 2013 for Geant4 by  doxygen 1.4.7