This commit is contained in:
Jan Kieseler
2023-10-07 11:14:45 +02:00
parent 34a0305601
commit 51001d1b59
15 changed files with 69 additions and 69 deletions
+6 -6
View File
@@ -35,7 +35,7 @@
class G4VPhysicalVolume;
class G4GlobalMagFieldMessenger;
class ConstructionWrapper;
class GeometryDescriptor;
namespace B4
{
@@ -67,7 +67,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction
return _global_detector_construction;
}
DetectorConstruction( ConstructionWrapper* Cw): G4VUserDetectorConstruction(), cw(Cw){
DetectorConstruction( GeometryDescriptor* Cw): G4VUserDetectorConstruction(), cw(Cw){
_global_detector_construction=this;
}
~DetectorConstruction() override = default;
@@ -76,14 +76,14 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4VPhysicalVolume* Construct() override;
void ConstructSDandField() override;
void setConstructionWrapper(ConstructionWrapper* Cw){
void setGeometryDescriptor(GeometryDescriptor* Cw){
this->cw = Cw;
}
ConstructionWrapper* getConstructionWrapper(){
GeometryDescriptor* getGeometryDescriptor(){
return cw;
}
const ConstructionWrapper* getConstructionWrapper()const{
const GeometryDescriptor* getGeometryDescriptor()const{
return cw;
}
@@ -100,7 +100,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
ConstructionWrapper* cw=nullptr;
GeometryDescriptor* cw=nullptr;
};
+1 -1
View File
@@ -34,7 +34,7 @@
#include "RunAction.hh"
#include "PrimaryGeneratorAction.hh"
#include "globals.hh"
class ConstructionWrapper;
class GeometryDescriptor;
namespace B4a
{
+7 -7
View File
@@ -2,7 +2,7 @@
#ifndef G4SYSTEM_HH
#define G4SYSTEM_HH
#include "ConstructionWrapper.hh"
#include "GeometryDescriptor.hh"
#include <stdexcept>
#include "G4RunManagerFactory.hh"
#include "DetectorConstruction.hh"
@@ -32,7 +32,7 @@ G4System(bool Gui=false):gui(Gui){};
};
void init(ConstructionWrapper &cw);
void init(GeometryDescriptor &cw);
//will use dawn for visualization, also wrap more in python
void run_visualize(const std::string& partSpecies, double minEnergy_GeV, double maxEnergy_GeV);
//runs the whole gui if available
@@ -48,10 +48,10 @@ void displayEvent()const{}; //just a placeholder, this will be implemented in py
void printMaterial(const std::string& name)const;
ConstructionWrapper& getConstructionWrapper(){
GeometryDescriptor& getGeometryDescriptor(){
check();
if ( assigned_cw == nullptr ){
throw std::runtime_error("ConstructionWrapper not assigned");
throw std::runtime_error("GeometryDescriptor not assigned");
}
return *assigned_cw;
}
@@ -59,7 +59,7 @@ ConstructionWrapper& getConstructionWrapper(){
private:
void check()const;
ConstructionWrapper * assigned_cw=nullptr;
GeometryDescriptor * assigned_cw=nullptr;
bool gui;
@@ -77,7 +77,7 @@ G4UIExecutive * ui=nullptr;
/*
void run(ConstructionWrapper CW, int nEvents, std::string partSpecies, double minEnergy, double maxEnergy, bool gui=false){
void run(GeometryDescriptor CW, int nEvents, std::string partSpecies, double minEnergy, double maxEnergy, bool gui=false){
char* argv[]={(char*)"dummy"};
@@ -87,7 +87,7 @@ void run(ConstructionWrapper CW, int nEvents, std::string partSpecies, double mi
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
runManager->SetNumberOfThreads(1);
ConstructionWrapper * cw = &CW;
GeometryDescriptor * cw = &CW;
G4String session;
G4UIExecutive* ui = nullptr;
if ( gui ) {
@@ -1,6 +1,6 @@
#ifndef CONSTRUCTIONWRAPPER_HH
#define CONSTRUCTIONWRAPPER_HH
#ifndef GeometryDescriptor_HH
#define GeometryDescriptor_HH
#include "G4ThreeVector.hh"
#include <vector>
@@ -62,11 +62,11 @@ public:
};
class ConstructionWrapper{
class GeometryDescriptor{
public:
ConstructionWrapper(double xy_width=50);
~ConstructionWrapper() {};
GeometryDescriptor(double xy_width=50);
~GeometryDescriptor() {};
void addLayer(double thickness_cm, std::string material, bool isActive=true, int nx=1, int ny=-1);
+1 -1
View File
@@ -31,7 +31,7 @@
#define B4aSteppingAction_h 1
#include "G4UserSteppingAction.hh"
#include "ConstructionWrapper.hh"
#include "GeometryDescriptor.hh"
#include "DetectorConstruction.hh"