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):
50 wireMaterial(wireMaterialIn),
51 wireDiameter(wireDiameterIn),
52 wireLength(wireLengthIn),
53 wireAngle(wireAngleIn),
54 wireOffset(wireOffsetIn)
56 if (wireDiameter <= 0)
57 {
throw BDSException(__METHOD_NAME__,
"Error: wireDiameter for \"" + name +
"\" is not defined or must be greater than 0");}
60 {
throw BDSException(__METHOD_NAME__,
"Error: wire for \"" + name +
"\" must be > 0.");}
64 G4TwoVector offsetXY = G4TwoVector(wireOffset.x(), wireOffset.y());
65 G4TwoVector tipTop = G4TwoVector(0, 0.5*wireLength);
66 tipTop.rotate(wireAngle);
67 G4TwoVector tipBot = G4TwoVector(tipTop);
68 tipBot.rotate(CLHEP::pi);
71 G4double innerRadius = beamPipeInfo->IndicativeRadiusInner();
72 if (tipTop.mag() > innerRadius || tipBot.mag() > innerRadius)
73 {
throw BDSException(__METHOD_NAME__,
"wire for \"" + name +
"\" is too big to fit in beam pipe give offsets.");}
103 G4Tubs* wire =
new G4Tubs(
name +
"_wire_solid",
110 G4LogicalVolume* wireLV =
new G4LogicalVolume(wire,
117 G4RotationMatrix* wireRot =
new G4RotationMatrix();
118 wireRot->rotateX(CLHEP::halfpi);
120 wireRot->rotateY(wireAngle);
124 G4VisAttributes* wireVisAttr =
new G4VisAttributes(*
BDSColours::Instance()->GetColour(
"wirescanner"));
125 wireLV->SetVisAttributes(wireVisAttr);
130 G4PVPlacement* wirePV =
new G4PVPlacement(wireRot,
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.
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)
void RegisterSensitiveVolume(G4LogicalVolume *sensitiveVolume, BDSSDType sensitivityType)
virtual void BuildContainerLogicalVolume()
BDSWireScanner()=delete
Private default constructor to force the use of the supplied one.