18#include "BDSCavity.hh"
19#include "BDSCavityFactoryBase.hh"
20#include "BDSCavityInfo.hh"
21#include "BDSColours.hh"
22#include "BDSExtent.hh"
23#include "BDSGlobalConstants.hh"
24#include "BDSMaterials.hh"
25#include "BDSSDType.hh"
26#include "BDSUtilities.hh"
29#include "G4LogicalVolume.hh"
30#include "G4RotationMatrix.hh"
31#include "G4PVPlacement.hh"
32#include "G4ThreeVector.hh"
34#include "G4VisAttributes.hh"
35#include "G4VPhysicalVolume.hh"
37#include "CLHEP/Units/SystemOfUnits.h"
44BDSCavityFactoryBase::BDSCavityFactoryBase()
54 G4double totalChordLength,
56 G4Material* vacuumMaterial)
59 G4double containerRadius =
CreateSolids(name, totalChordLength, info);
90 G4Material* vacuumMaterial)
100 name +
"_vacuum_lv");
107 name +
"_container_lv");
117 {allUserLimits.insert(ul);}
119 for (
auto lv : allLogicalVolumes)
120 {lv->SetUserLimits(ul);}
127 G4VisAttributes* cavityVis =
new G4VisAttributes(*col);
128 cavityVis->SetVisibility(
true);
130 cavityLV->SetVisAttributes(cavityVis);
131 allVisAttributes.insert(cavityVis);
141 G4PVPlacement* vacuumPV =
new G4PVPlacement(
nullptr,
149 allPhysicalVolumes.insert(vacuumPV);
151 G4PVPlacement* cavityPV =
new G4PVPlacement(
nullptr,
159 allPhysicalVolumes.insert(cavityPV);
G4bool sensitiveBeamPipe
Whether the beam pipe will record energy deposition.
G4bool sensitiveVacuum
Whether the vacuum will record energy deposition.
virtual BDSCavity * BuildCavityAndRegisterObjects(const BDSExtent &extent)
Construct output object and register all temporary objects from vectors.
virtual void SetVisAttributes(const G4String &colourName="rfcavity")
Set vis attributes for cavityLV, vacuumLV and containerLV.
G4LogicalVolume * vacuumLV
Cache of particular solid or lv for common functionality in this class.
virtual void SetUserLimits(G4double length)
BDSCavity * CreateCavity(const G4String &name, G4double totalChordLength, const BDSCavityInfo *info, G4Material *vacuumMaterial)
virtual G4double CreateSolids(const G4String &name, G4double totalChordLength, const BDSCavityInfo *info)=0
Create vacuumSolid and cavitySolid. Must return the container radius.
G4LogicalVolume * containerLV
Cache of particular solid or lv for common functionality in this class.
void CleanUpBase()
Non-virtual clean up that can be used in the constructor safely.
G4LogicalVolume * cavityLV
Cache of particular solid or lv for common functionality in this class.
virtual void PlaceComponents(const G4String &name)
Place the vacuum and cavity centrally in the container logical volume.
G4Material * emptyMaterial
Cache of variable from BDSGlobalConstants.
std::map< G4LogicalVolume *, BDSSDType > sensitiveVolumes
Map to sensitivity for volumes.
G4VSolid * vacuumSolid
Cache of particular solid or lv for common functionality in this class.
virtual void CleanUp()
Ensure all internal members are reset before reuse. Calls CleanUpBase.
G4VSolid * containerSolid
Cache of particular solid or lv for common functionality in this class.
virtual void CreateLogicalVolumes(const G4String &name, const BDSCavityInfo *info, G4Material *vacuumMaterial)
Create vacuumLV, cavityLV and containerLV.
G4VSolid * cavitySolid
Cache of particular solid or lv for common functionality in this class.
Holder for all Geometrical information required to create an RF cavity.
G4Material * material
Material.
A holder class for an RF cavity piece of geometry.
G4Colour * GetColour(G4double red, G4double green, G4double blue, G4double alpha=1)
Get a cached anonymous colour by values.
static BDSColours * Instance()
singleton pattern
Holder for +- extents in 3 dimensions.
G4bool checkOverlaps
Cache of global constants variable.
G4int 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 RegisterRotationMatrix(G4RotationMatrix *rotationMatrix)
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)
static BDSGlobalConstants * Instance()
Access method.
static BDSMaterials * Instance()
Singleton pattern access.
G4Material * GetMaterial(G4String material) const
Get material by name.
G4UserLimits * CreateUserLimits(G4UserLimits *defaultUL, G4double length, G4double fraction=1.6)