G4Field.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: G4Field.hh 69786 2013-05-15 09:38:51Z gcosmo $
00028 //
00029 //
00030 // class G4Field
00031 //
00032 // Class description:
00033 //
00034 // Abstract class for any kind of Field.
00035 // It allows any kind of field (vector, scalar, tensor and any set of them)
00036 // to be defined by implementing the inquiry function interface.
00037 //
00038 // The key method is  GetFieldValue( const  double Point[4],
00039 //                    *************         double *fieldArr ) 
00040 // Given an input position/time vector 'Point', 
00041 // this method must return the value of the field in "fieldArr".
00042 //
00043 // A field must also specify whether it changes a track's energy:
00044 //                    DoesFieldChangeEnergy() 
00045 //                    *********************
00046 // A field must co-work with a corresponding Equation of Motion, to
00047 // enable the integration of a particle's position, momentum and, optionally, 
00048 // spin.  For this a field and its equation of motion must follow the
00049 // same convention for the order of field components in the array "fieldArr"
00050 // -------------------------------------------------------------------
00051 // History:
00052 // - Created:  John Apostolakis, 10.03.1997
00053 // - Modified: 
00054 //   V. Grichine     8 Nov 2001: Extended "Point" arg to [4] array to add time
00055 //   J. Apostolakis  5 Nov 2003: Added virtual method DoesFieldChangeEnergy()
00056 //   J. Apostolakis 31 Aug 2004: Information on convention for components
00057 // -------------------------------------------------------------------
00058 
00059 #ifndef G4FIELD_HH
00060 #define G4FIELD_HH
00061 
00062 #include "G4Types.hh"
00063 
00064 class G4Field
00065 {
00066   public:  // with description
00067 
00068       virtual void  GetFieldValue( const  double Point[4],
00069                                           double *fieldArr ) const = 0;
00070        // Given the position time vector 'Point', 
00071        // return the value of the field in the array fieldArr.
00072        //  Notes: 
00073        //   1) The 'Point' vector has the following structure:
00074        //        Point[0]  is  x  ( position, in Geant4 units )
00075        //        Point[1]  is  y
00076        //        Point[2]  is  z
00077        //        Point[3]  is  t  ( time,  in Geant4 units )
00078        //   2) The convention for the components of the field
00079        //      array 'fieldArr' are determined by the type of field.
00080        //      See for example the class G4ElectroMagneticField.
00081 
00082       G4Field( G4bool gravityOn= false);
00083       G4Field( const G4Field & );
00084       virtual ~G4Field();
00085       inline G4Field& operator = (const G4Field &p); 
00086 
00087      // A field signature function that can be used to insure
00088      // that the Equation of motion object and the G4Field object
00089      // have the same "field signature"?
00090  
00091       virtual G4bool   DoesFieldChangeEnergy() const= 0 ;
00092        //  Each type/class of field should respond this accordingly
00093        //  For example:
00094        //    - an electric field     should return "true"
00095        //    - a pure magnetic field should return "false"
00096 
00097       G4bool   IsGravityActive() const { return fGravityActive;}
00098        //  Does this field include gravity?
00099       inline void SetGravityActive( G4bool OnOffFlag ); 
00100   private: 
00101       G4bool  fGravityActive;
00102 };
00103 
00104 inline void  G4Field::SetGravityActive( G4bool OnOffFlag )
00105 { 
00106   fGravityActive= OnOffFlag; 
00107 } 
00108 #endif /* G4FIELD_HH */

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