renamed
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
/// \brief Implementation of the B4::DetectorConstruction class
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "ConstructionWrapper.hh"
|
||||
#include "GeometryDescriptor.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
+5
-5
@@ -27,7 +27,7 @@
|
||||
/// \file B4/B4a/src/EventAction.cc
|
||||
/// \brief Implementation of the B4a::EventAction class
|
||||
|
||||
#include "ConstructionWrapper.hh"
|
||||
#include "GeometryDescriptor.hh"
|
||||
|
||||
#include "EventAction.hh"
|
||||
#include "RunAction.hh"
|
||||
@@ -49,11 +49,11 @@ namespace B4a
|
||||
|
||||
void EventAction::BeginOfEventAction(const G4Event* /*event*/)
|
||||
{
|
||||
auto cw = B4::DetectorConstruction::getDetectorConstruction()->getConstructionWrapper();
|
||||
auto cw = B4::DetectorConstruction::getDetectorConstruction()->getGeometryDescriptor();
|
||||
// initialisation per event
|
||||
if(cw == nullptr){
|
||||
G4cout << "ConstructionWrapper not found" << G4endl;
|
||||
throw std::runtime_error("ConstructionWrapper not found");
|
||||
G4cout << "GeometryDescriptor not found" << G4endl;
|
||||
throw std::runtime_error("GeometryDescriptor not found");
|
||||
}
|
||||
if(gen == nullptr){
|
||||
G4cout << "PrimaryGeneratorAction not found" << G4endl;
|
||||
@@ -84,7 +84,7 @@ void EventAction::EndOfEventAction(const G4Event* event)
|
||||
|
||||
// get analysis manager
|
||||
auto analysisManager = G4AnalysisManager::Instance();
|
||||
auto cw = B4::DetectorConstruction::getDetectorConstruction()->getConstructionWrapper();
|
||||
auto cw = B4::DetectorConstruction::getDetectorConstruction()->getGeometryDescriptor();
|
||||
|
||||
//cw->printSensorEnergies();//DEBUG
|
||||
|
||||
|
||||
+3
-3
@@ -4,10 +4,10 @@
|
||||
#include <G4NistManager.hh>
|
||||
#include <G4String.hh>
|
||||
|
||||
void G4System::init(ConstructionWrapper &CW){
|
||||
void G4System::init(GeometryDescriptor &CW){
|
||||
|
||||
if(CW.isAssigned()){
|
||||
throw std::runtime_error("ConstructionWrapper already assigned");
|
||||
throw std::runtime_error("GeometryDescriptor already assigned");
|
||||
}
|
||||
if(assigned_cw != nullptr){
|
||||
//reassign
|
||||
@@ -58,7 +58,7 @@ void G4System::init(ConstructionWrapper &CW){
|
||||
runManager->SetUserInitialization(actionInitialization);
|
||||
}
|
||||
else{
|
||||
detConstruction->setConstructionWrapper(&CW);
|
||||
detConstruction->setGeometryDescriptor(&CW);
|
||||
runManager->ReinitializeGeometry(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
#include "ConstructionWrapper.hh"
|
||||
#include "GeometryDescriptor.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
Layer::Layer(){
|
||||
@@ -36,11 +36,11 @@ void Layer::assignPhysicalVolume(G4VPhysicalVolume* physicalVolume){
|
||||
this->physicalVolume = physicalVolume;
|
||||
}
|
||||
|
||||
ConstructionWrapper::ConstructionWrapper(double xy_width){
|
||||
GeometryDescriptor::GeometryDescriptor(double xy_width){
|
||||
xywidth = xy_width;
|
||||
}
|
||||
|
||||
void ConstructionWrapper::addLayer(double thickness, std::string material, bool isActive, int nx, int ny){
|
||||
void GeometryDescriptor::addLayer(double thickness, std::string material, bool isActive, int nx, int ny){
|
||||
if(ny<0){
|
||||
ny = nx;
|
||||
}
|
||||
@@ -60,20 +60,20 @@ void ConstructionWrapper::addLayer(double thickness, std::string material, bool
|
||||
layers.push_back(layer);
|
||||
}
|
||||
|
||||
const std::vector<Layer> & ConstructionWrapper::getLayers() const{
|
||||
const std::vector<Layer> & GeometryDescriptor::getLayers() const{
|
||||
return layers;
|
||||
}
|
||||
|
||||
std::vector<Layer> & ConstructionWrapper::getLayers(){
|
||||
std::vector<Layer> & GeometryDescriptor::getLayers(){
|
||||
return layers;
|
||||
}
|
||||
|
||||
|
||||
double ConstructionWrapper::getXYWidth() const{
|
||||
double GeometryDescriptor::getXYWidth() const{
|
||||
return xywidth;
|
||||
}
|
||||
|
||||
void ConstructionWrapper::resetSensorEnergies()const {
|
||||
void GeometryDescriptor::resetSensorEnergies()const {
|
||||
for(const auto & layer : layers){
|
||||
for(const auto & sensor : layer.sensors){
|
||||
sensor.energy = 0;
|
||||
@@ -81,7 +81,7 @@ void ConstructionWrapper::resetSensorEnergies()const {
|
||||
}
|
||||
}
|
||||
|
||||
Layer* ConstructionWrapper::getLayerByVolume(G4VPhysicalVolume* volume){
|
||||
Layer* GeometryDescriptor::getLayerByVolume(G4VPhysicalVolume* volume){
|
||||
for(auto & layer : layers){
|
||||
if(layer.physicalVolume == volume){
|
||||
return &layer;
|
||||
@@ -90,7 +90,7 @@ Layer* ConstructionWrapper::getLayerByVolume(G4VPhysicalVolume* volume){
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Layer* ConstructionWrapper::getLayerByVolume(G4VPhysicalVolume* volume)const{
|
||||
const Layer* GeometryDescriptor::getLayerByVolume(G4VPhysicalVolume* volume)const{
|
||||
for(auto & layer : layers){
|
||||
if(layer.physicalVolume == volume){
|
||||
return &layer;
|
||||
@@ -99,7 +99,7 @@ const Layer* ConstructionWrapper::getLayerByVolume(G4VPhysicalVolume* volume)con
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Sensor* ConstructionWrapper::getSensorByVolume(G4VPhysicalVolume* volume){
|
||||
Sensor* GeometryDescriptor::getSensorByVolume(G4VPhysicalVolume* volume){
|
||||
int copyNo = volume->GetCopyNo();
|
||||
auto layer = getLayerByVolume(volume);
|
||||
if(layer == nullptr){
|
||||
@@ -111,7 +111,7 @@ Sensor* ConstructionWrapper::getSensorByVolume(G4VPhysicalVolume* volume){
|
||||
return &layer->sensors[copyNo];
|
||||
}
|
||||
|
||||
const Sensor* ConstructionWrapper::getSensorByVolume(G4VPhysicalVolume* volume)const{
|
||||
const Sensor* GeometryDescriptor::getSensorByVolume(G4VPhysicalVolume* volume)const{
|
||||
int copyNo = volume->GetCopyNo();
|
||||
auto layer = getLayerByVolume(volume);
|
||||
if(layer == nullptr){
|
||||
@@ -124,7 +124,7 @@ const Sensor* ConstructionWrapper::getSensorByVolume(G4VPhysicalVolume* volume)c
|
||||
}
|
||||
|
||||
|
||||
void ConstructionWrapper::printSensorEnergies()const{
|
||||
void GeometryDescriptor::printSensorEnergies()const{
|
||||
for(const auto& layer: layers){
|
||||
for(const auto& sensor: layer.sensors){
|
||||
G4cout << sensor.energy << " ";
|
||||
@@ -59,15 +59,15 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
|
||||
|
||||
//return;
|
||||
|
||||
//find the layer through the constructionwrapper that corresponds to the volume
|
||||
auto cw = DetectorConstruction::getDetectorConstruction()->getConstructionWrapper();
|
||||
//find the layer through the GeometryDescriptor that corresponds to the volume
|
||||
auto cw = DetectorConstruction::getDetectorConstruction()->getGeometryDescriptor();
|
||||
if(cw == nullptr){
|
||||
G4cout << "ConstructionWrapper not found" << G4endl;
|
||||
throw std::runtime_error("ConstructionWrapper not found");
|
||||
G4cout << "GeometryDescriptor not found" << G4endl;
|
||||
throw std::runtime_error("GeometryDescriptor not found");
|
||||
}
|
||||
|
||||
|
||||
auto sensor = DetectorConstruction::getDetectorConstruction()->getConstructionWrapper()->getSensorByVolume(volume);
|
||||
auto sensor = DetectorConstruction::getDetectorConstruction()->getGeometryDescriptor()->getSensorByVolume(volume);
|
||||
if(sensor == nullptr){
|
||||
//can simply be not an active volume, so no need to throw an error
|
||||
//G4cout << "Sensor not found in" << volume->GetName() << G4endl; //DEBUG
|
||||
|
||||
Reference in New Issue
Block a user