Import Geant4 11.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2024-06-28 13:08:51 +02:00
parent f7b23877ed
commit e58e650b32
5232 changed files with 239416 additions and 244360 deletions
@@ -48,7 +48,10 @@ ActionInitialization::~ActionInitialization() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void ActionInitialization::BuildForMaster() const { SetUserAction(new RunAction(fDetector)); }
void ActionInitialization::BuildForMaster() const
{
SetUserAction(new RunAction(fDetector));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,6 +32,8 @@
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
@@ -45,8 +47,6 @@
#include "G4SystemOfUnits.hh"
#include "G4UnitsTable.hh"
#include "DetectorMessenger.hh"
#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -110,20 +110,20 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
// World
//
auto* solidWorld = new G4Box("World", // its name
fWorldSizeX / 2, fWorldSizeYZ / 2,
fWorldSizeYZ / 2); // its size
fWorldSizeX / 2, fWorldSizeYZ / 2,
fWorldSizeYZ / 2); // its size
fLogicWorld = new G4LogicalVolume(solidWorld, // its solid
fWorldMaterial, // its material
"World"); // its name
fWorldMaterial, // its material
"World"); // its name
fPhysiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
fLogicWorld, // its fLogical volume
"World", // its name
0, // its mother volume
false, // no boolean operation
0); // copy number
G4ThreeVector(), // at (0,0,0)
fLogicWorld, // its fLogical volume
"World", // its name
0, // its mother volume
false, // no boolean operation
0); // copy number
//
// Calorimeter
//
@@ -134,12 +134,12 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
auto* logicCalor = new G4LogicalVolume(solidCalor, fWorldMaterial, "Calorimeter");
new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
logicCalor, // its fLogical volume
"Calorimeter", // its name
fLogicWorld, // its mother volume
false, // no boolean operation
0); // copy number
G4ThreeVector(), // at (0,0,0)
logicCalor, // its fLogical volume
"Calorimeter", // its name
fLogicWorld, // its mother volume
false, // no boolean operation
0); // copy number
//
// Layers
@@ -181,23 +181,23 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
xfront = -0.5 * fLayerThickness;
for (G4int k = 1; k <= fNbOfAbsor; ++k) {
auto* solidAbsor = new G4Box("Absorber", // its name
fAbsorThickness[k] / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2);
fAbsorThickness[k] / 2, fCalorSizeYZ / 2, fCalorSizeYZ / 2);
fLogicAbsorFront[k] = new G4LogicalVolume(solidAbsor, // its solid
fAbsorMaterial[k], // its material
fAbsorMaterial[k]->GetName());
fAbsorMaterial[k], // its material
fAbsorMaterial[k]->GetName());
fLogicAbsorBack[k] = new G4LogicalVolume(solidAbsor, // its solid
fAbsorMaterial[k], // its material
fAbsorMaterial[k]->GetName());
fAbsorMaterial[k], // its material
fAbsorMaterial[k]->GetName());
G4double xcenter = xfront + 0.5 * fAbsorThickness[k];
xfront += fAbsorThickness[k];
new G4PVPlacement(0, G4ThreeVector(xcenter, 0., 0.), fLogicAbsorFront[k],
fAbsorMaterial[k]->GetName(), fLogicLayerFront, false,
k); // copy number
fAbsorMaterial[k]->GetName(), fLogicLayerFront, false,
k); // copy number
new G4PVPlacement(0, G4ThreeVector(xcenter, 0., 0.), fLogicAbsorBack[k],
fAbsorMaterial[k]->GetName(), fLogicLayerBack, false,
k); // copy number
fAbsorMaterial[k]->GetName(), fLogicLayerBack, false,
k); // copy number
}
PrintCalorParameters();
@@ -32,6 +32,8 @@
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithoutParameter.hh"
@@ -39,8 +41,6 @@
#include "G4UIdirectory.hh"
#include "G4UIparameter.hh"
#include "DetectorConstruction.hh"
#include <sstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -30,6 +30,8 @@
#include "EmStandardPhysicsTrackingManager.hh"
#include "TrackingManagerHelper.hh"
#include "G4ComptonScattering.hh"
#include "G4CoulombScattering.hh"
#include "G4Electron.hh"
@@ -52,8 +54,6 @@
#include "G4eMultipleScattering.hh"
#include "G4eplusAnnihilation.hh"
#include "TrackingManagerHelper.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EmStandardPhysicsTrackingManager* EmStandardPhysicsTrackingManager::fMasterTrackingManager =
@@ -226,150 +226,150 @@ void EmStandardPhysicsTrackingManager::TrackElectron(G4Track* aTrack)
{
class ElectronPhysics final : public TrackingManagerHelper::Physics
{
public:
ElectronPhysics(EmStandardPhysicsTrackingManager& mgr) : fMgr(mgr) {}
public:
ElectronPhysics(EmStandardPhysicsTrackingManager& mgr) : fMgr(mgr) {}
void StartTracking(G4Track* aTrack) override
{
auto& electronProcs = fMgr.fElectronProcs;
void StartTracking(G4Track* aTrack) override
{
auto& electronProcs = fMgr.fElectronProcs;
electronProcs.msc->StartTracking(aTrack);
electronProcs.ioni->StartTracking(aTrack);
electronProcs.brems->StartTracking(aTrack);
electronProcs.ss->StartTracking(aTrack);
electronProcs.msc->StartTracking(aTrack);
electronProcs.ioni->StartTracking(aTrack);
electronProcs.brems->StartTracking(aTrack);
electronProcs.ss->StartTracking(aTrack);
fPreviousStepLength = 0;
}
void EndTracking() override
{
auto& electronProcs = fMgr.fElectronProcs;
fPreviousStepLength = 0;
}
void EndTracking() override
{
auto& electronProcs = fMgr.fElectronProcs;
electronProcs.msc->EndTracking();
electronProcs.ioni->EndTracking();
electronProcs.brems->EndTracking();
electronProcs.ss->EndTracking();
}
G4double GetPhysicalInteractionLength(const G4Track& track) override
{
auto& electronProcs = fMgr.fElectronProcs;
G4double physIntLength, proposedSafety = DBL_MAX;
G4ForceCondition condition;
G4GPILSelection selection;
fProposedStep = DBL_MAX;
fSelected = -1;
physIntLength = electronProcs.ss->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 0;
electronProcs.msc->EndTracking();
electronProcs.ioni->EndTracking();
electronProcs.brems->EndTracking();
electronProcs.ss->EndTracking();
}
physIntLength = electronProcs.brems->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 1;
}
G4double GetPhysicalInteractionLength(const G4Track& track) override
{
auto& electronProcs = fMgr.fElectronProcs;
G4double physIntLength, proposedSafety = DBL_MAX;
G4ForceCondition condition;
G4GPILSelection selection;
physIntLength = electronProcs.ioni->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 2;
}
physIntLength = electronProcs.ioni->AlongStepGPIL(
track, fPreviousStepLength, fProposedStep, proposedSafety, &selection);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fProposedStep = DBL_MAX;
fSelected = -1;
}
physIntLength = electronProcs.msc->AlongStepGPIL(
track, fPreviousStepLength, fProposedStep, proposedSafety, &selection);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
// Check if MSC actually wants to win, in most cases it only limits the
// step size.
if (selection == CandidateForSelection) {
physIntLength = electronProcs.ss->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 0;
}
physIntLength = electronProcs.brems->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 1;
}
physIntLength = electronProcs.ioni->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 2;
}
physIntLength = electronProcs.ioni->AlongStepGPIL(track, fPreviousStepLength, fProposedStep,
proposedSafety, &selection);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = -1;
}
physIntLength = electronProcs.msc->AlongStepGPIL(track, fPreviousStepLength, fProposedStep,
proposedSafety, &selection);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
// Check if MSC actually wants to win, in most cases it only limits the
// step size.
if (selection == CandidateForSelection) {
fSelected = -1;
}
}
return fProposedStep;
}
return fProposedStep;
}
void AlongStepDoIt(G4Track& track, G4Step& step, G4TrackVector&) override
{
if (step.GetStepLength() == fProposedStep) {
step.GetPostStepPoint()->SetStepStatus(fAlongStepDoItProc);
}
else {
// Remember that the step was limited by geometry.
fSelected = -1;
}
auto& electronProcs = fMgr.fElectronProcs;
G4VParticleChange* particleChange;
void AlongStepDoIt(G4Track& track, G4Step& step, G4TrackVector&) override
{
if (step.GetStepLength() == fProposedStep) {
step.GetPostStepPoint()->SetStepStatus(fAlongStepDoItProc);
}
else {
// Remember that the step was limited by geometry.
fSelected = -1;
}
auto& electronProcs = fMgr.fElectronProcs;
G4VParticleChange* particleChange;
particleChange = electronProcs.msc->AlongStepDoIt(track, step);
particleChange->UpdateStepForAlongStep(&step);
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
particleChange = electronProcs.msc->AlongStepDoIt(track, step);
particleChange->UpdateStepForAlongStep(&step);
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
particleChange = electronProcs.ioni->AlongStepDoIt(track, step);
particleChange->UpdateStepForAlongStep(&step);
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
particleChange = electronProcs.ioni->AlongStepDoIt(track, step);
particleChange->UpdateStepForAlongStep(&step);
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
fPreviousStepLength = step.GetStepLength();
}
void PostStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) override
{
if (fSelected < 0) {
return;
}
step.GetPostStepPoint()->SetStepStatus(fPostStepDoItProc);
auto& electronProcs = fMgr.fElectronProcs;
G4VProcess* process = nullptr;
G4VParticleChange* particleChange = nullptr;
switch (fSelected) {
case 0:
process = electronProcs.ss;
particleChange = electronProcs.ss->PostStepDoIt(track, step);
break;
case 1:
process = electronProcs.brems;
particleChange = electronProcs.brems->PostStepDoIt(track, step);
break;
case 2:
process = electronProcs.ioni;
particleChange = electronProcs.ioni->PostStepDoIt(track, step);
break;
fPreviousStepLength = step.GetStepLength();
}
particleChange->UpdateStepForPostStep(&step);
step.UpdateTrack();
void PostStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) override
{
if (fSelected < 0) {
return;
}
step.GetPostStepPoint()->SetStepStatus(fPostStepDoItProc);
int numSecondaries = particleChange->GetNumberOfSecondaries();
for (int i = 0; i < numSecondaries; i++) {
G4Track* secondary = particleChange->GetSecondary(i);
secondary->SetParentID(track.GetTrackID());
secondary->SetCreatorProcess(process);
secondaries.push_back(secondary);
auto& electronProcs = fMgr.fElectronProcs;
G4VProcess* process = nullptr;
G4VParticleChange* particleChange = nullptr;
switch (fSelected) {
case 0:
process = electronProcs.ss;
particleChange = electronProcs.ss->PostStepDoIt(track, step);
break;
case 1:
process = electronProcs.brems;
particleChange = electronProcs.brems->PostStepDoIt(track, step);
break;
case 2:
process = electronProcs.ioni;
particleChange = electronProcs.ioni->PostStepDoIt(track, step);
break;
}
particleChange->UpdateStepForPostStep(&step);
step.UpdateTrack();
G4int numSecondaries = particleChange->GetNumberOfSecondaries();
for (G4int i = 0; i < numSecondaries; ++i) {
G4Track* secondary = particleChange->GetSecondary(i);
secondary->SetParentID(track.GetTrackID());
secondary->SetCreatorProcess(process);
secondaries.push_back(secondary);
}
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
}
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
}
private:
EmStandardPhysicsTrackingManager& fMgr;
G4double fPreviousStepLength;
G4double fProposedStep;
G4int fSelected;
private:
EmStandardPhysicsTrackingManager& fMgr;
G4double fPreviousStepLength;
G4double fProposedStep;
G4int fSelected;
};
ElectronPhysics physics(*this);
@@ -382,185 +382,185 @@ void EmStandardPhysicsTrackingManager::TrackPositron(G4Track* aTrack)
{
class PositronPhysics final : public TrackingManagerHelper::Physics
{
public:
PositronPhysics(EmStandardPhysicsTrackingManager& mgr) : fMgr(mgr) {}
public:
PositronPhysics(EmStandardPhysicsTrackingManager& mgr) : fMgr(mgr) {}
void StartTracking(G4Track* aTrack) override
{
auto& positronProcs = fMgr.fPositronProcs;
void StartTracking(G4Track* aTrack) override
{
auto& positronProcs = fMgr.fPositronProcs;
positronProcs.msc->StartTracking(aTrack);
positronProcs.ioni->StartTracking(aTrack);
positronProcs.brems->StartTracking(aTrack);
positronProcs.annihilation->StartTracking(aTrack);
positronProcs.ss->StartTracking(aTrack);
positronProcs.msc->StartTracking(aTrack);
positronProcs.ioni->StartTracking(aTrack);
positronProcs.brems->StartTracking(aTrack);
positronProcs.annihilation->StartTracking(aTrack);
positronProcs.ss->StartTracking(aTrack);
fPreviousStepLength = 0;
}
void EndTracking() override
{
auto& positronProcs = fMgr.fPositronProcs;
fPreviousStepLength = 0;
}
void EndTracking() override
{
auto& positronProcs = fMgr.fPositronProcs;
positronProcs.msc->EndTracking();
positronProcs.ioni->EndTracking();
positronProcs.brems->EndTracking();
positronProcs.annihilation->EndTracking();
positronProcs.ss->EndTracking();
}
G4double GetPhysicalInteractionLength(const G4Track& track) override
{
auto& positronProcs = fMgr.fPositronProcs;
G4double physIntLength, proposedSafety = DBL_MAX;
G4ForceCondition condition;
G4GPILSelection selection;
fProposedStep = DBL_MAX;
fSelected = -1;
physIntLength = positronProcs.ss->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 0;
positronProcs.msc->EndTracking();
positronProcs.ioni->EndTracking();
positronProcs.brems->EndTracking();
positronProcs.annihilation->EndTracking();
positronProcs.ss->EndTracking();
}
physIntLength =
positronProcs.annihilation->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 1;
}
G4double GetPhysicalInteractionLength(const G4Track& track) override
{
auto& positronProcs = fMgr.fPositronProcs;
G4double physIntLength, proposedSafety = DBL_MAX;
G4ForceCondition condition;
G4GPILSelection selection;
physIntLength = positronProcs.brems->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 2;
}
physIntLength = positronProcs.ioni->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 3;
}
physIntLength = positronProcs.ioni->AlongStepGPIL(
track, fPreviousStepLength, fProposedStep, proposedSafety, &selection);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fProposedStep = DBL_MAX;
fSelected = -1;
}
physIntLength = positronProcs.msc->AlongStepGPIL(
track, fPreviousStepLength, fProposedStep, proposedSafety, &selection);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
// Check if MSC actually wants to win, in most cases it only limits the
// step size.
if (selection == CandidateForSelection) {
physIntLength = positronProcs.ss->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 0;
}
physIntLength =
positronProcs.annihilation->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 1;
}
physIntLength = positronProcs.brems->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 2;
}
physIntLength = positronProcs.ioni->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 3;
}
physIntLength = positronProcs.ioni->AlongStepGPIL(track, fPreviousStepLength, fProposedStep,
proposedSafety, &selection);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = -1;
}
physIntLength = positronProcs.msc->AlongStepGPIL(track, fPreviousStepLength, fProposedStep,
proposedSafety, &selection);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
// Check if MSC actually wants to win, in most cases it only limits the
// step size.
if (selection == CandidateForSelection) {
fSelected = -1;
}
}
return fProposedStep;
}
return fProposedStep;
}
void AlongStepDoIt(G4Track& track, G4Step& step, G4TrackVector&) override
{
if (step.GetStepLength() == fProposedStep) {
step.GetPostStepPoint()->SetStepStatus(fAlongStepDoItProc);
}
else {
// Remember that the step was limited by geometry.
fSelected = -1;
}
auto& positronProcs = fMgr.fPositronProcs;
G4VParticleChange* particleChange;
void AlongStepDoIt(G4Track& track, G4Step& step, G4TrackVector&) override
{
if (step.GetStepLength() == fProposedStep) {
step.GetPostStepPoint()->SetStepStatus(fAlongStepDoItProc);
}
else {
// Remember that the step was limited by geometry.
fSelected = -1;
}
auto& positronProcs = fMgr.fPositronProcs;
G4VParticleChange* particleChange;
particleChange = positronProcs.msc->AlongStepDoIt(track, step);
particleChange->UpdateStepForAlongStep(&step);
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
particleChange = positronProcs.msc->AlongStepDoIt(track, step);
particleChange->UpdateStepForAlongStep(&step);
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
particleChange = positronProcs.ioni->AlongStepDoIt(track, step);
particleChange->UpdateStepForAlongStep(&step);
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
particleChange = positronProcs.ioni->AlongStepDoIt(track, step);
particleChange->UpdateStepForAlongStep(&step);
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
fPreviousStepLength = step.GetStepLength();
}
void PostStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) override
{
if (fSelected < 0) {
return;
}
step.GetPostStepPoint()->SetStepStatus(fPostStepDoItProc);
auto& positronProcs = fMgr.fPositronProcs;
G4VProcess* process;
G4VParticleChange* particleChange = nullptr;
switch (fSelected) {
case 0:
process = positronProcs.ss;
particleChange = positronProcs.ss->PostStepDoIt(track, step);
break;
case 1:
process = positronProcs.annihilation;
particleChange = positronProcs.annihilation->PostStepDoIt(track, step);
break;
case 2:
process = positronProcs.brems;
particleChange = positronProcs.brems->PostStepDoIt(track, step);
break;
case 3:
process = positronProcs.ioni;
particleChange = positronProcs.ioni->PostStepDoIt(track, step);
break;
fPreviousStepLength = step.GetStepLength();
}
particleChange->UpdateStepForPostStep(&step);
step.UpdateTrack();
void PostStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) override
{
if (fSelected < 0) {
return;
}
step.GetPostStepPoint()->SetStepStatus(fPostStepDoItProc);
int numSecondaries = particleChange->GetNumberOfSecondaries();
for (int i = 0; i < numSecondaries; i++) {
G4Track* secondary = particleChange->GetSecondary(i);
secondary->SetParentID(track.GetTrackID());
secondary->SetCreatorProcess(process);
secondaries.push_back(secondary);
auto& positronProcs = fMgr.fPositronProcs;
G4VProcess* process = nullptr;
G4VParticleChange* particleChange = nullptr;
switch (fSelected) {
case 0:
process = positronProcs.ss;
particleChange = positronProcs.ss->PostStepDoIt(track, step);
break;
case 1:
process = positronProcs.annihilation;
particleChange = positronProcs.annihilation->PostStepDoIt(track, step);
break;
case 2:
process = positronProcs.brems;
particleChange = positronProcs.brems->PostStepDoIt(track, step);
break;
case 3:
process = positronProcs.ioni;
particleChange = positronProcs.ioni->PostStepDoIt(track, step);
break;
}
particleChange->UpdateStepForPostStep(&step);
step.UpdateTrack();
G4int numSecondaries = particleChange->GetNumberOfSecondaries();
for (G4int i = 0; i < numSecondaries; ++i) {
G4Track* secondary = particleChange->GetSecondary(i);
secondary->SetParentID(track.GetTrackID());
secondary->SetCreatorProcess(process);
secondaries.push_back(secondary);
}
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
}
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
}
G4bool HasAtRestProcesses() override { return true; }
G4bool HasAtRestProcesses() override { return true; }
void AtRestDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) override
{
auto& positronProcs = fMgr.fPositronProcs;
// Annihilate the positron at rest.
G4VParticleChange* particleChange = positronProcs.annihilation->AtRestDoIt(track, step);
particleChange->UpdateStepForAtRest(&step);
step.UpdateTrack();
void AtRestDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) override
{
auto& positronProcs = fMgr.fPositronProcs;
// Annihilate the positron at rest.
G4VParticleChange* particleChange = positronProcs.annihilation->AtRestDoIt(track, step);
particleChange->UpdateStepForAtRest(&step);
step.UpdateTrack();
G4int numSecondaries = particleChange->GetNumberOfSecondaries();
for (G4int i = 0; i < numSecondaries; ++i) {
G4Track* secondary = particleChange->GetSecondary(i);
secondary->SetParentID(track.GetTrackID());
secondary->SetCreatorProcess(positronProcs.annihilation);
secondaries.push_back(secondary);
}
int numSecondaries = particleChange->GetNumberOfSecondaries();
for (int i = 0; i < numSecondaries; i++) {
G4Track* secondary = particleChange->GetSecondary(i);
secondary->SetParentID(track.GetTrackID());
secondary->SetCreatorProcess(positronProcs.annihilation);
secondaries.push_back(secondary);
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
}
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
}
private:
EmStandardPhysicsTrackingManager& fMgr;
G4double fPreviousStepLength;
G4double fProposedStep;
G4int fSelected;
private:
EmStandardPhysicsTrackingManager& fMgr;
G4double fPreviousStepLength;
G4double fProposedStep;
G4int fSelected;
};
PositronPhysics physics(*this);
@@ -573,128 +573,128 @@ void EmStandardPhysicsTrackingManager::TrackGamma(G4Track* aTrack)
{
class GammaPhysics final : public TrackingManagerHelper::Physics
{
public:
GammaPhysics(EmStandardPhysicsTrackingManager& mgr) : fMgr(mgr) {}
public:
GammaPhysics(EmStandardPhysicsTrackingManager& mgr) : fMgr(mgr) {}
void StartTracking(G4Track* aTrack) override
{
auto& gammaProcs = fMgr.fGammaProcs;
void StartTracking(G4Track* aTrack) override
{
auto& gammaProcs = fMgr.fGammaProcs;
gammaProcs.pe->StartTracking(aTrack);
gammaProcs.compton->StartTracking(aTrack);
gammaProcs.conversion->StartTracking(aTrack);
gammaProcs.rayleigh->StartTracking(aTrack);
gammaProcs.pe->StartTracking(aTrack);
gammaProcs.compton->StartTracking(aTrack);
gammaProcs.conversion->StartTracking(aTrack);
gammaProcs.rayleigh->StartTracking(aTrack);
fPreviousStepLength = 0;
}
void EndTracking() override
{
auto& gammaProcs = fMgr.fGammaProcs;
fPreviousStepLength = 0;
}
void EndTracking() override
{
auto& gammaProcs = fMgr.fGammaProcs;
gammaProcs.pe->EndTracking();
gammaProcs.compton->EndTracking();
gammaProcs.conversion->EndTracking();
gammaProcs.rayleigh->EndTracking();
}
G4double GetPhysicalInteractionLength(const G4Track& track) override
{
auto& gammaProcs = fMgr.fGammaProcs;
G4double physIntLength;
G4ForceCondition condition;
fProposedStep = DBL_MAX;
fSelected = -1;
physIntLength = gammaProcs.rayleigh->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 0;
gammaProcs.pe->EndTracking();
gammaProcs.compton->EndTracking();
gammaProcs.conversion->EndTracking();
gammaProcs.rayleigh->EndTracking();
}
physIntLength = gammaProcs.conversion->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 1;
}
G4double GetPhysicalInteractionLength(const G4Track& track) override
{
auto& gammaProcs = fMgr.fGammaProcs;
G4double physIntLength;
G4ForceCondition condition;
physIntLength = gammaProcs.compton->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 2;
}
physIntLength = gammaProcs.pe->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 3;
}
return fProposedStep;
}
void AlongStepDoIt(G4Track&, G4Step& step, G4TrackVector&) override
{
if (step.GetStepLength() == fProposedStep) {
step.GetPostStepPoint()->SetStepStatus(fAlongStepDoItProc);
}
else {
// Remember that the step was limited by geometry.
fProposedStep = DBL_MAX;
fSelected = -1;
}
fPreviousStepLength = step.GetStepLength();
}
void PostStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) override
{
if (fSelected < 0) {
return;
}
step.GetPostStepPoint()->SetStepStatus(fPostStepDoItProc);
physIntLength = gammaProcs.rayleigh->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 0;
}
auto& gammaProcs = fMgr.fGammaProcs;
G4VProcess* process = nullptr;
G4VParticleChange* particleChange = nullptr;
physIntLength = gammaProcs.conversion->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 1;
}
switch (fSelected) {
case 0:
process = gammaProcs.rayleigh;
particleChange = gammaProcs.rayleigh->PostStepDoIt(track, step);
break;
case 1:
process = gammaProcs.conversion;
particleChange = gammaProcs.conversion->PostStepDoIt(track, step);
break;
case 2:
process = gammaProcs.compton;
particleChange = gammaProcs.compton->PostStepDoIt(track, step);
break;
case 3:
process = gammaProcs.pe;
particleChange = gammaProcs.pe->PostStepDoIt(track, step);
break;
physIntLength = gammaProcs.compton->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 2;
}
physIntLength = gammaProcs.pe->PostStepGPIL(track, fPreviousStepLength, &condition);
if (physIntLength < fProposedStep) {
fProposedStep = physIntLength;
fSelected = 3;
}
return fProposedStep;
}
particleChange->UpdateStepForPostStep(&step);
step.UpdateTrack();
int numSecondaries = particleChange->GetNumberOfSecondaries();
for (int i = 0; i < numSecondaries; i++) {
G4Track* secondary = particleChange->GetSecondary(i);
secondary->SetParentID(track.GetTrackID());
secondary->SetCreatorProcess(process);
secondaries.push_back(secondary);
void AlongStepDoIt(G4Track&, G4Step& step, G4TrackVector&) override
{
if (step.GetStepLength() == fProposedStep) {
step.GetPostStepPoint()->SetStepStatus(fAlongStepDoItProc);
}
else {
// Remember that the step was limited by geometry.
fSelected = -1;
}
fPreviousStepLength = step.GetStepLength();
}
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
}
void PostStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) override
{
if (fSelected < 0) {
return;
}
step.GetPostStepPoint()->SetStepStatus(fPostStepDoItProc);
private:
EmStandardPhysicsTrackingManager& fMgr;
G4double fPreviousStepLength;
G4double fProposedStep;
G4int fSelected;
auto& gammaProcs = fMgr.fGammaProcs;
G4VProcess* process = nullptr;
G4VParticleChange* particleChange = nullptr;
switch (fSelected) {
case 0:
process = gammaProcs.rayleigh;
particleChange = gammaProcs.rayleigh->PostStepDoIt(track, step);
break;
case 1:
process = gammaProcs.conversion;
particleChange = gammaProcs.conversion->PostStepDoIt(track, step);
break;
case 2:
process = gammaProcs.compton;
particleChange = gammaProcs.compton->PostStepDoIt(track, step);
break;
case 3:
process = gammaProcs.pe;
particleChange = gammaProcs.pe->PostStepDoIt(track, step);
break;
}
particleChange->UpdateStepForPostStep(&step);
step.UpdateTrack();
G4int numSecondaries = particleChange->GetNumberOfSecondaries();
for (G4int i = 0; i < numSecondaries; ++i) {
G4Track* secondary = particleChange->GetSecondary(i);
secondary->SetParentID(track.GetTrackID());
secondary->SetCreatorProcess(process);
secondaries.push_back(secondary);
}
track.SetTrackStatus(particleChange->GetTrackStatus());
particleChange->Clear();
}
private:
EmStandardPhysicsTrackingManager& fMgr;
G4double fPreviousStepLength;
G4double fProposedStep;
G4int fSelected;
};
GammaPhysics physics(*this);
@@ -32,11 +32,11 @@
#include "EventAction.hh"
#include "Run.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "Run.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
EventAction::EventAction(DetectorConstruction* det) : G4UserEventAction(), fDetector(det) {}
@@ -32,6 +32,10 @@
#include "PhysicsList.hh"
#include "PhysicsListEmSpecialized.hh"
#include "PhysicsListEmStandardTracking.hh"
#include "PhysicsListMessenger.hh"
#include "G4BaryonConstructor.hh"
#include "G4BosonConstructor.hh"
#include "G4EmStandardPhysics.hh"
@@ -40,10 +44,6 @@
#include "G4MesonConstructor.hh"
#include "G4ShortLivedConstructor.hh"
#include "PhysicsListEmSpecialized.hh"
#include "PhysicsListEmStandardTracking.hh"
#include "PhysicsListMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsList::PhysicsList()
@@ -29,13 +29,13 @@
#include "PhysicsListEmSpecialized.hh"
#include "SpecializedTrackingManager.hh"
#include "G4Electron.hh"
#include "G4Gamma.hh"
#include "G4ParticleDefinition.hh"
#include "G4Positron.hh"
#include "SpecializedTrackingManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListEmSpecialized::PhysicsListEmSpecialized(G4int ver, const G4String& name)
@@ -29,14 +29,14 @@
#include "PhysicsListEmStandardTracking.hh"
#include "EmStandardPhysicsTrackingManager.hh"
#include "G4Electron.hh"
#include "G4EmBuilder.hh"
#include "G4Gamma.hh"
#include "G4ParticleDefinition.hh"
#include "G4Positron.hh"
#include "EmStandardPhysicsTrackingManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListEmStandardTracking::PhysicsListEmStandardTracking(G4int ver)
@@ -32,11 +32,11 @@
#include "PhysicsListMessenger.hh"
#include "PhysicsList.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIdirectory.hh"
#include "PhysicsList.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
@@ -32,12 +32,12 @@
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "G4Electron.hh"
#include "G4ParticleGun.hh"
#include "G4SystemOfUnits.hh"
#include "DetectorConstruction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* det) : fDetector(det)
+11 -5
View File
@@ -32,6 +32,9 @@
#include "Run.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4Electron.hh"
#include "G4Gamma.hh"
#include "G4ParticleDefinition.hh"
@@ -41,9 +44,6 @@
#include "G4Track.hh"
#include "G4UnitsTable.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include <iomanip>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -94,11 +94,17 @@ void Run::FillPerEvent(G4int kAbs, G4double EAbs, G4double LAbs)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::AddChargedStep() { fChargedStep += 1.0; }
void Run::AddChargedStep()
{
fChargedStep += 1.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::AddNeutralStep() { fNeutralStep += 1.0; }
void Run::AddNeutralStep()
{
fNeutralStep += 1.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,14 +32,14 @@
#include "RunAction.hh"
#include "G4RunManager.hh"
#include "G4Timer.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "Run.hh"
#include "G4RunManager.hh"
#include "G4Timer.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
RunAction::RunAction(DetectorConstruction* det, PrimaryGeneratorAction* prim)
@@ -77,7 +77,7 @@ void RunAction::EndOfRunAction(const G4Run*)
// compute and print statistic
if (isMaster) {
fTimer.Stop();
if (! ((G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM))) {
if (!((G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM))) {
G4cout << "\n"
<< "Total number of events: " << fRun->GetNumberOfEvent() << G4endl;
G4cout << "Master thread time: " << fTimer << G4endl;
@@ -99,7 +99,7 @@ void SpecializedTrackingManager::HandOverOneTrack(G4Track* aTrack)
trackManager->ProcessOneTrack(aTrack);
if (aTrack->GetTrackStatus() != fStopAndKill) {
G4Exception("SpecializedTrackingManager::HandOverOneTrack", "NotStopped", FatalException,
"track was not stopped");
"track was not stopped");
}
G4TrackVector* secondaries = trackManager->GimmeSecondaries();
@@ -32,14 +32,14 @@
#include "SteppingAction.hh"
#include "G4PhysicalConstants.hh"
#include "G4Positron.hh"
#include "G4RunManager.hh"
#include "DetectorConstruction.hh"
#include "EventAction.hh"
#include "Run.hh"
#include "G4PhysicalConstants.hh"
#include "G4Positron.hh"
#include "G4RunManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingAction::SteppingAction(DetectorConstruction* det, EventAction* evt)
@@ -33,12 +33,12 @@
#include "TrackingAction.hh"
#include "Run.hh"
#include "G4PhysicalConstants.hh"
#include "G4Positron.hh"
#include "G4RunManager.hh"
#include "Run.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingAction::TrackingAction() : G4UserTrackingAction() {}