Import Geant4 11.3.1 source tree

This commit is contained in:
Gabriele Cosmo
2025-03-24 16:45:22 +01:00
parent 32390e802b
commit df176550b3
388 changed files with 29491 additions and 29435 deletions
+6
View File
@@ -6,6 +6,12 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-02-12 Ben Morgan (procscore-V11-02-01)
- Apply [GitHub PR 80](https://github.com/Geant4/geant4/pull/80)
- Changes to `G4EnergySplitter` to ensure that each call to `SplitEnergyInVolumes()`
utilizes the correct phantom parameterization.
- Fixes [Bugzilla 2636](https://bugzilla-geant4.kek.jp/show_bug.cgi?id=2636)
## 2024-10-10 Pedro Arce (procscore-V11-02-00)
- Safeguard for 0 energy deposited in G4EnergySplitter
- Fix bug #2629
@@ -72,7 +72,6 @@ class G4EnergySplitter
private:
void GetStepLength(G4int stepNo, G4double& stepLength);
void GetPhantomParam(G4bool mustExist);
G4bool IsPhantomVolume(G4VPhysicalVolume* pv);
G4EnergyLossForExtrapolator* theElossExt;
@@ -66,7 +66,10 @@ inline void G4EnergySplitter::SetNIterations(G4int niter)
//-----------------------------------------------------------------------
inline G4Material* G4EnergySplitter::GetVoxelMaterial(G4int stepNo)
{
if (thePhantomParam == nullptr) GetPhantomParam(true);
if (thePhantomParam == nullptr) {
G4Exception("G4EnergySplitter::GetVoxelMaterial()", "PhantomParamError",
FatalException, "Phantom parameterisation not set -- SplitEnergyInVolumes() must be called first");
}
G4int voxelID;
GetVoxelID(stepNo, voxelID);
return thePhantomParam->GetMaterial(voxelID);
@@ -82,7 +82,14 @@ G4int G4EnergySplitter::SplitEnergyInVolumes(const G4Step* aStep)
return (G4int)theEnergies.size();
}
if (thePhantomParam == nullptr) GetPhantomParam(true);
//----- Get the phantom parameterisation from the G4Step
auto preStepPhysVol = aStep->GetPreStepPoint()->GetPhysicalVolume();
if (!IsPhantomVolume(preStepPhysVol)) {
G4Exception("G4EnergySplitter::SplitEnergyInVolumes", "PhantomParamError", FatalException,
"SplitEnergyInVolumes() called for a step not in a phantom volume");
}
auto phantomVol = static_cast<G4PVParameterised*>(preStepPhysVol);
thePhantomParam = static_cast<G4PhantomParameterisation*>(phantomVol->GetParameterisation());
//----- Distribute energy deposited in voxels
std::vector<std::pair<G4int, G4double>> rnsl =
@@ -278,23 +285,6 @@ G4int G4EnergySplitter::SplitEnergyInVolumes(const G4Step* aStep)
return (G4int)theEnergies.size();
}
//-----------------------------------------------------------------------
void G4EnergySplitter::GetPhantomParam(G4bool mustExist)
{
G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance();
for (const auto pv : *pvs) {
if (IsPhantomVolume(pv)) {
const auto pvparam = static_cast<const G4PVParameterised*>(pv);
G4VPVParameterisation* param = pvparam->GetParameterisation();
thePhantomParam = static_cast<G4PhantomParameterisation*>(param);
}
}
if ((thePhantomParam == nullptr) && mustExist)
G4Exception("G4EnergySplitter::GetPhantomParam", "PhantomParamError", FatalException,
"No G4PhantomParameterisation found !");
}
//-----------------------------------------------------------------------
G4bool G4EnergySplitter::IsPhantomVolume(G4VPhysicalVolume* pv)
{