EDepSimUniformField.cc
Go to the documentation of this file.
1 // ********************************************************************
2 // * License and Disclaimer *
3 // * *
4 // * The Geant4 software is copyright of the Copyright Holders of *
5 // * the Geant4 Collaboration. It is provided under the terms and *
6 // * conditions of the Geant4 Software License, included in the file *
7 // * LICENSE and available at http://cern.ch/geant4/license . These *
8 // * include a list of copyright holders. *
9 // * *
10 // * Neither the authors of this software system, nor their employing *
11 // * institutes,nor the agencies providing financial support for this *
12 // * work make any representation or warranty, express or implied, *
13 // * regarding this software system or assume any liability for its *
14 // * use. Please see the license in the file LICENSE and URL above *
15 // * for the full disclaimer and the limitation of liability. *
16 // * *
17 // * This code implementation is the result of the scientific and *
18 // * technical work of the GEANT4 collaboration. *
19 // * By using, copying, modifying or distributing the software (or *
20 // * any work based on the software) you agree to acknowledge its *
21 // * use in resulting scientific publications, and indicate your *
22 // * acceptance of all terms of the Geant4 Software license. *
23 // ********************************************************************
24 //
25 //
26 // $Id$
27 //
28 //
29 // Class for creation of uniform Electric Field
30 //
31 // 30.1.97 V.Grichine
32 // - 15.03.17 C.McGrew adapted for EDepSim
33 // - 26.05.20 A.Cudd adapted for arbitrary fields
34 //
35 // -------------------------------------------------------------------
36 
37 #include "EDepSimUniformField.hh"
38 #include "G4PhysicalConstants.hh"
39 
41 {
42  fFieldComponents[0] = 0.0;
43  fFieldComponents[1] = 0.0;
44  fFieldComponents[2] = 0.0;
45  fFieldComponents[3] = 0.0;
46  fFieldComponents[4] = 0.0;
47  fFieldComponents[5] = 0.0;
48 }
49 
51  const G4ThreeVector bField,
52  const G4ThreeVector eField )
53 {
54  fFieldComponents[0] = bField.x();
55  fFieldComponents[1] = bField.y();
56  fFieldComponents[2] = bField.z();
57  fFieldComponents[3] = eField.x();
58  fFieldComponents[4] = eField.y();
59  fFieldComponents[5] = eField.z();
60 }
61 
63  const G4ThreeVector bField )
64 {
65  fFieldComponents[0] = bField.x();
66  fFieldComponents[1] = bField.y();
67  fFieldComponents[2] = bField.z();
68  fFieldComponents[3] = 0.0;
69  fFieldComponents[4] = 0.0;
70  fFieldComponents[5] = 0.0;
71 }
72 
74 {
75 }
76 
78  : G4ElectricField(p)
79 {
80  for (G4int i=0; i<6; i++) {
82  }
83 }
84 
87 {
88  for (G4int i=0; i<6; i++) {
90  }
91  return *this;
92 }
93 
94 // ------------------------------------------------------------------------
95 
96 void EDepSim::UniformField::GetFieldValue (const G4double* /* position */,
97  G4double *fieldBandE ) const
98 {
99  for (G4int i=0; i<6; ++i) {
100  fieldBandE[i] = fFieldComponents[i];
101  }
102 }
103 
104 void EDepSim::UniformField::SetBField(const G4ThreeVector bField)
105 {
106  fFieldComponents[0] = bField.x();
107  fFieldComponents[1] = bField.y();
108  fFieldComponents[2] = bField.z();
109 }
110 
111 void EDepSim::UniformField::SetEField(const G4ThreeVector eField)
112 {
113  fFieldComponents[3] = eField.x();
114  fFieldComponents[4] = eField.y();
115  fFieldComponents[5] = eField.z();
116 }
virtual void SetBField(const G4ThreeVector bField)
p
Definition: test.py:223
virtual void GetFieldValue(const G4double pos[4], G4double *field) const
virtual void SetEField(const G4ThreeVector eField)
UniformField & operator=(const UniformField &p)