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
+11
View File
@@ -8,6 +8,17 @@ https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy
History file of the Hadrontherapy application
====================================================
19.11.2019 G. Folger Tag: hadrontherapy-V10-05-02
- remove using namespace std from header files:
HadrontherapyElectricTabulatedField3D.hh and HadrontherapyMagneticField3D.hh
put the using into the .cc file, and make use of endl consistent with g4cout or std::cout
30.10.2019, S. Guatelli, Tag: hadrontherapy-V10-05-01
- namespace std deleted
30.08.2019, S. Guatelli Tag: hadrontherapy-V10-05-01
- G4VIS_USE cleaned
31.01.2019, I.Hrivnacova Tag: hadrontherapy-V10-05-00
- Merged GitHub PR #4: all Boolean operators now return G4bool.
@@ -98,13 +98,8 @@
#include "HadrontherapyActionInitialization.hh"
//#ifdef G4VIS_USE
#include "G4VisExecutive.hh"
//#endif
//#ifdef G4UI_USE
#include "G4UIExecutive.hh"
//#endif
//////////////////////////////////////////////////////////////////////////////////////////////
int main(int argc ,char ** argv)
@@ -155,7 +150,7 @@ int main(int argc ,char ** argv)
G4String physName = "";
// Physics List name defined via environment variable
char* path = getenv("PHYSLIST");
char* path = std::getenv("PHYSLIST");
if (path) { physName = G4String(path); }
if(physName != "" && factory.IsReferencePhysList(physName))
@@ -191,10 +186,8 @@ int main(int argc ,char ** argv)
// Initialise the Visualisation
//#ifdef G4VIS_USE
G4VisManager* visManager = new G4VisExecutive;
visManager -> Initialize();
//#endif
//** Get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
@@ -208,7 +201,6 @@ int main(int argc ,char ** argv)
}
else {
G4cout << "sono qua" << G4endl;
UImanager -> ApplyCommand("/control/execute macro/defaultMacro.mac");
ui -> SessionStart();
@@ -1,6 +1,10 @@
############################################
!!! WARNING - FPE detection is activated !!!
############################################
**************************************************************
Geant4 version Name: geant4-10-05-ref-06 (30-June-2019)
Geant4 version Name: geant4-10-06-ref-00 (6-December-2019)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -127,9 +131,7 @@ compt: for gamma SubType=13 BuildTable=1
conv: for gamma SubType=14 BuildTable=1
Lambda table from 1.022 MeV to 100 TeV, 20 bins/decade, spline: 1
===== EM models for the G4Region DefaultRegionForTheWorld ======
PenConversion : Emin= 0 eV Emax= 20 MeV
BetheHeitler : Emin= 20 MeV Emax= 80 GeV ModifiedTsai
BetheHeitlerLPM : Emin= 80 GeV Emax= 100 TeV ModifiedTsai
BetheHeitler5D : Emin= 0 eV Emax= 100 TeV ModifiedTsai
Rayl: for gamma SubType=11 BuildTable=1
Lambda table from 100 eV to 100 keV, 20 bins/decade, spline: 0
@@ -584,17 +586,17 @@ Run 0 starts ...
Run terminated.
Run Summary
Number of events processed : 500
User=5.520000s Real=7.801751s Sys=0.030000s
User=5.400000s Real=5.566863s Sys=0.070000s
... write Csv file : Hadrontherapy_h1_Ekin.csv - done
... write Csv file : Hadrontherapy_h1_Edep.csv - done
... write Csv files : - done
Graphics systems deleted.
Visualization Manager deleting...
The simulation took: 11.6726 s to run (real time)
The simulation took: 9.47318 s to run (real time)
Dose is being written to Dose.out
G4 kernel has come to Quit state.
================== Deleting memory pools ===================
Number of memory pools allocated: 12 of which, static: 0
Dynamic pools deleted: 12 / Total memory freed: 0.48 MB
Dynamic pools deleted: 12 / Total memory freed: 0.45 MB
============================================================
RunManagerKernel is deleted. Good bye :)
@@ -35,8 +35,6 @@
#include <vector>
#include <cmath>
using namespace std;
class HadrontherapyElectricTabulatedField3D
: public G4ElectricField
@@ -44,9 +42,9 @@ class HadrontherapyElectricTabulatedField3D
{
// Storage space for the table
vector< vector< vector< G4double > > > xEField;
vector< vector< vector< G4double > > > yEField;
vector< vector< vector< G4double > > > zEField;
std::vector< std::vector< std::vector< G4double > > > xEField;
std::vector< std::vector< std::vector< G4double > > > yEField;
std::vector< std::vector< std::vector< G4double > > > zEField;
// The dimensions of the table
G4int Enx,Eny,Enz;
// The physical limits of the defined region
@@ -35,8 +35,6 @@
#include <vector>
#include <cmath>
using namespace std;
class HadrontherapyMagneticField3D
#ifndef STANDALONE
: public G4MagneticField
@@ -44,9 +42,9 @@ class HadrontherapyMagneticField3D
{
// Storage space for the table
vector< vector< vector< double > > > xField;
vector< vector< vector< double > > > yField;
vector< vector< vector< double > > > zField;
std::vector< std::vector< std::vector< double > > > xField;
std::vector< std::vector< std::vector< double > > > yField;
std::vector< std::vector< std::vector< double > > > zField;
// The dimensions of the table
int nx,ny,nz;
// The physical limits of the defined region
@@ -42,7 +42,6 @@
#include "G4RotationMatrix.hh"
#include "HadrontherapyModulatorMessenger.hh"
// using namespace std;
class G4Tubs;
class G4LogicalVolume;
class G4VPhysicalVolume;
@@ -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
}