Import Geant4 11.0.0 source tree
This commit is contained in:
committed by
Ben Morgan
parent
6399a014b6
commit
80e2389dd8
+35
-29
@@ -24,45 +24,51 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4aActionInitialization.cc
|
||||
/// \brief Implementation of the B4aActionInitialization class
|
||||
/// \file ActionInitialization.cc
|
||||
/// \brief Implementation of the ActionInitialization class
|
||||
|
||||
#include "B4aActionInitialization.hh"
|
||||
#include "B4PrimaryGeneratorAction.hh"
|
||||
#include "B4RunAction.hh"
|
||||
#include "B4aEventAction.hh"
|
||||
#include "B4aSteppingAction.hh"
|
||||
#include "B4DetectorConstruction.hh"
|
||||
#include "ActionInitialization.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
using namespace B4;
|
||||
|
||||
B4aActionInitialization::B4aActionInitialization
|
||||
(B4DetectorConstruction* detConstruction)
|
||||
: G4VUserActionInitialization(),
|
||||
fDetConstruction(detConstruction)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4aActionInitialization::~B4aActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4aActionInitialization::BuildForMaster() const
|
||||
namespace B4a
|
||||
{
|
||||
SetUserAction(new B4RunAction);
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization
|
||||
(DetectorConstruction* detConstruction)
|
||||
: fDetConstruction(detConstruction)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::~ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
SetUserAction(new RunAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4aActionInitialization::Build() const
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new B4PrimaryGeneratorAction);
|
||||
SetUserAction(new B4RunAction);
|
||||
auto eventAction = new B4aEventAction;
|
||||
SetUserAction(new PrimaryGeneratorAction);
|
||||
SetUserAction(new RunAction);
|
||||
auto eventAction = new EventAction;
|
||||
SetUserAction(eventAction);
|
||||
SetUserAction(new B4aSteppingAction(fDetConstruction,eventAction));
|
||||
SetUserAction(new SteppingAction(fDetConstruction,eventAction));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+17
-15
@@ -24,10 +24,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4DetectorConstruction.cc
|
||||
/// \brief Implementation of the B4DetectorConstruction class
|
||||
/// \file DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
|
||||
#include "B4DetectorConstruction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
@@ -50,30 +50,29 @@
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreadLocal
|
||||
G4GlobalMagFieldMessenger* B4DetectorConstruction::fMagFieldMessenger = nullptr;
|
||||
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4DetectorConstruction::B4DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fAbsorberPV(nullptr),
|
||||
fGapPV(nullptr),
|
||||
fCheckOverlaps(true)
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4DetectorConstruction::~B4DetectorConstruction()
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* B4DetectorConstruction::Construct()
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
// Define materials
|
||||
DefineMaterials();
|
||||
@@ -84,7 +83,7 @@ G4VPhysicalVolume* B4DetectorConstruction::Construct()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4DetectorConstruction::DefineMaterials()
|
||||
void DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
// Lead material defined using NIST Manager
|
||||
auto nistManager = G4NistManager::Instance();
|
||||
@@ -107,7 +106,7 @@ void B4DetectorConstruction::DefineMaterials()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
|
||||
G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
|
||||
{
|
||||
// Geometry parameters
|
||||
G4int nofLayers = 10;
|
||||
@@ -128,7 +127,7 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
|
||||
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
|
||||
G4ExceptionDescription msg;
|
||||
msg << "Cannot retrieve materials already defined.";
|
||||
G4Exception("B4DetectorConstruction::DefineVolumes()",
|
||||
G4Exception("DetectorConstruction::DefineVolumes()",
|
||||
"MyCode0001", FatalException, msg);
|
||||
}
|
||||
|
||||
@@ -277,7 +276,7 @@ G4VPhysicalVolume* B4DetectorConstruction::DefineVolumes()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4DetectorConstruction::ConstructSDandField()
|
||||
void DetectorConstruction::ConstructSDandField()
|
||||
{
|
||||
// Create global magnetic field messenger.
|
||||
// Uniform magnetic field is then created automatically if
|
||||
@@ -291,3 +290,6 @@ void B4DetectorConstruction::ConstructSDandField()
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
|
||||
+14
-14
@@ -24,13 +24,13 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4aEventAction.cc
|
||||
/// \brief Implementation of the B4aEventAction class
|
||||
/// \file EventAction.cc
|
||||
/// \brief Implementation of the B4a::EventAction class
|
||||
|
||||
#include "B4aEventAction.hh"
|
||||
#include "B4RunAction.hh"
|
||||
#include "B4Analysis.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
@@ -38,24 +38,22 @@
|
||||
#include "Randomize.hh"
|
||||
#include <iomanip>
|
||||
|
||||
namespace B4a
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4aEventAction::B4aEventAction()
|
||||
: G4UserEventAction(),
|
||||
fEnergyAbs(0.),
|
||||
fEnergyGap(0.),
|
||||
fTrackLAbs(0.),
|
||||
fTrackLGap(0.)
|
||||
EventAction::EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4aEventAction::~B4aEventAction()
|
||||
EventAction::~EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4aEventAction::BeginOfEventAction(const G4Event* /*event*/)
|
||||
void EventAction::BeginOfEventAction(const G4Event* /*event*/)
|
||||
{
|
||||
// initialisation per event
|
||||
fEnergyAbs = 0.;
|
||||
@@ -66,7 +64,7 @@ void B4aEventAction::BeginOfEventAction(const G4Event* /*event*/)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4aEventAction::EndOfEventAction(const G4Event* event)
|
||||
void EventAction::EndOfEventAction(const G4Event* event)
|
||||
{
|
||||
// Accumulate statistics
|
||||
//
|
||||
@@ -109,3 +107,5 @@ void B4aEventAction::EndOfEventAction(const G4Event* event)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+11
-9
@@ -24,10 +24,10 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the B4PrimaryGeneratorAction class
|
||||
/// \file PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
|
||||
#include "B4PrimaryGeneratorAction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
@@ -40,11 +40,12 @@
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4PrimaryGeneratorAction::B4PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(nullptr)
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
{
|
||||
G4int nofParticles = 1;
|
||||
fParticleGun = new G4ParticleGun(nofParticles);
|
||||
@@ -60,14 +61,14 @@ B4PrimaryGeneratorAction::B4PrimaryGeneratorAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4PrimaryGeneratorAction::~B4PrimaryGeneratorAction()
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
// This function is called at the begining of event
|
||||
|
||||
@@ -92,7 +93,7 @@ void B4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
msg << "World volume of box shape not found." << G4endl;
|
||||
msg << "Perhaps you have changed geometry." << G4endl;
|
||||
msg << "The gun will be place in the center.";
|
||||
G4Exception("B4PrimaryGeneratorAction::GeneratePrimaries()",
|
||||
G4Exception("PrimaryGeneratorAction::GeneratePrimaries()",
|
||||
"MyCode0002", JustWarning, msg);
|
||||
}
|
||||
|
||||
@@ -105,3 +106,4 @@ void B4PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
@@ -24,30 +24,31 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4RunAction.cc
|
||||
/// \brief Implementation of the B4RunAction class
|
||||
/// \file RunAction.cc
|
||||
/// \brief Implementation of the B4::RunAction class
|
||||
|
||||
#include "B4RunAction.hh"
|
||||
#include "B4Analysis.hh"
|
||||
#include "RunAction.hh"
|
||||
|
||||
#include "G4AnalysisManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
namespace B4
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4RunAction::B4RunAction()
|
||||
: G4UserRunAction()
|
||||
RunAction::RunAction()
|
||||
{
|
||||
// set printing event number per each event
|
||||
G4RunManager::GetRunManager()->SetPrintProgress(1);
|
||||
|
||||
// Create analysis manager
|
||||
// The choice of analysis technology is done via selectin of a namespace
|
||||
// in B4Analysis.hh
|
||||
// The choice of the output format is done via the specified
|
||||
// file extension.
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
G4cout << "Using " << analysisManager->GetType() << G4endl;
|
||||
|
||||
// Create directories
|
||||
//analysisManager->SetHistoDirectoryName("histograms");
|
||||
@@ -77,14 +78,13 @@ B4RunAction::B4RunAction()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4RunAction::~B4RunAction()
|
||||
RunAction::~RunAction()
|
||||
{
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
void RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
//inform the runManager to save random number seed
|
||||
//G4RunManager::GetRunManager()->SetRandomNumberStore(true);
|
||||
@@ -94,13 +94,18 @@ void B4RunAction::BeginOfRunAction(const G4Run* /*run*/)
|
||||
|
||||
// Open an output file
|
||||
//
|
||||
G4String fileName = "B4";
|
||||
G4String fileName = "B4.root";
|
||||
// Other supported output types:
|
||||
// G4String fileName = "B4.csv";
|
||||
// G4String fileName = "B4.hdf5";
|
||||
// G4String fileName = "B4.xml";
|
||||
analysisManager->OpenFile(fileName);
|
||||
G4cout << "Using " << analysisManager->GetType() << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
void RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
{
|
||||
// print histogram statistics
|
||||
//
|
||||
@@ -142,3 +147,5 @@ void B4RunAction::EndOfRunAction(const G4Run* /*run*/)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
+17
-12
@@ -24,34 +24,37 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file B4aSteppingAction.cc
|
||||
/// \brief Implementation of the B4aSteppingAction class
|
||||
/// \file SteppingAction.cc
|
||||
/// \brief Implementation of the SteppingAction class
|
||||
|
||||
#include "B4aSteppingAction.hh"
|
||||
#include "B4aEventAction.hh"
|
||||
#include "B4DetectorConstruction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
using namespace B4;
|
||||
|
||||
namespace B4a
|
||||
{
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4aSteppingAction::B4aSteppingAction(
|
||||
const B4DetectorConstruction* detectorConstruction,
|
||||
B4aEventAction* eventAction)
|
||||
: G4UserSteppingAction(),
|
||||
fDetConstruction(detectorConstruction),
|
||||
SteppingAction::SteppingAction(const DetectorConstruction* detConstruction,
|
||||
EventAction* eventAction)
|
||||
: fDetConstruction(detConstruction),
|
||||
fEventAction(eventAction)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
B4aSteppingAction::~B4aSteppingAction()
|
||||
SteppingAction::~SteppingAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void B4aSteppingAction::UserSteppingAction(const G4Step* step)
|
||||
void SteppingAction::UserSteppingAction(const G4Step* step)
|
||||
{
|
||||
// Collect energy and track length step by step
|
||||
|
||||
@@ -77,3 +80,5 @@ void B4aSteppingAction::UserSteppingAction(const G4Step* step)
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user