Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -28,7 +28,6 @@
/// \brief Implementation of the OpNoviceActionInitialization class
#include "OpNoviceActionInitialization.hh"
#include "OpNoviceEventAction.hh"
#include "OpNovicePrimaryGeneratorAction.hh"
#include "OpNoviceRunAction.hh"
@@ -36,24 +35,20 @@
#include "OpNoviceSteppingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceActionInitialization::OpNoviceActionInitialization()
: G4VUserActionInitialization()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceActionInitialization::~OpNoviceActionInitialization() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceActionInitialization::BuildForMaster() const
{
SetUserAction(new OpNoviceRunAction());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceActionInitialization::Build() const
{
OpNovicePrimaryGeneratorAction* primary =
@@ -29,10 +29,9 @@
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "OpNoviceDetectorConstruction.hh"
#include "OpNoviceDetectorConstructionMessenger.hh"
#include "G4Box.hh"
#include "G4Element.hh"
#include "G4LogicalBorderSurface.hh"
@@ -43,49 +42,48 @@
#include "G4PVPlacement.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4GDMLParser.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceDetectorConstruction::OpNoviceDetectorConstruction()
: G4VUserDetectorConstruction()
{
DumpgdmlFile = "OpNovice_dump.gdml";
verbose = false;
dumpgdml = false;
// create a messenger for this class
fDetectorMessenger = new OpNoviceDetectorConstructionMessenger(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......
OpNoviceDetectorConstruction::~OpNoviceDetectorConstruction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
{
G4bool checkOverlaps = true;
// ------------- Materials -------------
G4double a, z, density;
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);
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);
water->AddElement(H, 2);
water->AddElement(O, 1);
// ------------ Generate & Add Material Properties Table ------------
//
std::vector<G4double> photonEnergy = {
@@ -96,7 +94,6 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
3.353 * eV, 3.446 * eV, 3.545 * eV, 3.649 * eV, 3.760 * eV, 3.877 * eV,
4.002 * eV, 4.136 * eV
};
// Water
//
std::vector<G4double> refractiveIndex1 = {
@@ -105,7 +102,6 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
1.3522, 1.3530, 1.3535, 1.354, 1.3545, 1.355, 1.3555, 1.356,
1.3568, 1.3572, 1.358, 1.3585, 1.359, 1.3595, 1.36, 1.3608
};
std::vector<G4double> absorption = {
3.448 * m, 4.082 * m, 6.329 * m, 9.174 * m, 12.346 * m, 13.889 * m,
15.152 * m, 17.241 * m, 18.868 * m, 20.000 * m, 26.316 * m, 35.714 * m,
@@ -114,35 +110,45 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
30.000 * m, 28.500 * m, 27.000 * m, 24.500 * m, 22.000 * m, 19.500 * m,
17.500 * m, 14.500 * m
};
std::vector<G4double> scintilFast = {
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00
};
std::vector<G4double> scintilSlow = {
0.01, 1.00, 2.00, 3.00, 4.00, 5.00, 6.00, 7.00, 8.00, 9.00, 8.00,
7.00, 6.00, 4.00, 3.00, 2.00, 1.00, 0.01, 1.00, 2.00, 3.00, 4.00,
5.00, 6.00, 7.00, 8.00, 9.00, 8.00, 7.00, 6.00, 5.00, 4.00
};
G4MaterialPropertiesTable* myMPT1 = new G4MaterialPropertiesTable();
myMPT1->AddProperty("RINDEX", photonEnergy, refractiveIndex1)
// Values can be added to the material property table individually.
// Check that group velocity is calculated from RINDEX
myMPT1->AddProperty("RINDEX", &photonEnergy[0], &refractiveIndex1[0], 1)
->SetSpline(true);
for(size_t i = 1; i < photonEnergy.size(); ++i)
{
myMPT1->AddEntry("RINDEX", photonEnergy[i], refractiveIndex1[i]);
}
if(myMPT1->GetProperty("RINDEX")->GetVectorLength() !=
myMPT1->GetProperty("GROUPVEL")->GetVectorLength())
{
G4ExceptionDescription ed;
ed << "Error calculating group velocities. Incorrect number of entries "
"in group velocity material property vector.";
G4Exception("OpNovice::OpNoviceDetectorConstruction", "OpNovice001",
FatalException, ed);
}
myMPT1->AddProperty("ABSLENGTH", photonEnergy, absorption)->SetSpline(true);
myMPT1->AddProperty("FASTCOMPONENT", photonEnergy, scintilFast)
myMPT1->AddProperty("SCINTILLATIONCOMPONENT1", photonEnergy, scintilFast)
->SetSpline(true);
myMPT1->AddProperty("SLOWCOMPONENT", photonEnergy, scintilSlow)
myMPT1->AddProperty("SCINTILLATIONCOMPONENT2", photonEnergy, scintilSlow)
->SetSpline(true);
myMPT1->AddConstProperty("SCINTILLATIONYIELD", 50. / MeV);
myMPT1->AddConstProperty("RESOLUTIONSCALE", 1.0);
myMPT1->AddConstProperty("FASTTIMECONSTANT", 1. * ns);
myMPT1->AddConstProperty("SLOWTIMECONSTANT", 10. * ns);
myMPT1->AddConstProperty("YIELDRATIO", 0.8);
myMPT1->AddConstProperty("SCINTILLATIONTIMECONSTANT1", 1. * ns);
myMPT1->AddConstProperty("SCINTILLATIONTIMECONSTANT2", 10. * ns);
myMPT1->AddConstProperty("SCINTILLATIONYIELD1", 0.8);
myMPT1->AddConstProperty("SCINTILLATIONYIELD2", 0.2);
std::vector<G4double> energy_water = {
1.56962 * eV, 1.58974 * eV, 1.61039 * eV, 1.63157 * eV, 1.65333 * eV,
1.67567 * eV, 1.69863 * eV, 1.72222 * eV, 1.74647 * eV, 1.77142 * eV,
@@ -159,7 +165,6 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
};
// Rayleigh scattering length calculated by G4OpRayleigh
// assume 100 times larger than the rayleigh scattering for now.
std::vector<G4double> mie_water = {
167024.4 * m, 158726.7 * m, 150742 * m, 143062.5 * m, 135680.2 * m,
@@ -209,39 +214,35 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
air->SetMaterialPropertiesTable(myMPT2);
// ------------- 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);
G4VPhysicalVolume* world_phys = new G4PVPlacement(
0, G4ThreeVector(), world_log, "world", 0, false, 0, checkOverlaps);
// The experimental Hall
//
G4Box* expHall_box = new G4Box("World", fExpHall_x, fExpHall_y, fExpHall_z);
G4Box* expHall_box = new G4Box("expHall", fExpHall_x, fExpHall_y, fExpHall_z);
G4LogicalVolume* expHall_log =
new G4LogicalVolume(expHall_box, air, "World", 0, 0, 0);
G4VPhysicalVolume* expHall_phys =
new G4PVPlacement(0, G4ThreeVector(), expHall_log, "World", 0, false, 0);
new G4LogicalVolume(expHall_box, air, "expHall", 0, 0, 0);
G4VPhysicalVolume* expHall_phys = new G4PVPlacement(
0, 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);
G4VPhysicalVolume* waterTank_phys = new G4PVPlacement(
0, 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);
// ------------- Surfaces --------------
// Water Tank
//
G4OpticalSurface* opWaterSurface = new G4OpticalSurface("WaterSurface");
@@ -285,13 +286,43 @@ G4VPhysicalVolume* OpNoviceDetectorConstruction::Construct()
myST2->AddProperty("REFLECTIVITY", ephoton, reflectivity);
myST2->AddProperty("EFFICIENCY", ephoton, efficiency);
G4cout << "Air Surface G4MaterialPropertiesTable:" << G4endl;
myST2->DumpTable();
if(verbose)
{
G4cout << "Air Surface G4MaterialPropertiesTable:" << G4endl;
myST2->DumpTable();
}
opAirSurface->SetMaterialPropertiesTable(myST2);
return expHall_phys;
if(dumpgdml)
{
G4GDMLParser* parser = new G4GDMLParser();
parser->Write(DumpgdmlFile, world_phys);
}
return world_phys;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceDetectorConstruction::SetDumpgdml(G4bool dumpgdml1)
{
this->dumpgdml = dumpgdml1;
}
G4bool OpNoviceDetectorConstruction::IsDumpgdml() const { return dumpgdml; }
void OpNoviceDetectorConstruction::SetVerbose(G4bool verbose1)
{
this->verbose = verbose1;
}
G4bool OpNoviceDetectorConstruction::IsVerbose() const { return verbose; }
void OpNoviceDetectorConstruction::SetDumpgdmlFile(G4String DumpgdmlFile1)
{
this->DumpgdmlFile = DumpgdmlFile1;
}
G4String OpNoviceDetectorConstruction::GetDumpgdmlFile() const
{
return DumpgdmlFile;
}
@@ -0,0 +1,88 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Geant4 headers
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAString.hh"
// project headers
#include "OpNoviceDetectorConstructionMessenger.hh"
#include "OpNoviceDetectorConstruction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceDetectorConstructionMessenger::OpNoviceDetectorConstructionMessenger(
OpNoviceDetectorConstruction* detcon)
: G4UImessenger()
, fOpNoviceDetCon(detcon)
{
fDetConDir = new G4UIdirectory("/OpNovice/DetectorConstruction/");
fDetConDir->SetGuidance("Configuring Detector Construction");
//
fverboseCmd =
new G4UIcmdWithABool("/OpNovice/DetectorConstruction/enable_verbose", this);
fverboseCmd->SetGuidance("Set flag for enabling verbose diagnostic printout");
fverboseCmd->SetParameterName("enable_verbose", false);
fverboseCmd->SetDefaultValue(false);
fverboseCmd->AvailableForStates(G4State_PreInit);
fdumpGdmlCmd =
new G4UIcmdWithABool("/OpNovice/DetectorConstruction/dumpgdml", this);
fdumpGdmlCmd->SetGuidance(
"Set flag for enabling dumping the detector to a gdml file");
fdumpGdmlCmd->SetParameterName("dumpgdml", false);
fdumpGdmlCmd->SetDefaultValue(false);
fdumpGdmlCmd->AvailableForStates(G4State_PreInit);
fdumpGdmlFileNameCmd = new G4UIcmdWithAString(
"/OpNovice/DetectorConstruction/DumpGDMLFileName", this);
fdumpGdmlFileNameCmd->SetGuidance("Enter file name to dump gdml file ");
fdumpGdmlFileNameCmd->SetParameterName("GDMLFileName", true);
fdumpGdmlFileNameCmd->SetDefaultValue("OpNovice_dump.gdml");
fdumpGdmlFileNameCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceDetectorConstructionMessenger::~OpNoviceDetectorConstructionMessenger()
{
delete fDetConDir;
delete fverboseCmd;
delete fdumpGdmlCmd;
delete fdumpGdmlFileNameCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceDetectorConstructionMessenger::SetNewValue(G4UIcommand* command,
G4String newValue)
{
if(command == fverboseCmd)
fOpNoviceDetCon->SetVerbose(fverboseCmd->GetNewBoolValue(newValue));
if(command == fdumpGdmlCmd)
fOpNoviceDetCon->SetDumpgdml(fdumpGdmlCmd->GetNewBoolValue(newValue));
if(command == fdumpGdmlFileNameCmd)
fOpNoviceDetCon->SetDumpgdmlFile(newValue);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -31,14 +31,11 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "OpNoviceEventAction.hh"
#include "OpNoviceRun.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceEventAction::OpNoviceEventAction()
: G4UserEventAction()
{
@@ -49,11 +46,9 @@ OpNoviceEventAction::OpNoviceEventAction()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceEventAction::~OpNoviceEventAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceEventAction::BeginOfEventAction(const G4Event*)
{
fRayleigh = 0;
@@ -63,16 +58,13 @@ void OpNoviceEventAction::BeginOfEventAction(const G4Event*)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceEventAction::EndOfEventAction(const G4Event*)
{
OpNoviceRun* run = static_cast<OpNoviceRun*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
run->AddRayleigh(fRayleigh);
run->AddAbsorption(fAbsorption);
run->AddMie(fMie);
run->AddBoundary(fBoundary);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Geant4 headers
#include "G4RunManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4VisAttributes.hh"
#include "G4NistManager.hh"
#include "globals.hh"
#include "G4GDMLParser.hh"
// project headers
#include "OpNoviceGDMLDetectorConstruction.hh"
#include "OpNoviceGDMLDetectorConstructionMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceGDMLDetectorConstruction::OpNoviceGDMLDetectorConstruction(G4String fname)
: G4VUserDetectorConstruction() {
fDumpgdmlFile = "OpNovice_dump.gdml";
fverbose = false;
fdumpgdml = false;
gdmlFile = fname;
// create a messenger for this class
fDetectorMessenger = new OpNoviceGDMLDetectorConstructionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceGDMLDetectorConstruction::~OpNoviceGDMLDetectorConstruction() {
delete fDetectorMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume *OpNoviceGDMLDetectorConstruction::Construct() {
ReadGDML();
G4VPhysicalVolume *worldPhysVol = parser->GetWorldVolume();
if (fdumpgdml) parser->Write(fDumpgdmlFile, worldPhysVol);
return worldPhysVol;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceGDMLDetectorConstruction::ConstructSDandField() {
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceGDMLDetectorConstruction::ReadGDML() {
parser = new G4GDMLParser();
parser->Read(gdmlFile, false);
G4VPhysicalVolume *world = parser->GetWorldVolume();
//----- GDML parser makes world invisible, this is a hack to make it
//visible again...
G4LogicalVolume *pworldLogical = world->GetLogicalVolume();
pworldLogical->SetVisAttributes(0);
G4cout << world->GetTranslation() << G4endl << G4endl;
if (fverbose) {
G4cout << "Found world: " << world-> GetName() << G4endl;
G4cout << "world LV: " << world->GetLogicalVolume()->GetName() << G4endl;
}
G4LogicalVolumeStore *pLVStore = G4LogicalVolumeStore::GetInstance();
if (fverbose) {
G4cout << "Found " << pLVStore->size()
<< " logical volumes."
<< G4endl << G4endl;
}
G4PhysicalVolumeStore *pPVStore = G4PhysicalVolumeStore::GetInstance();
if (fverbose) {
G4cout << "Found " << pPVStore->size()
<< " physical volumes."
<< G4endl << G4endl;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceGDMLDetectorConstruction::UpdateGeometry() {
G4RunManager::GetRunManager()->DefineWorldVolume(Construct());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceGDMLDetectorConstruction::SetDumpgdml(G4bool fdumpgdml1) {
this->fdumpgdml = fdumpgdml1;
}
G4bool OpNoviceGDMLDetectorConstruction::IsDumpgdml() const {
return fdumpgdml;
}
void OpNoviceGDMLDetectorConstruction::SetVerbose(G4bool fverbose1) {
this->fverbose = fverbose1;
}
G4bool OpNoviceGDMLDetectorConstruction::IsVerbose() const {
return fverbose;
}
void OpNoviceGDMLDetectorConstruction::SetDumpgdmlFile(G4String fDumpgdmlFile1) {
this->fDumpgdmlFile = fDumpgdmlFile1;
}
G4String OpNoviceGDMLDetectorConstruction::GetDumpgdmlFile() const {
return fDumpgdmlFile;
}
@@ -0,0 +1,87 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// Geant4 headers
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAString.hh"
// project headers
#include "OpNoviceGDMLDetectorConstructionMessenger.hh"
#include "OpNoviceGDMLDetectorConstruction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceGDMLDetectorConstructionMessenger::
OpNoviceGDMLDetectorConstructionMessenger(
OpNoviceGDMLDetectorConstruction* detcon)
: G4UImessenger()
, fOpNoviceDetCon(detcon)
{
fDetConDir = new G4UIdirectory("/OpNovice/DetectorConstruction/");
fDetConDir->SetGuidance("Configuring Detector Construction");
//
verboseCmd =
new G4UIcmdWithABool("/OpNovice/DetectorConstruction/enable_verbose", this);
verboseCmd->SetGuidance("Set flag for enabling verbose diagnostic printout");
verboseCmd->SetParameterName("enable_verbose", false);
verboseCmd->SetDefaultValue(false);
verboseCmd->AvailableForStates(G4State_PreInit);
dumpGdmlCmd =
new G4UIcmdWithABool("/OpNovice/DetectorConstruction/dumpgdml", this);
dumpGdmlCmd->SetGuidance(
"Set flag for enabling dumping the detector to a gdml file");
dumpGdmlCmd->SetParameterName("dumpgdml", false);
dumpGdmlCmd->SetDefaultValue(false);
dumpGdmlCmd->AvailableForStates(G4State_PreInit);
dumpGdmlFileNameCmd = new G4UIcmdWithAString(
"/OpNovice/DetectorConstruction/DumpGDMLFileName", this);
dumpGdmlFileNameCmd->SetGuidance("Enter file name to dump gdml file ");
dumpGdmlFileNameCmd->SetParameterName("GDMLFileName", true);
dumpGdmlFileNameCmd->SetDefaultValue("OpNovice_dump.gdml");
dumpGdmlFileNameCmd->AvailableForStates(G4State_PreInit);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceGDMLDetectorConstructionMessenger::
~OpNoviceGDMLDetectorConstructionMessenger()
{
delete fDetConDir;
delete verboseCmd;
delete dumpGdmlCmd;
delete dumpGdmlFileNameCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceGDMLDetectorConstructionMessenger::SetNewValue(
G4UIcommand* command, G4String newValue)
{
if(command == verboseCmd)
fOpNoviceDetCon->SetVerbose(verboseCmd->GetNewBoolValue(newValue));
if(command == dumpGdmlCmd)
fOpNoviceDetCon->SetDumpgdml(dumpGdmlCmd->GetNewBoolValue(newValue));
if(command == dumpGdmlFileNameCmd)
fOpNoviceDetCon->SetDumpgdmlFile(newValue);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,9 +32,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "OpNovicePrimaryGeneratorAction.hh"
#include "OpNovicePrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleGun.hh"
@@ -43,17 +41,14 @@
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNovicePrimaryGeneratorAction::OpNovicePrimaryGeneratorAction()
: G4VUserPrimaryGeneratorAction()
, fParticleGun(nullptr)
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
// create a messenger for this class
fGunMessenger = new OpNovicePrimaryGeneratorMessenger(this);
// default kinematic
//
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
@@ -67,7 +62,6 @@ OpNovicePrimaryGeneratorAction::OpNovicePrimaryGeneratorAction()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNovicePrimaryGeneratorAction::~OpNovicePrimaryGeneratorAction()
{
delete fParticleGun;
@@ -75,14 +69,12 @@ OpNovicePrimaryGeneratorAction::~OpNovicePrimaryGeneratorAction()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNovicePrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
fParticleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNovicePrimaryGeneratorAction::SetOptPhotonPolar()
{
G4double angle = G4UniformRand() * 360.0 * deg;
@@ -90,7 +82,6 @@ void OpNovicePrimaryGeneratorAction::SetOptPhotonPolar()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNovicePrimaryGeneratorAction::SetOptPhotonPolar(G4double angle)
{
if(fParticleGun->GetParticleDefinition()->GetParticleName() !=
@@ -117,5 +108,4 @@ void OpNovicePrimaryGeneratorAction::SetOptPhotonPolar(G4double angle)
std::cos(angle) * e_paralle + std::sin(angle) * e_perpend;
fParticleGun->SetParticlePolarization(polar);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,9 +32,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "OpNovicePrimaryGeneratorMessenger.hh"
#include "OpNovicePrimaryGeneratorAction.hh"
#include "G4SystemOfUnits.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIdirectory.hh"
@@ -86,5 +84,4 @@ void OpNovicePrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -32,7 +32,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "OpNoviceRun.hh"
#include "G4ParticleDefinition.hh"
#include "G4Run.hh"
#include "G4UnitsTable.hh"
@@ -29,18 +29,13 @@
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "OpNoviceRunAction.hh"
#include "OpNovicePrimaryGeneratorAction.hh"
#include "OpNoviceRun.hh"
#include "G4ParticleDefinition.hh"
#include "G4Run.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceRunAction::OpNoviceRunAction(OpNovicePrimaryGeneratorAction* prim)
: G4UserRunAction()
, fRun(nullptr)
@@ -48,9 +43,9 @@ OpNoviceRunAction::OpNoviceRunAction(OpNovicePrimaryGeneratorAction* prim)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceRunAction::~OpNoviceRunAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Run* OpNoviceRunAction::GenerateRun()
{
fRun = new OpNoviceRun();
@@ -58,7 +53,6 @@ G4Run* OpNoviceRunAction::GenerateRun()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceRunAction::BeginOfRunAction(const G4Run*)
{
if(fPrimary)
@@ -71,11 +65,9 @@ void OpNoviceRunAction::BeginOfRunAction(const G4Run*)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceRunAction::EndOfRunAction(const G4Run*)
{
if(isMaster)
fRun->EndOfRun();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -31,9 +31,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "OpNoviceStackingAction.hh"
#include "OpNoviceRun.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
@@ -50,11 +48,9 @@ OpNoviceStackingAction::OpNoviceStackingAction()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceStackingAction::~OpNoviceStackingAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ClassificationOfNewTrack OpNoviceStackingAction::ClassifyNewTrack(
const G4Track* aTrack)
{
@@ -72,7 +68,6 @@ G4ClassificationOfNewTrack OpNoviceStackingAction::ClassifyNewTrack(
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceStackingAction::NewStage()
{
// G4cout << "Number of Scintillation photons produced in this event : "
@@ -87,11 +82,9 @@ void OpNoviceStackingAction::NewStage()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceStackingAction::PrepareNewEvent()
{
fScintillationCounter = 0;
fCerenkovCounter = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -28,9 +28,7 @@
/// \brief Implementation of the OpNoviceSteppingAction class
#include "OpNoviceSteppingAction.hh"
#include "OpNoviceRun.hh"
#include "G4Event.hh"
#include "G4OpBoundaryProcess.hh"
#include "G4OpticalPhoton.hh"
@@ -46,11 +44,9 @@ OpNoviceSteppingAction::OpNoviceSteppingAction(OpNoviceEventAction* event)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
OpNoviceSteppingAction::~OpNoviceSteppingAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void OpNoviceSteppingAction::UserSteppingAction(const G4Step* step)
{
static G4ParticleDefinition* opticalphoton =
@@ -97,5 +93,4 @@ void OpNoviceSteppingAction::UserSteppingAction(const G4Step* step)
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......