23#include "G4ThreeVector.hh"
24#include "G4Transform3D.hh"
26#include "BDSSamplerType.hh"
27#include "BDSExtentGlobal.hh"
43typedef CLHEP::HepRotation G4RotationMatrix;
78 BDSBeamline(
const G4ThreeVector& initialGlobalPosition = G4ThreeVector(0,0,0),
79 G4RotationMatrix* initialGlobalRotation =
nullptr,
80 G4double initialSIn = 0.0);
83 explicit BDSBeamline(G4Transform3D initialTransform,
84 G4double initialSIn = 0.0);
184 G4int* indexOfFoundElement =
nullptr)
const;
188 G4int* indexOfFoundElement =
nullptr)
const;
197 G4double GetSMinimum()
const {
return sInitial;}
198 G4double GetSMaximum()
const {
return sMaximum;}
230 G4bool flip =
false)
const;
233 G4bool
IndexOK(G4int index)
const;
Abstract class that represents a component of an accelerator.
A class that holds a fully constructed BDSAcceleratorComponent as well as any information relevant to...
A vector of BDSBeamlineElement instances - a beamline.
std::vector< BDSBeamlineElement * > BeamlineVector
Typedefs up first so we can declare public iterators.
G4double totalChordLength
Sum of all chord lengths.
std::vector< G4double > GetEdgeSPositions() const
G4ThreeVector previousReferencePositionEnd
Current reference position at the end of the previous element.
const BDSBeamlineElement * GetPrevious(const BDSBeamlineElement *element) const
void PrintAllComponents(std::ostream &out) const
const BDSBeamlineElement * GetElement(G4String acceleratorComponentName, G4int i=0) const
Get the ith placement of an element in the beam line. Returns null pointer if not found.
friend std::ostream & operator<<(std::ostream &out, BDSBeamline const &bl)
output stream
BDSBeamlineElement * front() const
Return a reference to the first element.
BDSBeamlineElement * back() const
Return a reference to the last element.
G4double GetTotalAngle() const
Get the total angle of the beamline.
G4ThreeVector maximumExtentPositive
maximum extent in the positive coordinates in each dimension
const BDSBeamlineElement * GetLastItem() const
Return a reference to the last element.
BDSBeamline & operator=(const BDSBeamline &)=delete
assignment and copy constructor not implemented nor used.
G4double GetTotalChordLength() const
Get the total length of the beamline - the sum of the chord length of each element.
G4double previousSPositionEnd
Current s coordinate at the end of the previous element.
G4bool ElementAnglesSumToCircle() const
Check if the sum of the angle of all elements is two pi.
G4double totalAngle
Sum of all angles.
BDSBeamlineElement * ProvideEndPieceElementAfter(BDSSimpleComponent *endPiece, G4int index, G4bool flip=false) const
G4RotationMatrix * previousReferenceRotationEnd
Current reference rotation at the end of the previous element.
G4bool transformHasJustBeenApplied
void RegisterElement(BDSBeamlineElement *element)
const_iterator begin() const
Iterator mechanics.
const_reverse_iterator rend() const
Iterator mechanics.
void UpdateExtents(BDSBeamlineElement *element)
G4ThreeVector GetMaximumExtentAbsolute() const
Get the maximum extent absolute in each dimension.
void PrintMemoryConsumption() const
void ApplyTransform3D(BDSTransform3D *component)
static G4double PaddingLength()
Access the padding length between each element added to the beamline.
static G4double paddingLength
The gap added for padding between each component.
G4ThreeVector GetMaximumExtentNegative() const
Get the maximum negative extent in all dimensions.
const_reverse_iterator rbegin() const
Iterator mechanics.
const BDSBeamlineElement * at(int iElement) const
Return a reference to the element at i.
reverse_iterator rend()
Iterator mechanics.
const BDSBeamlineElement * GetFirstItem() const
Return a reference to the first element.
G4bool IndexOK(G4int index) const
Whether the supplied index will lie within the beam line vector.
BeamlineVector::iterator iterator
Iterator mechanics.
BeamlineVector::size_type size() const
Get the number of elements.
void AddBeamlineElement(BDSBeamlineElement *element)
G4Transform3D GetTransformForElement(const G4String &acceleratorComponentName, G4int i=0) const
const_iterator FindFromS(G4double S) const
Returns an iterator to the beamline element at s.
G4double totalArcLength
Sum of all arc lengths.
BeamlineVector::const_reverse_iterator const_reverse_iterator
Iterator mechanics.
BeamlineVector beamline
Vector of beam line elements - the data.
const BDSBeamlineElement * GetElementFromGlobalS(G4double S, G4int *indexOfFoundElement=nullptr) const
Return the element in this beam line according to a given s coordinate.
G4bool empty() const
Iterator mechanics.
void AddSingleComponent(BDSAcceleratorComponent *component, BDSTiltOffset *tiltOffset=nullptr, BDSSamplerInfo *samplerInfo=nullptr)
G4ThreeVector GetMaximumExtentPositive() const
Get the maximum positive extent in all dimensions
G4Transform3D GetGlobalEuclideanTransform(G4double s, G4double x=0, G4double y=0, G4int *indexOfFoundElement=nullptr) const
BDSExtentGlobal GetExtentGlobal() const
Get the global extents for this beamline.
reverse_iterator rbegin()
Iterator mechanics.
iterator begin()
Iterator mechanics.
const_iterator end() const
Iterator mechanics.
std::map< G4String, BDSBeamlineElement * > components
Map of objects by placement name stored in this beam line.
void AddComponent(BDSAcceleratorComponent *component, BDSTiltOffset *tiltOffset=nullptr, BDSSamplerInfo *samplerInfo=nullptr)
iterator end()
Iterator mechanics.
std::vector< G4int > GetIndicesOfElementsOfType(const G4String &type) const
Return vector of indices for this beam line where element of type name 'type' is found.
G4double GetTotalArcLength() const
Get the total ARC length for the beamline - ie the maximum s position.
std::vector< G4double > sEnd
BeamlineVector::const_iterator const_iterator
Iterator mechanics.
G4double sInitial
Cache the initial S so we can tell if a requested S is too low.
std::vector< G4int > GetIndicesOfCollimators() const
Return indices in order of ecol, rcol, jcol and crystalcol elements.
BeamlineVector::reverse_iterator reverse_iterator
Iterator mechanics.
G4ThreeVector maximumExtentNegative
maximum extent in the negative coordinates in each dimension
Holder for +- extents in 3 dimensions with a rotation and translation.
All info required to build a sampler but not place it.
A BDSAcceleratorComponent wrapper for BDSGeometryComponent.
A holder for any placement offsets and rotations for a BDSAcceleratorComponent.