Import Geant4 3.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:10:37 +02:00
parent 137e303ecc
commit 36c080dca6
3464 changed files with 119310 additions and 52696 deletions
+45 -27
View File
@@ -1,12 +1,28 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4Material.cc,v 1.8 2001/03/12 17:48:49 maire Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
// $Id: G4Material.cc,v 1.10.2.1 2001/06/28 19:10:31 gunter Exp $
// GEANT4 tag $Name: $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
//
@@ -33,6 +49,7 @@
// 16-01-01, Nuclear interaction length, M.Maire
// 12-03-01, G4bool fImplicitElement;
// copy constructor and assignement operator revised (mma)
// 03-05-01, flux.precision(prec) at begin/end of operator<<
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
@@ -230,7 +247,7 @@ void G4Material::AddElement(G4Element* element, G4int nAtoms)
}
// filling ...
if ( fNumberOfElements < maxNbComponents ) {
if ( G4int(fNumberOfElements) < maxNbComponents ) {
(*theElementVector)[fNumberOfElements] = element;
fAtomsVector [fNumberOfElements] = nAtoms;
fNumberOfComponents = ++fNumberOfElements;
@@ -240,9 +257,9 @@ void G4Material::AddElement(G4Element* element, G4int nAtoms)
("ERROR!!! - Attempt to add more than the declared number of elements.");
// filled.
if ( fNumberOfElements == maxNbComponents ) {
if ( G4int(fNumberOfElements) == maxNbComponents ) {
// compute proportion by mass
G4int i=0;
size_t i=0;
G4double Zmol(0.), Amol(0.);
for (i=0;i<fNumberOfElements;i++) {
Zmol += fAtomsVector[i]*(*theElementVector)[i]->GetZ();
@@ -279,7 +296,7 @@ void G4Material::AddElement(G4Element* element, G4double fraction)
}
// filling ...
if (fNumberOfComponents < maxNbComponents) {
if (G4int(fNumberOfComponents) < maxNbComponents) {
size_t el = 0;
while ((el<fNumberOfElements)&&(element!=(*theElementVector)[el])) el++;
if (el<fNumberOfElements) fMassFractionVector[el] += fraction;
@@ -296,11 +313,10 @@ void G4Material::AddElement(G4Element* element, G4double fraction)
("ERROR!!! - Attempt to add more than the declared number of components.");
// filled.
if (fNumberOfComponents == maxNbComponents) {
if (G4int(fNumberOfComponents) == maxNbComponents) {
// check sum of weights -- OK?
G4int i;
G4double wtSum(0.0);
for (i=0;i<fNumberOfElements;i++) { wtSum += fMassFractionVector[i]; }
for (size_t i=0;i<fNumberOfElements;i++) { wtSum += fMassFractionVector[i]; }
if (abs(1.-wtSum) > perThousand) {
G4cerr << "WARNING !! - Fractional masses do not sum to 1 :the Delta is > 0.001"
<< "( the weights are NOT renormalized; the results may be wrong)"
@@ -333,8 +349,8 @@ void G4Material::AddMaterial(G4Material* material, G4double fraction)
}
// filling ...
if (fNumberOfComponents < maxNbComponents) {
for (G4int elm=0; elm < material->GetNumberOfElements(); elm++)
if (G4int(fNumberOfComponents) < maxNbComponents) {
for (size_t elm=0; elm < material->GetNumberOfElements(); elm++)
{ G4Element* element = (*(material->GetElementVector()))[elm];
size_t el = 0;
while ((el<fNumberOfElements)&&(element!=(*theElementVector)[el])) el++;
@@ -354,11 +370,11 @@ void G4Material::AddMaterial(G4Material* material, G4double fraction)
("ERROR!!! - Attempt to add more than the declared number of components.");
// filled.
if (fNumberOfComponents == maxNbComponents) {
if (G4int(fNumberOfComponents) == maxNbComponents) {
// check sum of weights -- OK?
G4int i;
G4double wtSum(0.0);
for (i=0;i<fNumberOfElements;i++) { wtSum += fMassFractionVector[i]; }
for (size_t i=0;i<fNumberOfElements;i++)
{ wtSum += fMassFractionVector[i]; }
if (abs(1.-wtSum) > perThousand) {
G4cerr << "WARNING !! - Fractional masses do not sum to 1 :the Delta is > 0.001"
<< "( the weights are NOT renormalized; the results may be wrong)"
@@ -386,7 +402,7 @@ void G4Material::ComputeDerivedQuantities()
if (VecNbOfAtomsPerVolume) delete [] VecNbOfAtomsPerVolume;
VecNbOfAtomsPerVolume = new G4double[fNumberOfElements];
TotNbOfElectPerVolume = 0.;
for (G4int i=0;i<fNumberOfElements;i++) {
for (size_t i=0;i<fNumberOfElements;i++) {
Zi = (*theElementVector)[i]->GetZ();
Ai = (*theElementVector)[i]->GetA();
VecNbOfAtomsPerVolume[i] = Avogadro*fDensity*fMassFractionVector[i]/Ai;
@@ -423,7 +439,7 @@ void G4Material::ComputeDerivedQuantities()
void G4Material::ComputeRadiationLength()
{
G4double radinv = 0.0 ;
for (G4int i=0;i<fNumberOfElements;i++) {
for (size_t i=0;i<fNumberOfElements;i++) {
radinv += VecNbOfAtomsPerVolume[i]*((*theElementVector)[i]->GetfRadTsai());
}
fRadlen = (radinv <= 0.0 ? DBL_MAX : 1./radinv);
@@ -435,7 +451,7 @@ void G4Material::ComputeNuclearInterLength()
{
const G4double lambda0 = 35*g/cm2;
G4double NILinv = 0.0;
for (G4int i=0;i<fNumberOfElements;i++) {
for (size_t i=0;i<fNumberOfElements;i++) {
NILinv +=
VecNbOfAtomsPerVolume[i]*pow(((*theElementVector)[i]->GetN()),2./3.);
}
@@ -515,7 +531,7 @@ const G4Material& G4Material::operator=(const G4Material& right)
} else {
theElementVector = new G4ElementVector(fNumberOfElements);
fMassFractionVector = new G4double[fNumberOfElements];
for (G4int i=0; i<fNumberOfElements; i++) {
for (size_t i=0; i<fNumberOfElements; i++) {
(*theElementVector)[i]= (*right.theElementVector)[i];
fMassFractionVector[i]= right.fMassFractionVector[i];
}
@@ -523,7 +539,7 @@ const G4Material& G4Material::operator=(const G4Material& right)
if (right.fAtomsVector) {
fAtomsVector = new G4int[fNumberOfElements];
for (G4int i=0; i<fNumberOfElements; i++)
for (size_t i=0; i<fNumberOfElements; i++)
fAtomsVector[i] = right.fAtomsVector[i];
}
@@ -555,6 +571,7 @@ G4int G4Material::operator!=(const G4Material& right) const
G4std::ostream& operator<<(G4std::ostream& flux, G4Material* material)
{
long mode = flux.setf(G4std::ios::fixed,G4std::ios::floatfield);
long prec = flux.precision(3);
flux
<< " Material: " << G4std::setw(8) << material->fName
@@ -568,7 +585,7 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4Material* material)
<< " RadLength: " << G4std::setw(7) << G4std::setprecision(3)
<< G4BestUnit(material->fRadlen,"Length");
for (G4int i=0; i<material->fNumberOfElements; i++)
for (size_t i=0; i<material->fNumberOfElements; i++)
flux
<< "\n ---> " << (*(material->theElementVector))[i]
<< " fractionMass: " << G4std::setw(6)<< G4std::setprecision(2)
@@ -577,7 +594,8 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4Material* material)
<< 100*(material->VecNbOfAtomsPerVolume[i])/
(material->TotNbOfAtomsPerVolume)
<< " %";
flux.precision(prec);
flux.setf(mode,G4std::ios::floatfield);
return flux;
@@ -599,7 +617,7 @@ G4std::ostream& operator<<(G4std::ostream& flux, G4MaterialTable MaterialTable)
flux << "\n***** Table : Nb of materials = " << MaterialTable.length()
<< " *****\n" << G4endl;
for (G4int i=0; i<MaterialTable.length(); i++) flux << MaterialTable[i]
for (size_t i=0; i<MaterialTable.length(); i++) flux << MaterialTable[i]
<< G4endl << G4endl;
return flux;