Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
@@ -32,6 +32,8 @@
namespace{ G4Mutex MyHadrontherapyLockEField=G4MUTEX_INITIALIZER; }
using namespace std;
HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( const char* filename, G4double exOffset, G4double eyOffset, G4double ezOffset)
:feXoffset(exOffset),feYoffset(eyOffset),feZoffset(ezOffset),einvertX(false),einvertY(false),einvertZ(false)
{
@@ -43,7 +45,7 @@ HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( co
<< "\n Electric field"
<< "\n-----------------------------------------------------------";
G4cout << "\n ---> " "Reading the field grid from " << filename << " ... " << endl;
G4cout << "\n ---> " "Reading the field grid from " << filename << " ... " << G4endl;
G4AutoLock lock(&MyHadrontherapyLockEField);
ifstream file( filename ); // Open the file for reading.
@@ -57,7 +59,7 @@ HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( co
G4cout << " [ Number of values x,y,z: "
<< Enx << " " << Eny << " " << Enz << " ] "
<< endl;
<< G4endl;
// Set up storage space for table
xEField.resize( Enx );
@@ -105,9 +107,9 @@ HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( co
Emaxy = Eyval * ElenUnit;
Emaxz = Ezval * ElenUnit;
G4cout << "\n ---> ... done reading " << endl;
G4cout << "\n ---> ... done reading " << G4endl;
// G4cout << " Read values of field from file " << filename << endl;
// G4cout << " Read values of field from file " << filename << G4endl;
G4cout << " ---> assumed the order: x, y, z, Ex, Ey, Ez "
<< "\n ---> Min values x,y,z: "
<< Eminx/cm << " " << Eminy/cm << " " << Eminz/cm << " cm "
@@ -115,7 +117,7 @@ HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( co
<< 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 z by " << ezOffset/cm << " cm " << endl;
<< "\n ---> The field will be offset in z by " << ezOffset/cm << " cm " << G4endl;
// Should really check that the limits are not the wrong way around.
if (Emaxx < Eminx) {swap(Emaxx,Eminx); einvertX = true;}
@@ -132,7 +134,7 @@ HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D( co
dz1 = Emaxz - Eminz;
G4cout << "\n ---> Dif values x,y,z (range): "
<< dx1/cm << " " << dy1/cm << " " << dz1/cm << " cm "
<< "\n-----------------------------------------------------------" << endl;
<< "\n-----------------------------------------------------------" << G4endl;
}
void HadrontherapyElectricTabulatedField3D::GetFieldValue(const G4double Epoint[4],
@@ -184,8 +186,8 @@ void HadrontherapyElectricTabulatedField3D::GetFieldValue(const G4double Epoint[
/*
#ifdef DEBUG_G4intERPOLATING_FIELD
G4cout << "Local x,y,z: " << exlocal << " " << eylocal << " " << ezlocal << endl;
G4cout << "Index x,y,z: " << exindex << " " << eyindex << " " << ezindex << endl;
G4cout << "Local x,y,z: " << exlocal << " " << eylocal << " " << ezlocal << G4endl;
G4cout << "Index x,y,z: " << exindex << " " << eyindex << " " << ezindex << G4endl;
G4double valx0z0, mulx0z0, valx1z0, mulx1z0;
G4double valx0z1, mulx0z1, valx1z1, mulx1z1;
valx0z0= table[exindex ][0][ezindex]; mulx0z0= (1-exlocal) * (1-ezlocal);
@@ -228,7 +230,7 @@ void HadrontherapyElectricTabulatedField3D::GetFieldValue(const G4double Epoint[
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 << "Getting electric field " << Efield[3]/(volt/m) << " " << Efield[4]/(volt/m) << " " << Efield[5]/(volt/m) << G4endl;
//G4cout << "For coordinates: " << Epoint[0] << " " << Epoint[1] << " " << Epoint[2] << G4endl;
/*std::ofstream WriteDataIn("ElectricFieldFC.out", std::ios::app);
@@ -238,5 +240,5 @@ void HadrontherapyElectricTabulatedField3D::GetFieldValue(const G4double Epoint[
<< Efield[3]/(volt/m) << '\t' << " "
<< Efield[4]/(volt/m) << '\t' << " "
<< Efield[5]/(volt/m) << '\t' << " "
<< G4endl; */
<< std::endl; */
}
@@ -32,6 +32,8 @@
namespace{ G4Mutex MyHadrontherapyLock=G4MUTEX_INITIALIZER; }
using namespace std;
HadrontherapyMagneticField3D::HadrontherapyMagneticField3D( const char* filename, double xOffset )
:fXoffset(xOffset),invertX(false),invertY(false),invertZ(false)
{
@@ -44,7 +46,7 @@ HadrontherapyMagneticField3D::HadrontherapyMagneticField3D( const char* filename
<< "\n-----------------------------------------------------------";
G4cout << "\n ---> " "Reading the field grid from " << filename << " ... " << endl;
G4cout << "\n ---> " "Reading the field grid from " << filename << " ... " << G4endl;
G4AutoLock lock(&MyHadrontherapyLock);
ifstream file( filename ); // Open the file for reading.
@@ -58,7 +60,7 @@ HadrontherapyMagneticField3D::HadrontherapyMagneticField3D( const char* filename
G4cout << " [ Number of values x,y,z: "
<< nx << " " << ny << " " << nz << " ] "
<< endl;
<< G4endl;
// Set up storage space for table
xField.resize( nx );
@@ -106,15 +108,15 @@ HadrontherapyMagneticField3D::HadrontherapyMagneticField3D( const char* filename
maxy = yval * lenUnit;
maxz = zval * lenUnit;
G4cout << "\n ---> ... done reading " << endl;
G4cout << "\n ---> ... done reading " << G4endl;
// G4cout << " Read values of field from file " << filename << endl;
// G4cout << " Read values of field from file " << filename << G4endl;
G4cout << " ---> assumed the order: x, y, z, Bx, By, Bz "
<< "\n ---> Min values x,y,z: "
<< minx/cm << " " << miny/cm << " " << minz/cm << " cm "
<< "\n ---> Max values x,y,z: "
<< maxx/cm << " " << maxy/cm << " " << maxz/cm << " cm "
<< "\n ---> The field will be offset by " << xOffset/cm << " cm " << endl;
<< "\n ---> The field will be offset by " << xOffset/cm << " cm " << G4endl;
// Should really check that the limits are not the wrong way around.
if (maxx < minx) {swap(maxx,minx); invertX = true;}
@@ -131,7 +133,7 @@ HadrontherapyMagneticField3D::HadrontherapyMagneticField3D( const char* filename
dz = maxz - minz;
G4cout << "\n ---> Dif values x,y,z (range): "
<< dx/cm << " " << dy/cm << " " << dz/cm << " cm in z "
<< "\n-----------------------------------------------------------" << endl;
<< "\n-----------------------------------------------------------" << G4endl;
}
void HadrontherapyMagneticField3D::GetFieldValue(const double point[4],
@@ -180,8 +182,8 @@ void HadrontherapyMagneticField3D::GetFieldValue(const double point[4],
{
#ifdef DEBUG_INTERPOLATING_FIELD
G4cout << "Local x,y,z: " << xlocal << " " << ylocal << " " << zlocal << endl;
G4cout << "Index x,y,z: " << xindex << " " << yindex << " " << zindex << endl;
G4cout << "Local x,y,z: " << xlocal << " " << ylocal << " " << zlocal << G4endl;
G4cout << "Index x,y,z: " << xindex << " " << yindex << " " << zindex << G4endl;
double valx0z0, mulx0z0, valx1z0, mulx1z0;
double valx0z1, mulx0z1, valx1z1, mulx1z1;
valx0z0= table[xindex ][0][zindex]; mulx0z0= (1-xlocal) * (1-zlocal);
@@ -230,6 +232,6 @@ void HadrontherapyMagneticField3D::GetFieldValue(const double point[4],
<< point[0] << '\t' << " "
<< point[1] << '\t' << " "
<< point[2] << '\t' << " "
<< G4endl;*/
<< std::endl;*/
}
+1 -3
View File
@@ -54,8 +54,6 @@
#include "G4NistManager.hh"
#include <iostream>
using namespace std;
HadrontherapyModulator::HadrontherapyModulator(): physiMotherMod(0),
solidMod1(0), logicMod1(0), physiMod1(0),
solidMod2(0), logicMod2(0), physiMod2(0),
@@ -63,7 +61,7 @@ HadrontherapyModulator::HadrontherapyModulator(): physiMotherMod(0),
solidMod4(0), logicMod4(0), physiMod4(0),
FileName("Modulators/Modulator010.txt")
{
pi=4*atan(1.);
pi=4*std::atan(1.);
StepNumbers=22;
Weight=new G4double[StepNumbers];
StepThickness=new G4double[StepNumbers];
@@ -789,7 +789,7 @@ void LaserDrivenBeamLine::ConstructSDandField()
PurgMagField = new HadrontherapyMagneticField3D("field/ESSMagneticField.TABLE", xOffset);
pFieldMgr =new G4FieldManager();
pFieldMgr -> SetDetectorField(PurgMagField);
G4cout << "DeltaStep "<< pFieldMgr -> GetDeltaOneStep()/mm <<"mm" <<endl;
G4cout << "DeltaStep "<< pFieldMgr -> GetDeltaOneStep()/mm <<"mm" <<G4endl;
pFieldMgr -> CreateChordFinder(PurgMagField);
fEquation = new G4Mag_UsualEqRhs(PurgMagField);
fstepper = new G4ClassicalRK4(fEquation);
@@ -1998,9 +1998,9 @@ void LaserDrivenBeamLine::RemoveESS()
G4cout << "************ The ESS has been disabled *************" << G4endl;
G4cout << "****************************************************" << G4endl;
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
}
// Change via external macro command the diameter of the first collimator
void LaserDrivenBeamLine::SetFirstCollimatorRadius(G4double valueR)
@@ -2008,9 +2008,9 @@ void LaserDrivenBeamLine::SetFirstCollimatorRadius(G4double valueR)
G4double radius = valueR;
solidCollimatorHole -> SetOuterRadius(radius);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
G4cout << "The first collimator aperture has been modified to "<< valueR/mm <<"mm in diameter" << G4endl;
}
/////////////////////////////////////////////////////////////////////////////
@@ -2021,9 +2021,9 @@ void LaserDrivenBeamLine::SetFirstCollimatorThickness(G4double valueC)
solidCollimator -> SetXHalfLength(thickness);
solidCollimatorHole -> SetZHalfLength(thickness);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
G4cout << "The first collimator thickness has been modified to "<< valueC/mm <<" mm in thickness" << G4endl;
}
@@ -2032,9 +2032,9 @@ void LaserDrivenBeamLine::SetFirstCollimatorPositionZ(G4double valueQ)
{
physicCollimatorHole -> SetTranslation(G4ThreeVector(0., 0., valueQ));
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
G4cout << "The first collimator has been translated to "<< valueQ/mm <<"mm (along the z axis)" << G4endl;
}
@@ -2044,9 +2044,9 @@ void LaserDrivenBeamLine::SetSecondCollimatorRadius(G4double value)
G4double radius = value;
solidFinalCollimatorHole -> SetOuterRadius(radius);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
G4cout << "The second collimator aperture has been modified to "<< value/mm <<"mm in diameter" << G4endl;
}
@@ -2058,9 +2058,9 @@ void LaserDrivenBeamLine::SetSecondCollimatorThickness(G4double value)
solidFinalCollimator -> SetXHalfLength(thickness);
solidFinalCollimatorHole -> SetZHalfLength(thickness);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
G4cout << "The second collimator thickness has been modified to "<< value/mm <<" mm in thickness" << G4endl;
}
@@ -2069,9 +2069,9 @@ void LaserDrivenBeamLine::SetSecondCollimatorPositionZ(G4double value)
{
physicFinalCollimatorHole -> SetTranslation(G4ThreeVector(0., 0., value));
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
G4cout << "The second collimator has been translated to "<< value/mm <<"mm (along the z axis)" << G4endl;
}
// THE SLIT MESSENGERS
@@ -2094,9 +2094,9 @@ void LaserDrivenBeamLine::SetThicknessSlit(G4double value)
solidExternalSlit -> SetXHalfLength(dimension);
solidInternalSlit -> SetXHalfLength(dimension);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
G4cout <<"The thickness of the slit is:" << ((solidExternalSlit -> GetXHalfLength())*2.)/mm
<< G4endl;
}
@@ -2108,9 +2108,9 @@ void LaserDrivenBeamLine::SetSlitHoleDimensionY(G4double value)
G4double hole = value/2;
solidInternalSlit -> SetYHalfLength(hole);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
G4cout << "The hole of the Slit has been changed in the Y direction to "<< value/mm <<" mm" <<G4endl;
}
@@ -2121,9 +2121,9 @@ void LaserDrivenBeamLine::SetSlitHoleDimensionZ(G4double value)
G4double hole = value/2;
solidInternalSlit -> SetZHalfLength(hole);
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
G4cout << "The hole of the Slit has been changed in the Z direction to "<< value/mm <<" mm" <<G4endl;
}
/////////////////////////////////////////////////////////////////////////////
@@ -2132,9 +2132,9 @@ void LaserDrivenBeamLine::SetSlitHolePositionZ(G4double value)
{
physicInternalSlit -> SetTranslation(G4ThreeVector(0., 0., value));
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
G4cout << "The hole of the slit has been translated to "<< value/mm <<" mm (along the Z axis)" <<G4endl;
}
@@ -2161,8 +2161,8 @@ void LaserDrivenBeamLine::RemoveQuads()
G4cout << "************ The Quadrupoles system has been disabled *************" << G4endl;
G4cout << "******************************************************************" << G4endl;
G4RunManager::GetRunManager() -> GeometryHasBeenModified();
#ifdef G4VIS_USE
G4UImanager::GetUIpointer() -> ApplyCommand("/vis/viewer/flush");
#endif
}