diff --git a/src/simplebuild_dgcode/data/pkgs/G4/Components/G4StdGeometries/pycpp_GeoEmptyWorld/geometry_module.cc b/src/simplebuild_dgcode/data/pkgs/G4/Components/G4StdGeometries/pycpp_GeoEmptyWorld/geometry_module.cc index 44f51a1..d0f8c21 100644 --- a/src/simplebuild_dgcode/data/pkgs/G4/Components/G4StdGeometries/pycpp_GeoEmptyWorld/geometry_module.cc +++ b/src/simplebuild_dgcode/data/pkgs/G4/Components/G4StdGeometries/pycpp_GeoEmptyWorld/geometry_module.cc @@ -4,12 +4,12 @@ #include "G4Interfaces/GeoConstructPyExport.hh" -class GeoEmptyWorld : public G4Interfaces::GeoConstructBase +class GeoEmptyWorld final : public G4Interfaces::GeoConstructBase { public: GeoEmptyWorld(); virtual ~GeoEmptyWorld(){} - G4VPhysicalVolume* Construct(); + G4VPhysicalVolume* Construct() override; }; PYTHON_MODULE( mod ) { GeoConstructPyExport::exportGeo(mod, "GeoEmptyWorld"); } diff --git a/src/simplebuild_dgcode/data/pkgs/G4/Components/G4StdGeometries/pycpp_GeoSlab/geometry_module.cc b/src/simplebuild_dgcode/data/pkgs/G4/Components/G4StdGeometries/pycpp_GeoSlab/geometry_module.cc index 36b1a7e..d6ff1b1 100644 --- a/src/simplebuild_dgcode/data/pkgs/G4/Components/G4StdGeometries/pycpp_GeoSlab/geometry_module.cc +++ b/src/simplebuild_dgcode/data/pkgs/G4/Components/G4StdGeometries/pycpp_GeoSlab/geometry_module.cc @@ -4,12 +4,12 @@ #include "G4Interfaces/GeoConstructPyExport.hh" -class GeoSlab : public G4Interfaces::GeoConstructBase +class GeoSlab final : public G4Interfaces::GeoConstructBase { public: GeoSlab(); virtual ~GeoSlab(){} - G4VPhysicalVolume* Construct(); + G4VPhysicalVolume* Construct() override; bool validateParameters() override; }; diff --git a/src/simplebuild_dgcode/data/pkgs/G4/G4Interfaces/libinc/GeoConstructBase.hh b/src/simplebuild_dgcode/data/pkgs/G4/G4Interfaces/libinc/GeoConstructBase.hh index 28785cd..4c5a0c3 100644 --- a/src/simplebuild_dgcode/data/pkgs/G4/G4Interfaces/libinc/GeoConstructBase.hh +++ b/src/simplebuild_dgcode/data/pkgs/G4/G4Interfaces/libinc/GeoConstructBase.hh @@ -10,8 +10,7 @@ namespace G4Interfaces { //NB: Very important for python export that first listed base-class is GeoBase! - class GeoConstructBase : public GeoBase, public G4VUserDetectorConstruction - { + class GeoConstructBase : public GeoBase, public G4VUserDetectorConstruction { public: //Derived classes must: // diff --git a/src/simplebuild_dgcode/data/pkgs/G4/G4Interfaces/libinc/PhysicsListPyExport.hh b/src/simplebuild_dgcode/data/pkgs/G4/G4Interfaces/libinc/PhysicsListPyExport.hh index ac0995e..d8b7e12 100644 --- a/src/simplebuild_dgcode/data/pkgs/G4/G4Interfaces/libinc/PhysicsListPyExport.hh +++ b/src/simplebuild_dgcode/data/pkgs/G4/G4Interfaces/libinc/PhysicsListPyExport.hh @@ -13,11 +13,11 @@ namespace PhysicsListPyExport { template - class Provider : public G4Interfaces::PhysListProviderBase { + class Provider final : public G4Interfaces::PhysListProviderBase { public: Provider(const char*name) : G4Interfaces::PhysListProviderBase(name) {} virtual ~Provider(){} - virtual G4VUserPhysicsList * construct() { + G4VUserPhysicsList * construct() override { return new T; } }; diff --git a/src/simplebuild_dgcode/data/pkgs_val/Examples/G4Examples/app_visexamplecpp/main.cc b/src/simplebuild_dgcode/data/pkgs_val/Examples/G4Examples/app_visexamplecpp/main.cc index 7efb373..4d963d5 100644 --- a/src/simplebuild_dgcode/data/pkgs_val/Examples/G4Examples/app_visexamplecpp/main.cc +++ b/src/simplebuild_dgcode/data/pkgs_val/Examples/G4Examples/app_visexamplecpp/main.cc @@ -9,30 +9,32 @@ #include "G4UIterminal.hh" #include "G4UItcsh.hh" -class DummyGeo : public G4Interfaces::GeoConstructBase { -public: - - DummyGeo() : GeoConstructBase("DummyGeo") - { - addParameterDouble("boxThickness",1*Units::um,0.01*Units::um,300*Units::cm); - } - - G4VPhysicalVolume* Construct() - { - G4Material* mat_galactic = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic",true); - G4Material* mat_boroncarbide = G4NistManager::Instance()->FindOrBuildMaterial("G4_BORON_CARBIDE",true); - G4Box* solidWorld = new G4Box("World", 10*Units::meter,10*Units::meter,10*Units::meter); - G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, mat_galactic, "World"); - auto pv_world = new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicWorld, "World", 0, false, 0); - G4Box* solidBox = new G4Box("SldSomeBox", 5*Units::meter,5*Units::meter,getParameterDouble("boxThickness")*0.5); - auto logicBox= new G4LogicalVolume(solidBox, mat_boroncarbide, "LVSomeBox"); - new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0),"PVSomeBox", logicBox, pv_world, false, 0, true); - - logicWorld -> SetVisAttributes (G4VisAttributes::GetInvisible()); - - return pv_world; - } -}; +namespace { + class DummyGeo final : public G4Interfaces::GeoConstructBase { + public: + + DummyGeo() : GeoConstructBase("DummyGeo") + { + addParameterDouble("boxThickness",1*Units::um,0.01*Units::um,300*Units::cm); + } + + G4VPhysicalVolume* Construct() override + { + G4Material* mat_galactic = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic",true); + G4Material* mat_boroncarbide = G4NistManager::Instance()->FindOrBuildMaterial("G4_BORON_CARBIDE",true); + G4Box* solidWorld = new G4Box("World", 10*Units::meter,10*Units::meter,10*Units::meter); + G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, mat_galactic, "World"); + auto pv_world = new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicWorld, "World", 0, false, 0); + G4Box* solidBox = new G4Box("SldSomeBox", 5*Units::meter,5*Units::meter,getParameterDouble("boxThickness")*0.5); + auto logicBox= new G4LogicalVolume(solidBox, mat_boroncarbide, "LVSomeBox"); + new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0),"PVSomeBox", logicBox, pv_world, false, 0, true); + + logicWorld -> SetVisAttributes (G4VisAttributes::GetInvisible()); + + return pv_world; + } + }; +} int main(int,char**) { diff --git a/src/simplebuild_dgcode/data/pkgs_val/SkeletonSP/G4GeoSkeletonSP/pycpp_GeoSkeletonSP/geometry_module.cc b/src/simplebuild_dgcode/data/pkgs_val/SkeletonSP/G4GeoSkeletonSP/pycpp_GeoSkeletonSP/geometry_module.cc index 4ec6369..4dc37c6 100644 --- a/src/simplebuild_dgcode/data/pkgs_val/SkeletonSP/G4GeoSkeletonSP/pycpp_GeoSkeletonSP/geometry_module.cc +++ b/src/simplebuild_dgcode/data/pkgs_val/SkeletonSP/G4GeoSkeletonSP/pycpp_GeoSkeletonSP/geometry_module.cc @@ -6,12 +6,12 @@ #include "G4Interfaces/GeoConstructPyExport.hh" -class GeoSkeletonSP : public G4Interfaces::GeoConstructBase +class GeoSkeletonSP final : public G4Interfaces::GeoConstructBase { public: GeoSkeletonSP(); virtual ~GeoSkeletonSP(){} - virtual G4VPhysicalVolume* Construct(); + G4VPhysicalVolume* Construct() override; //(add more member functions and data here if needed) }; diff --git a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4ExprParserTests/app_test/main.cc b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4ExprParserTests/app_test/main.cc index fad19ff..35d3bf2 100644 --- a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4ExprParserTests/app_test/main.cc +++ b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4ExprParserTests/app_test/main.cc @@ -11,69 +11,74 @@ #include "G4UserSteppingAction.hh" #include -class DummyGeo : public G4Interfaces::GeoConstructBase { -public: +namespace { + class DummyGeo final : public G4Interfaces::GeoConstructBase { + public: - DummyGeo() : GeoConstructBase("DummyGeo") - { - addParameterDouble("boxThickness",1*Units::um,0.01*Units::um,300*Units::cm); - } + DummyGeo() : GeoConstructBase("DummyGeo") + { + addParameterDouble("boxThickness",1*Units::um,0.01*Units::um,300*Units::cm); + } + + G4VPhysicalVolume* Construct() override + { + G4Material* mat_galactic = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic",true); + G4Material* mat_boroncarbide = G4NistManager::Instance()->FindOrBuildMaterial("G4_BORON_CARBIDE",true); + G4Box* solidWorld = new G4Box("World", 10*Units::meter,10*Units::meter,10*Units::meter); + G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, mat_galactic, "World"); + auto pv_world = new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicWorld, "World", 0, false, 0); + G4Box* solidBox = new G4Box("SldSomeBox", 5*Units::meter,5*Units::meter,getParameterDouble("boxThickness")*0.5); + auto logicBox= new G4LogicalVolume(solidBox, mat_boroncarbide, "LVSomeBox"); + new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0),"PVSomeBox", logicBox, pv_world, false, 0, true); + + return pv_world; + } + }; - G4VPhysicalVolume* Construct() + std::function createG4StepFilter_opt1(const char * expr) { - G4Material* mat_galactic = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic",true); - G4Material* mat_boroncarbide = G4NistManager::Instance()->FindOrBuildMaterial("G4_BORON_CARBIDE",true); - G4Box* solidWorld = new G4Box("World", 10*Units::meter,10*Units::meter,10*Units::meter); - G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, mat_galactic, "World"); - auto pv_world = new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicWorld, "World", 0, false, 0); - G4Box* solidBox = new G4Box("SldSomeBox", 5*Units::meter,5*Units::meter,getParameterDouble("boxThickness")*0.5); - auto logicBox= new G4LogicalVolume(solidBox, mat_boroncarbide, "LVSomeBox"); - new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0),"PVSomeBox", logicBox, pv_world, false, 0, true); - - return pv_world; - } -}; - -std::function createG4StepFilter_opt1(const char * expr) -{ - //Test implementation of how to create a self-contained filter function based - //on an expression containing G4Step related variables, including proper - //lifetime management of instantiated objects (leaving it here, just for a - //compilation check): - - //Using shared rather than unique ptr here, since we can't capture-by-move until c++14: - auto builder = std::make_shared(); - auto evaluator = builder->createEvaluator(expr); - return [builder,evaluator](const G4Step* step) mutable->bool { builder->setCurrentStep(step); return evaluator(); }; -} -class CustomStepAct : public G4UserSteppingAction { - - G4ExprParser::G4SteppingASTBuilder m_builder; - ExprParser::Evaluator m_eval_value; - ExprParser::Evaluator m_eval_filter; -public: - - CustomStepAct(const char * filter_expr, const char * value_expr) : G4UserSteppingAction() { - m_eval_filter = m_builder.createEvaluator(filter_expr); - m_eval_value = m_builder.createEvaluator(value_expr); - printf("-------------------------------------------------------\n"); - ExprParser::printTree(m_eval_filter.arg()," |",false); - printf("-------------------------------------------------------\n"); - ExprParser::printTree(m_eval_value.arg()," |",false); - printf("-------------------------------------------------------\n"); - } - ~CustomStepAct(){} + //Test implementation of how to create a self-contained filter function based + //on an expression containing G4Step related variables, including proper + //lifetime management of instantiated objects (leaving it here, just for a + //compilation check): - virtual void UserSteppingAction( const G4Step* step ) { - m_builder.setCurrentStep(step);//Must set before attempting to evaluate filter or value! - printf("Test - filter: %i\n",(int)m_eval_filter()); - printf("Test - value : %g\n",m_eval_value()); + //Using shared rather than unique ptr here, since we can't capture-by-move until c++14: + auto builder = std::make_shared(); + auto evaluator = builder->createEvaluator(expr); + return [builder,evaluator](const G4Step* step) mutable->bool { builder->setCurrentStep(step); return evaluator(); }; } -}; + class CustomStepAct final : public G4UserSteppingAction { + + G4ExprParser::G4SteppingASTBuilder m_builder; + ExprParser::Evaluator m_eval_value; + ExprParser::Evaluator m_eval_filter; + public: + + CustomStepAct(const char * filter_expr, const char * value_expr) : G4UserSteppingAction() { + m_eval_filter = m_builder.createEvaluator(filter_expr); + m_eval_value = m_builder.createEvaluator(value_expr); + printf("-------------------------------------------------------\n"); + ExprParser::printTree(m_eval_filter.arg()," |",false); + printf("-------------------------------------------------------\n"); + ExprParser::printTree(m_eval_value.arg()," |",false); + printf("-------------------------------------------------------\n"); + } + ~CustomStepAct(){} + + void UserSteppingAction( const G4Step* step ) override { + m_builder.setCurrentStep(step);//Must set before attempting to evaluate filter or value! + printf("Test - filter: %i\n",(int)m_eval_filter()); + printf("Test - value : %g\n",m_eval_value()); + } + + }; +} int main(int,char**) { + (void)createG4StepFilter_opt1; + DummyGeo * geo = new DummyGeo(); geo->setParameterDouble("boxThickness",20*Units::cm); diff --git a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_dumpphyslist/main.cc b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_dumpphyslist/main.cc index 6b1f7ee..817508b 100644 --- a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_dumpphyslist/main.cc +++ b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_dumpphyslist/main.cc @@ -6,16 +6,18 @@ #include "QGSP_BIC_HP.hh" #include -struct DummyDetectorConstruction : public G4VUserDetectorConstruction -{ - G4VPhysicalVolume* Construct() - { - G4Box* solidWorld = new G4Box("World", 1,1,1); - G4Material* mat = new G4Material("some_dummy_material", 1, 1, 1); - G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, mat, "World"); - return new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicWorld, "World", 0, false, 0); - } -}; +namespace { + class DummyDetectorConstruction final : public G4VUserDetectorConstruction { + public: + G4VPhysicalVolume* Construct() override + { + G4Box* solidWorld = new G4Box("World", 1,1,1); + G4Material* mat = new G4Material("some_dummy_material", 1, 1, 1); + G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, mat, "World"); + return new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicWorld, "World", 0, false, 0); + } + }; +} int main(int argc,char**argv) { auto rm = new G4RunManager; diff --git a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testg4ncalloys/main.cc b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testg4ncalloys/main.cc index 674e973..d3b5ae9 100644 --- a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testg4ncalloys/main.cc +++ b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testg4ncalloys/main.cc @@ -22,7 +22,7 @@ #include "G4SDManager.hh" #include "G4StepPoint.hh" -class MySD : public G4VSensitiveDetector { +class MySD final : public G4VSensitiveDetector { ////////////////////////////////////////////////////////////////////////////// // Sensitive detector for monitoring neutron hits in the spherical detector // volume and printing out the "detected" scattering angle. @@ -31,7 +31,7 @@ class MySD : public G4VSensitiveDetector { MySD() : G4VSensitiveDetector("MySD") {} virtual ~MySD(){} - virtual G4bool ProcessHits(G4Step* step, G4TouchableHistory*) + G4bool ProcessHits(G4Step* step, G4TouchableHistory*) override { if (step->GetPreStepPoint()->GetStepStatus() != fGeomBoundary) return true;//must have just entered the volume @@ -46,7 +46,7 @@ class MySD : public G4VSensitiveDetector { } }; -class MyGeo : public G4VUserDetectorConstruction { +class MyGeo final : public G4VUserDetectorConstruction { ////////////////////////////////////////////////////////////////////////////// // Constructs an r=1*mm spherical sample of polycrystalline Aluminium inside an // r=100*cm spherical vacuum inside a 1*mm thick spherical counting volume, @@ -58,7 +58,7 @@ class MyGeo : public G4VUserDetectorConstruction { public: MyGeo(){} virtual ~MyGeo(){} - virtual G4VPhysicalVolume* Construct() + G4VPhysicalVolume* Construct() override { G4Material * mat_vacuum = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic",true); //G4Material * mat_sample = G4NCrystalRel::createMaterial("Al_sg225.ncmat;bkgd=0"); @@ -84,7 +84,7 @@ class MyGeo : public G4VUserDetectorConstruction { } }; -class MyGun : public G4VUserPrimaryGeneratorAction { +class MyGun final : public G4VUserPrimaryGeneratorAction { ////////////////////////////////////////////////////////////////////////////// // Setup monochromatic source of neutrons, hitting the sample with initial direction (0,0,1) ////////////////////////////////////////////////////////////////////////////// @@ -103,7 +103,7 @@ class MyGun : public G4VUserPrimaryGeneratorAction { delete m_particleGun; } - void GeneratePrimaries(G4Event* evt) + void GeneratePrimaries(G4Event* evt) override { m_particleGun->GeneratePrimaryVertex(evt); } diff --git a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testlauncher/main.cc b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testlauncher/main.cc index 79a9bc8..f802cf1 100644 --- a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testlauncher/main.cc +++ b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testlauncher/main.cc @@ -10,12 +10,13 @@ #include "G4Interfaces/PhysListProviderBase.hh" //More work to do this from the C++ side: -class Empty_Provider : public G4Interfaces::PhysListProviderBase { -public: - Empty_Provider() : G4Interfaces::PhysListProviderBase("PL_Empty") {} - virtual ~Empty_Provider(){} - virtual G4VUserPhysicsList * construct() { return new PhysicsListEmpty; } -}; +namespace { + class Empty_Provider final : public G4Interfaces::PhysListProviderBase { + public: + Empty_Provider() : G4Interfaces::PhysListProviderBase("PL_Empty") {} + G4VUserPhysicsList * construct() override { return new PhysicsListEmpty; } + }; +} class DummyGeo : public G4Interfaces::GeoConstructBase { public: @@ -25,7 +26,7 @@ class DummyGeo : public G4Interfaces::GeoConstructBase { addParameterDouble("boxThickness",1*Units::um,0.01*Units::um,10*Units::um); } - G4VPhysicalVolume* Construct() + G4VPhysicalVolume* Construct() override { G4Material* mat_galactic = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic",true); G4Material* mat_boroncarbide = G4NistManager::Instance()->FindOrBuildMaterial("G4_BORON_CARBIDE",true); diff --git a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testmaterials/init_dummy_geant4.cc b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testmaterials/init_dummy_geant4.cc index e3b497d..43b4770 100644 --- a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testmaterials/init_dummy_geant4.cc +++ b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testmaterials/init_dummy_geant4.cc @@ -4,16 +4,17 @@ #include "G4PVPlacement.hh" #include "QGSP_BERT.hh" -struct DummyDetectorConstruction : public G4VUserDetectorConstruction -{ - G4VPhysicalVolume* Construct() - { - G4Box* solidWorld = new G4Box("World", 1,1,1); - G4Material* mat = new G4Material("some_dummy_material", 1, 1, 1); - G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, mat, "World"); - return new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicWorld, "World", 0, false, 0); - } -}; +namespace { + class DummyDetectorConstruction final : public G4VUserDetectorConstruction { + G4VPhysicalVolume* Construct() override + { + G4Box* solidWorld = new G4Box("World", 1,1,1); + G4Material* mat = new G4Material("some_dummy_material", 1, 1, 1); + G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, mat, "World"); + return new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicWorld, "World", 0, false, 0); + } + }; +} void init_dummy_geant4() { auto rm = new G4RunManager; diff --git a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testpylist/main.cc b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testpylist/main.cc index cf78641..9fecfe3 100644 --- a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testpylist/main.cc +++ b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/app_testpylist/main.cc @@ -9,27 +9,29 @@ #include "G4PhysicsLists/PhysicsListEmpty.hh" #include "G4Interfaces/PhysListProviderBase.hh" -class DummyGeo : public G4Interfaces::GeoConstructBase { -public: +namespace { + class DummyGeo final : public G4Interfaces::GeoConstructBase { + public: - DummyGeo() : GeoConstructBase("DummyGeo") - { - addParameterDouble("boxThickness",1*Units::um,0.01*Units::um,10*Units::um); - } + DummyGeo() : GeoConstructBase("DummyGeo") + { + addParameterDouble("boxThickness",1*Units::um,0.01*Units::um,10*Units::um); + } - G4VPhysicalVolume* Construct() - { - G4Material* mat_galactic = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic",true); - G4Material* mat_boroncarbide = G4NistManager::Instance()->FindOrBuildMaterial("G4_BORON_CARBIDE",true); - G4Box* solidWorld = new G4Box("World", 10*Units::meter,10*Units::meter,10*Units::meter); - G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, mat_galactic, "World"); - auto pv_world = new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicWorld, "World", 0, false, 0); - G4Box* solidBox = new G4Box("SldSomeBox", 5*Units::meter,5*Units::meter,getParameterDouble("boxThickness")*0.5); - auto logicBox= new G4LogicalVolume(solidBox, mat_boroncarbide, "LVSomeBox"); - new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0),"PVSomeBox", logicBox, pv_world, false, 0, true); - return pv_world; - } -}; + G4VPhysicalVolume* Construct() override + { + G4Material* mat_galactic = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic",true); + G4Material* mat_boroncarbide = G4NistManager::Instance()->FindOrBuildMaterial("G4_BORON_CARBIDE",true); + G4Box* solidWorld = new G4Box("World", 10*Units::meter,10*Units::meter,10*Units::meter); + G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld, mat_galactic, "World"); + auto pv_world = new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), logicWorld, "World", 0, false, 0); + G4Box* solidBox = new G4Box("SldSomeBox", 5*Units::meter,5*Units::meter,getParameterDouble("boxThickness")*0.5); + auto logicBox= new G4LogicalVolume(solidBox, mat_boroncarbide, "LVSomeBox"); + new G4PVPlacement(0, G4ThreeVector(0.0,0.0,0.0),"PVSomeBox", logicBox, pv_world, false, 0, true); + return pv_world; + } + }; +} int main(int,char**) { diff --git a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/libinc/GeoTest.hh b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/libinc/GeoTest.hh index 386e01b..2a48642 100644 --- a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/libinc/GeoTest.hh +++ b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/G4Tests/libinc/GeoTest.hh @@ -2,13 +2,14 @@ namespace G4Tests { - struct GeoTest : public G4Interfaces::GeoConstructBase { + class GeoTest final : public G4Interfaces::GeoConstructBase { + public: GeoTest() : GeoConstructBase("G4Tests/GeoTest") { addParameterDouble("boronThickness_micron",1.0,0.01,1000.0); addParameterDouble("worldExtent_meters",1.0,0.01,1000.0); } - G4VPhysicalVolume* Construct(); + G4VPhysicalVolume* Construct() override; }; } diff --git a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/GriffDRWTests/pycpp_GeoGriffTests/geometry_module.cc b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/GriffDRWTests/pycpp_GeoGriffTests/geometry_module.cc index ea8a5f2..1a058e8 100644 --- a/src/simplebuild_dgcode/data/pkgs_val/UnitTests/GriffDRWTests/pycpp_GeoGriffTests/geometry_module.cc +++ b/src/simplebuild_dgcode/data/pkgs_val/UnitTests/GriffDRWTests/pycpp_GeoGriffTests/geometry_module.cc @@ -2,12 +2,12 @@ #include "G4Box.hh" #include "G4Orb.hh" -class GeoGriffTests : public G4Interfaces::GeoConstructBase +class GeoGriffTests final : public G4Interfaces::GeoConstructBase { public: GeoGriffTests() : GeoConstructBase("G4GeoGriffTests/GeoGriffTests") {} virtual ~GeoGriffTests(){} - G4VPhysicalVolume* Construct(); + G4VPhysicalVolume* Construct() override; }; PYTHON_MODULE( mod ) { GeoConstructPyExport::exportGeo(mod, "GeoGriffTests"); }