19#include "BDSAcceleratorComponent.hh"
20#include "BDSColours.hh"
22#include "BDSException.hh"
23#include "BDSBeamPipe.hh"
24#include "BDSBeamPipeFactory.hh"
25#include "BDSBeamPipeInfo.hh"
26#include "BDSUtilities.hh"
27#include "BDSWireScanner.hh"
30#include "G4LogicalVolume.hh"
31#include "G4PVPlacement.hh"
32#include "G4ThreeVector.hh"
34#include "G4TwoVector.hh"
35#include "G4VisAttributes.hh"
37#include "CLHEP/Units/PhysicalConstants.h"
44 G4Material* wireMaterialIn,
45 G4double wireDiameterIn,
46 G4double wireLengthIn,
48 G4ThreeVector wireOffsetIn,
49 G4Colour* wireColourIn):
51 wireMaterial(wireMaterialIn),
52 wireDiameter(wireDiameterIn),
53 wireLength(wireLengthIn),
54 wireAngle(wireAngleIn),
55 wireOffset(wireOffsetIn),
56 wireColour(wireColourIn)
58 if (wireDiameter <= 0)
59 {
throw BDSException(__METHOD_NAME__,
"Error: wireDiameter for \"" + name +
"\" is not defined or must be greater than 0");}
62 {
throw BDSException(__METHOD_NAME__,
"Error: wire for \"" + name +
"\" must be > 0.");}
66 G4TwoVector offsetXY = G4TwoVector(wireOffset.x(), wireOffset.y());
67 G4TwoVector tipTop = G4TwoVector(0, 0.5*wireLength);
68 tipTop.rotate(wireAngle);
69 G4TwoVector tipBot = G4TwoVector(tipTop);
70 tipBot.rotate(CLHEP::pi);
73 G4double innerRadius = beamPipeInfo->IndicativeRadiusInner();
74 if (tipTop.mag() > innerRadius || tipBot.mag() > innerRadius)
75 {
throw BDSException(__METHOD_NAME__,
"wire for \"" + name +
"\" is too big to fit in beam pipe give offsets.");}
111 G4RotationMatrix* wireRot =
new G4RotationMatrix();
112 wireRot->rotateX(CLHEP::halfpi);
114 wireRot->rotateY(wireAngle);
118 G4VisAttributes* wireVisAttr =
new G4VisAttributes(*wireColour);
119 wireLV->SetVisAttributes(wireVisAttr);
124 G4PVPlacement* wirePV =
new G4PVPlacement(wireRot,
137 G4Tubs* wire =
new G4Tubs(
name +
"_wire_solid",
149 G4LogicalVolume* wireLV =
new G4LogicalVolume(solid,
Abstract class that represents a component of an accelerator.
void SetAcceleratorVacuumLogicalVolume(G4LogicalVolume *accVacLVIn)
const G4String name
Const protected member variable that may not be changed by derived classes.
virtual void SetOutputFaceNormal(const G4ThreeVector &output)
Allow updating of face normals. Virtual so derived class may apply it to daughters.
static G4bool checkOverlaps
Useful variable often used in construction.
virtual std::set< G4LogicalVolume * > GetAcceleratorVacuumLogicalVolumes() const
Access the 'vacuum' volume(s) in this component if any. Default is empty set.
virtual void SetInputFaceNormal(const G4ThreeVector &input)
Allow updating of face normals. Virtual so derived class may apply it to daughters.
G4double chordLength
Protected member variable that can be modified by derived classes.
BDSBeamPipeInfo * beamPipeInfo
Optional beam pipe recipe that is written out to the survey if it exists.
The main interface for using the beam pipe factories.
static BDSBeamPipeFactory * Instance()
Singleton accessor.
Holder class for all information required to describe a beam pipe model.
A holder class for a piece of beam pipe geometry.
G4LogicalVolume * GetVacuumLogicalVolume() const
Access the vacuum volume to set fields and limits.
G4ThreeVector InputFaceNormal() const
Accessor.
G4ThreeVector OutputFaceNormal() const
Accessor.
G4Colour * GetColour(G4double red, G4double green, G4double blue, G4double alpha=1)
Get a cached anonymous colour by values.
static BDSColours * Instance()
singleton pattern
General exception with possible name of object and message.
G4LogicalVolume * GetContainerLogicalVolume() const
Accessor - see member for more info.
void InheritExtents(BDSGeometryComponent const *const anotherComponent)
Update the extents of this object with those of another object.
void RegisterRotationMatrix(G4RotationMatrix *rotationMatrix)
void RegisterDaughter(BDSGeometryComponent *anotherComponent)
void RegisterLogicalVolume(G4LogicalVolume *logicalVolume)
void RegisterPhysicalVolume(G4VPhysicalVolume *physicalVolume)
G4VSolid * GetContainerSolid() const
Accessor - see member for more info.
void RegisterVisAttributes(G4VisAttributes *visAttribute)
void RegisterSolid(G4VSolid *solid)
virtual void BuildContainerLogicalVolume()
virtual G4VSolid * BuildWireSolid()
Allow overriding of certain bits of construction.
virtual G4LogicalVolume * BuildWireLV(G4VSolid *solid)
Allow overriding of certain bits of construction.
BDSWireScanner()=delete
Private default constructor to force the use of the supplied one.