construction wrapper seems to work
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
class Layer{
|
||||
|
||||
public:
|
||||
Layer();
|
||||
~Layer(){};
|
||||
|
||||
void setThickness(double thickness_cm);
|
||||
void setMaterial(std::string material);
|
||||
void setNx(int nx);
|
||||
void setNy(int ny);
|
||||
void setIsActive(bool isActive);
|
||||
void assignPhysicalVolume(G4VPhysicalVolume* physicalVolume);
|
||||
|
||||
double thickness;
|
||||
double sens_xwidth;
|
||||
double sens_ywidth;
|
||||
std::string material;
|
||||
int nx;
|
||||
int ny;
|
||||
bool isActive;
|
||||
G4VPhysicalVolume* physicalVolume;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
|
||||
class ConstructionWrapper{
|
||||
|
||||
public:
|
||||
ConstructionWrapper(double xy_width=50);
|
||||
~ConstructionWrapper() {};
|
||||
|
||||
void addLayer(double thickness_cm, std::string material, bool isActive=true, int nx=1, int ny=1);
|
||||
|
||||
std::vector<Layer>& getLayers() ;
|
||||
const std::vector<Layer>& getLayers() const;
|
||||
|
||||
double getXYWidth() const{
|
||||
return xywidth;
|
||||
}
|
||||
private:
|
||||
double xywidth;
|
||||
std::vector<Layer> layers;
|
||||
};
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "globals.hh"
|
||||
#include "ConstructionWrapper.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4GlobalMagFieldMessenger;
|
||||
@@ -53,10 +54,14 @@ namespace B4
|
||||
/// In addition a transverse uniform magnetic field is defined
|
||||
/// via G4GlobalMagFieldMessenger class.
|
||||
|
||||
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
DetectorConstruction() = default;
|
||||
DetectorConstruction(const ConstructionWrapper& cw){
|
||||
this->cw = cw;
|
||||
}
|
||||
~DetectorConstruction() override = default;
|
||||
|
||||
public:
|
||||
@@ -83,6 +88,8 @@ class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
G4VPhysicalVolume* fGapPV = nullptr; // the gap physical volume
|
||||
|
||||
G4bool fCheckOverlaps = true; // option to activate checking of volumes overlaps
|
||||
|
||||
ConstructionWrapper cw;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
Reference in New Issue
Block a user