Files
geant4/source/processes/scoring/include/private/G4EnergySplitter.icc
2025-03-24 16:45:22 +01:00

77 lines
3.5 KiB
Plaintext

//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#include "G4PhantomParameterisation.hh"
#include "G4UIcommand.hh"
//-----------------------------------------------------------------------
inline void G4EnergySplitter::GetVoxelIDAndLength(G4int stepNo, G4int& voxelID,
G4double& stepLength)
{
GetVoxelID(stepNo, voxelID);
GetStepLength(stepNo, stepLength);
}
//-----------------------------------------------------------------------
inline void G4EnergySplitter::GetLengthAndEnergyDeposited(G4int stepNo, G4int& voxelID,
G4double& stepLength,
G4double& energyLoss)
{
GetVoxelIDAndLength(stepNo, voxelID, stepLength);
energyLoss = theEnergies[stepNo];
}
//-----------------------------------------------------------------------
inline void G4EnergySplitter::GetLengthAndInitialEnergy(G4double& preStepEnergy, G4int stepNo,
G4int& voxelID, G4double& stepLength,
G4double& initialEnergy)
{
GetVoxelIDAndLength(stepNo, voxelID, stepLength);
initialEnergy = preStepEnergy;
for (G4int ii = 0; ii < stepNo; ii++) {
initialEnergy -= theEnergies[stepNo];
}
}
//-----------------------------------------------------------------------
inline void G4EnergySplitter::SetNIterations(G4int niter)
{
theNIterations = niter;
}
//-----------------------------------------------------------------------
inline G4Material* G4EnergySplitter::GetVoxelMaterial(G4int stepNo)
{
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);
}