| 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: G4Field.hh,v 1.10 2006/06/29 18:22:13 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: HEAD $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // class G4Field
|
|---|
| 32 | //
|
|---|
| 33 | // Class description:
|
|---|
| 34 | //
|
|---|
| 35 | // Abstract class for any kind of Field.
|
|---|
| 36 | // It allows any kind of field (vector, scalar, tensor and any set of them)
|
|---|
| 37 | // to be defined by implementing the inquiry function interface.
|
|---|
| 38 | //
|
|---|
| 39 | // The key method is GetFieldValue( const double Point[4],
|
|---|
| 40 | // ************* double *fieldArr )
|
|---|
| 41 | // Given an input position/time vector 'Point',
|
|---|
| 42 | // this method must return the value of the field in "fieldArr".
|
|---|
| 43 | //
|
|---|
| 44 | // A field must also specify whether it changes a track's energy:
|
|---|
| 45 | // DoesFieldChangeEnergy()
|
|---|
| 46 | // *********************
|
|---|
| 47 | // A field must co-work with a corresponding Equation of Motion, to
|
|---|
| 48 | // enable the integration of a particle's position, momentum and, optionally,
|
|---|
| 49 | // spin. For this a field and its equation of motion must follow the
|
|---|
| 50 | // same convention for the order of field components in the array "fieldArr"
|
|---|
| 51 | // -------------------------------------------------------------------
|
|---|
| 52 | // History:
|
|---|
| 53 | // - Created: John Apostolakis, 10.03.1997
|
|---|
| 54 | // - Modified:
|
|---|
| 55 | // V. Grichine 8 Nov 2001: Extended "Point" arg to [4] array to add time
|
|---|
| 56 | // J. Apostolakis 5 Nov 2003: Added virtual method DoesFieldChangeEnergy()
|
|---|
| 57 | // J. Apostolakis 31 Aug 2004: Information on convention for components
|
|---|
| 58 | // -------------------------------------------------------------------
|
|---|
| 59 |
|
|---|
| 60 | #ifndef G4FIELD_HH
|
|---|
| 61 | #define G4FIELD_HH
|
|---|
| 62 |
|
|---|
| 63 | #include "G4Types.hh"
|
|---|
| 64 |
|
|---|
| 65 | class G4Field
|
|---|
| 66 | {
|
|---|
| 67 | public: // with description
|
|---|
| 68 |
|
|---|
| 69 | virtual void GetFieldValue( const double Point[4],
|
|---|
| 70 | double *fieldArr ) const = 0;
|
|---|
| 71 | // Given the position time vector 'Point',
|
|---|
| 72 | // return the value of the field in the array fieldArr.
|
|---|
| 73 | // Notes:
|
|---|
| 74 | // 1) The 'Point' vector has the following structure:
|
|---|
| 75 | // Point[0] is x ( position, in Geant4 units )
|
|---|
| 76 | // Point[1] is y
|
|---|
| 77 | // Point[2] is z
|
|---|
| 78 | // Point[3] is t ( time, in Geant4 units )
|
|---|
| 79 | // 2) The convention for the components of the field
|
|---|
| 80 | // array 'fieldArr' are determined by the type of field.
|
|---|
| 81 | // See for example the class G4ElectroMagneticField.
|
|---|
| 82 |
|
|---|
| 83 | G4Field(){;}
|
|---|
| 84 | virtual ~G4Field(){;}
|
|---|
| 85 | inline G4Field& operator = (const G4Field &p);
|
|---|
| 86 |
|
|---|
| 87 | // A field signature function that can be used to insure
|
|---|
| 88 | // that the Equation of motion object and the G4Field object
|
|---|
| 89 | // have the same "field signature"?
|
|---|
| 90 |
|
|---|
| 91 | virtual G4bool DoesFieldChangeEnergy() const= 0 ;
|
|---|
| 92 | // Each type/class of field should respond this accordingly
|
|---|
| 93 | // For example:
|
|---|
| 94 | // - an electric field should return "true"
|
|---|
| 95 | // - a pure magnetic field should return "false"
|
|---|
| 96 |
|
|---|
| 97 | };
|
|---|
| 98 |
|
|---|
| 99 | inline G4Field& G4Field::operator = (const G4Field &p)
|
|---|
| 100 | {
|
|---|
| 101 | if (&p != this) { *this = p; }
|
|---|
| 102 | return *this;
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 | #endif /* G4FIELD_HH */
|
|---|