18#include "BDSBeamPipe.hh"
19#include "BDSBeamPipeFactory.hh"
20#include "BDSAcceleratorComponent.hh"
21#include "BDSBeamPipeInfo.hh"
22#include "BDSColours.hh"
25#include "BDSLaserWireNew.hh"
26#include "BDSLogicalVolumeLaser.hh"
27#include "BDSMaterials.hh"
28#include "BDSUtilities.hh"
29#include "BDSWireScanner.hh"
34#include "G4IntersectionSolid.hh"
35#include "G4PVPlacement.hh"
36#include "G4ThreeVector.hh"
37#include "G4TwoVector.hh"
38#include "G4VisAttributes.hh"
39#include "BDSException.hh"
45 G4double wireDiameterIn,
46 G4double wireLengthIn,
48 G4double wireLongitudinalAngleIn,
49 G4ThreeVector wireOffsetIn,
50 G4Colour* wireColourIn):
53 wireDiameter(wireDiameterIn),
54 wireLength(wireLengthIn),
55 wireAngle(wireAngleIn),
56 wireLongitudinalAngle(wireLongitudinalAngleIn),
57 wireOffset(wireOffsetIn),
58 wireColour(wireColourIn)
63 if (wireDiameter <= 0)
64 {
throw BDSException(__METHOD_NAME__,
"W0 or Sigma0 in element " + name +
" must be greater than 0.");}
67 {
throw BDSException(__METHOD_NAME__,
"wireLength in element " + name +
" must be greater than 0.");}
69 if (wireLongitudinalAngle > CLHEP::halfpi && wireLongitudinalAngle < -1.0*CLHEP::halfpi)
70 {
throw BDSException(__METHOD_NAME__,
"laserOffsetPhi in element " + name +
" must be between -pi/2 and pi/2.");}
72 if(wireAngle < CLHEP::pi && wireAngle < -1.0*CLHEP::pi)
73 {
throw BDSException(__METHOD_NAME__,
"laserOffsetTheta in element " + name +
" must be between 0 and two pi.");}
77 G4TwoVector offsetXY = G4TwoVector(wireOffset.x(), wireOffset.y());
78 G4TwoVector tipTop = G4TwoVector(0, 0.5*wireLength);
79 tipTop.rotate(wireAngle);
80 G4TwoVector tipBot = G4TwoVector(tipTop);
81 tipBot.rotate(CLHEP::pi);
89BDSLaserWireNew::~BDSLaserWireNew()
121 G4VSolid* wire = BuildHyperbolicWireSolid();
122 G4LogicalVolume* wireLV = BuildWireLV(wire);
125 G4VisAttributes* wireVisAttr =
new G4VisAttributes(*wireColour);
126 wireLV->SetVisAttributes(wireVisAttr);
130 G4RotationMatrix* placementWireRot =
new G4RotationMatrix();
132 placementWireRot->rotateX(wireLongitudinalAngle);
134 placementWireRot->rotateY(CLHEP::pi-wireAngle);
135 placementWireRot->rotateZ(0);
136 placementWireRot->invert();
138 G4PVPlacement* wirePV =
new G4PVPlacement(placementWireRot,
151G4VSolid* BDSLaserWireNew::BuildHyperbolicWireSolid()
153 G4VSolid* laserwire =
nullptr;
156 laserwire =
new G4Tubs(
name +
"_laserwire_solid",
165 laserwire =
new G4Hype(
name +
"_laserwire_solid",
169 laser->HyperbolicAngle(),
174 G4ThreeVector unitLaserZ;
175 unitLaserZ.set(0,0,1);
178 G4RotationMatrix* wireRot =
new G4RotationMatrix();
180 wireRot->rotateX(wireLongitudinalAngle);
181 wireRot->rotateY(wireAngle);
185 wireColour->SetAlpha(0.5);
189 BDSBeamPipe* intersectionBP = bpf->CreateBeamPipeForVacuumIntersection(
name +
"_vacuum_intersection",
196 G4VSolid* lasersolid =
new G4IntersectionSolid(
name +
"_laserwire_solid",laserwire,vacuumSolid,wireRot,wireOffset);
204G4LogicalVolume* BDSLaserWireNew::BuildWireLV(G4VSolid* solid)
208 name +
"_laserwire_lv",
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.
BDSBeamPipeInfo * GetBeamPipeInfo() const
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()
BDSLaserWireNew()=delete
Private default constructor to force the use of the supplied one.
Class to provide laser intensity at any point.
G4bool IgnoreRayleighRange() const
Accessor.
Extended logical volume with laser definition.
static BDSMaterials * Instance()
Singleton pattern access.
G4Material * GetMaterial(G4String material) const
Get material by name.