34 :feXoffset(exOffset),feYoffset(eyOffset),feZoffset(ezOffset),einvertX(false),einvertY(false),einvertZ(false)
40 G4cout <<
"\n-----------------------------------------------------------"
41 <<
"\n Electric field"
42 <<
"\n-----------------------------------------------------------";
44 G4cout <<
"\n ---> " "Reading the field grid from " << filename <<
" ... " << endl;
47 ifstream file( filename );
51 file.getline(ebuffer,256);
56 G4cout <<
" [ Number of values x,y,z: "
57 <<
Enx <<
" " <<
Eny <<
" " << Enz <<
" ] "
65 for (ix=0; ix<
Enx; ix++) {
69 for (iy=0; iy<
Eny; iy++) {
83 for (iz=0; iz<
Enz; iz++) {
84 for (iy=0; iy<
Eny; iy++) {
85 for (ix=0; ix<
Enx; ix++) {
86 file >> Exval >> Eyval >> Ezval >> Ex >> Ey >> Ez;
88 if ( ix==0 && iy==0 && iz==0 ) {
89 Eminx = Exval * ElenUnit;
90 Eminy = Eyval * ElenUnit;
91 Eminz = Ezval * ElenUnit;
102 Emaxx = Exval * ElenUnit;
103 Emaxy = Eyval * ElenUnit;
104 Emaxz = Ezval * ElenUnit;
106 G4cout <<
"\n ---> ... done reading " << endl;
109 G4cout <<
" ---> assumed the order: x, y, z, Ex, Ey, Ez "
110 <<
"\n ---> Min values x,y,z: "
112 <<
"\n ---> Max values x,y,z: "
114 <<
"\n ---> The field will be offset in x by " << exOffset/
cm <<
" cm "
115 <<
"\n ---> The field will be offset in y by " << eyOffset/
cm <<
" cm "
116 <<
"\n ---> The field will be offset in z by " << ezOffset/
cm <<
" cm " << endl;
122 G4cout <<
"\nAfter reordering if neccesary"
123 <<
"\n ---> Min values x,y,z: "
125 <<
" \n ---> Max values x,y,z: "
131 G4cout <<
"\n ---> Dif values x,y,z (range): "
133 <<
"\n-----------------------------------------------------------" << endl;
156 if (
einvertX) { Exfraction = 1 - Exfraction;}
157 if (
einvertY) { Eyfraction = 1 - Eyfraction;}
158 if (
einvertZ) { Ezfraction = 1 - Ezfraction;}
162 G4double exdindex, eydindex, ezdindex;
166 G4double exlocal = ( std::modf(Exfraction*(
Enx-1), &exdindex));
167 G4double eylocal = ( std::modf(Eyfraction*(
Eny-1), &eydindex));
168 G4double ezlocal = ( std::modf(Ezfraction*(
Enz-1), &ezdindex));
195 xEField[exindex ][eyindex ][ezindex ] * (1-exlocal) * (1-eylocal) * (1-ezlocal) +
196 xEField[exindex ][eyindex ][ezindex+1] * (1-exlocal) * (1-eylocal) * ezlocal +
197 xEField[exindex ][eyindex+1][ezindex ] * (1-exlocal) * eylocal * (1-ezlocal) +
198 xEField[exindex ][eyindex+1][ezindex+1] * (1-exlocal) * eylocal * ezlocal +
199 xEField[exindex+1][eyindex ][ezindex ] * exlocal * (1-eylocal) * (1-ezlocal) +
200 xEField[exindex+1][eyindex ][ezindex+1] * exlocal * (1-eylocal) * ezlocal +
201 xEField[exindex+1][eyindex+1][ezindex ] * exlocal * eylocal * (1-ezlocal) +
202 xEField[exindex+1][eyindex+1][ezindex+1] * exlocal * eylocal * ezlocal ;
204 yEField[exindex ][eyindex ][ezindex ] * (1-exlocal) * (1-eylocal) * (1-ezlocal) +
205 yEField[exindex ][eyindex ][ezindex+1] * (1-exlocal) * (1-eylocal) * ezlocal +
206 yEField[exindex ][eyindex+1][ezindex ] * (1-exlocal) * eylocal * (1-ezlocal) +
207 yEField[exindex ][eyindex+1][ezindex+1] * (1-exlocal) * eylocal * ezlocal +
208 yEField[exindex+1][eyindex ][ezindex ] * exlocal * (1-eylocal) * (1-ezlocal) +
209 yEField[exindex+1][eyindex ][ezindex+1] * exlocal * (1-eylocal) * ezlocal +
210 yEField[exindex+1][eyindex+1][ezindex ] * exlocal * eylocal * (1-ezlocal) +
211 yEField[exindex+1][eyindex+1][ezindex+1] * exlocal * eylocal * ezlocal ;
213 zEField[exindex ][eyindex ][ezindex ] * (1-exlocal) * (1-eylocal) * (1-ezlocal) +
214 zEField[exindex ][eyindex ][ezindex+1] * (1-exlocal) * (1-eylocal) * ezlocal +
215 zEField[exindex ][eyindex+1][ezindex ] * (1-exlocal) * eylocal * (1-ezlocal) +
216 zEField[exindex ][eyindex+1][ezindex+1] * (1-exlocal) * eylocal * ezlocal +
217 zEField[exindex+1][eyindex ][ezindex ] * exlocal * (1-eylocal) * (1-ezlocal) +
218 zEField[exindex+1][eyindex ][ezindex+1] * exlocal * (1-eylocal) * ezlocal +
219 zEField[exindex+1][eyindex+1][ezindex ] * exlocal * eylocal * (1-ezlocal) +
220 zEField[exindex+1][eyindex+1][ezindex+1] * exlocal * eylocal * ezlocal ;
#define G4MUTEX_INITIALIZER
vector< vector< vector< G4double > > > xEField
G4GLOB_DLL std::ostream G4cout
void GetFieldValue(const G4double Epoint[4], G4double *Efield) const
HadrontherapyElectricTabulatedField3D(const char *filename, G4double exOffset, G4double eyOffset, G4double ezOffset)
vector< vector< vector< G4double > > > zEField
vector< vector< vector< G4double > > > yEField