Import Geant4 11.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2021-12-10 14:46:44 +01:00
committed by Ben Morgan
parent 6399a014b6
commit 80e2389dd8
3932 changed files with 202519 additions and 246221 deletions
@@ -24,31 +24,40 @@
// ********************************************************************
//
//
/// \file B4bActionInitialization.hh
/// \brief Definition of the B4bActionInitialization class
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
#ifndef B4bActionInitialization_h
#define B4bActionInitialization_h 1
#ifndef B4aActionInitialization_h
#define B4aActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
class B4DetectorConstruction;
namespace B4
{
class DetectorConstruction;
}
namespace B4b
{
/// Action initialization class.
///
class B4bActionInitialization : public G4VUserActionInitialization
class ActionInitialization : public G4VUserActionInitialization
{
public:
B4bActionInitialization(B4DetectorConstruction*);
virtual ~B4bActionInitialization();
ActionInitialization(B4::DetectorConstruction*);
~ActionInitialization() override;
virtual void BuildForMaster() const;
virtual void Build() const;
void BuildForMaster() const override;
void Build() const override;
private:
B4DetectorConstruction* fDetConstruction;
B4::DetectorConstruction* fDetConstruction = nullptr;
};
}
#endif
@@ -1,40 +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 B4Analysis.hh
/// \brief Selection of the analysis technology
#ifndef B4Analysis_h
#define B4Analysis_h 1
#include "g4root.hh"
//#include "g4csv.hh"
//#include "g4xml.hh"
//#include "G4GenericAnalysisManager.hh"
//using G4AnalysisManager = G4GenericAnalysisManager;
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B4DetectorConstruction.hh
/// \brief Definition of the B4DetectorConstruction class
/// \file DetectorConstruction.hh
/// \brief Definition of the DetectorConstruction class
#ifndef B4DetectorConstruction_h
#define B4DetectorConstruction_h 1
@@ -36,6 +36,9 @@
class G4VPhysicalVolume;
class G4GlobalMagFieldMessenger;
namespace B4
{
/// Detector construction class to define materials and geometry.
/// The calorimeter is a box made of a given number of layers. A layer consists
/// of an absorber plate and of a detection gap. The layer is replicated.
@@ -50,15 +53,15 @@ class G4GlobalMagFieldMessenger;
/// In addition a transverse uniform magnetic field is defined
/// via G4GlobalMagFieldMessenger class.
class B4DetectorConstruction : public G4VUserDetectorConstruction
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
B4DetectorConstruction();
virtual ~B4DetectorConstruction();
DetectorConstruction();
~DetectorConstruction() override;
public:
virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
G4VPhysicalVolume* Construct() override;
void ConstructSDandField() override;
// get methods
//
@@ -76,22 +79,23 @@ class B4DetectorConstruction : public G4VUserDetectorConstruction
static G4ThreadLocal G4GlobalMagFieldMessenger* fMagFieldMessenger;
// magnetic field messenger
G4VPhysicalVolume* fAbsorberPV; // the absorber physical volume
G4VPhysicalVolume* fGapPV; // the gap physical volume
G4VPhysicalVolume* fAbsorberPV = nullptr; // the absorber physical volume
G4VPhysicalVolume* fGapPV = nullptr; // the gap physical volume
G4bool fCheckOverlaps; // option to activate checking of volumes overlaps
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
};
// inline functions
inline const G4VPhysicalVolume* B4DetectorConstruction::GetAbsorberPV() const {
inline const G4VPhysicalVolume* DetectorConstruction::GetAbsorberPV() const {
return fAbsorberPV;
}
inline const G4VPhysicalVolume* B4DetectorConstruction::GetGapPV() const {
inline const G4VPhysicalVolume* DetectorConstruction::GetGapPV() const {
return fGapPV;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B4bEventAction.hh
/// \brief Definition of the B4bEventAction class
/// \file EventAction.hh
/// \brief Definition of the B4b::EventAction class
#ifndef B4bEventAction_h
#define B4bEventAction_h 1
@@ -33,20 +33,23 @@
#include "G4UserEventAction.hh"
#include "globals.hh"
namespace B4b
{
/// Event action class
///
/// In EndOfEventAction(), it prints the accumulated quantities of the energy
/// deposit and track lengths of charged particles in Absober and Gap layers
/// stored in B4bRunData object.
/// stored in RunData object.
class B4bEventAction : public G4UserEventAction
class EventAction : public G4UserEventAction
{
public:
B4bEventAction();
virtual ~B4bEventAction();
EventAction();
~EventAction() override;
virtual void BeginOfEventAction(const G4Event* event);
virtual void EndOfEventAction(const G4Event* event);
void BeginOfEventAction(const G4Event* event) override;
void EndOfEventAction(const G4Event* event) override;
private:
// methods
@@ -54,6 +57,8 @@ class B4bEventAction : public G4UserEventAction
G4double gapEdep, G4double gapTrackLength) const;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B4PrimaryGeneratorAction.hh
/// \brief Definition of the B4PrimaryGeneratorAction class
/// \file PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
#ifndef B4PrimaryGeneratorAction_h
#define B4PrimaryGeneratorAction_h 1
@@ -36,6 +36,9 @@
class G4ParticleGun;
class G4Event;
namespace B4
{
/// The primary generator action class with particle gum.
///
/// It defines a single particle which hits the calorimeter
@@ -43,21 +46,23 @@ class G4Event;
/// can be changed via the G4 build-in commands of G4ParticleGun class
/// (see the macros provided with this example).
class B4PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
B4PrimaryGeneratorAction();
virtual ~B4PrimaryGeneratorAction();
PrimaryGeneratorAction();
~PrimaryGeneratorAction() override;
virtual void GeneratePrimaries(G4Event* event);
void GeneratePrimaries(G4Event* event) override;
// set methods
void SetRandomFlag(G4bool value);
private:
G4ParticleGun* fParticleGun; // G4 particle gun
G4ParticleGun* fParticleGun = nullptr; // G4 particle gun
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B4bRunAction.hh
/// \brief Definition of the B4bRunAction class
/// \file RunAction.hh
/// \brief Definition of the B4b::RunAction class
#ifndef B4bRunAction_h
#define B4bRunAction_h 1
@@ -35,6 +35,9 @@
class G4Run;
namespace B4b
{
/// Run action class
///
/// It accumulates statistic and computes dispersion of the energy deposit
@@ -47,24 +50,26 @@ class G4Run;
/// - Track length in gap
/// The same values are also saved in the ntuple.
/// The histograms and ntuple are saved in the output file in a format
/// accoring to a selected technology in B4Analysis.hh.
/// according to a specified file extension.
///
/// In EndOfRunAction(), the accumulated statistic and computed
/// dispersion is printed.
///
class B4bRunAction : public G4UserRunAction
class RunAction : public G4UserRunAction
{
public:
B4bRunAction();
virtual ~B4bRunAction();
RunAction();
~RunAction() override;
virtual G4Run* GenerateRun();
G4Run* GenerateRun() override;
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
/// \file B4bRunData.hh
/// \brief Definition of the B4bRunData class
/// \file RunData.hh
/// \brief Definition of the B4b::RunData class
#ifndef B4bRunData_h
#define B4bRunData_h 1
@@ -35,6 +35,9 @@
#include <array>
namespace B4b
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4int kAbs = 0;
@@ -50,15 +53,15 @@ const G4int kDim = 2;
/// is introduced for each quantity:
/// - fEdep[], fTrackLength[].
///
/// The data are collected step by step in B4bSteppingAction, and
/// The data are collected step by step in SteppingAction, and
/// the accumulated values are filled in histograms and entuple
/// event by event in B4EventAction.
/// event by event in EventAction.
class B4bRunData : public G4Run
class RunData : public G4Run
{
public:
B4bRunData();
virtual ~B4bRunData();
RunData();
~RunData() override;
void Add(G4int id, G4double de, G4double dl);
void FillPerEvent();
@@ -71,30 +74,32 @@ public:
G4double GetTrackLength(G4int id) const;
private:
std::array<G4String, kDim> fVolumeNames;
std::array<G4double, kDim> fEdep;
std::array<G4double, kDim> fTrackLength;
std::array<G4String, kDim> fVolumeNames = { "Absorber", "Gap" };
std::array<G4double, kDim> fEdep = { 0., 0. };
std::array<G4double, kDim> fTrackLength = { 0., 0. };
};
// inline functions
inline void B4bRunData::Add(G4int id, G4double de, G4double dl) {
inline void RunData::Add(G4int id, G4double de, G4double dl) {
fEdep[id] += de;
fTrackLength[id] += dl;
}
inline G4String B4bRunData::GetVolumeName(G4int id) const {
inline G4String RunData::GetVolumeName(G4int id) const {
return fVolumeNames[id];
}
inline G4double B4bRunData::GetEdep(G4int id) const {
inline G4double RunData::GetEdep(G4int id) const {
return fEdep[id];
}
inline G4double B4bRunData::GetTrackLength(G4int id) const {
inline G4double RunData::GetTrackLength(G4int id) const {
return fTrackLength[id];
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -24,34 +24,42 @@
// ********************************************************************
//
//
/// \file B4bSteppingAction.hh
/// \brief Definition of the B4bSteppingAction class
/// \file SteppingAction.hh
/// \brief Definition of the B4b::SteppingAction class
#ifndef B4bSteppingAction_h
#define B4bSteppingAction_h 1
#include "G4UserSteppingAction.hh"
class B4DetectorConstruction;
namespace B4
{
class DetectorConstruction;
}
namespace B4b
{
/// Stepping action class.
///
/// In UserSteppingAction() there are collected the energy deposit and track
/// lengths of charged particles in Absober and Gap layers and
/// updated in B4bRunData object.
/// updated in RunData object.
class B4bSteppingAction : public G4UserSteppingAction
class SteppingAction : public G4UserSteppingAction
{
public:
B4bSteppingAction(const B4DetectorConstruction* detectorConstruction);
virtual ~B4bSteppingAction();
SteppingAction(const B4::DetectorConstruction* detConstruction);
~SteppingAction() override;
virtual void UserSteppingAction(const G4Step* step);
void UserSteppingAction(const G4Step* step) override;
private:
const B4DetectorConstruction* fDetConstruction;
const B4::DetectorConstruction* fDetConstruction = nullptr;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif