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,39 +24,45 @@
// ********************************************************************
//
//
/// \file B4cActionInitialization.cc
/// \brief Implementation of the B4cActionInitialization class
/// \file ActionInitialization.cc
/// \brief Implementation of the B4c::ActionInitialization class
#include "B4cActionInitialization.hh"
#include "B4PrimaryGeneratorAction.hh"
#include "B4RunAction.hh"
#include "B4cEventAction.hh"
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
using namespace B4;
namespace B4c
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cActionInitialization::B4cActionInitialization()
: G4VUserActionInitialization()
ActionInitialization::ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cActionInitialization::~B4cActionInitialization()
ActionInitialization::~ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B4cActionInitialization::BuildForMaster() const
void ActionInitialization::BuildForMaster() const
{
SetUserAction(new B4RunAction);
SetUserAction(new RunAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B4cActionInitialization::Build() const
void ActionInitialization::Build() const
{
SetUserAction(new B4PrimaryGeneratorAction);
SetUserAction(new B4RunAction);
SetUserAction(new B4cEventAction);
SetUserAction(new PrimaryGeneratorAction);
SetUserAction(new RunAction);
SetUserAction(new EventAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,10 +24,10 @@
// ********************************************************************
//
//
/// \file B4cCalorHit.cc
/// \brief Implementation of the B4cCalorHit class
/// \file CalorHit.cc
/// \brief Implementation of the B4c::CalorHit class
#include "B4cCalorHit.hh"
#include "CalorHit.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
@@ -36,49 +36,49 @@
#include <iomanip>
G4ThreadLocal G4Allocator<B4cCalorHit>* B4cCalorHitAllocator = nullptr;
namespace B4c
{
G4ThreadLocal G4Allocator<CalorHit>* CalorHitAllocator = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cCalorHit::B4cCalorHit()
: G4VHit(),
fEdep(0.),
fTrackLength(0.)
CalorHit::CalorHit()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cCalorHit::~B4cCalorHit() {}
CalorHit::~CalorHit() {}
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// CalorHit::CalorHit(const CalorHit& right)
// : G4VHit()
// {
// fEdep = right.fEdep;
// fTrackLength = right.fTrackLength;
// }
// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// const CalorHit& CalorHit::operator=(const CalorHit& right)
// {
// fEdep = right.fEdep;
// fTrackLength = right.fTrackLength;
// return *this;
// }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cCalorHit::B4cCalorHit(const B4cCalorHit& right)
: G4VHit()
{
fEdep = right.fEdep;
fTrackLength = right.fTrackLength;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const B4cCalorHit& B4cCalorHit::operator=(const B4cCalorHit& right)
{
fEdep = right.fEdep;
fTrackLength = right.fTrackLength;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool B4cCalorHit::operator==(const B4cCalorHit& right) const
G4bool CalorHit::operator==(const CalorHit& right) const
{
return ( this == &right ) ? true : false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B4cCalorHit::Print()
void CalorHit::Print()
{
G4cout
<< "Edep: "
@@ -89,3 +89,5 @@ void B4cCalorHit::Print()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,24 +24,25 @@
// ********************************************************************
//
//
/// \file B4cCalorimeterSD.cc
/// \brief Implementation of the B4cCalorimeterSD class
/// \file CalorimeterSD.cc
/// \brief Implementation of the B4c::CalorimeterSD class
#include "B4cCalorimeterSD.hh"
#include "CalorimeterSD.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
namespace B4c
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cCalorimeterSD::B4cCalorimeterSD(
const G4String& name,
const G4String& hitsCollectionName,
G4int nofCells)
CalorimeterSD::CalorimeterSD(const G4String& name,
const G4String& hitsCollectionName,
G4int nofCells)
: G4VSensitiveDetector(name),
fHitsCollection(nullptr),
fNofCells(nofCells)
{
collectionName.insert(hitsCollectionName);
@@ -49,17 +50,17 @@ B4cCalorimeterSD::B4cCalorimeterSD(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cCalorimeterSD::~B4cCalorimeterSD()
CalorimeterSD::~CalorimeterSD()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B4cCalorimeterSD::Initialize(G4HCofThisEvent* hce)
void CalorimeterSD::Initialize(G4HCofThisEvent* hce)
{
// Create hits collection
fHitsCollection
= new B4cCalorHitsCollection(SensitiveDetectorName, collectionName[0]);
= new CalorHitsCollection(SensitiveDetectorName, collectionName[0]);
// Add this collection in hce
auto hcID
@@ -69,13 +70,13 @@ void B4cCalorimeterSD::Initialize(G4HCofThisEvent* hce)
// Create hits
// fNofCells for cells + one more for total sums
for (G4int i=0; i<fNofCells+1; i++ ) {
fHitsCollection->insert(new B4cCalorHit());
fHitsCollection->insert(new CalorHit());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool B4cCalorimeterSD::ProcessHits(G4Step* step,
G4bool CalorimeterSD::ProcessHits(G4Step* step,
G4TouchableHistory*)
{
// energy deposit
@@ -99,7 +100,7 @@ G4bool B4cCalorimeterSD::ProcessHits(G4Step* step,
if ( ! hit ) {
G4ExceptionDescription msg;
msg << "Cannot access hit " << layerNumber;
G4Exception("B4cCalorimeterSD::ProcessHits()",
G4Exception("CalorimeterSD::ProcessHits()",
"MyCode0004", FatalException, msg);
}
@@ -116,7 +117,7 @@ G4bool B4cCalorimeterSD::ProcessHits(G4Step* step,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B4cCalorimeterSD::EndOfEvent(G4HCofThisEvent*)
void CalorimeterSD::EndOfEvent(G4HCofThisEvent*)
{
if ( verboseLevel>1 ) {
auto nofHits = fHitsCollection->entries();
@@ -129,3 +130,5 @@ void B4cCalorimeterSD::EndOfEvent(G4HCofThisEvent*)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,11 +24,11 @@
// ********************************************************************
//
//
/// \file B4cDetectorConstruction.cc
/// \brief Implementation of the B4cDetectorConstruction class
/// \file DetectorConstruction.cc
/// \brief Implementation of the B4c::DetectorConstruction class
#include "B4cDetectorConstruction.hh"
#include "B4cCalorimeterSD.hh"
#include "DetectorConstruction.hh"
#include "CalorimeterSD.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
@@ -47,29 +47,29 @@
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
namespace B4c
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* B4cDetectorConstruction::fMagFieldMessenger = nullptr;
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cDetectorConstruction::B4cDetectorConstruction()
: G4VUserDetectorConstruction(),
fCheckOverlaps(true),
fNofLayers(-1)
DetectorConstruction::DetectorConstruction()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cDetectorConstruction::~B4cDetectorConstruction()
DetectorConstruction::~DetectorConstruction()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* B4cDetectorConstruction::Construct()
G4VPhysicalVolume* DetectorConstruction::Construct()
{
// Define materials
DefineMaterials();
@@ -80,7 +80,7 @@ G4VPhysicalVolume* B4cDetectorConstruction::Construct()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B4cDetectorConstruction::DefineMaterials()
void DetectorConstruction::DefineMaterials()
{
// Lead material defined using NIST Manager
auto nistManager = G4NistManager::Instance();
@@ -103,7 +103,7 @@ void B4cDetectorConstruction::DefineMaterials()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* B4cDetectorConstruction::DefineVolumes()
G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
{
// Geometry parameters
fNofLayers = 10;
@@ -124,7 +124,7 @@ G4VPhysicalVolume* B4cDetectorConstruction::DefineVolumes()
if ( ! defaultMaterial || ! absorberMaterial || ! gapMaterial ) {
G4ExceptionDescription msg;
msg << "Cannot retrieve materials already defined.";
G4Exception("B4DetectorConstruction::DefineVolumes()",
G4Exception("DetectorConstruction::DefineVolumes()",
"MyCode0001", FatalException, msg);
}
@@ -271,7 +271,7 @@ G4VPhysicalVolume* B4cDetectorConstruction::DefineVolumes()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B4cDetectorConstruction::ConstructSDandField()
void DetectorConstruction::ConstructSDandField()
{
// G4SDManager::GetSDMpointer()->SetVerboseLevel(1);
@@ -279,12 +279,12 @@ void B4cDetectorConstruction::ConstructSDandField()
// Sensitive detectors
//
auto absoSD
= new B4cCalorimeterSD("AbsorberSD", "AbsorberHitsCollection", fNofLayers);
= new CalorimeterSD("AbsorberSD", "AbsorberHitsCollection", fNofLayers);
G4SDManager::GetSDMpointer()->AddNewDetector(absoSD);
SetSensitiveDetector("AbsoLV",absoSD);
auto gapSD
= new B4cCalorimeterSD("GapSD", "GapHitsCollection", fNofLayers);
= new CalorimeterSD("GapSD", "GapHitsCollection", fNofLayers);
G4SDManager::GetSDMpointer()->AddNewDetector(gapSD);
SetSensitiveDetector("GapLV",gapSD);
@@ -303,3 +303,5 @@ void B4cDetectorConstruction::ConstructSDandField()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,14 +24,14 @@
// ********************************************************************
//
//
/// \file B4cEventAction.cc
/// \brief Implementation of the B4cEventAction class
/// \file EventAction.cc
/// \brief Implementation of the B4c::EventAction class
#include "B4cEventAction.hh"
#include "B4cCalorimeterSD.hh"
#include "B4cCalorHit.hh"
#include "B4Analysis.hh"
#include "EventAction.hh"
#include "CalorimeterSD.hh"
#include "CalorHit.hh"
#include "G4AnalysisManager.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4SDManager.hh"
@@ -41,33 +41,33 @@
#include "Randomize.hh"
#include <iomanip>
namespace B4c
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cEventAction::B4cEventAction()
: G4UserEventAction(),
fAbsHCID(-1),
fGapHCID(-1)
EventAction::EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cEventAction::~B4cEventAction()
EventAction::~EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B4cCalorHitsCollection*
B4cEventAction::GetHitsCollection(G4int hcID,
CalorHitsCollection*
EventAction::GetHitsCollection(G4int hcID,
const G4Event* event) const
{
auto hitsCollection
= static_cast<B4cCalorHitsCollection*>(
= static_cast<CalorHitsCollection*>(
event->GetHCofThisEvent()->GetHC(hcID));
if ( ! hitsCollection ) {
G4ExceptionDescription msg;
msg << "Cannot access hitsCollection ID " << hcID;
G4Exception("B4cEventAction::GetHitsCollection()",
G4Exception("EventAction::GetHitsCollection()",
"MyCode0003", FatalException, msg);
}
@@ -76,7 +76,7 @@ B4cEventAction::GetHitsCollection(G4int hcID,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B4cEventAction::PrintEventStatistics(
void EventAction::PrintEventStatistics(
G4double absoEdep, G4double absoTrackLength,
G4double gapEdep, G4double gapTrackLength) const
{
@@ -96,12 +96,12 @@ void B4cEventAction::PrintEventStatistics(
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B4cEventAction::BeginOfEventAction(const G4Event* /*event*/)
void EventAction::BeginOfEventAction(const G4Event* /*event*/)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B4cEventAction::EndOfEventAction(const G4Event* event)
void EventAction::EndOfEventAction(const G4Event* event)
{
// Get hits collections IDs (only once)
if ( fAbsHCID == -1 ) {
@@ -152,3 +152,5 @@ void B4cEventAction::EndOfEventAction(const G4Event* event)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,10 +24,10 @@
// ********************************************************************
//
//
/// \file B4PrimaryGeneratorAction.cc
/// \brief Implementation of the B4PrimaryGeneratorAction class
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the B4::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......
}