Import Geant4 11.1.0 source tree
This commit is contained in:
@@ -103,7 +103,7 @@ G4PhysicsTableHelper::PreparePhysicsTable(G4PhysicsTable* physTable)
|
||||
|
||||
for (std::size_t idx = 0; idx <numberOfMCC; ++idx)
|
||||
{
|
||||
const G4MaterialCutsCouple* mcc = cutTable->GetMaterialCutsCouple(idx);
|
||||
const G4MaterialCutsCouple* mcc = cutTable->GetMaterialCutsCouple((G4int)idx);
|
||||
|
||||
// check if re-calculation of the physics vector is needed
|
||||
// MCC is not used
|
||||
|
||||
@@ -33,14 +33,9 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
G4ThreadLocal G4ParticleDefinition* G4ProductionCuts::gammaDef = nullptr;
|
||||
G4ThreadLocal G4ParticleDefinition* G4ProductionCuts::electDef = nullptr;
|
||||
G4ThreadLocal G4ParticleDefinition* G4ProductionCuts::positDef = nullptr;
|
||||
G4ThreadLocal G4ParticleDefinition* G4ProductionCuts::protonDef = nullptr;
|
||||
|
||||
G4ProductionCuts::G4ProductionCuts()
|
||||
{
|
||||
for (G4int i=0; i< NumberOfG4CutIndex; ++i)
|
||||
for (G4int i=0; i<NumberOfG4CutIndex; ++i)
|
||||
{
|
||||
fRangeCuts.push_back(0.0);
|
||||
}
|
||||
@@ -48,7 +43,7 @@ G4ProductionCuts::G4ProductionCuts()
|
||||
|
||||
G4ProductionCuts::G4ProductionCuts(const G4ProductionCuts& right)
|
||||
{
|
||||
for (G4int i=0; i< NumberOfG4CutIndex; ++i)
|
||||
for (G4int i=0; i<NumberOfG4CutIndex; ++i)
|
||||
{
|
||||
fRangeCuts.push_back(0.0);
|
||||
}
|
||||
@@ -64,7 +59,7 @@ G4ProductionCuts& G4ProductionCuts::operator=(const G4ProductionCuts& right)
|
||||
{
|
||||
if (&right==this) return *this;
|
||||
|
||||
for (G4int i=0; i< NumberOfG4CutIndex; ++i)
|
||||
for (G4int i=0; i<NumberOfG4CutIndex; ++i)
|
||||
{
|
||||
fRangeCuts[i] = right.fRangeCuts[i];
|
||||
}
|
||||
@@ -77,7 +72,6 @@ G4bool G4ProductionCuts::operator==(const G4ProductionCuts& right) const
|
||||
return (this == &right);
|
||||
}
|
||||
|
||||
|
||||
G4bool G4ProductionCuts::operator!=(const G4ProductionCuts& right) const
|
||||
{
|
||||
return (this != &right);
|
||||
@@ -109,20 +103,20 @@ void G4ProductionCuts::SetProductionCut(G4double cut)
|
||||
isModified = true;
|
||||
}
|
||||
|
||||
void G4ProductionCuts::SetProductionCut(G4double cut, G4ParticleDefinition* ptcl)
|
||||
void G4ProductionCuts::SetProductionCut(G4double cut, G4ParticleDefinition* ptr)
|
||||
{
|
||||
SetProductionCut(cut,GetIndex(ptcl));
|
||||
SetProductionCut(cut, GetIndex(ptr));
|
||||
}
|
||||
|
||||
void G4ProductionCuts::SetProductionCut(G4double cut, const G4String& pName)
|
||||
{
|
||||
SetProductionCut(cut,GetIndex(pName));
|
||||
SetProductionCut(cut, GetIndex(pName));
|
||||
}
|
||||
|
||||
G4double G4ProductionCuts::GetProductionCut(G4int index) const
|
||||
{
|
||||
G4double cut=-1.0;
|
||||
if ( (index>=0) && (index<NumberOfG4CutIndex) )
|
||||
G4double cut = -1.0;
|
||||
if (index>=0 && index<NumberOfG4CutIndex)
|
||||
{
|
||||
cut = fRangeCuts[index];
|
||||
}
|
||||
@@ -152,56 +146,38 @@ void G4ProductionCuts::PhysicsTableUpdated()
|
||||
|
||||
G4int G4ProductionCuts::GetIndex(const G4String& name)
|
||||
{
|
||||
static const G4String gamma ("gamma");
|
||||
static const G4String electron("e-");
|
||||
static const G4String positron("e+");
|
||||
static const G4String proton("proton");
|
||||
|
||||
G4int index;
|
||||
if ( name == gamma ) { index = 0; }
|
||||
else if ( name == electron ) { index = 1; }
|
||||
else if ( name == positron ) { index = 2; }
|
||||
else if ( name == proton ) { index = 3; }
|
||||
else { index = -1; }
|
||||
G4int index = -1;
|
||||
if ( name == "gamma" ) { index = 0; }
|
||||
else if ( name == "e-" ) { index = 1; }
|
||||
else if ( name == "e+" ) { index = 2; }
|
||||
else if ( name == "proton" ) { index = 3; }
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
G4int G4ProductionCuts::GetIndex(const G4ParticleDefinition* ptcl)
|
||||
{
|
||||
if(!ptcl) return -1;
|
||||
|
||||
// In the first call, pointers are set
|
||||
if(gammaDef==nullptr && ptcl->GetParticleName()=="gamma")
|
||||
{ gammaDef = (G4ParticleDefinition*) ptcl; }
|
||||
if(electDef==nullptr && ptcl->GetParticleName()=="e-")
|
||||
{ electDef = (G4ParticleDefinition*) ptcl; }
|
||||
if(positDef==nullptr && ptcl->GetParticleName()=="e+")
|
||||
{ positDef = (G4ParticleDefinition*) ptcl; }
|
||||
if(protonDef==nullptr && ptcl->GetParticleName()=="proton")
|
||||
{ protonDef = (G4ParticleDefinition*) ptcl; }
|
||||
|
||||
G4int index;
|
||||
if(ptcl==(const G4ParticleDefinition*) gammaDef) { index = 0; }
|
||||
else if(ptcl==(const G4ParticleDefinition*) electDef) { index = 1; }
|
||||
else if(ptcl==(const G4ParticleDefinition*) positDef) { index = 2; }
|
||||
else if(ptcl==(const G4ParticleDefinition*) protonDef) { index = 3; }
|
||||
else { index = -1; }
|
||||
G4int G4ProductionCuts::GetIndex(const G4ParticleDefinition* ptr)
|
||||
{
|
||||
G4int pdg = (nullptr == ptr) ? 0 : ptr->GetPDGEncoding();
|
||||
G4int index = -1;
|
||||
if (pdg == 22) { index = 0; }
|
||||
else if (pdg == 11) { index = 1; }
|
||||
else if (pdg == -11) { index = 2; }
|
||||
else if (pdg == 2212) { index = 3; }
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
void G4ProductionCuts::SetProductionCuts(std::vector<G4double>& cut)
|
||||
{
|
||||
G4int vSize = cut.size();
|
||||
G4int vSize = (G4int)cut.size();
|
||||
if (vSize != NumberOfG4CutIndex)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if ( G4ProductionCutsTable::GetProductionCutsTable()->GetVerboseLevel()>1)
|
||||
if (G4ProductionCutsTable::GetProductionCutsTable()->GetVerboseLevel() > 1)
|
||||
{
|
||||
G4cerr << "G4ProductionCuts::SetProductionCuts ";
|
||||
G4cerr << " The size of given cut value vector [=" << vSize << "] "
|
||||
G4cout << "G4ProductionCuts::SetProductionCuts ";
|
||||
G4cout << " The size of given cut value vector [=" << vSize << "] "
|
||||
<< " is not consistent with number of CutIndex [="
|
||||
<< NumberOfG4CutIndex << G4endl;
|
||||
}
|
||||
@@ -211,7 +187,7 @@ void G4ProductionCuts::SetProductionCuts(std::vector<G4double>& cut)
|
||||
JustWarning, "Given vector size is inconsistent ");
|
||||
if (NumberOfG4CutIndex<vSize) { vSize = NumberOfG4CutIndex; }
|
||||
}
|
||||
for(G4int i = 0; (i<vSize ); ++i)
|
||||
for(G4int i = 0; i<vSize; ++i)
|
||||
{
|
||||
fRangeCuts[i] = cut[i];
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ void G4ProductionCutsTable::UpdateCoupleTable(G4VPhysicalVolume* /*currWorld*/)
|
||||
{
|
||||
aCouple = new G4MaterialCutsCouple((*mItr),fProductionCut);
|
||||
coupleTable.push_back(aCouple);
|
||||
aCouple->SetIndex(coupleTable.size()-1);
|
||||
aCouple->SetIndex(G4int(coupleTable.size()-1));
|
||||
}
|
||||
|
||||
// Register this couple to the region
|
||||
@@ -247,7 +247,7 @@ void G4ProductionCutsTable::UpdateCoupleTable(G4VPhysicalVolume* /*currWorld*/)
|
||||
{
|
||||
for(std::size_t ptcl=0; ptcl< NumberOfG4CutIndex; ++ptcl)
|
||||
{
|
||||
G4double rCut = aCut->GetProductionCut(ptcl);
|
||||
G4double rCut = aCut->GetProductionCut((G4int)ptcl);
|
||||
(*(rangeCutTable[ptcl]))[idx] = rCut;
|
||||
// if(converters[ptcl] && (*cItr)->IsUsed())
|
||||
if(converters[ptcl])
|
||||
@@ -560,7 +560,7 @@ G4bool G4ProductionCutsTable::StoreMaterialInfo(const G4String& directory,
|
||||
|
||||
const G4MaterialTable* matTable = G4Material::GetMaterialTable();
|
||||
// number of materials in the table
|
||||
G4int numberOfMaterial = matTable->size();
|
||||
G4int numberOfMaterial = (G4int)matTable->size();
|
||||
|
||||
if (ascii)
|
||||
{
|
||||
@@ -598,7 +598,7 @@ G4bool G4ProductionCutsTable::StoreMaterialInfo(const G4String& directory,
|
||||
}
|
||||
for (i=0; i<key.length() && i<FixedStringLengthForStore-1; ++i)
|
||||
{
|
||||
temp[i]=key[i];
|
||||
temp[i]=key[(G4int)i];
|
||||
}
|
||||
fOut.write(temp, FixedStringLengthForStore);
|
||||
|
||||
@@ -613,7 +613,7 @@ G4bool G4ProductionCutsTable::StoreMaterialInfo(const G4String& directory,
|
||||
for (i=0; i<FixedStringLengthForStore; ++i)
|
||||
temp[i] = '\0';
|
||||
for (i=0; i<name.length() && i<FixedStringLengthForStore-1; ++i)
|
||||
temp[i]=name[i];
|
||||
temp[i]=name[(G4int)i];
|
||||
fOut.write(temp, FixedStringLengthForStore);
|
||||
fOut.write( (char*)(&density), sizeof(G4double));
|
||||
}
|
||||
@@ -809,7 +809,7 @@ G4ProductionCutsTable::StoreMaterialCutsCoupleInfo(const G4String& directory,
|
||||
JustWarning, "Cannot open file!");
|
||||
return false;
|
||||
}
|
||||
G4int numberOfCouples = coupleTable.size();
|
||||
G4int numberOfCouples = (G4int)coupleTable.size();
|
||||
if (ascii)
|
||||
{
|
||||
/////////////// ASCII mode /////////////////
|
||||
@@ -827,7 +827,7 @@ G4ProductionCutsTable::StoreMaterialCutsCoupleInfo(const G4String& directory,
|
||||
for (i=0; i<FixedStringLengthForStore; ++i)
|
||||
temp[i] = '\0';
|
||||
for (i=0; i<key.length() && i<FixedStringLengthForStore-1; ++i)
|
||||
temp[i]=key[i];
|
||||
temp[i]=key[(G4int)i];
|
||||
fOut.write(temp, FixedStringLengthForStore);
|
||||
|
||||
// number of couples in the table
|
||||
@@ -844,7 +844,7 @@ G4ProductionCutsTable::StoreMaterialCutsCoupleInfo(const G4String& directory,
|
||||
G4double cutValues[NumberOfG4CutIndex];
|
||||
for (std::size_t idx=0; idx <NumberOfG4CutIndex; ++idx)
|
||||
{
|
||||
cutValues[idx] = aCut->GetProductionCut(idx);
|
||||
cutValues[idx] = aCut->GetProductionCut((G4int)idx);
|
||||
}
|
||||
// material/region info
|
||||
G4String materialName = aCouple->GetMaterial()->GetName();
|
||||
@@ -895,14 +895,14 @@ G4ProductionCutsTable::StoreMaterialCutsCoupleInfo(const G4String& directory,
|
||||
for (i=0; i<FixedStringLengthForStore; ++i)
|
||||
temp[i] = '\0';
|
||||
for (i=0; i<materialName.length() && i<FixedStringLengthForStore-1; ++i)
|
||||
temp[i]=materialName[i];
|
||||
temp[i]=materialName[(G4int)i];
|
||||
fOut.write(temp, FixedStringLengthForStore);
|
||||
|
||||
// region name
|
||||
for (i=0; i<FixedStringLengthForStore; ++i)
|
||||
temp[i] = '\0';
|
||||
for (i=0; i<regionName.length() && i<FixedStringLengthForStore-1; ++i)
|
||||
temp[i]=regionName[i];
|
||||
temp[i]=regionName[(G4int)i];
|
||||
fOut.write(temp, FixedStringLengthForStore);
|
||||
|
||||
// cut values
|
||||
@@ -1052,9 +1052,9 @@ G4ProductionCutsTable::CheckMaterialCutsCoupleInfo(const G4String& directory,
|
||||
for (std::size_t j=0; j< NumberOfG4CutIndex; ++j)
|
||||
{
|
||||
// check ratio only if values are not the same
|
||||
if (cutValues[j] != aCut->GetProductionCut(j))
|
||||
if (cutValues[j] != aCut->GetProductionCut((G4int)j))
|
||||
{
|
||||
G4double ratio = cutValues[j]/aCut->GetProductionCut(j);
|
||||
G4double ratio = cutValues[j]/aCut->GetProductionCut((G4int)j);
|
||||
fRatio = fRatio && (0.999<ratio) && (ratio<1.001) ;
|
||||
}
|
||||
}
|
||||
@@ -1170,7 +1170,7 @@ G4bool G4ProductionCutsTable::StoreCutsInfo(const G4String& directory,
|
||||
return false;
|
||||
}
|
||||
|
||||
G4int numberOfCouples = coupleTable.size();
|
||||
G4int numberOfCouples = (G4int)coupleTable.size();
|
||||
if (ascii)
|
||||
{
|
||||
/////////////// ASCII mode /////////////////
|
||||
@@ -1188,7 +1188,7 @@ G4bool G4ProductionCutsTable::StoreCutsInfo(const G4String& directory,
|
||||
for (i=0; i<FixedStringLengthForStore; ++i)
|
||||
temp[i] = '\0';
|
||||
for (i=0; i<key.length() && i<FixedStringLengthForStore-1; ++i)
|
||||
temp[i]=key[i];
|
||||
temp[i]=key[(G4int)i];
|
||||
fOut.write(temp, FixedStringLengthForStore);
|
||||
|
||||
// number of couples in the table
|
||||
@@ -1301,7 +1301,7 @@ G4bool G4ProductionCutsTable::RetrieveCutsInfo(const G4String& directory,
|
||||
"ProcCuts109", JustWarning,
|
||||
"Number of Couples in the file exceeds defined couples");
|
||||
}
|
||||
numberOfCouples = mccConversionTable.size();
|
||||
numberOfCouples = (G4int)mccConversionTable.size();
|
||||
|
||||
for (std::size_t idx=0; static_cast<G4int>(idx) <NumberOfG4CutIndex; ++idx)
|
||||
{
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace
|
||||
G4Mutex theREMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
G4double G4VRangeToEnergyConverter::sEmin = 0.0;
|
||||
G4double G4VRangeToEnergyConverter::sEmax = 10000;
|
||||
G4double G4VRangeToEnergyConverter::sEmin = CLHEP::keV;
|
||||
G4double G4VRangeToEnergyConverter::sEmax = 10.*CLHEP::GeV;
|
||||
|
||||
std::vector<G4double>* G4VRangeToEnergyConverter::sEnergy = nullptr;
|
||||
|
||||
@@ -64,7 +64,7 @@ G4VRangeToEnergyConverter::G4VRangeToEnergyConverter()
|
||||
// this method defines lock itself
|
||||
if(isFirstInstance)
|
||||
{
|
||||
FillEnergyVector(1*CLHEP::keV, 10.0*CLHEP::GeV);
|
||||
FillEnergyVector(CLHEP::keV, 10.0*CLHEP::GeV);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +75,8 @@ G4VRangeToEnergyConverter::~G4VRangeToEnergyConverter()
|
||||
{
|
||||
delete sEnergy;
|
||||
sEnergy = nullptr;
|
||||
sEmin = 0.;
|
||||
sEmax = 10000.;
|
||||
sEmin = CLHEP::keV;
|
||||
sEmax = 10.*CLHEP::GeV;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,20 +161,15 @@ void G4VRangeToEnergyConverter::FillEnergyVector(const G4double emin,
|
||||
{
|
||||
if(emin != sEmin || emax != sEmax || nullptr == sEnergy)
|
||||
{
|
||||
G4AutoLock l(&theREMutex);
|
||||
if(emin != sEmin || emax != sEmax || nullptr == sEnergy)
|
||||
{
|
||||
sEmin = emin;
|
||||
sEmax = emax;
|
||||
sNbin = sNbinPerDecade*static_cast<G4int>(std::log10(emax/emin));
|
||||
if(nullptr == sEnergy) { sEnergy = new std::vector<G4double>; }
|
||||
sEnergy->resize(sNbin + 1);
|
||||
(*sEnergy)[0] = emin;
|
||||
(*sEnergy)[sNbin] = emax;
|
||||
G4double fact = G4Log(emax/emin)/sNbin;
|
||||
for(G4int i=1; i<sNbin; ++i) { (*sEnergy)[i] = emin*G4Exp(i * fact); }
|
||||
}
|
||||
l.unlock();
|
||||
sEmin = emin;
|
||||
sEmax = emax;
|
||||
sNbin = sNbinPerDecade*G4lrint(std::log10(emax/emin));
|
||||
if(nullptr == sEnergy) { sEnergy = new std::vector<G4double>; }
|
||||
sEnergy->resize(sNbin + 1);
|
||||
(*sEnergy)[0] = emin;
|
||||
(*sEnergy)[sNbin] = emax;
|
||||
G4double fact = G4Log(emax/emin)/sNbin;
|
||||
for(G4int i=1; i<sNbin; ++i) { (*sEnergy)[i] = emin*G4Exp(i * fact); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +182,7 @@ G4VRangeToEnergyConverter::ConvertForGamma(const G4double rangeCut,
|
||||
const G4double* dens = material->GetAtomicNumDensityVector();
|
||||
|
||||
// fill absorption length vector
|
||||
G4int nelm = material->GetNumberOfElements();
|
||||
G4int nelm = (G4int)material->GetNumberOfElements();
|
||||
G4double range1 = 0.0;
|
||||
G4double range2 = 0.0;
|
||||
G4double e1 = 0.0;
|
||||
@@ -224,7 +219,7 @@ G4VRangeToEnergyConverter::ConvertForElectron(const G4double rangeCut,
|
||||
const G4double* dens = material->GetAtomicNumDensityVector();
|
||||
|
||||
// fill absorption length vector
|
||||
G4int nelm = material->GetNumberOfElements();
|
||||
G4int nelm = (G4int)material->GetNumberOfElements();
|
||||
G4double dedx1 = 0.0;
|
||||
G4double dedx2 = 0.0;
|
||||
G4double range1 = 0.0;
|
||||
|
||||
Reference in New Issue
Block a user