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
@@ -26,7 +26,7 @@
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -40,12 +40,14 @@ class DetectorConstruction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ActionInitialization : public G4VUserActionInitialization {
class ActionInitialization : public G4VUserActionInitialization
{
public:
ActionInitialization( const DetectorConstruction* inputDetectorConstruction = nullptr );
ActionInitialization(const DetectorConstruction* inputDetectorConstruction = nullptr);
~ActionInitialization() override = default;
void BuildForMaster() const override;
void Build() const override;
private:
const DetectorConstruction* fPtrDetectorConstruction = nullptr;
};
@@ -26,7 +26,7 @@
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,7 +35,7 @@
#define DetectorConstruction_H 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
#include "globals.hh"
class G4LogicalVolume;
class G4VPhysicalVolume;
@@ -46,50 +46,50 @@ class DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction : public G4VUserDetectorConstruction {
public:
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction();
G4VPhysicalVolume* Construct();
void ConstructSDandField();
void SetMagField( const G4double fieldValue );
void SetAbsorberMaterial( const G4String name );
void SetActiveMaterial( const G4String name );
void SetMagField(const G4double fieldValue);
void SetAbsorberMaterial(const G4String name);
void SetActiveMaterial(const G4String name);
// Use by the messenger.
inline G4Material* GetAbsorberMaterial() const;
inline G4Material* GetActiveMaterial() const;
inline void SetIsCalHomogeneous( const G4bool choice );
inline void SetIsUnitInLambda( const G4bool choice );
inline void SetAbsorberTotalLength( const G4double value );
inline void SetCalorimeterRadius( const G4double value );
inline void SetActiveLayerNumber( const G4int value );
inline void SetActiveLayerSize( const G4double value );
inline void SetIsCalHomogeneous(const G4bool choice);
inline void SetIsUnitInLambda(const G4bool choice);
inline void SetAbsorberTotalLength(const G4double value);
inline void SetCalorimeterRadius(const G4double value);
inline void SetActiveLayerNumber(const G4int value);
inline void SetActiveLayerSize(const G4double value);
// To define the calorimeter geometry.
inline void SetIsRadiusUnitInLambda( const G4bool choice );
inline void SetIsRadiusUnitInLambda(const G4bool choice);
void UpdateGeometry();
inline G4double GetCaloLength() const;
private:
void DefineMaterials();
// Define all the materials.
G4VPhysicalVolume* ConstructCalorimeter();
G4VPhysicalVolume* ConstructCalorimeter();
// To be invoked each time the geometry needs to be updated.
G4bool AreParametersOK();
// Return true if all the parameters are sensible, false otherwise.
void PrintParameters();
// Print the various parameters which define the calorimeter.
G4Material* fVacuum;
G4Material* fIron;
G4Material* fCopper;
@@ -106,58 +106,58 @@ class DetectorConstruction : public G4VUserDetectorConstruction {
G4Material* fGraphite;
G4Material* fAbsorberMaterial;
G4Material* fActiveMaterial;
G4LogicalVolume* fExperimentalHall_log;
G4VPhysicalVolume* fExperimentalHall_phys;
// World envelope.
G4LogicalVolume* fLogicCalo;
// World envelope.
G4LogicalVolume* fLogicCalo;
G4VPhysicalVolume* fPhysiCalo;
// "Calorimeter".
G4LogicalVolume* fLogicModule;
G4LogicalVolume* fLogicModule;
G4VPhysicalVolume* fPhysiModule;
// Module of the "calorimeter".
G4LogicalVolume* fLogicAbsorber;
G4LogicalVolume* fLogicAbsorber;
G4VPhysicalVolume* fPhysiAbsorber;
// Absorber layer of the "calorimeter".
G4LogicalVolume* fLogicActive;
G4LogicalVolume* fLogicActive;
G4VPhysicalVolume* fPhysiActive;
// Active layer of the "calorimeter".
G4FieldManager* fFieldMgr;
// Pointer to the field manager.
G4UniformMagField* fUniformMagField;
G4UniformMagField* fUniformMagField;
// Pointer to the uniform magnetic field.
DetectorMessenger* fDetectorMessenger;
// Pointer to the Messenger.
G4bool fIsCalHomogeneous;
G4bool fIsCalHomogeneous;
// If false then Sampling calorimeter;
// If true then Homogeneous calorimeter.
G4bool fIsUnitInLambda;
// If false then normal unit of length to express the absorber total length.
// If true then lambda (interaction length) to express the absorber total length.
G4double fAbsorberTotalLength;
// This is the total length of the absorber material, expressed
// in unit of length (e.g. m, cm, mm) if theIsUnitInLambda is false,
// This is the total length of the absorber material, expressed
// in unit of length (e.g. m, cm, mm) if theIsUnitInLambda is false,
// otherwise in number of lambdas (interaction lengths).
// Notice that in the case of a sampling calorimeter (i.e.
// Notice that in the case of a sampling calorimeter (i.e.
// theIsCalHomogeneous is false), the active layers are not counted;
// in the case of an homogenous calorimeter, this length account
// for the overall dimension of the calorimeter.
G4double fCalorimeterRadius;
// This is the radius of the calorimeter which is a cylinder, expressed
// in unit of length (e.g. m, cm, mm) if theIsUnitInLambda is false,
// This is the radius of the calorimeter which is a cylinder, expressed
// in unit of length (e.g. m, cm, mm) if theIsUnitInLambda is false,
// otherwise in number of lambdas (interaction lengths) of the absorber.
G4int fActiveLayerNumber;
G4double fActiveLayerSize;
// Number of active layers and length of each of them (in normal unit
@@ -167,60 +167,70 @@ class DetectorConstruction : public G4VUserDetectorConstruction {
// only a fictitious way to sample the longitudinal energy deposits,
// but they are actually made of the same absorber material, and their
// thickness is taken into account in theAbsorberTotalLength.
G4bool fIsRadiusUnitInLambda;
// If false then normal unit of length to express the radius bin size.
// If true then lambda (interaction length of the absorber) to express
// If true then lambda (interaction length of the absorber) to express
// the radius bin size.
G4double fCaloLength; // total length of the calorimeter along its (z) axis
// Scoring part
G4LogicalVolume* fLogicScoringUpDown;
G4LogicalVolume* fLogicScoringUpDown;
G4VPhysicalVolume* fPhysiScoringUpstream;
G4VPhysicalVolume* fPhysiScoringDownstream;
G4LogicalVolume* fLogicScoringSide;
G4LogicalVolume* fLogicScoringSide;
G4VPhysicalVolume* fPhysiScoringSide;
const G4double fScoringThickness = 10.0;
};
inline G4Material* DetectorConstruction::GetAbsorberMaterial() const {
inline G4Material* DetectorConstruction::GetAbsorberMaterial() const
{
return fAbsorberMaterial;
}
inline G4Material* DetectorConstruction::GetActiveMaterial() const {
inline G4Material* DetectorConstruction::GetActiveMaterial() const
{
return fActiveMaterial;
}
inline void DetectorConstruction::SetIsCalHomogeneous( const G4bool choice ) {
inline void DetectorConstruction::SetIsCalHomogeneous(const G4bool choice)
{
fIsCalHomogeneous = choice;
}
inline void DetectorConstruction::SetIsUnitInLambda( const G4bool choice ) {
inline void DetectorConstruction::SetIsUnitInLambda(const G4bool choice)
{
fIsUnitInLambda = choice;
}
inline void DetectorConstruction::SetAbsorberTotalLength( const G4double value ) {
inline void DetectorConstruction::SetAbsorberTotalLength(const G4double value)
{
fAbsorberTotalLength = value;
}
inline void DetectorConstruction::SetCalorimeterRadius( const G4double value ) {
inline void DetectorConstruction::SetCalorimeterRadius(const G4double value)
{
fCalorimeterRadius = value;
}
inline void DetectorConstruction::SetActiveLayerNumber( const G4int value ) {
inline void DetectorConstruction::SetActiveLayerNumber(const G4int value)
{
fActiveLayerNumber = value;
}
inline void DetectorConstruction::SetActiveLayerSize( const G4double value ) {
inline void DetectorConstruction::SetActiveLayerSize(const G4double value)
{
fActiveLayerSize = value;
}
inline void DetectorConstruction::SetIsRadiusUnitInLambda( const G4bool choice ) {
inline void DetectorConstruction::SetIsRadiusUnitInLambda(const G4bool choice)
{
fIsRadiusUnitInLambda = choice;
}
inline G4double DetectorConstruction::GetCaloLength() const {
inline G4double DetectorConstruction::GetCaloLength() const
{
return fCaloLength;
}
@@ -26,7 +26,7 @@
/// \file DetectorMessenger.hh
/// \brief Definition of the DetectorMessenger class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -34,8 +34,8 @@
#ifndef DetectorMessenger_h
#define DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
class DetectorConstruction;
class G4UIdirectory;
@@ -49,19 +49,20 @@ class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorMessenger: public G4UImessenger {
class DetectorMessenger : public G4UImessenger
{
public:
DetectorMessenger( DetectorConstruction* );
DetectorMessenger(DetectorConstruction*);
~DetectorMessenger();
void SetNewValue( G4UIcommand*, G4String ) override;
void SetNewValue(G4UIcommand*, G4String) override;
private:
DetectorConstruction* fDetector;
G4UIdirectory* fDetectorDir;
G4UIcmdWithADoubleAndUnit* fFieldCommand;
G4UIcmdWithAString* fAbsorberMaterial;
G4UIcmdWithAString* fActiveMaterial;
G4UIcmdWithABool* fIsCalHomogeneous;
G4UIcmdWithABool* fIsCalHomogeneous;
G4UIcmdWithABool* fIsUnitInLambda;
G4UIcmdWithADouble* fAbsorberTotalLength;
G4UIcmdWithADouble* fCalorimeterRadius;
@@ -26,7 +26,7 @@
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -42,12 +42,14 @@ class DetectorConstruction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction( const DetectorConstruction* );
PrimaryGeneratorAction(const DetectorConstruction*);
~PrimaryGeneratorAction();
void GeneratePrimaries( G4Event* anEvent ) override;
void GeneratePrimaries(G4Event* anEvent) override;
void SetGunPosition() const;
private:
G4ParticleGun* fParticleGun;
const DetectorConstruction* fPointerDetectorConstruction = nullptr;
@@ -26,7 +26,7 @@
/// \file Run.hh
/// \brief Definition of the Run class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -34,57 +34,67 @@
#ifndef Run_h
#define Run_h 1
#include "SteppingAction.hh"
#include "TrackingAction.hh"
#include "G4Run.hh"
#include "G4ThreeVector.hh"
#include "SteppingAction.hh"
#include "TrackingAction.hh"
#include <array>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class Run : public G4Run {
// This class accumulates relevant quantities related to particle fluence collected during
// the run.
// ( Note: these information are provided via calls of accessor methods of this Run class
// made by SteppingAction::UserSteppingAction
// and TrackingAction::PreUserTrackingAction. )
// At the end of a run, the PrintInfo method is called by the run-action to print out
// some summary information about these quantities.
// In multithreaded (MT) mode, an object of this class is filled up for each working thread,
// and then merged (automatically by the Geant4 kernel) into another object (of this class)
// owned by the master class; the PrintInfo method is then called only for the latter run
// object.
// Note that, for simplicity and brevity, we avoid histograms and print-out instead some
// statistics (compute by ourself) at the end of the run.
class Run : public G4Run
{
// This class accumulates relevant quantities related to particle fluence collected during
// the run.
// ( Note: these information are provided via calls of accessor methods of this Run class
// made by SteppingAction::UserSteppingAction
// and TrackingAction::PreUserTrackingAction. )
// At the end of a run, the PrintInfo method is called by the run-action to print out
// some summary information about these quantities.
// In multithreaded (MT) mode, an object of this class is filled up for each working thread,
// and then merged (automatically by the Geant4 kernel) into another object (of this class)
// owned by the master class; the PrintInfo method is then called only for the latter run
// object.
// Note that, for simplicity and brevity, we avoid histograms and print-out instead some
// statistics (compute by ourself) at the end of the run.
public:
Run();
~Run() override = default;
void RecordEvent( const G4Event* anEvent ) override;
void RecordEvent(const G4Event* anEvent) override;
// This method is called automatically by the Geant4 kernel (not by the user!) at the end
// of each event. In the case of multithreaded mode, it is called only for the working thread
// that handled that event.
void Merge( const G4Run* aRun ) override;
void Merge(const G4Run* aRun) override;
// This method is called automatically by the Geant4 kernel (not by the user!) only in the
// case of multithreaded mode and only for working threads.
void PrintInfo() const;
// This method is called by RunAction::EndOfRunAction : in the case of multithreaded mode,
// only the master thread calls it.
void SetPrimaryParticleId( const G4int inputValue ) { fPrimaryParticleId = inputValue; }
void SetPrimaryParticleEnergy( const G4double inputValue )
{ fPrimaryParticleEnergy = inputValue; }
void SetPrimaryParticleDirection( const G4ThreeVector &inputValue )
{ fPrimaryParticleDirection = inputValue; }
void SetAbsorberMaterialName( const G4String &inputValue )
{ fAbsorberMaterialName = inputValue; }
void SetActiveMaterialName( const G4String &inputValue ) { fActiveMaterialName = inputValue; }
void SetCubicVolumeScoringUpDown( const G4double inputValue )
{ fCubicVolumeScoringUpDown = inputValue; }
void SetCubicVolumeScoringSide( const G4double inputValue )
{ fCubicVolumeScoringSide = inputValue; }
void SetPrimaryParticleId(const G4int inputValue) { fPrimaryParticleId = inputValue; }
void SetPrimaryParticleEnergy(const G4double inputValue)
{
fPrimaryParticleEnergy = inputValue;
}
void SetPrimaryParticleDirection(const G4ThreeVector& inputValue)
{
fPrimaryParticleDirection = inputValue;
}
void SetAbsorberMaterialName(const G4String& inputValue) { fAbsorberMaterialName = inputValue; }
void SetActiveMaterialName(const G4String& inputValue) { fActiveMaterialName = inputValue; }
void SetCubicVolumeScoringUpDown(const G4double inputValue)
{
fCubicVolumeScoringUpDown = inputValue;
}
void SetCubicVolumeScoringSide(const G4double inputValue)
{
fCubicVolumeScoringSide = inputValue;
}
G4int GetPrimaryParticleId() const { return fPrimaryParticleId; }
G4double GetPrimaryParticleEnergy() const { return fPrimaryParticleEnergy; }
G4ThreeVector GetPrimaryParticleDirection() const { return fPrimaryParticleDirection; }
@@ -93,25 +103,31 @@ class Run : public G4Run {
G4double GetCubicVolumeScoringUpDown() const { return fCubicVolumeScoringUpDown; }
G4double GetCubicVolumeScoringSide() const { return fCubicVolumeScoringSide; }
void SetSteppingArray( const std::array< G4double,
SteppingAction::fkNumberCombinations >& inputArray );
std::array< G4double, SteppingAction::fkNumberCombinations > GetSteppingArray() const
{ return fSteppingArray; }
void
SetSteppingArray(const std::array<G4double, SteppingAction::fkNumberCombinations>& inputArray);
std::array<G4double, SteppingAction::fkNumberCombinations> GetSteppingArray() const
{
return fSteppingArray;
}
// Accessor methods useful to transfer information collected by the stepping-action
// into this Run class
void SetTrackingArray1( const std::array< G4long,
TrackingAction::fkNumberCombinations >& inputArray );
std::array< G4long, TrackingAction::fkNumberCombinations > GetTrackingArray1() const
{ return fTrackingArray1; }
void SetTrackingArray2( const std::array< G4double,
TrackingAction::fkNumberCombinations >& inputArray );
std::array< G4double, TrackingAction::fkNumberCombinations > GetTrackingArray2() const
{ return fTrackingArray2; }
void
SetTrackingArray1(const std::array<G4long, TrackingAction::fkNumberCombinations>& inputArray);
std::array<G4long, TrackingAction::fkNumberCombinations> GetTrackingArray1() const
{
return fTrackingArray1;
}
void
SetTrackingArray2(const std::array<G4double, TrackingAction::fkNumberCombinations>& inputArray);
std::array<G4double, TrackingAction::fkNumberCombinations> GetTrackingArray2() const
{
return fTrackingArray2;
}
// Accessor methods useful to transfer information collected by the tracking-action
// into this Run class
private:
private:
G4int fNumEvents;
G4int fPrimaryParticleId;
G4double fPrimaryParticleEnergy;
@@ -120,9 +136,9 @@ class Run : public G4Run {
G4String fActiveMaterialName;
G4double fCubicVolumeScoringUpDown;
G4double fCubicVolumeScoringSide;
std::array< G4double, SteppingAction::fkNumberCombinations > fSteppingArray;
std::array< G4long, TrackingAction::fkNumberCombinations > fTrackingArray1;
std::array< G4double, TrackingAction::fkNumberCombinations > fTrackingArray2;
std::array<G4double, SteppingAction::fkNumberCombinations> fSteppingArray;
std::array<G4long, TrackingAction::fkNumberCombinations> fTrackingArray1;
std::array<G4double, TrackingAction::fkNumberCombinations> fTrackingArray2;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,7 +26,7 @@
/// \file RunAction.hh
/// \brief Definition of the RunAction class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -42,17 +42,18 @@ class TrackingAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class RunAction: public G4UserRunAction {
class RunAction : public G4UserRunAction
{
public:
RunAction( SteppingAction* steppingAction = nullptr,
TrackingAction* trackingAction = nullptr );
RunAction(SteppingAction* steppingAction = nullptr, TrackingAction* trackingAction = nullptr);
~RunAction() override = default;
void BeginOfRunAction( const G4Run* aRun ) override;
void EndOfRunAction( const G4Run* aRun ) override;
void BeginOfRunAction(const G4Run* aRun) override;
void EndOfRunAction(const G4Run* aRun) override;
G4Run* GenerateRun() override;
private:
SteppingAction* fSteppingAction;
TrackingAction* fTrackingAction;
TrackingAction* fTrackingAction;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -26,7 +26,7 @@
/// \file SteppingAction.hh
/// \brief Definition of the SteppingAction class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -34,21 +34,23 @@
#ifndef SteppingAction_H
#define SteppingAction_H 1
#include "globals.hh"
#include "G4UserSteppingAction.hh"
#include "G4ThreeVector.hh"
#include "G4UserSteppingAction.hh"
#include "globals.hh"
#include <array>
class Run;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class SteppingAction : public G4UserSteppingAction {
public:
class SteppingAction : public G4UserSteppingAction
{
public:
SteppingAction();
~SteppingAction() override = default;
void UserSteppingAction( const G4Step* ) override;
void UserSteppingAction(const G4Step*) override;
// This is the main method where the step lengths of particles inside
// the scoring volumes are collected, and then the corresponding fluences
// are filled up in the Run object where they are stored (and then
@@ -62,7 +64,7 @@ class SteppingAction : public G4UserSteppingAction {
// This is necessary because different runs can have different primary particle
// types, kinetic energies, and detector configurations.
void SetRunPointer( Run* inputValue = nullptr ) { fRunPtr = inputValue; }
void SetRunPointer(Run* inputValue = nullptr) { fRunPtr = inputValue; }
// This method is called by RunAction::BeginOfRunAction for providing to the
// stepping-action the pointer to the run object at the beginning of each Run.
// This pointer is then used to pass the information collected by the stepping-action
@@ -74,20 +76,20 @@ class SteppingAction : public G4UserSteppingAction {
// the sum of step lengths in those scoring volumes.
// Notice that two of the three scoring volumes - upstream and downstream -
// have the same cubic-volume, that we call "fCubicVolumeScoringUpDown".
static const G4int fkNumberScoringVolumes = 3; // downstream, side, upstream
static const G4int fkNumberScoringVolumes = 3; // downstream, side, upstream
static const G4int fkNumberKinematicRegions = 3; // all, below 20 MeV, above 20 MeV
static const G4int fkNumberParticleTypes = 11; // all, e, gamma, mu, nu, pi, n, p, ions,
static const G4int fkNumberParticleTypes = 11; // all, e, gamma, mu, nu, pi, n, p, ions,
// other-mesons, other-baryons
static const G4int fkNumberCombinations =
fkNumberScoringVolumes*fkNumberKinematicRegions*fkNumberParticleTypes;
static const std::array< G4String, fkNumberScoringVolumes > fkArrayScoringVolumeNames;
static const std::array< G4String, fkNumberKinematicRegions > fkArrayKinematicRegionNames;
static const std::array< G4String, fkNumberParticleTypes > fkArrayParticleTypeNames;
static G4int GetIndex( const G4int iScoringVolume, const G4int iKinematicRegion,
const G4int iParticleType );
private:
fkNumberScoringVolumes * fkNumberKinematicRegions * fkNumberParticleTypes;
static const std::array<G4String, fkNumberScoringVolumes> fkArrayScoringVolumeNames;
static const std::array<G4String, fkNumberKinematicRegions> fkArrayKinematicRegionNames;
static const std::array<G4String, fkNumberParticleTypes> fkArrayParticleTypeNames;
static G4int GetIndex(const G4int iScoringVolume, const G4int iKinematicRegion,
const G4int iParticleType);
private:
Run* fRunPtr; // Pointer to the Run object
G4int fPrimaryParticleId;
G4double fPrimaryParticleEnergy;
@@ -101,8 +103,8 @@ class SteppingAction : public G4UserSteppingAction {
G4bool fIsFirstStepInScoringSide;
G4double fCubicVolumeScoringUpDown;
G4double fCubicVolumeScoringSide;
std::array< G4double, fkNumberCombinations > fArraySumStepLengths;
std::array<G4double, fkNumberCombinations> fArraySumStepLengths;
// Array to collect the sum of step lengths in the scoring volumes for the whole run,
// according to the various cases (kinematical region and particle type).
// Note that the fluence in a scoring volume is defined as sum of step lengths
@@ -26,63 +26,65 @@
/// \file TrackingAction.hh
/// \brief Definition of the TrackingAction class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef TrackingAction_h
#ifndef TrackingAction_h
#define TrackingAction_h 1
#include "globals.hh"
#include "G4UserTrackingAction.hh"
#include "globals.hh"
#include <array>
class Run;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class TrackingAction : public G4UserTrackingAction {
// We are using this class to monitor the average multiplicity, the average
// kinetic energy, and the average total energy flow (i.e. sum of the
// kinetic energies) of different particle types as they are produced
// inside the calorimeter.
// The aim is then to try to correlate some changes in these (more primitive)
// quantities with the observed changes in the (more indirect and complex)
// particle fluences.
class TrackingAction : public G4UserTrackingAction
{
// We are using this class to monitor the average multiplicity, the average
// kinetic energy, and the average total energy flow (i.e. sum of the
// kinetic energies) of different particle types as they are produced
// inside the calorimeter.
// The aim is then to try to correlate some changes in these (more primitive)
// quantities with the observed changes in the (more indirect and complex)
// particle fluences.
public:
TrackingAction();
~TrackingAction() override = default;
void PreUserTrackingAction( const G4Track* ) override;
void PostUserTrackingAction( const G4Track* ) override;
void PreUserTrackingAction(const G4Track*) override;
void PostUserTrackingAction(const G4Track*) override;
void Initialize();
// This method is called by RunAction::BeginOfRunAction for the
// initialization of the tracking-action at the beginning of each Run.
void SetRunPointer( Run* inputValue = nullptr ) { fRunPtr = inputValue; }
void SetRunPointer(Run* inputValue = nullptr) { fRunPtr = inputValue; }
// This method is called by RunAction::BeginOfRunAction for providing to the
// tracking-action the pointer to the run object at the beginning of each Run.
// This pointer is then used to pass the information collected by the tracking-action
// to the run object.
static const G4int fkNumberScoringVolumes = 1; // calorimeter
static const G4int fkNumberScoringVolumes = 1; // calorimeter
static const G4int fkNumberKinematicRegions = 3; // all, below 20 MeV, above 20 MeV
static const G4int fkNumberParticleTypes = 11; // all, e, gamma, mu, nu, pi, n, p, ions,
static const G4int fkNumberParticleTypes = 11; // all, e, gamma, mu, nu, pi, n, p, ions,
// other-mesons, other-baryons
static const G4int fkNumberCombinations =
fkNumberScoringVolumes*fkNumberKinematicRegions*fkNumberParticleTypes;
static const std::array< G4String, fkNumberScoringVolumes > fkArrayScoringVolumeNames;
static const std::array< G4String, fkNumberKinematicRegions > fkArrayKinematicRegionNames;
static const std::array< G4String, fkNumberParticleTypes > fkArrayParticleTypeNames;
static G4int GetIndex( const G4int iScoringVolume, const G4int iKinematicRegion,
const G4int iParticleType );
fkNumberScoringVolumes * fkNumberKinematicRegions * fkNumberParticleTypes;
static const std::array<G4String, fkNumberScoringVolumes> fkArrayScoringVolumeNames;
static const std::array<G4String, fkNumberKinematicRegions> fkArrayKinematicRegionNames;
static const std::array<G4String, fkNumberParticleTypes> fkArrayParticleTypeNames;
static G4int GetIndex(const G4int iScoringVolume, const G4int iKinematicRegion,
const G4int iParticleType);
private:
Run* fRunPtr; // Pointer to the Run object
std::array< G4long, fkNumberCombinations > fArrayMultiplicities;
std::array< G4double, fkNumberCombinations > fArraySumKineticEnergies;
std::array<G4long, fkNumberCombinations> fArrayMultiplicities;
std::array<G4double, fkNumberCombinations> fArraySumKineticEnergies;
// Keep record of the fkNumber of particles and their kinetic energy at production,
// according to the particle type and their kinetic energy range (below/above 20 MeV).
};