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,44 @@
// ********************************************************************
//
//
/// \file B2ActionInitialization.cc
/// \brief Implementation of the B2ActionInitialization class
/// \file ActionInitialization.cc
/// \brief Implementation of the B2::ActionInitialization class
#include "B2ActionInitialization.hh"
#include "B2PrimaryGeneratorAction.hh"
#include "B2RunAction.hh"
#include "B2EventAction.hh"
#include "ActionInitialization.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
namespace B2
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2ActionInitialization::B2ActionInitialization()
: G4VUserActionInitialization()
ActionInitialization::ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2ActionInitialization::~B2ActionInitialization()
ActionInitialization::~ActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2ActionInitialization::BuildForMaster() const
void ActionInitialization::BuildForMaster() const
{
SetUserAction(new B2RunAction);
SetUserAction(new RunAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2ActionInitialization::Build() const
void ActionInitialization::Build() const
{
SetUserAction(new B2PrimaryGeneratorAction);
SetUserAction(new B2RunAction);
SetUserAction(new B2EventAction);
SetUserAction(new PrimaryGeneratorAction);
SetUserAction(new RunAction);
SetUserAction(new EventAction);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,12 +24,12 @@
// ********************************************************************
//
//
/// \file B2aDetectorConstruction.cc
/// \brief Implementation of the B2aDetectorConstruction class
/// \file DetectorConstruction.cc
/// \brief Implementation of the B2a::DetectorConstruction class
#include "B2aDetectorConstruction.hh"
#include "B2aDetectorMessenger.hh"
#include "B2TrackerSD.hh"
#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "TrackerSD.hh"
#include "G4Material.hh"
#include "G4NistManager.hh"
@@ -52,20 +52,19 @@
#include "G4SystemOfUnits.hh"
using namespace B2;
namespace B2a
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ThreadLocal
G4GlobalMagFieldMessenger* B2aDetectorConstruction::fMagFieldMessenger = nullptr;
G4GlobalMagFieldMessenger* DetectorConstruction::fMagFieldMessenger = nullptr;
B2aDetectorConstruction::B2aDetectorConstruction()
:G4VUserDetectorConstruction(),
fNbOfChambers(0),
fLogicTarget(nullptr), fLogicChamber(nullptr),
fTargetMaterial(nullptr), fChamberMaterial(nullptr),
fStepLimit(nullptr),
fCheckOverlaps(true)
DetectorConstruction::DetectorConstruction()
{
fMessenger = new B2aDetectorMessenger(this);
fMessenger = new DetectorMessenger(this);
fNbOfChambers = 5;
fLogicChamber = new G4LogicalVolume*[fNbOfChambers];
@@ -73,7 +72,7 @@ B2aDetectorConstruction::B2aDetectorConstruction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2aDetectorConstruction::~B2aDetectorConstruction()
DetectorConstruction::~DetectorConstruction()
{
delete [] fLogicChamber;
delete fStepLimit;
@@ -82,7 +81,7 @@ B2aDetectorConstruction::~B2aDetectorConstruction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* B2aDetectorConstruction::Construct()
G4VPhysicalVolume* DetectorConstruction::Construct()
{
// Define materials
DefineMaterials();
@@ -93,7 +92,7 @@ G4VPhysicalVolume* B2aDetectorConstruction::Construct()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2aDetectorConstruction::DefineMaterials()
void DetectorConstruction::DefineMaterials()
{
// Material definition
@@ -114,7 +113,7 @@ void B2aDetectorConstruction::DefineMaterials()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
{
G4Material* air = G4Material::GetMaterial("G4_AIR");
@@ -231,7 +230,7 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
if( fNbOfChambers > 0 ){
rmaxIncr = 0.5 * (lastLength-firstLength)/(fNbOfChambers-1);
if (chamberSpacing < chamberWidth) {
G4Exception("B2aDetectorConstruction::DefineVolumes()",
G4Exception("DetectorConstruction::DefineVolumes()",
"InvalidSetup", FatalException,
"Width>Spacing");
}
@@ -287,12 +286,12 @@ G4VPhysicalVolume* B2aDetectorConstruction::DefineVolumes()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2aDetectorConstruction::ConstructSDandField()
void DetectorConstruction::ConstructSDandField()
{
// Sensitive detectors
G4String trackerChamberSDname = "B2/TrackerChamberSD";
B2TrackerSD* aTrackerSD = new B2TrackerSD(trackerChamberSDname,
G4String trackerChamberSDname = "/TrackerChamberSD";
TrackerSD* aTrackerSD = new TrackerSD(trackerChamberSDname,
"TrackerHitsCollection");
G4SDManager::GetSDMpointer()->AddNewDetector(aTrackerSD);
// Setting aTrackerSD to all logical volumes with the same name
@@ -312,7 +311,7 @@ void B2aDetectorConstruction::ConstructSDandField()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2aDetectorConstruction::SetTargetMaterial(G4String materialName)
void DetectorConstruction::SetTargetMaterial(G4String materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
@@ -337,7 +336,7 @@ void B2aDetectorConstruction::SetTargetMaterial(G4String materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2aDetectorConstruction::SetChamberMaterial(G4String materialName)
void DetectorConstruction::SetChamberMaterial(G4String materialName)
{
G4NistManager* nistManager = G4NistManager::Instance();
@@ -365,14 +364,18 @@ void B2aDetectorConstruction::SetChamberMaterial(G4String materialName)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2aDetectorConstruction::SetMaxStep(G4double maxStep)
void DetectorConstruction::SetMaxStep(G4double maxStep)
{
if ((fStepLimit)&&(maxStep>0.)) fStepLimit->SetMaxAllowedStep(maxStep);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2aDetectorConstruction::SetCheckOverlaps(G4bool checkOverlaps)
void DetectorConstruction::SetCheckOverlaps(G4bool checkOverlaps)
{
fCheckOverlaps = checkOverlaps;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,39 +24,41 @@
// ********************************************************************
//
//
/// \file B2aDetectorMessenger.cc
/// \brief Implementation of the B2aDetectorMessenger class
/// \file DetectorMessenger.cc
/// \brief Implementation of the B2a::DetectorMessenger class
#include "B2aDetectorMessenger.hh"
#include "B2aDetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "DetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
namespace B2a
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2aDetectorMessenger::B2aDetectorMessenger(B2aDetectorConstruction* Det)
: G4UImessenger(),
fDetectorConstruction(Det)
DetectorMessenger::DetectorMessenger(DetectorConstruction* det)
: fDetectorConstruction(det)
{
fB2Directory = new G4UIdirectory("/B2/");
fB2Directory->SetGuidance("UI commands specific to this example.");
fDirectory = new G4UIdirectory("//");
fDirectory->SetGuidance("UI commands specific to this example.");
fDetDirectory = new G4UIdirectory("/B2/det/");
fDetDirectory = new G4UIdirectory("//det/");
fDetDirectory->SetGuidance("Detector construction control");
fTargMatCmd = new G4UIcmdWithAString("/B2/det/setTargetMaterial",this);
fTargMatCmd = new G4UIcmdWithAString("//det/setTargetMaterial",this);
fTargMatCmd->SetGuidance("Select Material of the Target.");
fTargMatCmd->SetParameterName("choice",false);
fTargMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fChamMatCmd = new G4UIcmdWithAString("/B2/det/setChamberMaterial",this);
fChamMatCmd = new G4UIcmdWithAString("//det/setChamberMaterial",this);
fChamMatCmd->SetGuidance("Select Material of the Chamber.");
fChamMatCmd->SetParameterName("choice",false);
fChamMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("/B2/det/stepMax",this);
fStepMaxCmd = new G4UIcmdWithADoubleAndUnit("//det/stepMax",this);
fStepMaxCmd->SetGuidance("Define a step max");
fStepMaxCmd->SetParameterName("stepMax",false);
fStepMaxCmd->SetUnitCategory("Length");
@@ -65,18 +67,18 @@ B2aDetectorMessenger::B2aDetectorMessenger(B2aDetectorConstruction* Det)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2aDetectorMessenger::~B2aDetectorMessenger()
DetectorMessenger::~DetectorMessenger()
{
delete fTargMatCmd;
delete fChamMatCmd;
delete fStepMaxCmd;
delete fB2Directory;
delete fDirectory;
delete fDetDirectory;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2aDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
if( command == fTargMatCmd )
{ fDetectorConstruction->SetTargetMaterial(newValue);}
@@ -91,3 +93,5 @@ void B2aDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,10 +24,10 @@
// ********************************************************************
//
//
/// \file B2EventAction.cc
/// \brief Implementation of the B2EventAction class
/// \file EventAction.cc
/// \brief Implementation of the B2::EventAction class
#include "B2EventAction.hh"
#include "EventAction.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
@@ -35,25 +35,27 @@
#include "G4Trajectory.hh"
#include "G4ios.hh"
namespace B2
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2EventAction::B2EventAction()
: G4UserEventAction()
EventAction::EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2EventAction::~B2EventAction()
EventAction::~EventAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2EventAction::BeginOfEventAction(const G4Event*)
void EventAction::BeginOfEventAction(const G4Event*)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2EventAction::EndOfEventAction(const G4Event* event)
void EventAction::EndOfEventAction(const G4Event* event)
{
// get number of stored trajectories
@@ -77,3 +79,6 @@ void B2EventAction::EndOfEventAction(const G4Event* event)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,10 +24,10 @@
// ********************************************************************
//
//
/// \file B2PrimaryGeneratorAction.cc
/// \brief Implementation of the B2PrimaryGeneratorAction class
/// \file PrimaryGeneratorAction.cc
/// \brief Implementation of the B2::PrimaryGeneratorAction class
#include "B2PrimaryGeneratorAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
@@ -37,13 +37,14 @@
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
namespace B2
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2PrimaryGeneratorAction::B2PrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction()
PrimaryGeneratorAction::PrimaryGeneratorAction()
{
G4int nofParticles = 1;
fParticleGun = new G4ParticleGun(nofParticles);
@@ -60,14 +61,14 @@ B2PrimaryGeneratorAction::B2PrimaryGeneratorAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2PrimaryGeneratorAction::~B2PrimaryGeneratorAction()
PrimaryGeneratorAction::~PrimaryGeneratorAction()
{
delete fParticleGun;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// This function is called at the begining of event
@@ -95,3 +96,6 @@ void B2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,18 +24,20 @@
// ********************************************************************
//
//
/// \file B2RunAction.cc
/// \brief Implementation of the B2RunAction class
/// \file RunAction.cc
/// \brief Implementation of the B2::RunAction class
#include "B2RunAction.hh"
#include "RunAction.hh"
#include "G4Run.hh"
#include "G4RunManager.hh"
namespace B2
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2RunAction::B2RunAction()
: G4UserRunAction()
RunAction::RunAction()
{
// set printing event number per each 100 events
G4RunManager::GetRunManager()->SetPrintProgress(1000);
@@ -43,12 +45,12 @@ B2RunAction::B2RunAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2RunAction::~B2RunAction()
RunAction::~RunAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2RunAction::BeginOfRunAction(const G4Run*)
void RunAction::BeginOfRunAction(const G4Run*)
{
//inform the runManager to save random number seed
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
@@ -56,7 +58,10 @@ void B2RunAction::BeginOfRunAction(const G4Run*)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2RunAction::EndOfRunAction(const G4Run* )
void RunAction::EndOfRunAction(const G4Run* )
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,10 +24,10 @@
// ********************************************************************
//
//
/// \file B2TrackerHit.cc
/// \brief Implementation of the B2TrackerHit class
/// \file TrackerHit.cc
/// \brief Implementation of the B2::TrackerHit class
#include "B2TrackerHit.hh"
#include "TrackerHit.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
@@ -36,55 +36,30 @@
#include <iomanip>
G4ThreadLocal G4Allocator<B2TrackerHit>* B2TrackerHitAllocator = nullptr;
namespace B2
{
G4ThreadLocal G4Allocator<TrackerHit>* TrackerHitAllocator = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerHit::B2TrackerHit()
: G4VHit(),
fTrackID(-1),
fChamberNb(-1),
fEdep(0.),
fPos(G4ThreeVector())
TrackerHit::TrackerHit()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerHit::~B2TrackerHit() {}
TrackerHit::~TrackerHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerHit::B2TrackerHit(const B2TrackerHit& right)
: G4VHit()
{
fTrackID = right.fTrackID;
fChamberNb = right.fChamberNb;
fEdep = right.fEdep;
fPos = right.fPos;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const B2TrackerHit& B2TrackerHit::operator=(const B2TrackerHit& right)
{
fTrackID = right.fTrackID;
fChamberNb = right.fChamberNb;
fEdep = right.fEdep;
fPos = right.fPos;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool B2TrackerHit::operator==(const B2TrackerHit& right) const
G4bool TrackerHit::operator==(const TrackerHit& right) const
{
return ( this == &right ) ? true : false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2TrackerHit::Draw()
void TrackerHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
@@ -101,7 +76,7 @@ void B2TrackerHit::Draw()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2TrackerHit::Print()
void TrackerHit::Print()
{
G4cout
<< " trackID: " << fTrackID << " chamberNb: " << fChamberNb
@@ -113,3 +88,5 @@ void B2TrackerHit::Print()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}
@@ -24,39 +24,41 @@
// ********************************************************************
//
//
/// \file B2TrackerSD.cc
/// \brief Implementation of the B2TrackerSD class
/// \file TrackerSD.cc
/// \brief Implementation of the B2::TrackerSD class
#include "B2TrackerSD.hh"
#include "TrackerSD.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
namespace B2
{
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerSD::B2TrackerSD(const G4String& name,
const G4String& hitsCollectionName)
: G4VSensitiveDetector(name),
fHitsCollection(nullptr)
TrackerSD::TrackerSD(const G4String& name,
const G4String& hitsCollectionName)
: G4VSensitiveDetector(name)
{
collectionName.insert(hitsCollectionName);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
B2TrackerSD::~B2TrackerSD()
TrackerSD::~TrackerSD()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2TrackerSD::Initialize(G4HCofThisEvent* hce)
void TrackerSD::Initialize(G4HCofThisEvent* hce)
{
// Create hits collection
fHitsCollection
= new B2TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
= new TrackerHitsCollection(SensitiveDetectorName, collectionName[0]);
// Add this collection in hce
@@ -67,7 +69,7 @@ void B2TrackerSD::Initialize(G4HCofThisEvent* hce)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
G4bool TrackerSD::ProcessHits(G4Step* aStep,
G4TouchableHistory*)
{
// energy deposit
@@ -75,7 +77,7 @@ G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
if (edep==0.) return false;
B2TrackerHit* newHit = new B2TrackerHit();
TrackerHit* newHit = new TrackerHit();
newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchableHandle()
@@ -92,7 +94,7 @@ G4bool B2TrackerSD::ProcessHits(G4Step* aStep,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void B2TrackerSD::EndOfEvent(G4HCofThisEvent*)
void TrackerSD::EndOfEvent(G4HCofThisEvent*)
{
if ( verboseLevel>1 ) {
G4int nofHits = fHitsCollection->entries();
@@ -104,3 +106,6 @@ void B2TrackerSD::EndOfEvent(G4HCofThisEvent*)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
}