Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
@@ -26,19 +26,18 @@
#include "G4FastSimHitMaker.hh"
#include "G4TransportationManager.hh"
#include "G4VSensitiveDetector.hh"
#include "G4TouchableHandle.hh"
#include "G4Step.hh"
#include "G4StepPoint.hh"
#include "G4TouchableHandle.hh"
#include "G4TransportationManager.hh"
#include "G4VFastSimSensitiveDetector.hh"
#include "G4VSensitiveDetector.hh"
G4FastSimHitMaker::G4FastSimHitMaker()
{
fTouchableHandle = new G4TouchableHistory();
fpNavigator = new G4Navigator();
fNaviSetup = false;
fpNavigator = new G4Navigator();
fNaviSetup = false;
fWorldWithSdName = "";
fpSpotS = new G4Step();
fpSpotP = new G4StepPoint();
@@ -49,9 +48,9 @@ G4FastSimHitMaker::G4FastSimHitMaker()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4FastSimHitMaker::~G4FastSimHitMaker()
G4FastSimHitMaker::~G4FastSimHitMaker()
{
delete fpNavigator;
delete fpNavigator;
delete fpSpotP;
fpSpotS->ResetPreStepPoint();
fpSpotS->ResetPostStepPoint();
@@ -63,54 +62,44 @@ G4FastSimHitMaker::~G4FastSimHitMaker()
void G4FastSimHitMaker::make(const G4FastHit& aHit, const G4FastTrack& aTrack)
{
// do not make empty deposit
if(aHit.GetEnergy() <= 0)
return;
if (aHit.GetEnergy() <= 0) return;
// Locate the spot
if(!fNaviSetup)
{
if (!fNaviSetup) {
// Choose the world volume that contains the sensitive detector based on its
// name (empty name for mass geometry)
G4VPhysicalVolume* worldWithSD = nullptr;
if(fWorldWithSdName.empty())
{
if (fWorldWithSdName.empty()) {
worldWithSD = G4TransportationManager::GetTransportationManager()
->GetNavigatorForTracking()
->GetWorldVolume();
}
else
{
else {
worldWithSD =
G4TransportationManager::GetTransportationManager()->GetParallelWorld(
fWorldWithSdName);
G4TransportationManager::GetTransportationManager()->GetParallelWorld(fWorldWithSdName);
}
fpNavigator->SetWorldVolume(worldWithSD);
// use track global position
fpNavigator->LocateGlobalPointAndUpdateTouchable(
aTrack.GetPrimaryTrack()->GetPosition(), fTouchableHandle(), false);
fpNavigator->LocateGlobalPointAndUpdateTouchable(aTrack.GetPrimaryTrack()->GetPosition(),
fTouchableHandle(), false);
fNaviSetup = true;
}
else
{
else {
// for further deposits use hit (local) position and local->global
// transformation
fpNavigator->LocateGlobalPointAndUpdateTouchable(
aTrack.GetInverseAffineTransformation()->TransformPoint(
aHit.GetPosition()),
aTrack.GetInverseAffineTransformation()->TransformPoint(aHit.GetPosition()),
fTouchableHandle());
}
G4VPhysicalVolume* currentVolume = fTouchableHandle()->GetVolume();
if(currentVolume != 0)
{
if (currentVolume != nullptr) {
G4VSensitiveDetector* sensitive = currentVolume->GetLogicalVolume()->GetSensitiveDetector();
G4VFastSimSensitiveDetector* fastSimSensitive =
dynamic_cast<G4VFastSimSensitiveDetector*>(sensitive);
if(fastSimSensitive)
{
auto fastSimSensitive = dynamic_cast<G4VFastSimSensitiveDetector*>(sensitive);
if (fastSimSensitive != nullptr) {
fastSimSensitive->Hit(&aHit, &aTrack, &fTouchableHandle);
}
else if(sensitive &&
currentVolume->GetLogicalVolume()->GetFastSimulationManager())
else if ((sensitive != nullptr)
&& (currentVolume->GetLogicalVolume()->GetFastSimulationManager() != nullptr))
{
fpSpotS->SetTotalEnergyDeposit(aHit.GetEnergy());
fpSpotS->SetTrack(const_cast<G4Track*>(aTrack.GetPrimaryTrack()));