Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 10:49:55 +02:00
parent 3a5407696b
commit 1a1316fea4
2180 changed files with 237880 additions and 59109 deletions
+6 -11
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Material.cc 100662 2016-10-31 10:21:14Z gcosmo $
// $Id: G4Material.cc 102843 2017-02-27 13:02:28Z gcosmo $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//
@@ -665,16 +665,11 @@ std::ostream& operator<<(std::ostream& flux, const G4Material* material)
<< "\n" << std::setw(30)
<< " Imean: " << std::setw(7) << std::setprecision(3)
<< G4BestUnit(material->GetIonisation()->GetMeanExcitationEnergy(),
"Energy");
if(material->fState == kStateGas) {
flux
<< " temperature: " << std::setw(6) << std::setprecision(2)
<< (material->fTemp)/kelvin << " K"
<< " pressure: " << std::setw(6) << std::setprecision(2)
<< (material->fPressure)/atmosphere << " atm";
}
flux << "\n";
"Energy")
<< " temperature: " << std::setw(6) << std::setprecision(2)
<< (material->fTemp)/kelvin << " K"
<< " pressure: " << std::setw(6) << std::setprecision(2)
<< (material->fPressure)/atmosphere << " atm" << "\n";
for (G4int i=0; i<material->fNumberOfElements; i++) {
flux
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4MaterialPropertiesTable.cc 102806 2017-02-22 16:36:36Z gcosmo $
// $Id: G4MaterialPropertiesTable.cc 102805 2017-02-22 16:34:13Z gcosmo $
//
//
////////////////////////////////////////////////////////////////////////
+236 -40
View File
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4OpticalSurface.cc 80747 2014-05-09 12:53:43Z gcosmo $
// $Id: G4OpticalSurface.cc 104459 2017-05-31 15:54:52Z gcosmo $
//
//
////////////////////////////////////////////////////////////////////////
@@ -35,8 +35,8 @@
// Version: 2.0
// Created: 1997-06-26
// Author: Peter Gumplinger
// updated: 2017-02-24 Mariele Stockhoff add DAVIS model
// mail: gum@triumf.ca
//
////////////////////////////////////////////////////////////////////////
#include <iostream>
@@ -65,13 +65,23 @@ G4OpticalSurface& G4OpticalSurface::operator=(const G4OpticalSurface& right)
sigma_alpha = right.sigma_alpha;
polish = right.polish;
theMaterialPropertiesTable = right.theMaterialPropertiesTable;
if (AngularDistribution) delete [] AngularDistribution;
AngularDistribution =
new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
*(AngularDistribution) = *(right.AngularDistribution);
*(AngularDistribution) = *(right.AngularDistribution);
if (AngularDistributionLUT) delete [] AngularDistributionLUT;
AngularDistributionLUT = new G4float[indexmax];
*(AngularDistributionLUT) = *(right.AngularDistributionLUT);
if (Reflectivity) delete [] Reflectivity;
Reflectivity = new G4float[RefMax];
*(Reflectivity) = *(right.Reflectivity);
if (DichroicVector) delete DichroicVector;
DichroicVector = new G4Physics2DVector();
*DichroicVector = *(right.DichroicVector);
*DichroicVector = *(right.DichroicVector);
}
return *this;
}
@@ -81,22 +91,22 @@ G4OpticalSurface& G4OpticalSurface::operator=(const G4OpticalSurface& right)
/////////////////
G4OpticalSurface::G4OpticalSurface(const G4String& name,
G4OpticalSurfaceModel model,
G4OpticalSurfaceFinish finish,
G4SurfaceType type,
G4double value)
G4OpticalSurfaceModel model,
G4OpticalSurfaceFinish finish,
G4SurfaceType type,
G4double value)
: G4SurfaceProperty(name,type),
theModel(model),
theFinish(finish),
theMaterialPropertiesTable(0)
theModel(model),
theFinish(finish),
theMaterialPropertiesTable(0)
{
if (model == glisur ){
polish = value;
sigma_alpha = 0.0;
}
else if ( model == unified ) {
sigma_alpha = value;
polish = 0.0;
if ( model == glisur ){
polish = value;
sigma_alpha = 0.0;
}
else if ( model == unified ) {
sigma_alpha = value;
polish = 0.0;
}
else if ( model == LUT ) {
sigma_alpha = value;
@@ -106,20 +116,36 @@ G4OpticalSurface::G4OpticalSurface(const G4String& name,
sigma_alpha = value;
polish = 0.0;
}
else {
else if ( model == DAVIS ) {
sigma_alpha = value;
polish = 0.0;
}
else {
G4Exception("G4OpticalSurface::G4OpticalSurface()", "mat309",
FatalException,
"Constructor called with INVALID model.");
"Constructor called with INVALID model.");
}
AngularDistribution = NULL;
DichroicVector = NULL;
AngularDistribution = NULL;
AngularDistributionLUT = NULL;
Reflectivity = NULL;
DichroicVector = NULL;
if (type == dielectric_LUT) {
AngularDistribution =
new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
ReadLUTFile();
}
if (type == dielectric_LUTDAVIS) {
AngularDistributionLUT = new G4float[indexmax];
ReadLUTDAVISFile();
Reflectivity = new G4float[RefMax];
ReadReflectivityLUTFile();
}
if (type == dielectric_dichroic) {
DichroicVector = new G4Physics2DVector();
@@ -130,6 +156,10 @@ G4OpticalSurface::G4OpticalSurface(const G4String& name,
G4OpticalSurface::~G4OpticalSurface()
{
if (AngularDistribution) delete [] AngularDistribution;
if (AngularDistributionLUT) delete [] AngularDistributionLUT;
if (Reflectivity) delete [] Reflectivity;
if (DichroicVector) delete DichroicVector;
}
@@ -144,10 +174,19 @@ G4OpticalSurface::G4OpticalSurface(const G4OpticalSurface &right)
this->sigma_alpha = right.sigma_alpha;
this->polish = right.polish;
this->theMaterialPropertiesTable = right.theMaterialPropertiesTable;
if (this->AngularDistribution) delete [] AngularDistribution;
this->AngularDistribution =
new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
*(this->AngularDistribution) = *(right.AngularDistribution);
if (this->AngularDistributionLUT) delete [] AngularDistributionLUT;
this->AngularDistributionLUT = new G4float[indexmax];
*(this->AngularDistributionLUT) = *(right.AngularDistributionLUT);
if (this->Reflectivity) delete [] Reflectivity;
this->Reflectivity = new G4float[RefMax];
*(this->Reflectivity) = *(right.Reflectivity);
if (this->DichroicVector) delete DichroicVector;
this->DichroicVector = new G4Physics2DVector();
*(this->DichroicVector) = *(right.DichroicVector);
@@ -155,12 +194,12 @@ G4OpticalSurface::G4OpticalSurface(const G4OpticalSurface &right)
G4int G4OpticalSurface::operator==(const G4OpticalSurface &right) const
{
return (this == (G4OpticalSurface *) &right);
return (this == (G4OpticalSurface *) &right);
}
G4int G4OpticalSurface::operator!=(const G4OpticalSurface &right) const
{
return (this != (G4OpticalSurface *) &right);
return (this != (G4OpticalSurface *) &right);
}
////////////
// Methods
@@ -168,36 +207,43 @@ G4int G4OpticalSurface::operator!=(const G4OpticalSurface &right) const
void G4OpticalSurface::DumpInfo() const
{
// Dump info for surface
// Dump info for surface
G4cout <<
G4cout <<
" Surface type = " << G4int(theType) << G4endl <<
" Surface finish = " << G4int(theFinish) << G4endl <<
" Surface model = " << G4int(theModel) << G4endl;
" Surface finish = " << G4int(theFinish) << G4endl <<
" Surface model = " << G4int(theModel) << G4endl;
G4cout << G4endl;
G4cout << G4endl;
G4cout << " Surface parameter " << G4endl;
G4cout << " ----------------- " << G4endl;
if (theModel == glisur ){
G4cout << polish << G4endl;
}
G4cout << " Surface parameter " << G4endl;
G4cout << " ----------------- " << G4endl;
if (theModel == glisur ){
G4cout << polish << G4endl;
}
else if (theModel == LUT ){
G4cout << sigma_alpha << G4endl;
G4cout << sigma_alpha << G4endl;
}
else {
G4cout << sigma_alpha << G4endl;
}
G4cout << G4endl;
G4cout << sigma_alpha << G4endl;
}
G4cout << G4endl;
}
void G4OpticalSurface::SetType(const G4SurfaceType& type)
{
theType = type;
if (type == dielectric_LUTDAVIS) {
if (!AngularDistributionLUT) AngularDistributionLUT =
new G4float[indexmax];
ReadLUTDAVISFile();
}
if (type == dielectric_LUT) {
if (!AngularDistribution) AngularDistribution =
new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
ReadLUTFile();
}
if (type == dielectric_dichroic) {
@@ -214,6 +260,16 @@ void G4OpticalSurface::SetFinish(const G4OpticalSurfaceFinish finish)
new G4float[incidentIndexMax*thetaIndexMax*phiIndexMax];
ReadLUTFile();
}
if (theType == dielectric_LUTDAVIS) {
if (!AngularDistributionLUT) AngularDistributionLUT =
new G4float[indexmax];
ReadLUTDAVISFile();
if (!Reflectivity) Reflectivity = new G4float[RefMax];
ReadReflectivityLUTFile();
}
if (theType == dielectric_dichroic) {
if (!DichroicVector) DichroicVector = new G4Physics2DVector();
ReadDichroicFile();
@@ -329,6 +385,146 @@ void G4OpticalSurface::ReadLUTFile()
readLUTFileHandle.close();
}
void G4OpticalSurface::ReadLUTDAVISFile()
{
G4String readLUTDAVISFileName = " ";
if (theFinish == Rough_LUT) {
readLUTDAVISFileName = "Rough_LUT.dat";
}else if (theFinish == RoughTeflon_LUT) {
readLUTDAVISFileName = "RoughTeflon_LUT.dat";
}else if (theFinish == RoughESR_LUT) {
readLUTDAVISFileName = "RoughESR_LUT.dat";
}else if (theFinish == RoughESRGrease_LUT) {
readLUTDAVISFileName = "RoughESRGrease_LUT.dat";
}else if (theFinish == Polished_LUT) {
readLUTDAVISFileName = "Polished_LUT.dat";
}else if (theFinish == PolishedTeflon_LUT) {
readLUTDAVISFileName = "PolishedTeflon_LUT.dat";
}else if (theFinish == PolishedESR_LUT) {
readLUTDAVISFileName = "PolishedESR_LUT.dat";
}else if (theFinish == PolishedESRGrease_LUT) {
readLUTDAVISFileName = "PolishedESRGrease_LUT.dat";
}else if (theFinish == Detector_LUT) {
readLUTDAVISFileName = "Detector_LUT.dat";
}
if (readLUTDAVISFileName == " ") return;
char* path = getenv("G4REALSURFACEDATA");
if (!path) {
G4String excep =
"G4OpBoundaryProcess - G4REALSURFACEDATA environment variable not set";
G4Exception("G4OpticalSurface::ReadLUTDAVISFile()", "mat310",
FatalException, excep);
return;
}
G4String pathString(path);
readLUTDAVISFileName = pathString + "/" + readLUTDAVISFileName;
std::ifstream readLUTDAVISFileHandle(readLUTDAVISFileName, std::ios::in);
if (readLUTDAVISFileHandle) {
for (G4int i = 0; i<indexmax; i++) {
if (readLUTDAVISFileHandle.eof()) break;
readLUTDAVISFileHandle >> AngularDistributionLUT[i];
}
if (!readLUTDAVISFileHandle.bad()) {
G4cout <<"LUT DAVIS - data file: " <<
readLUTDAVISFileName << " read in! " << G4endl;
}
else {
G4String excep="LUT DAVIS- data file: "+readLUTDAVISFileName+" not read propery";
G4Exception("G4OpticalSurface::ReadLUTFile()", "mat312",
FatalException, excep);
return;
}
}
else {
G4String excep ="LUT DAVIS- data file: "+readLUTDAVISFileName+" not found";
G4Exception("G4OpticalSurface::ReadLUTFile()", "mat311",
FatalException, excep);
return;
}
readLUTDAVISFileHandle.close();
}
void G4OpticalSurface::ReadReflectivityLUTFile()
{
G4String readReflectivityLUTFileName = " ";
if (theFinish == Rough_LUT) {
readReflectivityLUTFileName = "Rough_LUTR.dat";
}
if (theFinish == RoughTeflon_LUT) {
readReflectivityLUTFileName = "RoughTeflon_LUTR.dat";
}
if (theFinish== RoughESR_LUT) {
readReflectivityLUTFileName = "RoughESR_LUTR.dat";
}
if (theFinish == RoughESRGrease_LUT) {
readReflectivityLUTFileName = "RoughESRGrease_LUTR.dat";
}
if (theFinish== Polished_LUT) {
readReflectivityLUTFileName = "Polished_LUTR.dat";
}
if (theFinish == PolishedTeflon_LUT) {
readReflectivityLUTFileName = "PolishedTeflon_LUTR.dat";
}
if (theFinish== PolishedESR_LUT) {
readReflectivityLUTFileName = "PolishedESR_LUTR.dat";
}
if (theFinish== PolishedESRGrease_LUT) {
readReflectivityLUTFileName = "PolishedESRGrease_LUTR.dat";
}
if (theFinish== Detector_LUT) {
readReflectivityLUTFileName = "Detector_LUTR.dat";
}
if (readReflectivityLUTFileName == " ") return;
char* path = getenv("G4REALSURFACEDATA");
if (!path) {
G4String excep =
"G4OpBoundaryProcess - G4REALSURFACEDATA environment variable not set";
G4Exception("G4OpticalSurface::ReadReflectivityLUTFile()", "mat310",
FatalException, excep);
return;
}
G4String pathString(path);
readReflectivityLUTFileName = pathString + "/" + readReflectivityLUTFileName;
std::ifstream readReflectivityLUTFileHandle(readReflectivityLUTFileName,
std::ios::in);
if (readReflectivityLUTFileHandle) {
for (G4int i = 0; i<RefMax; i++) {
if (readReflectivityLUTFileHandle.eof()) break;
readReflectivityLUTFileHandle >> Reflectivity[i];
}
if (!readReflectivityLUTFileHandle.bad()) {
G4cout << "Reflectivity LUT DAVIS - data file: " <<
readReflectivityLUTFileName << " read in! " << G4endl;
}
else {
G4String excep="Reflectivity LUT DAVIS- data file: "+readReflectivityLUTFileName+" not read propery";
G4Exception("G4OpticalSurface::ReadReflectivityLUTFile()", "mat312",
FatalException, excep);
return;
}
}
else {
G4String excep ="Reflectivity LUT DAVIS - data file: "+readReflectivityLUTFileName+" not found";
G4Exception("G4OpticalSurface::ReadReflectivityLUTFile()", "mat311",
FatalException, excep);
return;
}
readReflectivityLUTFileHandle.close();
}
void G4OpticalSurface::ReadDichroicFile()
{
const char* datadir = getenv("G4DICHROICDATA");