20#include "BDSBLMFactory.hh"
21#include "BDSBLMType.hh"
23#include "BDSException.hh"
24#include "BDSExtent.hh"
25#include "BDSGeometryExternal.hh"
26#include "BDSGeometryFactory.hh"
27#include "BDSGlobalConstants.hh"
28#include "BDSMaterials.hh"
29#include "BDSUtilities.hh"
31#include "parser/blmplacement.h"
35#include "G4LogicalVolume.hh"
41BDSBLMFactory::BDSBLMFactory()
44BDSBLMFactory::~BDSBLMFactory()
47void BDSBLMFactory::PositiveFinite(G4double value,
48 const G4String& parameterName,
49 const G4String& blmName)
const
52 {
throw BDSException(__METHOD_NAME__,
"\"" + parameterName +
"\" must be +ve finite for blm named \"" + blmName +
"\"");}
56 G4VSensitiveDetector* sd)
58 return CreateBLM(G4String(bp.
name),
59 G4String(bp.geometryFile),
60 G4String(bp.geometryType),
61 G4String(bp.blmMaterial),
70BDSBLM* BDSBLMFactory::CreateBLM(
const G4String& name,
71 const G4String& geometryFile,
72 const G4String& geometryType,
73 const G4String& material,
78 G4VSensitiveDetector* sd,
83 if (!geometryFile.empty())
86 result =
new BDSBLM(blmGeom);
93 case BDSBLMType::cylinder:
95 case BDSBLMType::cube:
96 {result =
BuildBLMCube(name, material, blm1, blm2, blm3);
break;}
97 case BDSBLMType::sphere:
108 {lv->SetSensitiveDetector(sd);}
117 const G4String& material,
121 PositiveFinite(halfLength,
"blm1 (half length)", name);
122 PositiveFinite(radius,
"blm2 (radius)", name);
123 G4Tubs* shape =
new G4Tubs(name +
"_solid",
134 const G4String& material,
135 G4double halfLengthX,
136 G4double halfLengthY,
137 G4double halfLengthZ)
139 PositiveFinite(halfLengthX,
"blm1 (half length in x)", name);
140 PositiveFinite(halfLengthY,
"blm2 (half length in y)", name);
141 PositiveFinite(halfLengthZ,
"blm3 (half length in z)", name);
142 G4Box* shape =
new G4Box(name +
"_solid", halfLengthX, halfLengthY, halfLengthZ);
148 const G4String& material,
151 PositiveFinite(radius,
"blm1 (radius)", name);
152 G4Orb* shape =
new G4Orb(name +
"_solid", radius);
158 const G4String& material,
163 G4LogicalVolume* lv =
new G4LogicalVolume(shape, mat, name +
"_lv");
BDSBLM * BuildBLMCylinder(const G4String &name, const G4String &material, G4double halfLength, G4double radius)
Build the geometry for a cylinder.
BDSBLM * BuildBLMCube(const G4String &name, const G4String &material, G4double halfLengthX, G4double halfLengthY, G4double halfLengthZ)
Build the geometry for a cube.
BDSBLM * CommonConstruction(const G4String &name, const G4String &material, G4VSolid *shape, const BDSExtent &extent)
BDSBLM * BuildBLMSphere(const G4String &name, const G4String &material, G4double radius)
Build the geometry for a sphere.
void SetBias(const G4String &biasIn)
General exception with possible name of object and message.
Holder for +- extents in 3 dimensions.
G4LogicalVolume * GetContainerLogicalVolume() const
Accessor - see member for more info.
virtual std::set< G4LogicalVolume * > GetAllLogicalVolumes() const
Access all logical volumes belonging to this component.
A loaded piece of externally provided geometry.
BDSGeometryExternal * BuildGeometry(G4String componentName, const G4String &formatAndFilePath, std::map< G4String, G4Colour * > *colourMapping=nullptr, G4bool autoColour=true, G4double suggestedLength=0, G4double suggestedHorizontalWidth=0, std::vector< G4String > *namedVacuumVolumes=nullptr, G4bool makeSensitive=true, BDSSDType sensitivityType=BDSSDType::energydep, BDSSDType vacuumSensitivityType=BDSSDType::energydepvacuum, G4bool stripOuterVolumeAndMakeAssembly=false, G4UserLimits *userLimitsToAttachToAllLVs=nullptr, G4bool dontReloadGeometry=false)
static BDSGeometryFactory * Instance()
Singleton accessor.
static BDSGlobalConstants * Instance()
Access method.
static BDSMaterials * Instance()
Singleton pattern access.
G4Material * GetMaterial(G4String material) const
Get material by name.
Improve type-safety of native enum data type in C++.
type underlying() const
return underlying value (can be used in switch statement)
std::string name
Name of this samplerplacement.
BDSBLMType DetermineBLMType(G4String blmType)
function that gives corresponding enum value for string (case-insensitive)
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())