19#include "BDSBeamPipe.hh"
20#include "BDSBeamPipeFactory.hh"
21#include "BDSAcceleratorComponent.hh"
22#include "BDSBeamPipeInfo.hh"
23#include "BDSColours.hh"
26#include "BDSLaserWireNew.hh"
27#include "BDSLogicalVolumeLaser.hh"
28#include "BDSMaterials.hh"
29#include "BDSUtilities.hh"
30#include "BDSWireScanner.hh"
35#include "G4IntersectionSolid.hh"
36#include "G4PVPlacement.hh"
37#include "G4ThreeVector.hh"
38#include "G4TwoVector.hh"
39#include "G4VisAttributes.hh"
40#include "BDSException.hh"
46 G4double wireDiameterIn,
47 G4double wireLengthIn,
49 G4double wireLongitudinalAngleIn,
50 G4ThreeVector wireOffsetIn,
51 G4Colour* wireColourIn):
54 wireDiameter(wireDiameterIn),
55 wireLength(wireLengthIn),
56 wireAngle(wireAngleIn),
57 wireLongitudinalAngle(wireLongitudinalAngleIn),
58 wireOffset(wireOffsetIn),
59 wireColour(wireColourIn)
64 if (wireDiameter <= 0)
65 {
throw BDSException(__METHOD_NAME__,
"W0 or Sigma0 in element " + name +
" must be greater than 0.");}
68 {
throw BDSException(__METHOD_NAME__,
"wireLength in element " + name +
" must be greater than 0.");}
70 if (wireLongitudinalAngle > CLHEP::halfpi && wireLongitudinalAngle < -1.0*CLHEP::halfpi)
71 {
throw BDSException(__METHOD_NAME__,
"laserOffsetPhi in element " + name +
" must be between -pi/2 and pi/2.");}
73 if(wireAngle < CLHEP::pi && wireAngle < -1.0*CLHEP::pi)
74 {
throw BDSException(__METHOD_NAME__,
"laserOffsetTheta in element " + name +
" must be between 0 and two pi.");}
78 G4TwoVector offsetXY = G4TwoVector(wireOffset.x(), wireOffset.y());
79 G4TwoVector tipTop = G4TwoVector(0, 0.5*wireLength);
80 tipTop.rotate(wireAngle);
81 G4TwoVector tipBot = G4TwoVector(tipTop);
82 tipBot.rotate(CLHEP::pi);
90BDSLaserWireNew::~BDSLaserWireNew()
122 G4VSolid* wire = BuildHyperbolicWireSolid();
123 G4LogicalVolume* wireLV = BuildWireLV(wire);
126 G4VisAttributes* wireVisAttr =
new G4VisAttributes(*wireColour);
127 wireLV->SetVisAttributes(wireVisAttr);
131 G4RotationMatrix* placementWireRot =
new G4RotationMatrix();
133 placementWireRot->rotateX(wireLongitudinalAngle);
135 placementWireRot->rotateY(CLHEP::pi-wireAngle);
136 placementWireRot->rotateZ(0);
137 placementWireRot->invert();
139 G4PVPlacement* wirePV =
new G4PVPlacement(placementWireRot,
152G4VSolid* BDSLaserWireNew::BuildHyperbolicWireSolid()
154 G4VSolid* laserwire =
nullptr;
157 laserwire =
new G4Tubs(
name +
"_laserwire_solid",
166 laserwire =
new G4Hype(
name +
"_laserwire_solid",
170 laser->HyperbolicAngle(),
175 G4ThreeVector unitLaserZ;
176 unitLaserZ.set(0,0,1);
179 G4RotationMatrix* wireRot =
new G4RotationMatrix();
181 wireRot->rotateX(wireLongitudinalAngle);
182 wireRot->rotateY(wireAngle);
186 wireColour->SetAlpha(0.5);
190 BDSBeamPipe* intersectionBP = bpf->CreateBeamPipeForVacuumIntersection(
name +
"_vacuum_intersection",
197 G4VSolid* lasersolid =
new G4IntersectionSolid(
name +
"_laserwire_solid",laserwire,vacuumSolid,wireRot,wireOffset);
205G4LogicalVolume* BDSLaserWireNew::BuildWireLV(G4VSolid* solid)
209 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.