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......
@@ -38,7 +38,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class ActionInitialization : public G4VUserActionInitialization {
class ActionInitialization : public G4VUserActionInitialization
{
public:
ActionInitialization();
~ActionInitialization() override = default;
@@ -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;
@@ -44,36 +44,37 @@ class DetectorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class DetectorConstruction : public G4VUserDetectorConstruction {
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
~DetectorConstruction();
G4VPhysicalVolume* Construct();
void SetMaterialTracker( const G4String name );
void SetMaterialTracker(const G4String name);
inline G4Material* GetMaterialTracker() const;
void SetMaterialEmCalo( const G4String name );
void SetMaterialEmCalo(const G4String name);
inline G4Material* GetMaterialEmCalo() const;
void SetMaterialHadCalo( const G4String name );
void SetMaterialHadCalo(const G4String name);
inline G4Material* GetMaterialHadCalo() const;
inline void SetInnerRadiusTracker( const G4double value );
inline void SetInnerRadiusTracker(const G4double value);
inline G4double GetInnerRadiusTracker() const;
inline void SetOuterRadiusTracker( const G4double value );
inline void SetOuterRadiusTracker(const G4double value);
inline G4double GetOuterRadiusTracker() const;
inline void SetInnerRadiusEmCalo( const G4double value );
inline void SetInnerRadiusEmCalo(const G4double value);
inline G4double GetInnerRadiusEmCalo() const;
inline void SetOuterRadiusEmCalo( const G4double value );
inline void SetOuterRadiusEmCalo(const G4double value);
inline G4double GetOuterRadiusEmCalo() const;
inline void SetInnerRadiusHadCalo( const G4double value );
inline void SetInnerRadiusHadCalo(const G4double value);
inline G4double GetInnerRadiusHadCalo() const;
inline void SetOuterRadiusHadCalo( const G4double value );
inline void SetOuterRadiusHadCalo(const G4double value);
inline G4double GetOuterRadiusHadCalo() const;
inline G4double GetScoringThickness() const;
void UpdateGeometry();
private:
G4VPhysicalVolume* ConstructDetector(); // To be invoked each time the geometry needs
// to be updated.
@@ -81,21 +82,21 @@ class DetectorConstruction : public G4VUserDetectorConstruction {
G4Material* fMaterialTracker;
G4Material* fMaterialEmCalo;
G4Material* fMaterialHadCalo;
G4LogicalVolume* fExperimentalHall_log;
G4LogicalVolume* fExperimentalHall_log;
G4VPhysicalVolume* fExperimentalHall_phys;
G4LogicalVolume* fLogicTrackerShell;
G4LogicalVolume* fLogicTrackerShell;
G4VPhysicalVolume* fPhysiTrackerShell;
G4LogicalVolume* fLogicEmCaloShell;
G4LogicalVolume* fLogicEmCaloShell;
G4VPhysicalVolume* fPhysiEmCaloShell;
G4LogicalVolume* fLogicHadCaloShell;
G4LogicalVolume* fLogicHadCaloShell;
G4VPhysicalVolume* fPhysiHadCaloShell;
G4LogicalVolume* fLogicScoringTrackerShell;
G4LogicalVolume* fLogicScoringTrackerShell;
G4VPhysicalVolume* fPhysiScoringTrackerShell;
G4LogicalVolume* fLogicScoringEmCaloShell;
G4LogicalVolume* fLogicScoringEmCaloShell;
G4VPhysicalVolume* fPhysiScoringEmCaloShell;
G4LogicalVolume* fLogicScoringHadCaloShell;
G4LogicalVolume* fLogicScoringHadCaloShell;
G4VPhysicalVolume* fPhysiScoringHadCaloShell;
DetectorMessenger* fDetectorMessenger;
DetectorMessenger* fDetectorMessenger;
G4double fInnerRadiusTracker;
G4double fOuterRadiusTracker;
G4double fInnerRadiusEmCalo;
@@ -105,67 +106,83 @@ class DetectorConstruction : public G4VUserDetectorConstruction {
const G4double fScoringThickness = 10.0; //***LOOKHERE*** thickness of the scoring shell
};
inline G4Material* DetectorConstruction::GetMaterialTracker() const {
inline G4Material* DetectorConstruction::GetMaterialTracker() const
{
return fMaterialTracker;
}
inline G4Material* DetectorConstruction::GetMaterialEmCalo() const {
inline G4Material* DetectorConstruction::GetMaterialEmCalo() const
{
return fMaterialEmCalo;
}
inline G4Material* DetectorConstruction::GetMaterialHadCalo() const {
inline G4Material* DetectorConstruction::GetMaterialHadCalo() const
{
return fMaterialHadCalo;
}
inline G4double DetectorConstruction::GetInnerRadiusTracker() const {
inline G4double DetectorConstruction::GetInnerRadiusTracker() const
{
return fInnerRadiusTracker;
}
inline void DetectorConstruction::SetInnerRadiusTracker( const G4double value ) {
inline void DetectorConstruction::SetInnerRadiusTracker(const G4double value)
{
fInnerRadiusTracker = value;
}
inline G4double DetectorConstruction::GetOuterRadiusTracker() const {
inline G4double DetectorConstruction::GetOuterRadiusTracker() const
{
return fOuterRadiusTracker;
}
inline void DetectorConstruction::SetOuterRadiusTracker( const G4double value ) {
inline void DetectorConstruction::SetOuterRadiusTracker(const G4double value)
{
fOuterRadiusTracker = value;
}
inline G4double DetectorConstruction::GetInnerRadiusEmCalo() const {
inline G4double DetectorConstruction::GetInnerRadiusEmCalo() const
{
return fInnerRadiusEmCalo;
}
inline void DetectorConstruction::SetInnerRadiusEmCalo( const G4double value ) {
inline void DetectorConstruction::SetInnerRadiusEmCalo(const G4double value)
{
fInnerRadiusEmCalo = value;
}
inline G4double DetectorConstruction::GetOuterRadiusEmCalo() const {
inline G4double DetectorConstruction::GetOuterRadiusEmCalo() const
{
return fOuterRadiusEmCalo;
}
inline void DetectorConstruction::SetOuterRadiusEmCalo( const G4double value ) {
inline void DetectorConstruction::SetOuterRadiusEmCalo(const G4double value)
{
fOuterRadiusEmCalo = value;
}
inline G4double DetectorConstruction::GetInnerRadiusHadCalo() const {
inline G4double DetectorConstruction::GetInnerRadiusHadCalo() const
{
return fInnerRadiusHadCalo;
}
inline void DetectorConstruction::SetInnerRadiusHadCalo( const G4double value ) {
inline void DetectorConstruction::SetInnerRadiusHadCalo(const G4double value)
{
fInnerRadiusHadCalo = value;
}
inline G4double DetectorConstruction::GetOuterRadiusHadCalo() const {
inline G4double DetectorConstruction::GetOuterRadiusHadCalo() const
{
return fOuterRadiusHadCalo;
}
inline void DetectorConstruction::SetOuterRadiusHadCalo( const G4double value ) {
inline void DetectorConstruction::SetOuterRadiusHadCalo(const G4double value)
{
fOuterRadiusHadCalo = value;
}
inline G4double DetectorConstruction::GetScoringThickness() const {
inline G4double DetectorConstruction::GetScoringThickness() const
{
return fScoringThickness;
}
@@ -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;
@@ -45,11 +45,13 @@ 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;
@@ -26,7 +26,7 @@
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -41,12 +41,14 @@ class G4Event;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction {
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
~PrimaryGeneratorAction();
void GeneratePrimaries( G4Event* anEvent ) override;
void GeneratePrimaries(G4Event* anEvent) override;
void SetGunPosition() const;
private:
G4ParticleGun* fParticleGun;
};
@@ -26,7 +26,7 @@
/// \file Run.hh
/// \brief Definition of the Run class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -34,62 +34,72 @@
#ifndef Run_h
#define Run_h 1
#include "G4Run.hh"
#include "G4ThreeVector.hh"
#include "SteppingAction.hh"
#include "TrackingAction.hh"
#include "G4Run.hh"
#include "G4ThreeVector.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 SetTrackerMaterialName( const G4String &inputValue )
{ fTrackerMaterialName = inputValue; }
void SetEmCaloMaterialName( const G4String &inputValue )
{ fEmCaloMaterialName = inputValue; }
void SetHadCaloMaterialName( const G4String &inputValue )
{ fHadCaloMaterialName = inputValue; }
void SetCubicVolumeScoringTrackerShell( const G4double inputValue )
{ fCubicVolumeScoringTrackerShell = inputValue; }
void SetCubicVolumeScoringEmCaloShell( const G4double inputValue )
{ fCubicVolumeScoringEmCaloShell = inputValue; }
void SetCubicVolumeScoringHadCaloShell( const G4double inputValue )
{ fCubicVolumeScoringHadCaloShell = inputValue; }
void SetPrimaryParticleId(const G4int inputValue) { fPrimaryParticleId = inputValue; }
void SetPrimaryParticleEnergy(const G4double inputValue)
{
fPrimaryParticleEnergy = inputValue;
}
void SetPrimaryParticleDirection(const G4ThreeVector& inputValue)
{
fPrimaryParticleDirection = inputValue;
}
void SetTrackerMaterialName(const G4String& inputValue) { fTrackerMaterialName = inputValue; }
void SetEmCaloMaterialName(const G4String& inputValue) { fEmCaloMaterialName = inputValue; }
void SetHadCaloMaterialName(const G4String& inputValue) { fHadCaloMaterialName = inputValue; }
void SetCubicVolumeScoringTrackerShell(const G4double inputValue)
{
fCubicVolumeScoringTrackerShell = inputValue;
}
void SetCubicVolumeScoringEmCaloShell(const G4double inputValue)
{
fCubicVolumeScoringEmCaloShell = inputValue;
}
void SetCubicVolumeScoringHadCaloShell(const G4double inputValue)
{
fCubicVolumeScoringHadCaloShell = inputValue;
}
G4int GetPrimaryParticleId() const { return fPrimaryParticleId; }
G4double GetPrimaryParticleEnergy() const { return fPrimaryParticleEnergy; }
G4ThreeVector GetPrimaryParticleDirection() const { return fPrimaryParticleDirection; }
@@ -100,25 +110,31 @@ class Run : public G4Run {
G4double GetCubicVolumeScoringEmCaloShell() const { return fCubicVolumeScoringEmCaloShell; }
G4double GetCubicVolumeScoringHadCaloShell() const { return fCubicVolumeScoringHadCaloShell; }
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;
@@ -129,9 +145,9 @@ class Run : public G4Run {
G4double fCubicVolumeScoringTrackerShell;
G4double fCubicVolumeScoringEmCaloShell;
G4double fCubicVolumeScoringHadCaloShell;
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,13 +42,14 @@ class TrackingAction;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class RunAction: public G4UserRunAction {
class RunAction : public G4UserRunAction
{
public:
RunAction( SteppingAction* steppingAction = nullptr,
TrackingAction* trackingAction = nullptr );
void BeginOfRunAction( const G4Run* aRun ) override;
void EndOfRunAction( const G4Run* aRun ) override;
RunAction(SteppingAction* steppingAction = nullptr, TrackingAction* trackingAction = nullptr);
void BeginOfRunAction(const G4Run* aRun) override;
void EndOfRunAction(const G4Run* aRun) override;
G4Run* GenerateRun() override;
private:
SteppingAction* fSteppingAction;
TrackingAction* fTrackingAction;
@@ -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 shell are collected, and then the corresponding fluences
// are filled up in the Run object where they are stored (and then
@@ -62,33 +64,33 @@ 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
// to the run object.
G4double GetCubicVolumeScoringTrackerShell() const { return fCubicVolumeScoringTrackerShell; }
G4double GetCubicVolumeScoringEmCaloShell() const { return fCubicVolumeScoringEmCaloShell; }
G4double GetCubicVolumeScoringEmCaloShell() const { return fCubicVolumeScoringEmCaloShell; }
G4double GetCubicVolumeScoringHadCaloShell() const { return fCubicVolumeScoringHadCaloShell; }
// Needed to get the fluence from the sum of step lengths
static const G4int fkNumberScoringShells = 3; // tracker, emCalo, hadCalo
static const G4int fkNumberScoringShells = 3; // tracker, emCalo, hadCalo
static const G4int fkNumberKinematicRegions = 3; // all, below 20 MeV, above 20 MeV
static const G4int fkNumberScoringPositions = 2; // forward, backward (hemisphere, w.r.t.
// the primary particle direction)
static const G4int fkNumberParticleTypes = 11; // all, e, gamma, mu, nu, pi, n, p, ions,
// other-mesons, other-baryons
static const G4int fkNumberCombinations = fkNumberScoringShells *
fkNumberKinematicRegions * fkNumberScoringPositions * fkNumberParticleTypes;
static const std::array< G4String, fkNumberScoringShells > fkArrayScoringShellNames;
static const std::array< G4String, fkNumberKinematicRegions > fkArrayKinematicRegionNames;
static const std::array< G4String, fkNumberScoringPositions > fkArrayScoringPositionNames;
static const std::array< G4String, fkNumberParticleTypes > fkArrayParticleTypeNames;
static G4int GetIndex( const G4int iScoringShell, const G4int iKinematicRegion,
const G4int iScoringPosition, const G4int iParticleType );
private:
static const G4int fkNumberParticleTypes = 11; // all, e, gamma, mu, nu, pi, n, p, ions,
// other-mesons, other-baryons
static const G4int fkNumberCombinations = fkNumberScoringShells * fkNumberKinematicRegions
* fkNumberScoringPositions * fkNumberParticleTypes;
static const std::array<G4String, fkNumberScoringShells> fkArrayScoringShellNames;
static const std::array<G4String, fkNumberKinematicRegions> fkArrayKinematicRegionNames;
static const std::array<G4String, fkNumberScoringPositions> fkArrayScoringPositionNames;
static const std::array<G4String, fkNumberParticleTypes> fkArrayParticleTypeNames;
static G4int GetIndex(const G4int iScoringShell, const G4int iKinematicRegion,
const G4int iScoringPosition, const G4int iParticleType);
private:
Run* fRunPtr; // Pointer to the Run object
G4int fPrimaryParticleId;
G4double fPrimaryParticleEnergy;
@@ -106,8 +108,8 @@ class SteppingAction : public G4UserSteppingAction {
G4bool fIsFirstStepInHadCalo;
G4bool fIsFirstStepInScoringHadCaloShell;
G4double fCubicVolumeScoringHadCaloShell;
std::array< G4double, fkNumberCombinations > fArraySumStepLengths;
std::array<G4double, fkNumberCombinations> fArraySumStepLengths;
// Array to collect the sum of step lengths in the scoring shells for the whole run,
// according to the various cases (scoring shell, kinematical region, scoring position
// and particle type).
@@ -26,64 +26,66 @@
/// \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 inner sphere (tracker), the middle spherical shell (EM calo),
// and the outmost spherical shell (HAD calo).
// 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 inner sphere (tracker), the middle spherical shell (EM calo),
// and the outmost spherical shell (HAD calo).
// 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 = 3; // tracker, emCalo, hadCalo
static const G4int fkNumberScoringVolumes = 3; // tracker, emCalo, hadCalo
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 number of particles and their kinetic energy at production,
// according to the particle type and their kinetic energy range (below/above 20 MeV).
};