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
+8 -3
View File
@@ -1,11 +1,16 @@
# Example RE07 History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2023-11-09 I. Hrivnacova (exampleRE07-V11-01-00)
## 2024-05-02 Gabriele Cosmo (exampleRE07-V11-02-00)
- Fixed compilation warnings for potentially initialised local variable
in EmStandardPhysicsTrackingManager::PostStepDoIt().
## 2023-11-09 Ivana Hrivnacova (exampleRE07-V11-01-00)
- Coding guidelines - document macros in README files
- Added separators in EmStandardPhysicsTrackingManager.cc
@@ -30,14 +30,14 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include <memory>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -39,15 +39,15 @@ class DetectorConstruction;
class ActionInitialization : public G4VUserActionInitialization
{
public:
ActionInitialization(DetectorConstruction*);
~ActionInitialization() override;
public:
ActionInitialization(DetectorConstruction*);
~ActionInitialization() override;
void BuildForMaster() const override;
void Build() const override;
void BuildForMaster() const override;
void Build() const override;
private:
DetectorConstruction* fDetector;
private:
DetectorConstruction* fDetector;
};
#endif
@@ -53,67 +53,67 @@ const G4int kMaxAbsor = 10; // 0 + 9
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
public:
DetectorConstruction();
public:
void SetNbOfAbsor(G4int);
void SetAbsorMaterial(G4int, const G4String&);
void SetAbsorThickness(G4int, G4double);
public:
void SetNbOfAbsor(G4int);
void SetAbsorMaterial(G4int, const G4String&);
void SetAbsorThickness(G4int, G4double);
void SetWorldMaterial(const G4String&);
void SetCalorSizeYZ(G4double);
void SetNbOfLayers(G4int);
void SetWorldMaterial(const G4String&);
void SetCalorSizeYZ(G4double);
void SetNbOfLayers(G4int);
G4VPhysicalVolume* Construct() override;
void ConstructSDandField() override;
G4VPhysicalVolume* Construct() override;
void ConstructSDandField() override;
public:
void PrintCalorParameters();
public:
void PrintCalorParameters();
G4double GetWorldSizeX() const { return fWorldSizeX; };
G4double GetWorldSizeYZ() const { return fWorldSizeYZ; };
G4double GetWorldSizeX() const { return fWorldSizeX; };
G4double GetWorldSizeYZ() const { return fWorldSizeYZ; };
G4double GetCalorThickness() const { return fCalorThickness; };
G4double GetCalorSizeYZ() const { return fCalorSizeYZ; };
G4double GetCalorThickness() const { return fCalorThickness; };
G4double GetCalorSizeYZ() const { return fCalorSizeYZ; };
G4int GetNbOfLayers() const { return fNbOfLayers; };
G4int GetNbOfLayers() const { return fNbOfLayers; };
G4int GetNbOfAbsor() const { return fNbOfAbsor; };
G4double GetAbsorThickness(G4int i) const { return fAbsorThickness[i]; };
const G4Material* GetAbsorMaterial(G4int i) const { return fAbsorMaterial[i]; };
G4int GetNbOfAbsor() const { return fNbOfAbsor; };
G4double GetAbsorThickness(G4int i) const { return fAbsorThickness[i]; };
const G4Material* GetAbsorMaterial(G4int i) const { return fAbsorMaterial[i]; };
const G4VPhysicalVolume* GetphysiWorld() const { return fPhysiWorld; };
const G4Material* GetWorldMaterial() const { return fWorldMaterial; };
const G4VPhysicalVolume* GetphysiWorld() const { return fPhysiWorld; };
const G4Material* GetWorldMaterial() const { return fWorldMaterial; };
private:
void ComputeCalorParameters();
private:
void ComputeCalorParameters();
G4int fNbOfAbsor;
G4Material* fAbsorMaterial[kMaxAbsor];
G4double fAbsorThickness[kMaxAbsor];
G4int fNbOfAbsor;
G4Material* fAbsorMaterial[kMaxAbsor];
G4double fAbsorThickness[kMaxAbsor];
G4int fNbOfLayers;
G4double fLayerThickness;
G4int fNbOfLayers;
G4double fLayerThickness;
G4double fCalorSizeYZ;
G4double fCalorThickness;
G4double fCalorSizeYZ;
G4double fCalorThickness;
G4Material* fWorldMaterial;
G4double fWorldSizeYZ;
G4double fWorldSizeX;
G4Material* fWorldMaterial;
G4double fWorldSizeYZ;
G4double fWorldSizeX;
G4LogicalVolume* fLogicWorld;
G4VPhysicalVolume* fPhysiWorld;
G4LogicalVolume* fLogicWorld;
G4VPhysicalVolume* fPhysiWorld;
G4LogicalVolume* fLogicLayerFront;
G4LogicalVolume* fLogicLayerBack;
G4LogicalVolume* fLogicLayerFront;
G4LogicalVolume* fLogicLayerBack;
G4LogicalVolume* fLogicAbsorFront[kMaxAbsor];
G4LogicalVolume* fLogicAbsorBack[kMaxAbsor];
G4LogicalVolume* fLogicAbsorFront[kMaxAbsor];
G4LogicalVolume* fLogicAbsorBack[kMaxAbsor];
std::unique_ptr<DetectorMessenger> fDetectorMessenger;
G4Cache<G4GlobalMagFieldMessenger*> fFieldMessenger;
std::unique_ptr<DetectorMessenger> fDetectorMessenger;
G4Cache<G4GlobalMagFieldMessenger*> fFieldMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,21 +49,21 @@ class G4UIcmdWithoutParameter;
class DetectorMessenger : public G4UImessenger
{
public:
DetectorMessenger(DetectorConstruction*);
~DetectorMessenger();
public:
DetectorMessenger(DetectorConstruction*);
~DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String) override;
void SetNewValue(G4UIcommand*, G4String) override;
private:
DetectorConstruction* fDetector;
private:
DetectorConstruction* fDetector;
std::unique_ptr<G4UIdirectory> fDetDir;
std::unique_ptr<G4UIdirectory> fDetDir;
std::unique_ptr<G4UIcmdWithADoubleAndUnit> fSizeYZCmd;
std::unique_ptr<G4UIcmdWithAnInteger> fNbLayersCmd;
std::unique_ptr<G4UIcmdWithAnInteger> fNbAbsorCmd;
std::unique_ptr<G4UIcommand> fAbsorCmd;
std::unique_ptr<G4UIcmdWithADoubleAndUnit> fSizeYZCmd;
std::unique_ptr<G4UIcmdWithAnInteger> fNbLayersCmd;
std::unique_ptr<G4UIcmdWithAnInteger> fNbAbsorCmd;
std::unique_ptr<G4UIcommand> fAbsorCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -51,47 +51,47 @@ class G4RayleighScattering;
class EmStandardPhysicsTrackingManager : public G4VTrackingManager
{
public:
EmStandardPhysicsTrackingManager();
~EmStandardPhysicsTrackingManager();
public:
EmStandardPhysicsTrackingManager();
~EmStandardPhysicsTrackingManager();
void BuildPhysicsTable(const G4ParticleDefinition&) override;
void BuildPhysicsTable(const G4ParticleDefinition&) override;
void PreparePhysicsTable(const G4ParticleDefinition&) override;
void PreparePhysicsTable(const G4ParticleDefinition&) override;
void HandOverOneTrack(G4Track* aTrack) override;
void HandOverOneTrack(G4Track* aTrack) override;
private:
void TrackElectron(G4Track* aTrack);
void TrackPositron(G4Track* aTrack);
void TrackGamma(G4Track* aTrack);
private:
void TrackElectron(G4Track* aTrack);
void TrackPositron(G4Track* aTrack);
void TrackGamma(G4Track* aTrack);
struct
{
G4eMultipleScattering* msc;
G4eIonisation* ioni;
G4eBremsstrahlung* brems;
G4CoulombScattering* ss;
} fElectronProcs;
struct
{
G4eMultipleScattering* msc;
G4eIonisation* ioni;
G4eBremsstrahlung* brems;
G4CoulombScattering* ss;
} fElectronProcs;
struct
{
G4eMultipleScattering* msc;
G4eIonisation* ioni;
G4eBremsstrahlung* brems;
G4eplusAnnihilation* annihilation;
G4CoulombScattering* ss;
} fPositronProcs;
struct
{
G4eMultipleScattering* msc;
G4eIonisation* ioni;
G4eBremsstrahlung* brems;
G4eplusAnnihilation* annihilation;
G4CoulombScattering* ss;
} fPositronProcs;
struct
{
G4PhotoElectricEffect* pe;
G4ComptonScattering* compton;
G4GammaConversion* conversion;
G4RayleighScattering* rayleigh;
} fGammaProcs;
struct
{
G4PhotoElectricEffect* pe;
G4ComptonScattering* compton;
G4GammaConversion* conversion;
G4RayleighScattering* rayleigh;
} fGammaProcs;
static EmStandardPhysicsTrackingManager* fMasterTrackingManager;
static EmStandardPhysicsTrackingManager* fMasterTrackingManager;
};
#endif
@@ -33,32 +33,32 @@
#ifndef EventAction_h
#define EventAction_h 1
#include "DetectorConstruction.hh"
#include "G4UserEventAction.hh"
#include "globals.hh"
#include "DetectorConstruction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class EventAction : public G4UserEventAction
{
public:
EventAction(DetectorConstruction*);
public:
EventAction(DetectorConstruction*);
void BeginOfEventAction(const G4Event*) override;
void EndOfEventAction(const G4Event*) override;
void BeginOfEventAction(const G4Event*) override;
void EndOfEventAction(const G4Event*) override;
void SumEnergy(G4int k, G4double de, G4double dl)
{
fEnergyDeposit[k] += de;
fTrackLengthCh[k] += dl;
};
void SumEnergy(G4int k, G4double de, G4double dl)
{
fEnergyDeposit[k] += de;
fTrackLengthCh[k] += dl;
};
private:
DetectorConstruction* fDetector;
private:
DetectorConstruction* fDetector;
G4double fEnergyDeposit[kMaxAbsor];
G4double fTrackLengthCh[kMaxAbsor];
G4double fEnergyDeposit[kMaxAbsor];
G4double fTrackLengthCh[kMaxAbsor];
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -45,16 +45,16 @@ class PhysicsListMessenger;
class PhysicsList : public G4VUserPhysicsList
{
public:
PhysicsList();
public:
PhysicsList();
void ConstructParticle() override;
void ConstructProcess() override;
void SetMode(const G4String& name);
void ConstructParticle() override;
void ConstructProcess() override;
void SetMode(const G4String& name);
private:
std::unique_ptr<PhysicsListMessenger> fMessenger;
std::unique_ptr<G4VPhysicsConstructor> fEmPhysicsList;
private:
std::unique_ptr<PhysicsListMessenger> fMessenger;
std::unique_ptr<G4VPhysicsConstructor> fEmPhysicsList;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -40,12 +40,12 @@
class PhysicsListEmSpecialized : public G4EmStandardPhysics
{
public:
PhysicsListEmSpecialized(G4int ver = 1, const G4String& name = "");
~PhysicsListEmSpecialized();
public:
PhysicsListEmSpecialized(G4int ver = 1, const G4String& name = "");
~PhysicsListEmSpecialized();
public:
void ConstructProcess() override;
public:
void ConstructProcess() override;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -40,13 +40,13 @@
class PhysicsListEmStandardTracking : public G4VPhysicsConstructor
{
public:
PhysicsListEmStandardTracking(G4int ver = 1);
~PhysicsListEmStandardTracking();
public:
PhysicsListEmStandardTracking(G4int ver = 1);
~PhysicsListEmStandardTracking();
public:
void ConstructParticle() override;
void ConstructProcess() override;
public:
void ConstructParticle() override;
void ConstructProcess() override;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -45,16 +45,16 @@ class G4UIcmdWithAString;
class PhysicsListMessenger : public G4UImessenger
{
public:
PhysicsListMessenger(PhysicsList*);
~PhysicsListMessenger();
public:
PhysicsListMessenger(PhysicsList*);
~PhysicsListMessenger();
void SetNewValue(G4UIcommand*, G4String) override;
void SetNewValue(G4UIcommand*, G4String) override;
private:
PhysicsList* fPhysicsList;
private:
PhysicsList* fPhysicsList;
std::unique_ptr<G4UIcmdWithAString> fModeCmd;
std::unique_ptr<G4UIcmdWithAString> fModeCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -46,18 +46,18 @@ class DetectorConstruction;
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction(DetectorConstruction*);
public:
PrimaryGeneratorAction(DetectorConstruction*);
public:
void SetDefaultKinematic();
void GeneratePrimaries(G4Event*) override;
public:
void SetDefaultKinematic();
void GeneratePrimaries(G4Event*) override;
G4ParticleGun* GetParticleGun() { return fParticleGun.get(); };
G4ParticleGun* GetParticleGun() { return fParticleGun.get(); };
private:
std::unique_ptr<G4ParticleGun> fParticleGun;
DetectorConstruction* fDetector;
private:
std::unique_ptr<G4ParticleGun> fParticleGun;
DetectorConstruction* fDetector;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -33,11 +33,11 @@
#ifndef Run_h
#define Run_h 1
#include "DetectorConstruction.hh"
#include "G4Run.hh"
#include "globals.hh"
#include "DetectorConstruction.hh"
#include <map>
class DetectorConstruction;
@@ -48,38 +48,38 @@ class G4Track;
class Run : public G4Run
{
public:
Run(DetectorConstruction*);
~Run();
public:
Run(DetectorConstruction*);
~Run();
public:
void SetPrimary(G4ParticleDefinition* particle, G4double energy);
public:
void SetPrimary(G4ParticleDefinition* particle, G4double energy);
void FillPerEvent(G4int, G4double, G4double);
void FillPerEvent(G4int, G4double, G4double);
void AddChargedStep();
void AddNeutralStep();
void AddSecondaryTrack(const G4Track*);
void AddChargedStep();
void AddNeutralStep();
void AddSecondaryTrack(const G4Track*);
void Merge(const G4Run*) override;
void EndOfRun();
void Merge(const G4Run*) override;
void EndOfRun();
private:
DetectorConstruction* fDetector;
G4ParticleDefinition* fParticle;
G4double fEkin;
private:
DetectorConstruction* fDetector;
G4ParticleDefinition* fParticle;
G4double fEkin;
G4double fSumEAbs[kMaxAbsor], fSum2EAbs[kMaxAbsor];
G4double fSumLAbs[kMaxAbsor], fSum2LAbs[kMaxAbsor];
G4double fSumEAbs[kMaxAbsor], fSum2EAbs[kMaxAbsor];
G4double fSumLAbs[kMaxAbsor], fSum2LAbs[kMaxAbsor];
std::vector<G4double> fEnergyDeposit[kMaxAbsor];
std::vector<G4double> fEnergyDeposit[kMaxAbsor];
G4double fChargedStep;
G4double fNeutralStep;
G4double fChargedStep;
G4double fNeutralStep;
G4int fN_gamma;
G4int fN_elec;
G4int fN_pos;
G4int fN_gamma;
G4int fN_elec;
G4int fN_pos;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -47,19 +47,19 @@ class PrimaryGeneratorAction;
class RunAction : public G4UserRunAction
{
public:
RunAction(DetectorConstruction*, PrimaryGeneratorAction* prim = 0);
public:
RunAction(DetectorConstruction*, PrimaryGeneratorAction* prim = 0);
G4Run* GenerateRun() override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
G4Run* GenerateRun() override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
private:
G4Timer fTimer;
private:
G4Timer fTimer;
DetectorConstruction* fDetector;
PrimaryGeneratorAction* fPrimary;
Run* fRun;
DetectorConstruction* fDetector;
PrimaryGeneratorAction* fPrimary;
Run* fRun;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -43,23 +43,23 @@ class G4Region;
class SpecializedTrackingManager : public G4VTrackingManager
{
public:
SpecializedTrackingManager();
~SpecializedTrackingManager();
public:
SpecializedTrackingManager();
~SpecializedTrackingManager();
void BuildPhysicsTable(const G4ParticleDefinition&) override;
void BuildPhysicsTable(const G4ParticleDefinition&) override;
void PreparePhysicsTable(const G4ParticleDefinition&) override;
void PreparePhysicsTable(const G4ParticleDefinition&) override;
void HandOverOneTrack(G4Track* aTrack) override;
void FlushEvent() override;
void HandOverOneTrack(G4Track* aTrack) override;
void FlushEvent() override;
private:
void StepInBackRegion(G4Track* aTrack);
void StepOutside(G4Track* aTrack);
private:
void StepInBackRegion(G4Track* aTrack);
void StepOutside(G4Track* aTrack);
std::vector<G4Track*> fBufferedTracks;
G4Region* fBackRegion = nullptr;
std::vector<G4Track*> fBufferedTracks;
G4Region* fBackRegion = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -43,14 +43,14 @@ class EventAction;
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction(DetectorConstruction*, EventAction*);
public:
SteppingAction(DetectorConstruction*, EventAction*);
void UserSteppingAction(const G4Step*) override;
void UserSteppingAction(const G4Step*) override;
private:
DetectorConstruction* fDetector;
EventAction* fEventAct;
private:
DetectorConstruction* fDetector;
EventAction* fEventAct;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -42,10 +42,10 @@ class DetectorConstruction;
class TrackingAction : public G4UserTrackingAction
{
public:
TrackingAction();
public:
TrackingAction();
void PreUserTrackingAction(const G4Track*) override;
void PreUserTrackingAction(const G4Track*) override;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -45,59 +45,59 @@ class G4Track;
class TrackingManagerHelper
{
public:
class Physics
{
public:
virtual void StartTracking(G4Track*) {}
virtual void EndTracking() {}
// Combines AlongStep and PostStep; the implementation needs to remember
// the right value to pass as previousStepSize to G4VProcess.
virtual G4double GetPhysicalInteractionLength(const G4Track& track) = 0;
// This method is called for every step after navigation. The updated
// position is stored in the G4Step's post-step point. Any particle change
// should be applied directly to the step, UpdateTrack() will be called
// automatically after this method returns. If secondaries should be given
// back to the G4EventManager, put them into the container passed as the
// last argument.
virtual void AlongStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) = 0;
// This method is called unless the track has been killed during this step.
// If secondaries should be given back to the G4EventManager, put them into
// the container passed as the last argument.
virtual void PostStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) = 0;
virtual bool HasAtRestProcesses() { return false; }
// This method is called when a track is stopped, but still alive. If
// secondaries should be given back to the G4EventManager, put them into
// the container passed as the last argument.
virtual void AtRestDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries)
public:
class Physics
{
(void)track;
(void)step;
(void)secondaries;
}
};
public:
virtual void StartTracking(G4Track*) {}
virtual void EndTracking() {}
class Navigation
{
public:
virtual G4double MakeStep(G4Track& track, G4Step& step, G4double physicalStep) = 0;
// Combines AlongStep and PostStep; the implementation needs to remember
// the right value to pass as previousStepSize to G4VProcess.
virtual G4double GetPhysicalInteractionLength(const G4Track& track) = 0;
virtual void FinishStep(G4Track& track, G4Step& step) = 0;
};
// This method is called for every step after navigation. The updated
// position is stored in the G4Step's post-step point. Any particle change
// should be applied directly to the step, UpdateTrack() will be called
// automatically after this method returns. If secondaries should be given
// back to the G4EventManager, put them into the container passed as the
// last argument.
virtual void AlongStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) = 0;
template <typename PhysicsImpl, typename NavigationImpl>
static void TrackParticle(G4Track* aTrack, PhysicsImpl& physics, NavigationImpl& navigation);
// This method is called unless the track has been killed during this step.
// If secondaries should be given back to the G4EventManager, put them into
// the container passed as the last argument.
virtual void PostStepDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries) = 0;
template <typename PhysicsImpl>
static void TrackChargedParticle(G4Track* aTrack, PhysicsImpl& physics);
virtual bool HasAtRestProcesses() { return false; }
template <typename PhysicsImpl>
static void TrackNeutralParticle(G4Track* aTrack, PhysicsImpl& physics);
// This method is called when a track is stopped, but still alive. If
// secondaries should be given back to the G4EventManager, put them into
// the container passed as the last argument.
virtual void AtRestDoIt(G4Track& track, G4Step& step, G4TrackVector& secondaries)
{
(void)track;
(void)step;
(void)secondaries;
}
};
class Navigation
{
public:
virtual G4double MakeStep(G4Track& track, G4Step& step, G4double physicalStep) = 0;
virtual void FinishStep(G4Track& track, G4Step& step) = 0;
};
template<typename PhysicsImpl, typename NavigationImpl>
static void TrackParticle(G4Track* aTrack, PhysicsImpl& physics, NavigationImpl& navigation);
template<typename PhysicsImpl>
static void TrackChargedParticle(G4Track* aTrack, PhysicsImpl& physics);
template<typename PhysicsImpl>
static void TrackNeutralParticle(G4Track* aTrack, PhysicsImpl& physics);
};
#include "TrackingManagerHelper.icc"
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -64,15 +64,15 @@ Command is ignored.
------------------------------------------------------------
material Edep RMS sqrt(E0(GeV))*rmsE/Emean total tracklen
G4_Pb: 775.63 MeV : 16.45 MeV 2.12 +- 0.06705 % 54.8 cm +- 1.27 cm
G4_lAr: 213.94 MeV : 15.28 MeV 7.144 +- 0.2259 % 1.05 m +- 7.81 cm
G4_Pb: 775.35 MeV : 16.44 MeV 2.12 +- 0.06706 % 54.7 cm +- 1.26 cm
G4_lAr: 215.06 MeV : 15.96 MeV 7.421 +- 0.2347 % 1.06 m +- 8.16 cm
------------------------------------------------------------
Beam particle e- E = 1 GeV
Mean number of gamma 508
Mean number of e- 870
Mean number of gamma 509
Mean number of e- 873
Mean number of e+ 53.7
Mean number of charged steps 3663.33
Mean number of neutral steps 3685.01
Mean number of charged steps 3681.48
Mean number of neutral steps 3694.58
------------------------------------------------------------
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -64,15 +64,15 @@ Command is ignored.
------------------------------------------------------------
material Edep RMS sqrt(E0(GeV))*rmsE/Emean total tracklen
G4_Pb: 774.7 MeV : 20.7 MeV 2.672 +- 0.08451 % 54.7 cm +- 1.58 cm
G4_lAr: 213.2 MeV : 15.58 MeV 7.309 +- 0.2311 % 1.05 m +- 7.92 cm
G4_Pb: 774.27 MeV : 18.12 MeV 2.341 +- 0.07402 % 54.7 cm +- 1.41 cm
G4_lAr: 214.58 MeV : 15.86 MeV 7.393 +- 0.2338 % 1.06 m +- 8.05 cm
------------------------------------------------------------
Beam particle e- E = 1 GeV
Mean number of gamma 509
Mean number of gamma 508
Mean number of e- 871
Mean number of e+ 53.6
Mean number of charged steps 3655.39
Mean number of neutral steps 3689.52
Mean number of e+ 53.4
Mean number of charged steps 3668.58
Mean number of neutral steps 3701.69
------------------------------------------------------------
@@ -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() {}
@@ -11,7 +11,7 @@ Environment variable "G4FORCE_RUN_MANAGER_TYPE" enabled with value == Serial. Fo
**************************************************************
Geant4 version Name: geant4-11-02-patch-02 (21-June-2024)
Geant4 version Name: geant4-11-02-ref-06 (28-June-2024)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
@@ -64,15 +64,15 @@ Command is ignored.
------------------------------------------------------------
material Edep RMS sqrt(E0(GeV))*rmsE/Emean total tracklen
G4_Pb: 775.67 MeV : 16.18 MeV 2.086 +- 0.06597 % 54.8 cm +- 1.28 cm
G4_lAr: 214.11 MeV : 15.42 MeV 7.203 +- 0.2278 % 1.05 m +- 7.89 cm
G4_Pb: 774.9 MeV : 15.93 MeV 2.055 +- 0.065 % 54.7 cm +- 1.25 cm
G4_lAr: 214.84 MeV : 15.06 MeV 7.01 +- 0.2217 % 1.06 m +- 7.69 cm
------------------------------------------------------------
Beam particle e- E = 1 GeV
Mean number of gamma 509
Mean number of e- 871
Mean number of e+ 53.7
Mean number of charged steps 3676.98
Mean number of neutral steps 3695.06
Mean number of gamma 510
Mean number of e- 873
Mean number of e+ 53.6
Mean number of charged steps 3673.44
Mean number of neutral steps 3700.06
------------------------------------------------------------