19#include "BDSBeamPipeFactoryBase.hh"
20#include "BDSColours.hh"
21#include "BDSColourFromMaterial.hh"
23#include "BDSException.hh"
24#include "BDSGlobalConstants.hh"
25#include "BDSMaterials.hh"
26#include "BDSSDType.hh"
27#include "BDSUtilities.hh"
30#include "G4LogicalVolume.hh"
31#include "G4Material.hh"
32#include "G4PVPlacement.hh"
33#include "G4ThreeVector.hh"
34#include "G4UserLimits.hh"
35#include "G4VisAttributes.hh"
49void BDSBeamPipeFactoryBase::CleanUp()
57 vacuumSolid =
nullptr;
58 beamPipeSolid =
nullptr;
59 containerSolid =
nullptr;
63 containerLV =
nullptr;
72 G4Material* vacuumMaterialIn,
73 G4Material* beamPipeMaterialIn,
76 allSolids.insert(vacuumSolid);
77 allSolids.insert(beamPipeSolid);
89 G4Material* vacuumMaterialIn,
90 G4Material* beamPipeMaterialIn)
93 vacuumLV =
new G4LogicalVolume(vacuumSolid,
95 nameIn +
"_vacuum_lv");
97 beamPipeLV =
new G4LogicalVolume(beamPipeSolid,
99 nameIn +
"_beampipe_lv");
102 containerLV =
new G4LogicalVolume(containerSolid,
104 nameIn +
"_container_lv");
105 allLogicalVolumes.insert(vacuumLV);
106 allLogicalVolumes.insert(beamPipeLV);
113 G4VisAttributes* pipeVisAttr =
new G4VisAttributes(*c);
114 pipeVisAttr->SetVisibility(
true);
116 allVisAttributes.insert(pipeVisAttr);
117 beamPipeLV->SetVisAttributes(pipeVisAttr);
128 {allUserLimits.insert(ul);}
129 vacuumLV->SetUserLimits(ul);
130 containerLV->SetUserLimits(ul);
132 G4UserLimits* beamPipeUL = ul;
135 beamPipeUL =
new G4UserLimits(*ul);
136 beamPipeUL->SetUserMinEkine(std::numeric_limits<double>::max());
137 allUserLimits.insert(beamPipeUL);
139 beamPipeLV->SetUserLimits(beamPipeUL);
147 vacuumPV =
new G4PVPlacement(
nullptr,
150 nameIn +
"_vacuum_pv",
156 beamPipePV =
new G4PVPlacement(
nullptr,
159 nameIn +
"_beampipe_pipe_pv",
164 allPhysicalVolumes.insert(vacuumPV);
165 allPhysicalVolumes.insert(beamPipePV);
169 G4double containerRadius,
170 G4bool containerIsCircular)
175 vacuumLV,containerIsCircular,containerRadius,
200 const G4ThreeVector &inputface,
201 const G4ThreeVector &outputface,
202 G4double beampipeRadius,
203 const G4String& name)
205 G4bool intersects =
BDS::WillIntersect(inputface.angle(), outputface.angle(), beampipeRadius*2, length);
208 {
throw BDSException(__METHOD_NAME__,
"a volume in the \"" + name +
"\" beam pipe geometry cannot be constructed as it's angled faces intersect within it's extent");}
virtual void SetVisAttributes(G4Material *beamPipeMaterialIn)
Set visual attributes.
G4ThreeVector outputFaceNormal
For recording the face normals in the finished pipe component.
G4bool storeApertureImpacts
Whether to store aperture impacts.
BDSBeamPipeFactoryBase()
base constructor
virtual void BuildLogicalVolumes(const G4String &nameIn, G4Material *vacuumMaterialIn, G4Material *beamPipeMaterialIn)
build logical volumes
G4ThreeVector inputFaceNormal
For recording the face normals in the finished pipe component.
void CommonConstruction(const G4String &nameIn, G4Material *vacuumMaterialIn, G4Material *beamPipeMaterialIn, G4double length)
finalise beampipe construction
G4bool sensitiveVacuum
Whether the vacuum will record any energy deposition.
BDSBeamPipe * BuildBeamPipeAndRegisterVolumes(BDSExtent extent, G4double containerRadius, G4bool containerIsCircular=false)
build beampipe and register logical volumes
virtual void PlaceComponents(const G4String &nameIn)
Place volumes.
G4bool sensitiveBeamPipe
Whether the beam pipe will record energy deposition.
static void CheckAngledVolumeCanBeBuilt(G4double length, const G4ThreeVector &inputfaceAngle, const G4ThreeVector &outputfaceAngle, G4double horizontalWidth, const G4String &name)
check if a beam pipe volume with angled faces can be constructed
G4VSolid * containerSubtractionSolid
Longer (in length) version of container solid for unambiguous subtraction.
virtual void SetUserLimits(G4double length)
Set user limits.
A holder class for a piece of beam pipe geometry.
static BDSColourFromMaterial * Instance()
Singleton pattern.
G4Colour * GetColourWithDefault(const G4Material *material, G4Colour *defaultIn) const
Get colour from name - if not found return the supplied default.
static BDSColours * Instance()
singleton pattern
General exception with possible name of object and message.
Holder for +- extents in 3 dimensions.
G4bool checkOverlaps
Cache of global constants variable.
G4double nSegmentsPerCircle
Cache of global constants variable.
virtual void FactoryBaseCleanUp()
Empty containers for next use - factories are never deleted so can't rely on scope.
void RegisterLogicalVolume(G4LogicalVolume *logicalVolume)
void RegisterPhysicalVolume(G4VPhysicalVolume *physicalVolume)
void RegisterUserLimits(G4UserLimits *userLimit)
void RegisterVisAttributes(G4VisAttributes *visAttribute)
void RegisterSolid(G4VSolid *solid)
void RegisterSensitiveVolume(G4LogicalVolume *sensitiveVolume, BDSSDType sensitivityType)
A class that holds global options and constants.
static BDSGlobalConstants * Instance()
Access method.
static BDSMaterials * Instance()
Singleton pattern access.
G4Material * GetMaterial(G4String material) const
Get material by name.
G4bool WillIntersect(const G4ThreeVector &incomingNormal, const G4ThreeVector &outgoingNormal, const G4double &zSeparation, const BDSExtent &incomingExtent, const BDSExtent &outgoingExtent)
G4UserLimits * CreateUserLimits(G4UserLimits *defaultUL, G4double length, G4double fraction=1.6)