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
@@ -34,14 +34,6 @@
#include "OpNoviceStackingAction.hh"
#include "OpNoviceSteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceActionInitialization::OpNoviceActionInitialization()
: G4VUserActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceActionInitialization::~OpNoviceActionInitialization() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceActionInitialization::BuildForMaster() const
{
@@ -51,11 +43,10 @@ void OpNoviceActionInitialization::BuildForMaster() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceActionInitialization::Build() const
{
OpNovicePrimaryGeneratorAction* primary =
new OpNovicePrimaryGeneratorAction();
auto primary = new OpNovicePrimaryGeneratorAction();
SetUserAction(primary);
SetUserAction(new OpNoviceRunAction(primary));
OpNoviceEventAction* event = new OpNoviceEventAction();
auto event = new OpNoviceEventAction();
SetUserAction(event);
SetUserAction(new OpNoviceSteppingAction(event));
SetUserAction(new OpNoviceStackingAction());
@@ -47,15 +47,8 @@
OpNoviceDetectorConstruction::OpNoviceDetectorConstruction()
: G4VUserDetectorConstruction()
{
fDumpGdmlFileName = "OpNovice_dump.gdml";
fVerbose = false;
fDumpGdml = false;
// create a messenger for this class
fDetectorMessenger = new OpNoviceDetectorMessenger(this);
fWorld_x = fWorld_y = fWorld_z = 15.0 * m;
fExpHall_x = fExpHall_y = fExpHall_z = 10.0 * m;
fTank_x = fTank_y = fTank_z = 5.0 * m;
fBubble_x = fBubble_y = fBubble_z = 0.5 * m;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -73,17 +66,15 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
G4int nelements;
// Air
G4Element* N = new G4Element("Nitrogen", "N", z = 7, a = 14.01 * g / mole);
G4Element* O = new G4Element("Oxygen", "O", z = 8, a = 16.00 * g / mole);
G4Material* air =
new G4Material("Air", density = 1.29 * mg / cm3, nelements = 2);
auto N = new G4Element("Nitrogen", "N", z = 7, a = 14.01 * g / mole);
auto O = new G4Element("Oxygen", "O", z = 8, a = 16.00 * g / mole);
auto air = new G4Material("Air", density = 1.29 * mg / cm3, nelements = 2);
air->AddElement(N, 70. * perCent);
air->AddElement(O, 30. * perCent);
//
// Water
G4Element* H = new G4Element("Hydrogen", "H", z = 1, a = 1.01 * g / mole);
G4Material* water =
new G4Material("Water", density = 1.0 * g / cm3, nelements = 2);
auto H = new G4Element("Hydrogen", "H", z = 1, a = 1.01 * g / mole);
auto water = new G4Material("Water", density = 1.0 * g / cm3, nelements = 2);
water->AddElement(H, 2);
water->AddElement(O, 1);
@@ -126,7 +117,7 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
5.00, 6.00, 7.00, 8.00, 9.00, 8.00, 7.00, 6.00, 5.00, 4.00
};
G4MaterialPropertiesTable* myMPT1 = new G4MaterialPropertiesTable();
auto myMPT1 = new G4MaterialPropertiesTable();
// Values can be added to the material property table individually.
// With this method, spline interpolation cannot be set. Arguments
@@ -227,7 +218,7 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
1.0, 1.0, 1.0, 1.0 };
G4MaterialPropertiesTable* myMPT2 = new G4MaterialPropertiesTable();
auto myMPT2 = new G4MaterialPropertiesTable();
myMPT2->AddProperty("RINDEX", photonEnergy, refractiveIndex2);
G4cout << "Air G4MaterialPropertiesTable:" << G4endl;
@@ -238,57 +229,54 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
// ------------- Volumes --------------
//
// The world
G4Box* world_box = new G4Box("World", fWorld_x, fWorld_y, fWorld_z);
G4LogicalVolume* world_log =
new G4LogicalVolume(world_box, air, "World", 0, 0, 0);
auto world_box = new G4Box("World", fWorld_x, fWorld_y, fWorld_z);
auto world_log = new G4LogicalVolume(world_box, air, "World");
G4VPhysicalVolume* world_phys = new G4PVPlacement(
0, G4ThreeVector(), world_log, "world", 0, false, 0, checkOverlaps);
nullptr, G4ThreeVector(), world_log, "world", nullptr, false, 0,
checkOverlaps);
// The experimental Hall
G4Box* expHall_box = new G4Box("expHall", fExpHall_x, fExpHall_y, fExpHall_z);
G4LogicalVolume* expHall_log =
new G4LogicalVolume(expHall_box, air, "expHall", 0, 0, 0);
auto expHall_box = new G4Box("expHall", fExpHall_x, fExpHall_y, fExpHall_z);
auto expHall_log = new G4LogicalVolume(expHall_box, air, "expHall");
G4VPhysicalVolume* expHall_phys = new G4PVPlacement(
0, G4ThreeVector(), expHall_log, "expHall", world_log, false, 0);
nullptr, G4ThreeVector(), expHall_log, "expHall", world_log, false, 0);
// The Water Tank
G4Box* waterTank_box = new G4Box("Tank", fTank_x, fTank_y, fTank_z);
G4LogicalVolume* waterTank_log =
new G4LogicalVolume(waterTank_box, water, "Tank", 0, 0, 0);
auto waterTank_box = new G4Box("Tank", fTank_x, fTank_y, fTank_z);
auto waterTank_log = new G4LogicalVolume(waterTank_box, water, "Tank");
G4VPhysicalVolume* waterTank_phys = new G4PVPlacement(
0, G4ThreeVector(), waterTank_log, "Tank", expHall_log, false, 0);
nullptr, G4ThreeVector(), waterTank_log, "Tank", expHall_log, false, 0);
// The Air Bubble
G4Box* bubbleAir_box = new G4Box("Bubble", fBubble_x, fBubble_y, fBubble_z);
G4LogicalVolume* bubbleAir_log =
new G4LogicalVolume(bubbleAir_box, air, "Bubble", 0, 0, 0);
new G4PVPlacement(0, G4ThreeVector(0, 2.5 * m, 0), bubbleAir_log, "Bubble",
waterTank_log, false, 0);
auto bubbleAir_box = new G4Box("Bubble", fBubble_x, fBubble_y, fBubble_z);
auto bubbleAir_log = new G4LogicalVolume(bubbleAir_box, air, "Bubble");
new G4PVPlacement(nullptr, G4ThreeVector(0, 2.5 * m, 0), bubbleAir_log,
"Bubble", waterTank_log, false, 0);
// ------------- Surfaces --------------
// Water Tank
G4OpticalSurface* opWaterSurface = new G4OpticalSurface("WaterSurface");
auto opWaterSurface = new G4OpticalSurface("WaterSurface");
opWaterSurface->SetType(dielectric_LUTDAVIS);
opWaterSurface->SetFinish(Rough_LUT);
opWaterSurface->SetModel(DAVIS);
G4LogicalBorderSurface* waterSurface = new G4LogicalBorderSurface(
auto waterSurface = new G4LogicalBorderSurface(
"WaterSurface", waterTank_phys, expHall_phys, opWaterSurface);
G4OpticalSurface* opticalSurface = dynamic_cast<G4OpticalSurface*>(
auto opticalSurface = dynamic_cast<G4OpticalSurface*>(
waterSurface->GetSurface(waterTank_phys, expHall_phys)
->GetSurfaceProperty());
if(opticalSurface)
opticalSurface->DumpInfo();
// Air Bubble
G4OpticalSurface* opAirSurface = new G4OpticalSurface("AirSurface");
auto opAirSurface = new G4OpticalSurface("AirSurface");
opAirSurface->SetType(dielectric_dielectric);
opAirSurface->SetFinish(polished);
opAirSurface->SetModel(glisur);
G4LogicalSkinSurface* airSurface =
auto airSurface =
new G4LogicalSkinSurface("AirSurface", bubbleAir_log, opAirSurface);
opticalSurface = dynamic_cast<G4OpticalSurface*>(
@@ -304,7 +292,7 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
std::vector<G4double> reflectivity = { 0.3, 0.5 };
std::vector<G4double> efficiency = { 0.8, 1.0 };
G4MaterialPropertiesTable* myST2 = new G4MaterialPropertiesTable();
auto myST2 = new G4MaterialPropertiesTable();
myST2->AddProperty("REFLECTIVITY", ephoton, reflectivity);
myST2->AddProperty("EFFICIENCY", ephoton, efficiency);
@@ -317,7 +305,7 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
if(fDumpGdml)
{
G4GDMLParser* parser = new G4GDMLParser();
auto parser = new G4GDMLParser();
parser->Write(fDumpGdmlFileName, world_phys);
}
@@ -76,8 +76,7 @@ OpNoviceDetectorMessenger::~OpNoviceDetectorMessenger()
void OpNoviceDetectorMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
OpNoviceDetectorConstruction* dc1 =
dynamic_cast<OpNoviceDetectorConstruction*>(fOpNoviceDetCon);
auto dc1 = dynamic_cast<OpNoviceDetectorConstruction*>(fOpNoviceDetCon);
if(dc1 != nullptr)
{
if(command == fVerboseCmd)
@@ -89,8 +88,7 @@ void OpNoviceDetectorMessenger::SetNewValue(G4UIcommand* command,
}
else
{
OpNoviceGDMLDetectorConstruction* dc2 =
dynamic_cast<OpNoviceGDMLDetectorConstruction*>(fOpNoviceDetCon);
auto dc2 = dynamic_cast<OpNoviceGDMLDetectorConstruction*>(fOpNoviceDetCon);
if(command == fVerboseCmd)
dc2->SetVerbose(fVerboseCmd->GetNewBoolValue(newValue));
if(command == fDumpGdmlCmd)
@@ -35,19 +35,6 @@
#include "G4Event.hh"
#include "G4RunManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceEventAction::OpNoviceEventAction()
: G4UserEventAction()
{
fRayleigh = 0;
fAbsorption = 0;
fMie = 0;
fBoundary = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceEventAction::~OpNoviceEventAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceEventAction::BeginOfEventAction(const G4Event*)
{
@@ -60,7 +47,7 @@ void OpNoviceEventAction::BeginOfEventAction(const G4Event*)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceEventAction::EndOfEventAction(const G4Event*)
{
OpNoviceRun* run = static_cast<OpNoviceRun*>(
auto run = static_cast<OpNoviceRun*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
run->AddRayleigh(fRayleigh);
run->AddAbsorption(fAbsorption);
@@ -40,9 +40,6 @@ OpNoviceGDMLDetectorConstruction::OpNoviceGDMLDetectorConstruction(
G4String fname)
: G4VUserDetectorConstruction()
{
fDumpGdmlFileName = "OpNovice_dump.gdml";
fVerbose = false;
fDumpGdml = false;
fGdmlFile = fname;
// create a messenger for this class
fDetectorMessenger = new OpNoviceDetectorMessenger(this);
@@ -78,7 +75,7 @@ void OpNoviceGDMLDetectorConstruction::ReadGDML()
G4VPhysicalVolume* world = fParser->GetWorldVolume();
// GDML parser makes world invisible. make it visible again.
G4LogicalVolume* pworldLogical = world->GetLogicalVolume();
pworldLogical->SetVisAttributes(0);
pworldLogical->SetVisAttributes(nullptr);
G4cout << world->GetTranslation() << G4endl << G4endl;
if(fVerbose)
{
@@ -38,31 +38,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceRun::OpNoviceRun()
: G4Run()
{
fParticle = nullptr;
fEnergy = -1.;
fCerenkovCounter = 0.;
fCerenkov2 = 0.;
fScintillationCounter = 0.;
fScintillation2 = 0.;
fRayleighCounter = 0.;
fRayleigh2 = 0.;
fAbsorptionCounter = 0.;
fAbsorption2 = 0.;
fMieCounter = 0.;
fMie2 = 0.;
fBoundaryCounter = 0.;
fBoundary2 = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceRun::~OpNoviceRun() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceRun::SetPrimary(G4ParticleDefinition* particle, G4double energy)
{
fParticle = particle;
@@ -73,7 +48,7 @@ void OpNoviceRun::SetPrimary(G4ParticleDefinition* particle, G4double energy)
void OpNoviceRun::Merge(const G4Run* run)
{
const OpNoviceRun* localRun = static_cast<const OpNoviceRun*>(run);
const auto localRun = static_cast<const OpNoviceRun*>(run);
fParticle = localRun->fParticle;
fEnergy = localRun->fEnergy;
@@ -100,7 +75,7 @@ void OpNoviceRun::EndOfRun()
{
if(numberOfEvent == 0)
return;
G4double TotNbofEvents = G4double(numberOfEvent);
auto TotNbofEvents = G4double(numberOfEvent);
fCerenkovCounter /= TotNbofEvents;
fCerenkov2 /= TotNbofEvents;
@@ -42,9 +42,6 @@ OpNoviceRunAction::OpNoviceRunAction(OpNovicePrimaryGeneratorAction* prim)
, fPrimary(prim)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceRunAction::~OpNoviceRunAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Run* OpNoviceRunAction::GenerateRun()
{
@@ -38,17 +38,6 @@
#include "G4Track.hh"
#include "G4VProcess.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceStackingAction::OpNoviceStackingAction()
: G4UserStackingAction()
, fScintillationCounter(0)
, fCerenkovCounter(0)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceStackingAction::~OpNoviceStackingAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ClassificationOfNewTrack OpNoviceStackingAction::ClassifyNewTrack(
const G4Track* aTrack)
@@ -74,7 +63,7 @@ void OpNoviceStackingAction::NewStage()
// G4cout << "Number of Cerenkov photons produced in this event : "
// << fCerenkovCounter << G4endl;
OpNoviceRun* run = static_cast<OpNoviceRun*>(
auto run = static_cast<OpNoviceRun*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
run->AddScintillation((G4double) fScintillationCounter);
run->AddCerenkov((G4double) fCerenkovCounter);
@@ -43,9 +43,6 @@ OpNoviceSteppingAction::OpNoviceSteppingAction(OpNoviceEventAction* event)
, fEventAction(event)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceSteppingAction::~OpNoviceSteppingAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceSteppingAction::UserSteppingAction(const G4Step* step)
{
@@ -60,11 +57,11 @@ void OpNoviceSteppingAction::UserSteppingAction(const G4Step* step)
G4StepPoint* endPoint = step->GetPostStepPoint();
const G4VProcess* pds = endPoint->GetProcessDefinedStep();
G4String procname = pds->GetProcessName();
if(procname.compare("OpRayleigh") == 0)
if(procname == "OpRayleigh")
fEventAction->AddRayleigh();
else if(procname.compare("OpAbsorption") == 0)
else if(procname == "OpAbsorption")
fEventAction->AddAbsorption();
else if(procname.compare("OpMieHG") == 0)
else if(procname == "OpMieHG")
fEventAction->AddMie();
// for boundary scattering, process name in 'transportation'.
@@ -80,8 +77,7 @@ void OpNoviceSteppingAction::UserSteppingAction(const G4Step* step)
{
G4VProcess* currentProcess = (*postStepDoItVector)[i];
G4OpBoundaryProcess* opProc =
dynamic_cast<G4OpBoundaryProcess*>(currentProcess);
auto opProc = dynamic_cast<G4OpBoundaryProcess*>(currentProcess);
if(opProc)
theStatus = opProc->GetStatus();
}