Import Geant4 10.3.1 source tree

This commit is contained in:
Gabriele Cosmo
2017-02-28 16:16:20 +01:00
parent a3452e42ac
commit 4597adb7c4
267 changed files with 14761 additions and 24650 deletions
@@ -32,30 +32,30 @@
namespace{ G4Mutex MyHadrontherapyLockEField=G4MUTEX_INITIALIZER; }
HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( const char* filename, G4double exOffset, G4double eyOffset, G4double ezOffset)
HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( const char* filename, G4double exOffset, G4double eyOffset, G4double ezOffset)
:feXoffset(exOffset),feYoffset(eyOffset),feZoffset(ezOffset),einvertX(false),einvertY(false),einvertZ(false)
{
{
//The format file is: X Y Z Ex Ey Ez
G4double ElenUnit= cm;
G4double EfieldUnit= volt/m;
G4double EfieldUnit= volt/m;
G4cout << "\n-----------------------------------------------------------"
<< "\n Electric field"
<< "\n-----------------------------------------------------------";
G4cout << "\n ---> " "Reading the field grid from " << filename << " ... " << endl;
G4AutoLock lock(&MyHadrontherapyLockEField);
ifstream file( filename ); // Open the file for reading.
// Ignore first blank line
char ebuffer[256];
file.getline(ebuffer,256);
// Read table dimensions
// Read table dimensions
file >> Enx >> Eny >> Enz; // Note dodgy order
G4cout << " [ Number of values x,y,z: "
G4cout << " [ Number of values x,y,z: "
<< Enx << " " << Eny << " " << Enz << " ] "
<< endl;
@@ -86,7 +86,7 @@ HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( co
for (iy=0; iy<Eny; iy++) {
for (ix=0; ix<Enx; ix++) {
file >> Exval >> Eyval >> Ezval >> Ex >> Ey >> Ez;
if ( ix==0 && iy==0 && iz==0 ) {
Eminx = Exval * ElenUnit;
Eminy = Eyval * ElenUnit;
@@ -107,30 +107,30 @@ HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( co
G4cout << "\n ---> ... done reading " << endl;
// G4cout << " Read values of field from file " << filename << endl;
// G4cout << " Read values of field from file " << filename << endl;
G4cout << " ---> assumed the order: x, y, z, Ex, Ey, Ez "
<< "\n ---> Min values x,y,z: "
<< "\n ---> Min values x,y,z: "
<< Eminx/cm << " " << Eminy/cm << " " << Eminz/cm << " cm "
<< "\n ---> Max values x,y,z: "
<< "\n ---> Max values x,y,z: "
<< Emaxx/cm << " " << Emaxy/cm << " " << Emaxz/cm << " cm "
<< "\n ---> The field will be offset in x by " << exOffset/cm << " cm "
<< "\n ---> The field will be offset in y by " << eyOffset/cm << " cm "
<< "\n ---> The field will be offset in x by " << exOffset/cm << " cm "
<< "\n ---> The field will be offset in y by " << eyOffset/cm << " cm "
<< "\n ---> The field will be offset in z by " << ezOffset/cm << " cm " << endl;
// Should really check that the limits are not the wrong way around.
if (Emaxx < Eminx) {swap(Emaxx,Eminx); einvertX = true;}
if (Emaxy < Eminy) {swap(Emaxy,Eminy); einvertY = true;}
if (Emaxz < Eminz) {swap(Emaxz,Eminz); einvertZ = true;}
G4cout << "\nAfter reordering if neccesary"
<< "\n ---> Min values x,y,z: "
if (Emaxx < Eminx) {swap(Emaxx,Eminx); einvertX = true;}
if (Emaxy < Eminy) {swap(Emaxy,Eminy); einvertY = true;}
if (Emaxz < Eminz) {swap(Emaxz,Eminz); einvertZ = true;}
G4cout << "\nAfter reordering if neccesary"
<< "\n ---> Min values x,y,z: "
<< Eminx/cm << " " << Eminy/cm << " " << Eminz/cm << " cm "
<< " \n ---> Max values x,y,z: "
<< " \n ---> Max values x,y,z: "
<< Emaxx/cm << " " << Emaxy/cm << " " << Emaxz/cm << " cm ";
dx1 = Emaxx - Eminx;
dy1 = Emaxy - Eminy;
dz1 = Emaxz - Eminz;
G4cout << "\n ---> Dif values x,y,z (range): "
G4cout << "\n ---> Dif values x,y,z (range): "
<< dx1/cm << " " << dy1/cm << " " << dz1/cm << " cm "
<< "\n-----------------------------------------------------------" << endl;
}
@@ -138,19 +138,14 @@ HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( co
void HadrontherapyElectricTabulatedField3D::GetFieldValue(const G4double Epoint[4],
G4double *Efield ) const
{
G4double x1 = Epoint[0] + feXoffset;
G4double y1 = Epoint[1] + feYoffset;
G4double z1 = Epoint[2] + feZoffset;
G4double x1 = Epoint[0] + feXoffset;
G4double y1 = Epoint[1] + feYoffset;
G4double z1 = Epoint[2] + feZoffset;
// Check that the point is within the defined region
if ( x1>Eminx && x1<Emaxx &&
y1>Eminy && y1<Emaxy &&
z1>Eminz && z1<Emaxz ) {
// Position of given point within region, normalized to the range
// [0,1]
G4double Exfraction = (x1 - Eminx) / dx1;
G4double Eyfraction = (y1 - Eminy) / dy1;
G4double Eyfraction = (y1 - Eminy) / dy1;
G4double Ezfraction = (z1 - Eminz) / dz1;
if (einvertX) { Exfraction = 1 - Exfraction;}
@@ -160,19 +155,33 @@ void HadrontherapyElectricTabulatedField3D::GetFieldValue(const G4double Epoint[
// Need addresses of these to pass to modf below.
// modf uses its second argument as an OUTPUT argument.
G4double exdindex, eydindex, ezdindex;
// Position of the point within the cuboid defined by the
// nearest surrounding tabulated points
G4double exlocal = ( std::modf(Exfraction*(Enx-1), &exdindex));
G4double eylocal = ( std::modf(Eyfraction*(Eny-1), &eydindex));
G4double ezlocal = ( std::modf(Ezfraction*(Enz-1), &ezdindex));
// The indices of the nearest tabulated point whose coordinates
// are all less than those of the given point
G4int exindex = static_cast<G4int>(std::floor(exdindex));
G4int eyindex = static_cast<G4int>(std::floor(eydindex));
G4int ezindex = static_cast<G4int>(std::floor(ezdindex));
if ((exindex < 0) || (exindex >= Enx - 1) ||
(eyindex < 0) || (eyindex >= Eny - 1) ||
(ezindex < 0) || (ezindex >= Enz - 1))
{
Efield[0] = 0.0;
Efield[1] = 0.0;
Efield[2] = 0.0;
Efield[3] = 0.0;
Efield[4] = 0.0;
Efield[5] = 0.0;
}
else
{
/*
#ifdef DEBUG_G4intERPOLATING_FIELD
G4cout << "Local x,y,z: " << exlocal << " " << eylocal << " " << ezlocal << endl;
@@ -187,45 +196,37 @@ void HadrontherapyElectricTabulatedField3D::GetFieldValue(const G4double Epoint[
*/
// Full 3-dimensional version
Efield[0] = 0.0;
Efield[1] = 0.0;
Efield[2] = 0.0;
Efield[0] = 0.0;
Efield[1] = 0.0;
Efield[2] = 0.0;
Efield[3] =
xEField[exindex ][eyindex ][ezindex ] * (1-exlocal) * (1-eylocal) * (1-ezlocal) +
xEField[exindex ][eyindex ][ezindex+1] * (1-exlocal) * (1-eylocal) * ezlocal +
xEField[exindex ][eyindex+1][ezindex ] * (1-exlocal) * eylocal * (1-ezlocal) +
xEField[exindex ][eyindex+1][ezindex+1] * (1-exlocal) * eylocal * ezlocal +
xEField[exindex+1][eyindex ][ezindex ] * exlocal * (1-eylocal) * (1-ezlocal) +
xEField[exindex+1][eyindex ][ezindex+1] * exlocal * (1-eylocal) * ezlocal +
xEField[exindex+1][eyindex+1][ezindex ] * exlocal * eylocal * (1-ezlocal) +
xEField[exindex+1][eyindex+1][ezindex+1] * exlocal * eylocal * ezlocal ;
Efield[4] =
yEField[exindex ][eyindex ][ezindex ] * (1-exlocal) * (1-eylocal) * (1-ezlocal) +
yEField[exindex ][eyindex ][ezindex+1] * (1-exlocal) * (1-eylocal) * ezlocal +
yEField[exindex ][eyindex+1][ezindex ] * (1-exlocal) * eylocal * (1-ezlocal) +
yEField[exindex ][eyindex+1][ezindex+1] * (1-exlocal) * eylocal * ezlocal +
yEField[exindex+1][eyindex ][ezindex ] * exlocal * (1-eylocal) * (1-ezlocal) +
yEField[exindex+1][eyindex ][ezindex+1] * exlocal * (1-eylocal) * ezlocal +
yEField[exindex+1][eyindex+1][ezindex ] * exlocal * eylocal * (1-ezlocal) +
yEField[exindex+1][eyindex+1][ezindex+1] * exlocal * eylocal * ezlocal ;
Efield[5] =
zEField[exindex ][eyindex ][ezindex ] * (1-exlocal) * (1-eylocal) * (1-ezlocal) +
zEField[exindex ][eyindex ][ezindex+1] * (1-exlocal) * (1-eylocal) * ezlocal +
zEField[exindex ][eyindex+1][ezindex ] * (1-exlocal) * eylocal * (1-ezlocal) +
zEField[exindex ][eyindex+1][ezindex+1] * (1-exlocal) * eylocal * ezlocal +
zEField[exindex+1][eyindex ][ezindex ] * exlocal * (1-eylocal) * (1-ezlocal) +
zEField[exindex+1][eyindex ][ezindex+1] * exlocal * (1-eylocal) * ezlocal +
zEField[exindex+1][eyindex+1][ezindex ] * exlocal * eylocal * (1-ezlocal) +
zEField[exindex+1][eyindex+1][ezindex+1] * exlocal * eylocal * ezlocal ;
} else {
Efield[0] = 0.0;
Efield[1] = 0.0;
Efield[2] = 0.0;
Efield[3] = 0.0;
Efield[4] = 0.0;
Efield[5] = 0.0;
Efield[3] =
xEField[exindex ][eyindex ][ezindex ] * (1-exlocal) * (1-eylocal) * (1-ezlocal) +
xEField[exindex ][eyindex ][ezindex+1] * (1-exlocal) * (1-eylocal) * ezlocal +
xEField[exindex ][eyindex+1][ezindex ] * (1-exlocal) * eylocal * (1-ezlocal) +
xEField[exindex ][eyindex+1][ezindex+1] * (1-exlocal) * eylocal * ezlocal +
xEField[exindex+1][eyindex ][ezindex ] * exlocal * (1-eylocal) * (1-ezlocal) +
xEField[exindex+1][eyindex ][ezindex+1] * exlocal * (1-eylocal) * ezlocal +
xEField[exindex+1][eyindex+1][ezindex ] * exlocal * eylocal * (1-ezlocal) +
xEField[exindex+1][eyindex+1][ezindex+1] * exlocal * eylocal * ezlocal ;
Efield[4] =
yEField[exindex ][eyindex ][ezindex ] * (1-exlocal) * (1-eylocal) * (1-ezlocal) +
yEField[exindex ][eyindex ][ezindex+1] * (1-exlocal) * (1-eylocal) * ezlocal +
yEField[exindex ][eyindex+1][ezindex ] * (1-exlocal) * eylocal * (1-ezlocal) +
yEField[exindex ][eyindex+1][ezindex+1] * (1-exlocal) * eylocal * ezlocal +
yEField[exindex+1][eyindex ][ezindex ] * exlocal * (1-eylocal) * (1-ezlocal) +
yEField[exindex+1][eyindex ][ezindex+1] * exlocal * (1-eylocal) * ezlocal +
yEField[exindex+1][eyindex+1][ezindex ] * exlocal * eylocal * (1-ezlocal) +
yEField[exindex+1][eyindex+1][ezindex+1] * exlocal * eylocal * ezlocal ;
Efield[5] =
zEField[exindex ][eyindex ][ezindex ] * (1-exlocal) * (1-eylocal) * (1-ezlocal) +
zEField[exindex ][eyindex ][ezindex+1] * (1-exlocal) * (1-eylocal) * ezlocal +
zEField[exindex ][eyindex+1][ezindex ] * (1-exlocal) * eylocal * (1-ezlocal) +
zEField[exindex ][eyindex+1][ezindex+1] * (1-exlocal) * eylocal * ezlocal +
zEField[exindex+1][eyindex ][ezindex ] * exlocal * (1-eylocal) * (1-ezlocal) +
zEField[exindex+1][eyindex ][ezindex+1] * exlocal * (1-eylocal) * ezlocal +
zEField[exindex+1][eyindex+1][ezindex ] * exlocal * eylocal * (1-ezlocal) +
zEField[exindex+1][eyindex+1][ezindex+1] * exlocal * eylocal * ezlocal ;
}
//G4cout << "Getting electric field " << Efield[3]/(volt/m) << " " << Efield[4]/(volt/m) << " " << Efield[5]/(volt/m) << endl;
//G4cout << "For coordinates: " << Epoint[0] << " " << Epoint[1] << " " << Epoint[2] << G4endl;
@@ -239,4 +240,3 @@ void HadrontherapyElectricTabulatedField3D::GetFieldValue(const G4double Epoint[
<< Efield[5]/(volt/m) << '\t' << " "
<< G4endl; */
}
@@ -32,31 +32,31 @@
namespace{ G4Mutex MyHadrontherapyLock=G4MUTEX_INITIALIZER; }
HadrontherapyMagneticField3D::HadrontherapyMagneticField3D( const char* filename, double xOffset )
HadrontherapyMagneticField3D::HadrontherapyMagneticField3D( const char* filename, double xOffset )
:fXoffset(xOffset),invertX(false),invertY(false),invertZ(false)
{
{
//The format file is: X Y Z Ex Ey Ez
double lenUnit= meter;
double fieldUnit= tesla;
double lenUnit= meter;
double fieldUnit= tesla;
G4cout << "\n-----------------------------------------------------------"
<< "\n Magnetic field"
<< "\n-----------------------------------------------------------";
G4cout << "\n ---> " "Reading the field grid from " << filename << " ... " << endl;
G4cout << "\n ---> " "Reading the field grid from " << filename << " ... " << endl;
G4AutoLock lock(&MyHadrontherapyLock);
ifstream file( filename ); // Open the file for reading.
// Ignore first blank line
char buffer[256];
file.getline(buffer,256);
// Read table dimensions
// Read table dimensions
file >> nx >> ny >> nz; // Note dodgy order
G4cout << " [ Number of values x,y,z: "
G4cout << " [ Number of values x,y,z: "
<< nx << " " << ny << " " << nz << " ] "
<< endl;
@@ -92,7 +92,7 @@ HadrontherapyMagneticField3D::HadrontherapyMagneticField3D( const char* filename
miny = yval * lenUnit;
minz = zval * lenUnit;
}
xField[ix][iy][iz] = bx * fieldUnit;
xField[ix][iy][iz] = bx * fieldUnit;
yField[ix][iy][iz] = by * fieldUnit;
zField[ix][iy][iz] = bz * fieldUnit;
}
@@ -108,28 +108,28 @@ HadrontherapyMagneticField3D::HadrontherapyMagneticField3D( const char* filename
G4cout << "\n ---> ... done reading " << endl;
// G4cout << " Read values of field from file " << filename << endl;
// G4cout << " Read values of field from file " << filename << endl;
G4cout << " ---> assumed the order: x, y, z, Bx, By, Bz "
<< "\n ---> Min values x,y,z: "
<< "\n ---> Min values x,y,z: "
<< minx/cm << " " << miny/cm << " " << minz/cm << " cm "
<< "\n ---> Max values x,y,z: "
<< "\n ---> Max values x,y,z: "
<< maxx/cm << " " << maxy/cm << " " << maxz/cm << " cm "
<< "\n ---> The field will be offset by " << xOffset/cm << " cm " << endl;
// Should really check that the limits are not the wrong way around.
if (maxx < minx) {swap(maxx,minx); invertX = true;}
if (maxy < miny) {swap(maxy,miny); invertY = true;}
if (maxz < minz) {swap(maxz,minz); invertZ = true;}
G4cout << "\nAfter reordering if neccesary"
<< "\n ---> Min values x,y,z: "
if (maxx < minx) {swap(maxx,minx); invertX = true;}
if (maxy < miny) {swap(maxy,miny); invertY = true;}
if (maxz < minz) {swap(maxz,minz); invertZ = true;}
G4cout << "\nAfter reordering if neccesary"
<< "\n ---> Min values x,y,z: "
<< minx/cm << " " << miny/cm << " " << minz/cm << " cm "
<< " \n ---> Max values x,y,z: "
<< " \n ---> Max values x,y,z: "
<< maxx/cm << " " << maxy/cm << " " << maxz/cm << " cm ";
dx = maxx - minx;
dy = maxy - miny;
dz = maxz - minz;
G4cout << "\n ---> Dif values x,y,z (range): "
G4cout << "\n ---> Dif values x,y,z (range): "
<< dx/cm << " " << dy/cm << " " << dz/cm << " cm in z "
<< "\n-----------------------------------------------------------" << endl;
}
@@ -137,18 +137,14 @@ HadrontherapyMagneticField3D::HadrontherapyMagneticField3D( const char* filename
void HadrontherapyMagneticField3D::GetFieldValue(const double point[4],
double *Bfield ) const
{
double x = point[0]+ fXoffset;
double y = point[1];
double z = point[2];
double x = point[0]+ fXoffset;
double y = point[1];
double z = point[2];
// Check that the point is within the defined region
if ( x>minx && x<maxx &&
y>miny && y<maxy &&
z>minz && z<maxz ) {
// Position of given point within region, normalized to the range
// [0,1]
double xfraction = (x - minx) / dx;
double yfraction = (y - miny) / dy;
double yfraction = (y - miny) / dy;
double zfraction = (z - minz) / dz;
if (invertX) { xfraction = 1 - xfraction;}
@@ -158,66 +154,74 @@ void HadrontherapyMagneticField3D::GetFieldValue(const double point[4],
// Need addresses of these to pass to modf below.
// modf uses its second argument as an OUTPUT argument.
double xdindex, ydindex, zdindex;
// Position of the point within the cuboid defined by the
// nearest surrounding tabulated points
double xlocal = ( std::modf(xfraction*(nx-1), &xdindex));
double ylocal = ( std::modf(yfraction*(ny-1), &ydindex));
double zlocal = ( std::modf(zfraction*(nz-1), &zdindex));
// The indices of the nearest tabulated point whose coordinates
// are all less than those of the given point
int xindex = static_cast<int>(std::floor(xdindex));
int yindex = static_cast<int>(std::floor(ydindex));
int zindex = static_cast<int>(std::floor(zdindex));
// Check that the point is within the defined region
if ((xindex < 0) || (xindex >= nx - 1) ||
(yindex < 0) || (yindex >= ny - 1) ||
(zindex < 0) || (zindex >= nz - 1))
{
Bfield[0] = 0.0;
Bfield[1] = 0.0;
Bfield[2] = 0.0;
}
else
{
#ifdef DEBUG_INTERPOLATING_FIELD
G4cout << "Local x,y,z: " << xlocal << " " << ylocal << " " << zlocal << endl;
G4cout << "Index x,y,z: " << xindex << " " << yindex << " " << zindex << endl;
double valx0z0, mulx0z0, valx1z0, mulx1z0;
double valx0z1, mulx0z1, valx1z1, mulx1z1;
valx0z0= table[xindex ][0][zindex]; mulx0z0= (1-xlocal) * (1-zlocal);
valx1z0= table[xindex+1][0][zindex]; mulx1z0= xlocal * (1-zlocal);
valx0z1= table[xindex ][0][zindex+1]; mulx0z1= (1-xlocal) * zlocal;
valx1z1= table[xindex+1][0][zindex+1]; mulx1z1= xlocal * zlocal;
G4cout << "Local x,y,z: " << xlocal << " " << ylocal << " " << zlocal << endl;
G4cout << "Index x,y,z: " << xindex << " " << yindex << " " << zindex << endl;
double valx0z0, mulx0z0, valx1z0, mulx1z0;
double valx0z1, mulx0z1, valx1z1, mulx1z1;
valx0z0= table[xindex ][0][zindex]; mulx0z0= (1-xlocal) * (1-zlocal);
valx1z0= table[xindex+1][0][zindex]; mulx1z0= xlocal * (1-zlocal);
valx0z1= table[xindex ][0][zindex+1]; mulx0z1= (1-xlocal) * zlocal;
valx1z1= table[xindex+1][0][zindex+1]; mulx1z1= xlocal * zlocal;
#endif
// Full 3-dimensional version
Bfield[0] =
xField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
xField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
xField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
xField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
xField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
xField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
xField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
xField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal ;
Bfield[0] =
xField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
xField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
xField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
xField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
xField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
xField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
xField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
xField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal ;
Bfield[1] =
yField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
yField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
yField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
yField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
yField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
yField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
yField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
yField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal ;
Bfield[1] =
yField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
yField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
yField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
yField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
yField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
yField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
yField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
yField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal ;
Bfield[2] =
zField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
zField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
zField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
zField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
zField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
zField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
zField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
zField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal ;
}
Bfield[2] =
zField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
zField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
zField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
zField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
zField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
zField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
zField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
zField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal ;
} else {
Bfield[0] = 0.0;
Bfield[1] = 0.0;
Bfield[2] = 0.0;
}
//In order to obtain the output file with the magnetic components read from a particle passing in the magnetic field
/* std::ofstream MagneticField("MagneticField.out", std::ios::app);
MagneticField<< Bfield[0] << '\t' << " "
@@ -227,6 +231,5 @@ void HadrontherapyMagneticField3D::GetFieldValue(const double point[4],
<< point[1] << '\t' << " "
<< point[2] << '\t' << " "
<< G4endl;*/
}
}
@@ -469,12 +469,12 @@ for (G4int i=1;i<StepNumbers;i++)
G4VisAttributes * red = new G4VisAttributes( G4Colour(1. ,0. ,0.));
red-> SetVisibility(true);
red-> SetForceSolid(true);
logicMotherMod -> SetVisAttributes(G4VisAttributes::GetInvisible());
logicMotherMod -> SetVisAttributes(G4VisAttributes::Invisible);
logicMod1 ->SetVisAttributes(G4VisAttributes::GetInvisible());
logicMod2 ->SetVisAttributes(G4VisAttributes::GetInvisible());
logicMod3 ->SetVisAttributes(G4VisAttributes::GetInvisible());
logicMod4 ->SetVisAttributes(G4VisAttributes::GetInvisible());
logicMod1 ->SetVisAttributes(G4VisAttributes::Invisible);
logicMod2 ->SetVisAttributes(G4VisAttributes::Invisible);
logicMod3 ->SetVisAttributes(G4VisAttributes::Invisible);
logicMod4 ->SetVisAttributes(G4VisAttributes::Invisible);
for (G4int i=1;i<StepNumbers;i++)
{
@@ -727,7 +727,7 @@ void LaserDrivenBeamLine::ConstructLaserDrivenBeamLine()
// The treatment room is invisible in the Visualisation
logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::GetInvisible());
logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::Invisible);
// The various components of the energyselector are constructed calling
// the following methods
@@ -1049,7 +1049,7 @@ G4double VirtualLateralPosX=GuardRingPosX+GuardRingThickness/2+1*cm+(FaradayCupB
logicVirtualWindow,
physicVirtualMag,
true,0);
logicVirtualWindow->SetVisAttributes (G4VisAttributes::GetInvisible());
logicVirtualWindow->SetVisAttributes (G4VisAttributes::Invisible);
///// GuardRing /////
@@ -1094,7 +1094,7 @@ G4double VirtualLateralPosX=GuardRingPosX+GuardRingThickness/2+1*cm+(FaradayCupB
physicVirtualMag,
true,0);
logicVirtualMiddle->SetVisAttributes (G4VisAttributes::GetInvisible());
logicVirtualMiddle->SetVisAttributes (G4VisAttributes::Invisible);
///// FaradayCupBottom /////
@@ -1135,7 +1135,7 @@ G4double VirtualLateralPosX=GuardRingPosX+GuardRingThickness/2+1*cm+(FaradayCupB
physicVirtualMag,
true,0);
logicVirtualBottom->SetVisAttributes (G4VisAttributes::GetInvisible());
logicVirtualBottom->SetVisAttributes (G4VisAttributes::Invisible);
///// Cup /////
@@ -1177,7 +1177,7 @@ G4double VirtualLateralPosX=GuardRingPosX+GuardRingThickness/2+1*cm+(FaradayCupB
physicVirtualMag,
true,0);
logicVirtualOverBottom->SetVisAttributes (G4VisAttributes::GetInvisible());
logicVirtualOverBottom->SetVisAttributes (G4VisAttributes::Invisible);
///// Virtual Lateral /////
@@ -1202,7 +1202,7 @@ logicVirtualLateral=new G4LogicalVolume( VirtualLateral,
logicVirtualLateral->SetVisAttributes (G4VisAttributes::GetInvisible());
logicVirtualLateral->SetVisAttributes (G4VisAttributes::Invisible);
}
/////////////////////////////////////////////////////////////////////////////
@@ -349,7 +349,7 @@ void PassiveCarbonBeamLine::ConstructPassiveCarbonBeamLine()
// The treatment room is invisible in the Visualisation
logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::GetInvisible());
logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::Invisible);
// Components of the Passive Carbon Beam Line
HadrontherapyBeamLineSupport();
@@ -571,7 +571,7 @@ void PassiveProtonBeamLine::ConstructPassiveProtonBeamLine()
// The treatment room is invisible in the Visualisation
logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::GetInvisible());
logicTreatmentRoom -> SetVisAttributes (G4VisAttributes::Invisible);
// Components of the Passive Proton Beam Line
HadrontherapyBeamLineSupport();