renamed
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
|
||||
#ifndef GeometryDescriptor_HH
|
||||
#define GeometryDescriptor_HH
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
//#include "G4VPhysicalVolume.hh"
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
|
||||
class Sensor{
|
||||
public:
|
||||
Sensor(){};
|
||||
~Sensor(){};
|
||||
|
||||
const G4double getEnergy()const{
|
||||
return energy;
|
||||
}
|
||||
G4ThreeVector getPos()const{
|
||||
return position;
|
||||
}
|
||||
G4ThreeVector getSize()const{
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
G4ThreeVector position;
|
||||
G4ThreeVector size;
|
||||
mutable G4double energy;
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
void unAssign(){
|
||||
physicalVolume = nullptr;
|
||||
sensors.clear();
|
||||
}
|
||||
|
||||
double thickness;
|
||||
double sens_xwidth;
|
||||
double sens_ywidth;
|
||||
std::string material;
|
||||
int nx;
|
||||
int ny;
|
||||
bool isActive;
|
||||
G4VPhysicalVolume* physicalVolume;
|
||||
std::string name;
|
||||
|
||||
std::vector<Sensor> sensors;
|
||||
};
|
||||
|
||||
|
||||
class GeometryDescriptor{
|
||||
|
||||
public:
|
||||
GeometryDescriptor(double xy_width=50);
|
||||
~GeometryDescriptor() {};
|
||||
|
||||
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;
|
||||
|
||||
|
||||
void resetSensorEnergies()const;//energies are mutable
|
||||
int getNSensors()const{
|
||||
int n_sensors = 0;
|
||||
for(const auto& layer: layers){
|
||||
n_sensors += layer.sensors.size();
|
||||
}
|
||||
return n_sensors;
|
||||
}
|
||||
|
||||
Layer* getLayerByVolume(G4VPhysicalVolume* volume);
|
||||
|
||||
const Layer* getLayerByVolume(G4VPhysicalVolume* volume)const;
|
||||
|
||||
Sensor* getSensorByVolume(G4VPhysicalVolume* volume);
|
||||
|
||||
const Sensor* getSensorByVolume(G4VPhysicalVolume* volume)const;
|
||||
|
||||
void printSensorEnergies()const;
|
||||
|
||||
bool isAssigned()const{
|
||||
if(layers.size() == 0){
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
return layers[0].physicalVolume != nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void unAssign(){
|
||||
for(auto& layer: layers){
|
||||
layer.unAssign();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
double xywidth;
|
||||
std::vector<Layer> layers;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user