Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
@@ -24,28 +24,31 @@
// ********************************************************************
//
//
/// \file B1ConActionInitialization.hh
/// \brief Definition of the B1ConActionInitialization class
/// \file ActionInitialization.hh
/// \brief Definition of the B1::ActionInitialization class
#ifndef B1ConActionInitialization_h
#define B1ConActionInitialization_h 1
#ifndef B1ActionInitialization_h
#define B1ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
/// Action initialization class.
///
namespace B1Con
{
class B1ConActionInitialization : public G4VUserActionInitialization
/// Action initialization class.
class ActionInitialization : public G4VUserActionInitialization
{
public:
B1ConActionInitialization();
virtual ~B1ConActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
ActionInitialization() = default;
~ActionInitialization() override = default;
void BuildForMaster() const override;
void Build() const override;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -1,62 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
/// \file B1ConRun.hh
/// \brief Definition of the B1ConRun class
#ifndef B1ConRun_h
#define B1ConRun_h 1
#include "B1Run.hh"
#include "globals.hh"
class G4Event;
/// Run class which extends B1Run
///
class B1ConRun : public B1Run
{
public:
B1ConRun();
virtual ~B1ConRun();
// method from the base class
virtual void Merge(const G4Run*);
virtual void AddEdep (G4double edep);
// get methods
G4int GetNumberOfEvent() const { return (G4int)fEdepEventVector.size(); }
G4double GetEdepPerEvent(G4int i) const { return fEdepEventVector[i]; }
private:
std::vector<G4double> fEdepEventVector;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B1DetectorConstruction.hh
/// \brief Definition of the B1DetectorConstruction class
/// \file B1/include/DetectorConstruction.hh
/// \brief Definition of the B1::DetectorConstruction class
#ifndef B1DetectorConstruction_h
#define B1DetectorConstruction_h 1
@@ -36,23 +36,27 @@
class G4VPhysicalVolume;
class G4LogicalVolume;
namespace B1
{
/// Detector construction class to define materials and geometry.
class B1DetectorConstruction : public G4VUserDetectorConstruction
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
B1DetectorConstruction();
virtual ~B1DetectorConstruction();
DetectorConstruction() = default;
~DetectorConstruction() override = default;
virtual G4VPhysicalVolume* Construct();
G4VPhysicalVolume* Construct() override;
G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; }
protected:
G4LogicalVolume* fScoringVolume;
G4LogicalVolume* fScoringVolume = nullptr;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B1EventAction.hh
/// \brief Definition of the B1EventAction class
/// \file B1/include/EventAction.hh
/// \brief Definition of the B1::EventAction class
#ifndef B1EventAction_h
#define B1EventAction_h 1
@@ -33,28 +33,34 @@
#include "G4UserEventAction.hh"
#include "globals.hh"
/// Event action class
///
/// It instantiates B1EventInformation object at the beginning of
/// each event.
namespace B1Con
{
class RunAction;
}
class B1EventAction : public G4UserEventAction
namespace B1
{
/// Event action class
class EventAction : public G4UserEventAction
{
public:
B1EventAction();
virtual ~B1EventAction();
EventAction(B1Con::RunAction* runAction);
~EventAction() override = default;
virtual void BeginOfEventAction(const G4Event* event);
virtual void EndOfEventAction(const G4Event* event);
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
void AddEdep(G4double edep) { fEdep += edep; }
G4double GetEdep() const { return fEdep; }
private:
G4int fPrintModulo;
G4double fEdep;
B1Con::RunAction* fRunAction = nullptr;
G4double fEdep = 0.;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B1PrimaryGeneratorAction.hh
/// \brief Definition of the B1PrimaryGeneratorAction class
/// \file B1/include/PrimaryGeneratorAction.hh
/// \brief Definition of the B1::PrimaryGeneratorAction class
#ifndef B1PrimaryGeneratorAction_h
#define B1PrimaryGeneratorAction_h 1
@@ -38,30 +38,33 @@ class G4ParticleGun;
class G4Event;
class G4Box;
namespace B1
{
/// The primary generator action class with particle gun.
///
/// The default kinematic is a 6 MeV gamma, randomly distribued
/// in front of the phantom across 80% of the (X,Y) phantom size.
class B1PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
B1PrimaryGeneratorAction();
virtual ~B1PrimaryGeneratorAction();
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
// method from the base class
virtual void GeneratePrimaries(G4Event*);
void GeneratePrimaries(G4Event*) override;
// method to access particle gun
const G4ParticleGun* GetParticleGun() const { return fParticleGun; }
private:
G4ParticleGun* fParticleGun; // pointer a to G4 gun class
G4Box* fEnvelopeBox;
G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 gun class
G4Box* fEnvelopeBox = nullptr;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,18 +24,25 @@
// ********************************************************************
//
//
/// \file B1ConRunAction.hh
/// \brief Definition of the B1ConRunAction class
/// \file B1/include/RunAction.hh
/// \brief Definition of the B1::RunAction class
#ifndef B1ConRunAction_h
#define B1ConRunAction_h 1
#ifndef B1RunAction_h
#define B1RunAction_h 1
#include "VectorAccummulable.hh"
#include "G4ConvergenceTester.hh"
#include "G4UserRunAction.hh"
#include "G4Accumulable.hh"
#include "globals.hh"
class G4ConvergenceTester;
class G4Run;
class G4LogicalVolume;
namespace B1Con
{
/// Run action class
///
@@ -43,20 +50,25 @@ class G4LogicalVolume;
/// from the energy deposit accumulated via stepping and event actions.
/// The computed dose is then printed on the screen.
class B1ConRunAction : public G4UserRunAction
class RunAction : public G4UserRunAction
{
public:
B1ConRunAction();
virtual ~B1ConRunAction();
RunAction();
~RunAction() override = default;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
void AddEdep (G4double edep);
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
private:
G4ConvergenceTester* fdose_tally;
G4Accumulable<G4double> fEdep = 0.;
G4Accumulable<G4double> fEdep2 = 0.;
VectorAccumulable<G4double> fEdepPerEvent;
G4ConvergenceTester* fDoseTally = nullptr;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B1SteppingAction.hh
/// \brief Definition of the B1SteppingAction class
/// \file B1/include/SteppingAction.hh
/// \brief Definition of the B1::SteppingAction class
#ifndef B1SteppingAction_h
#define B1SteppingAction_h 1
@@ -33,27 +33,31 @@
#include "G4UserSteppingAction.hh"
#include "globals.hh"
class B1EventAction;
class G4LogicalVolume;
/// Stepping action class
///
namespace B1
{
class B1SteppingAction : public G4UserSteppingAction
class EventAction;
/// Stepping action class
class SteppingAction : public G4UserSteppingAction
{
public:
B1SteppingAction(B1EventAction* eventAction);
virtual ~B1SteppingAction();
SteppingAction(EventAction* eventAction);
~SteppingAction() override = default;
// method from the base class
virtual void UserSteppingAction(const G4Step*);
void UserSteppingAction(const G4Step*) override;
private:
B1EventAction* fEventAction;
G4LogicalVolume* fScoringVolume;
EventAction* fEventAction = nullptr;
G4LogicalVolume* fScoringVolume = nullptr;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,41 +24,59 @@
// ********************************************************************
//
//
/// \file B1Run.hh
/// \brief Definition of the B1Run class
#ifndef B1Run_h
#define B1Run_h 1
#include "G4Run.hh"
#include "globals.hh"
class G4Event;
/// Run class
/// \file VectorAccummulable.hh
/// \brief Definition of the VectorAccummulable class
///
/// This class defines an accummulable of a vector<T> type
/// that merges the vectors filled on workers in a single vector.
class B1Run : public G4Run
#ifndef VectorAccumulable_h
#define VectorAccumulable_h 1
#include "G4VAccumulable.hh"
#include "globals.hh"
#include <vector>
template <typename T>
class VectorAccumulable : public G4VAccumulable
{
public:
B1Run();
virtual ~B1Run();
VectorAccumulable() = default;
~VectorAccumulable() override = default;
// method from the base class
virtual void Merge(const G4Run*);
void AddValue(T value);
const std::vector<T>& GetVector() const;
virtual void AddEdep (G4double edep);
// get methods
G4double GetEdep() const { return fEdep; }
G4double GetEdep2() const { return fEdep2; }
void Merge(const G4VAccumulable& other) override;
void Reset() override;
private:
G4double fEdep;
G4double fEdep2;
std::vector<T> fTVector;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// inline functions
template <typename T>
inline void VectorAccumulable<T>::AddValue(T value) {
fTVector.push_back(value);
}
template <typename T>
inline const std::vector<T>& VectorAccumulable<T>::GetVector() const
{
return fTVector;
}
template <typename T>
inline void VectorAccumulable<T>::Merge(const G4VAccumulable& other) {
for (const auto& value : static_cast<const VectorAccumulable<T>&>(other).fTVector ) {
fTVector.push_back(value);
}
}
template <typename T>
inline void VectorAccumulable<T>::Reset() {
fTVector.clear();
}
#endif