19#include "BDSCavity.hh"
20#include "BDSCavityFactoryBase.hh"
21#include "BDSCavityInfo.hh"
22#include "BDSColours.hh"
23#include "BDSExtent.hh"
24#include "BDSGlobalConstants.hh"
25#include "BDSMaterials.hh"
26#include "BDSSDType.hh"
27#include "BDSUtilities.hh"
30#include "G4LogicalVolume.hh"
31#include "G4RotationMatrix.hh"
32#include "G4PVPlacement.hh"
33#include "G4ThreeVector.hh"
35#include "G4VisAttributes.hh"
36#include "G4VPhysicalVolume.hh"
38#include "CLHEP/Units/SystemOfUnits.h"
45BDSCavityFactoryBase::BDSCavityFactoryBase()
55 G4double totalChordLength,
57 G4Material* vacuumMaterial)
60 G4double containerRadius =
CreateSolids(name, totalChordLength, info);
91 G4Material* vacuumMaterial)
101 name +
"_vacuum_lv");
108 name +
"_container_lv");
118 {allUserLimits.insert(ul);}
120 for (
auto lv : allLogicalVolumes)
121 {lv->SetUserLimits(ul);}
128 G4VisAttributes* cavityVis =
new G4VisAttributes(*col);
129 cavityVis->SetVisibility(
true);
131 cavityLV->SetVisAttributes(cavityVis);
132 allVisAttributes.insert(cavityVis);
142 G4PVPlacement* vacuumPV =
new G4PVPlacement(
nullptr,
150 allPhysicalVolumes.insert(vacuumPV);
152 G4PVPlacement* cavityPV =
new G4PVPlacement(
nullptr,
160 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.
G4LogicalVolume * vacuumLV
Cache of particular solid or lv for common functionality in this class.
virtual void SetUserLimits(G4double length)
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 G4double CreateSolids(G4String name, G4double totalChordLength, const BDSCavityInfo *info)=0
Create vacuumSolid and cavitySolid. Must return the container radius.
G4Material * emptyMaterial
Cache of variable from BDSGlobalConstants.
std::map< G4LogicalVolume *, BDSSDType > sensitiveVolumes
Map to sensitivity for volumes.
virtual void SetVisAttributes(G4String colourName="rfcavity")
Set vis attributes for cavityLV, vacuumLV and containerLV.
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.
BDSCavity * CreateCavity(G4String name, G4double totalChordLength, const BDSCavityInfo *info, G4Material *vacuumMaterial)
G4VSolid * cavitySolid
Cache of particular solid or lv for common functionality in this class.
virtual void PlaceComponents(G4String name)
Place the vacuum and cavity centrally in the container logical volume.
virtual void CreateLogicalVolumes(G4String name, const BDSCavityInfo *info, G4Material *vacuumMaterial)
Create vacuumLV, cavityLV and containerLV.
Holder for all Geometrical information required to create an RF cavity.
G4Material * material
Material.
A holder class for an RF cavity piece of geometry.
static BDSColours * Instance()
singleton pattern
G4Colour * GetColour(const G4String &type, G4bool normaliseTo255=true)
Get colour from name.
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)