seems to work with different geometries

This commit is contained in:
Jan Kieseler
2023-09-21 09:06:20 +02:00
parent cee740716c
commit 8d2302b5dc
8 changed files with 58 additions and 38 deletions
+16 -1
View File
@@ -53,9 +53,15 @@
#include "G4PVParameterised.hh"
#include "G4VPVParameterisation.hh"
#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"
namespace B4
{
DetectorConstruction* DetectorConstruction::_global_detector_construction=nullptr;
//helper
class LayerParametrisation: public G4VPVParameterisation{
@@ -129,6 +135,13 @@ nistManager->FindOrBuildMaterial("G4_AIR");
G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
{
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
// Geometry parameters
auto & cwLayers = cw->getLayers();
G4int nofLayers = cwLayers.size();
@@ -201,6 +214,8 @@ G4VPhysicalVolume* DetectorConstruction::DefineVolumes()
layer.name = "Layer_"+std::to_string(layerNumber);
layerNumber++;
G4cout << "building layer " << layer.name << G4endl;
position += layer.thickness / 2 *cm;
auto layerS
= new G4Box(layer.name, // its name