BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Public Member Functions | Friends
BDSExtent Class Reference

Holder for +- extents in 3 dimensions. More...

#include <BDSExtent.hh>

Inheritance diagram for BDSExtent:
Inheritance graph
Collaboration diagram for BDSExtent:
Collaboration graph

Public Member Functions

 BDSExtent ()
 Default constructor gives 0 in all extents - typically unphysical. More...
 
 BDSExtent (const std::pair< G4double, G4double > &extXIn, const std::pair< G4double, G4double > &extYIn, const std::pair< G4double, G4double > &extZIn)
 Construct with pairs of extents. More...
 
 BDSExtent (G4double extXNegIn, G4double extXPosIn, G4double extYNegIn, G4double extYPosIn, G4double extZNegIn, G4double extZPosIn)
 Construct with individual extents. More...
 
 BDSExtent (G4double extXIn, G4double extYIn, G4double extZIn)
 Symmetric variant - assumed to be +/- same amount. More...
 
 BDSExtent (G4ThreeVector extInNeg, G4ThreeVector extInPos)
 Threevectors of positive and negative extents. More...
 
 BDSExtent (G4ThreeVector extIn)
 Symmetric from three vector. More...
 
G4bool Encompasses (const G4ThreeVector &point) const
 Return whether the extent encompasses the point. True if point lies inside the extent. More...
 
G4bool Encompasses (const BDSExtent &other) const
 
G4bool Encompasses (G4double x, G4double y, G4double z) const
 Return whether the extent encompasses the point. Similar, but with separate x,y,z coordinates. More...
 
G4bool Encompasses (const BDSParticleCoords &coords) const
 
BDSExtent Tilted (G4double angle) const
 Provide a new copy of this extent but rotated along Z by a given tilt angle. More...
 
BDSExtent TiltOffset (const BDSTiltOffset *tiltOffset) const
 Provide a new copy of this extent with both a tilt and an offset applied. More...
 
G4double MaximumAbs () const
 Return the maximum absolute value considering all dimensions. More...
 
G4double MinimumAbs () const
 Return the minimum absolute value considering all dimensions. More...
 
G4double MaximumX () const
 
G4double MaximumY () const
 
G4double MaximumZ () const
 
G4double MaximumAbsTransverse () const
 Return the maximum absolute value considering only x,y. More...
 
G4double MinimumAbsTransverse () const
 Return the minimum absolute value considering only x,y. More...
 
G4double TransverseBoundingRadius () const
 Return a radius that would encompass the maximum x,y extent. More...
 
BDSExtent ExpandBy (G4double margin) const
 Return a copy expanded in all dimensions by the given margin. More...
 
BDSExtent ExpandTransverselyBy (G4double margin) const
 Return a copy expanded in x and y by the given margin. More...
 
void ExpandToEncompass (const BDSExtent &other)
 
std::pair< G4double, G4double > ExtentX () const
 Accessor. More...
 
std::pair< G4double, G4double > ExtentY () const
 Accessor. More...
 
std::pair< G4double, G4double > ExtentZ () const
 Accessor. More...
 
G4double XNeg () const
 Accessor. More...
 
G4double XPos () const
 Accessor. More...
 
G4double YNeg () const
 Accessor. More...
 
G4double YPos () const
 Accessor. More...
 
G4double ZNeg () const
 Accessor. More...
 
G4double ZPos () const
 Accessor. More...
 
G4ThreeVector ExtentPositive () const
 Accessor. More...
 
G4ThreeVector ExtentNegative () const
 Accessor. More...
 
std::vector< G4ThreeVector > AllBoundaryPoints () const
 All 8 boundary points of the bounding box. More...
 
G4double DX () const
 The difference in a dimension. More...
 
G4double DY () const
 The difference in a dimension. More...
 
G4double DZ () const
 The difference in a dimension. More...
 
G4bool operator< (const BDSExtent &r) const
 Comparison operator. More...
 
G4bool operator> (const BDSExtent &r) const
 Comparison operator. More...
 
G4bool operator<= (const BDSExtent &r) const
 Comparison operator. More...
 
G4bool operator>= (const BDSExtent &r) const
 Comparison operator. More...
 
G4bool operator== (const BDSExtent &r) const
 Equality operator. More...
 
G4bool operator!= (const BDSExtent &r) const
 Equality operator. More...
 
G4bool TransverselyLessThan (const BDSExtent &r) const
 Comparison operator for x,y only. Ignores z (length). More...
 
G4bool TransverselyGreaterThan (const BDSExtent &r) const
 Comparison operator for x,y only. Ignores z (length). More...
 
G4bool TransverselyLessEquals (const BDSExtent &r) const
 Comparison operator for x,y only. Ignores z (length). More...
 
G4bool TransverselyGreaterEquals (const BDSExtent &r) const
 Comparison operator for x,y only. Ignores z (length). More...
 
BDSExtent Translate (const G4ThreeVector &offset) const
 Provide a new copy of this extent with an offset applied. More...
 
BDSExtent Translate (G4double dx, G4double dy, G4double dz) const
 Provide a new copy of this extent with an offset applied. More...
 

Private Attributes

G4double extXNeg
 Extent. More...
 
G4double extXPos
 Extent. More...
 
G4double extYNeg
 Extent. More...
 
G4double extYPos
 Extent. More...
 
G4double extZNeg
 Extent. More...
 
G4double extZPos
 Extent. More...
 

Friends

std::ostream & operator<< (std::ostream &out, BDSExtent const &ext)
 Output stream. More...
 

Detailed Description

Holder for +- extents in 3 dimensions.

Author
Laurie Nevay

Definition at line 38 of file BDSExtent.hh.

Constructor & Destructor Documentation

◆ BDSExtent() [1/6]

BDSExtent::BDSExtent ( )

Default constructor gives 0 in all extents - typically unphysical.

Definition at line 34 of file BDSExtent.cc.

Referenced by ExpandToEncompass(), Tilted(), TiltOffset(), and Translate().

Here is the caller graph for this function:

◆ BDSExtent() [2/6]

BDSExtent::BDSExtent ( const std::pair< G4double, G4double > &  extXIn,
const std::pair< G4double, G4double > &  extYIn,
const std::pair< G4double, G4double > &  extZIn 
)

Construct with pairs of extents.

Definition at line 43 of file BDSExtent.cc.

◆ BDSExtent() [3/6]

BDSExtent::BDSExtent ( G4double  extXNegIn,
G4double  extXPosIn,
G4double  extYNegIn,
G4double  extYPosIn,
G4double  extZNegIn,
G4double  extZPosIn 
)

Construct with individual extents.

Definition at line 54 of file BDSExtent.cc.

◆ BDSExtent() [4/6]

BDSExtent::BDSExtent ( G4double  extXIn,
G4double  extYIn,
G4double  extZIn 
)

Symmetric variant - assumed to be +/- same amount.

Definition at line 65 of file BDSExtent.cc.

◆ BDSExtent() [5/6]

BDSExtent::BDSExtent ( G4ThreeVector  extInNeg,
G4ThreeVector  extInPos 
)

Threevectors of positive and negative extents.

Definition at line 78 of file BDSExtent.cc.

◆ BDSExtent() [6/6]

BDSExtent::BDSExtent ( G4ThreeVector  extIn)
explicit

Symmetric from three vector.

Definition at line 74 of file BDSExtent.cc.

◆ ~BDSExtent()

BDSExtent::~BDSExtent ( )
virtual

Definition at line 88 of file BDSExtent.cc.

Member Function Documentation

◆ AllBoundaryPoints()

std::vector< G4ThreeVector > BDSExtent::AllBoundaryPoints ( ) const

All 8 boundary points of the bounding box.

Definition at line 91 of file BDSExtent.cc.

References extXNeg, extXPos, extYNeg, extYPos, extZNeg, and extZPos.

Referenced by BDSExtentGlobal::BDSExtentGlobal(), and Encompasses().

Here is the caller graph for this function:

◆ DX()

G4double BDSExtent::DX ( ) const
inline

The difference in a dimension.

Definition at line 83 of file BDSExtent.hh.

References extXNeg, and extXPos.

Referenced by BDSDetectorConstruction::SideToLocalOffset(), and BDSMagnetOuterFactoryCylindrical::TestInputParameters().

Here is the caller graph for this function:

◆ DY()

G4double BDSExtent::DY ( ) const
inline

The difference in a dimension.

Definition at line 84 of file BDSExtent.hh.

References extYNeg, and extYPos.

Referenced by BDSUndulator::BuildContainerLogicalVolume(), and BDSMagnetOuterFactoryCylindrical::TestInputParameters().

Here is the caller graph for this function:

◆ DZ()

G4double BDSExtent::DZ ( ) const
inline

The difference in a dimension.

Definition at line 85 of file BDSExtent.hh.

References extZNeg, and extZPos.

Referenced by BDS::BuildBLMs(), BDSElement::BuildContainerLogicalVolume(), BDS::BuildPlacementGeometry(), and BDSMagnetOuterFactory::CreateMagnetOuter().

Here is the caller graph for this function:

◆ Encompasses() [1/4]

G4bool BDSExtent::Encompasses ( const BDSExtent other) const

Return whether the boundary points given by a set of extents lie within this extent. True if all points lie within this extent; false if even one lies outside.

Definition at line 198 of file BDSExtent.cc.

References AllBoundaryPoints(), and Encompasses().

Here is the call graph for this function:

◆ Encompasses() [2/4]

G4bool BDSExtent::Encompasses ( const BDSParticleCoords coords) const

Definition at line 207 of file BDSExtent.cc.

◆ Encompasses() [3/4]

G4bool BDSExtent::Encompasses ( const G4ThreeVector &  point) const

Return whether the extent encompasses the point. True if point lies inside the extent.

Definition at line 190 of file BDSExtent.cc.

References extXNeg, extXPos, extYNeg, extYPos, extZNeg, and extZPos.

Referenced by BDSCollimatorCrystal::Build(), Encompasses(), BDSLinkPrimaryGeneratorAction::GeneratePrimaries(), BDSPrimaryGeneratorAction::GeneratePrimaries(), BDSFieldEInterpolated2Layer::GetField(), and BDSFieldMagInterpolated2Layer::GetField().

Here is the caller graph for this function:

◆ Encompasses() [4/4]

G4bool BDSExtent::Encompasses ( G4double  x,
G4double  y,
G4double  z 
) const
inline

Return whether the extent encompasses the point. Similar, but with separate x,y,z coordinates.

Definition at line 115 of file BDSExtent.hh.

References Encompasses().

Here is the call graph for this function:

◆ ExpandBy()

BDSExtent BDSExtent::ExpandBy ( G4double  margin) const

Return a copy expanded in all dimensions by the given margin.

Definition at line 213 of file BDSExtent.cc.

References extXNeg, extXPos, extYNeg, extYPos, extZNeg, and extZPos.

◆ ExpandToEncompass()

void BDSExtent::ExpandToEncompass ( const BDSExtent other)

Expand this extent to encompass the other one. Takes the max of each extent in this and the other.

Definition at line 236 of file BDSExtent.cc.

References BDSExtent(), extXNeg, extXPos, extYNeg, extYPos, extZNeg, and extZPos.

Here is the call graph for this function:

◆ ExpandTransverselyBy()

BDSExtent BDSExtent::ExpandTransverselyBy ( G4double  margin) const

Return a copy expanded in x and y by the given margin.

Definition at line 226 of file BDSExtent.cc.

References extXNeg, extXPos, extYNeg, and extYPos.

◆ ExtentNegative()

G4ThreeVector BDSExtent::ExtentNegative ( ) const
inline

Accessor.

Definition at line 75 of file BDSExtent.hh.

References extXNeg, extYNeg, and extZNeg.

Referenced by BDSGeometryComponent::GetExtentNegative().

Here is the caller graph for this function:

◆ ExtentPositive()

G4ThreeVector BDSExtent::ExtentPositive ( ) const
inline

Accessor.

Definition at line 72 of file BDSExtent.hh.

References extXPos, extYPos, and extZPos.

Referenced by BDSGeometryComponent::GetExtentPositive().

Here is the caller graph for this function:

◆ ExtentX()

std::pair< G4double, G4double > BDSExtent::ExtentX ( ) const
inline

Accessor.

Definition at line 61 of file BDSExtent.hh.

References extXNeg, and extXPos.

Referenced by BDSGeometryComponent::GetExtentX(), and BDSGeometryComponent::GetInnerExtentX().

Here is the caller graph for this function:

◆ ExtentY()

std::pair< G4double, G4double > BDSExtent::ExtentY ( ) const
inline

Accessor.

Definition at line 62 of file BDSExtent.hh.

References extYNeg, and extYPos.

Referenced by BDSGeometryComponent::GetExtentY(), and BDSGeometryComponent::GetInnerExtentY().

Here is the caller graph for this function:

◆ ExtentZ()

std::pair< G4double, G4double > BDSExtent::ExtentZ ( ) const
inline

Accessor.

Definition at line 63 of file BDSExtent.hh.

References extZNeg, and extZPos.

Referenced by BDSGeometryComponent::GetExtentZ(), BDSGeometryComponent::GetInnerExtentZ(), and BDSDetectorConstruction::SideToLocalOffset().

Here is the caller graph for this function:

◆ MaximumAbs()

G4double BDSExtent::MaximumAbs ( ) const

Return the maximum absolute value considering all dimensions.

Definition at line 157 of file BDSExtent.cc.

References extXNeg, extXPos, extYNeg, extYPos, extZNeg, and extZPos.

◆ MaximumAbsTransverse()

G4double BDSExtent::MaximumAbsTransverse ( ) const

Return the maximum absolute value considering only x,y.

Definition at line 171 of file BDSExtent.cc.

References extXNeg, extXPos, extYNeg, and extYPos.

Referenced by BDSTunnelBuilder::BuildTunnelSections(), BDSBeamPipeFactoryClicPCL::CommonFinalConstruction(), BDSMagnetOuterFactory::CreateContainerForExternal(), BDSApertureInfo::IndicativeRadius(), and BDSBeamPipeInfo::IndicativeRadius().

Here is the caller graph for this function:

◆ MaximumX()

G4double BDSExtent::MaximumX ( ) const
inline

Definition at line 141 of file BDSExtent.hh.

◆ MaximumY()

G4double BDSExtent::MaximumY ( ) const
inline

Definition at line 142 of file BDSExtent.hh.

◆ MaximumZ()

G4double BDSExtent::MaximumZ ( ) const
inline

Definition at line 143 of file BDSExtent.hh.

◆ MinimumAbs()

G4double BDSExtent::MinimumAbs ( ) const

Return the minimum absolute value considering all dimensions.

Definition at line 164 of file BDSExtent.cc.

References extXNeg, extXPos, extYNeg, extYPos, extZNeg, and extZPos.

◆ MinimumAbsTransverse()

G4double BDSExtent::MinimumAbsTransverse ( ) const

Return the minimum absolute value considering only x,y.

Definition at line 177 of file BDSExtent.cc.

References extXNeg, extXPos, extYNeg, and extYPos.

Referenced by BDSBeamPipeInfo::IndicativeRadiusInner().

Here is the caller graph for this function:

◆ operator!=()

G4bool BDSExtent::operator!= ( const BDSExtent r) const
inline

Equality operator.

Definition at line 97 of file BDSExtent.hh.

◆ operator<()

G4bool BDSExtent::operator< ( const BDSExtent r) const
inline

Comparison operator.

Definition at line 175 of file BDSExtent.hh.

References extXNeg, extXPos, extYNeg, extYPos, extZNeg, and extZPos.

◆ operator<=()

G4bool BDSExtent::operator<= ( const BDSExtent r) const
inline

Comparison operator.

Definition at line 91 of file BDSExtent.hh.

◆ operator==()

G4bool BDSExtent::operator== ( const BDSExtent r) const
inline

Equality operator.

Definition at line 183 of file BDSExtent.hh.

References extXNeg, extXPos, extYNeg, extYPos, extZNeg, and extZPos.

◆ operator>()

G4bool BDSExtent::operator> ( const BDSExtent r) const
inline

Comparison operator.

Definition at line 90 of file BDSExtent.hh.

◆ operator>=()

G4bool BDSExtent::operator>= ( const BDSExtent r) const
inline

Comparison operator.

Definition at line 92 of file BDSExtent.hh.

◆ Tilted()

BDSExtent BDSExtent::Tilted ( G4double  angle) const

Provide a new copy of this extent but rotated along Z by a given tilt angle.

Definition at line 121 of file BDSExtent.cc.

References BDSExtent(), extXNeg, extXPos, extYNeg, extYPos, extZNeg, extZPos, and BDS::IsFinite().

Referenced by BDS::BuildEndPieceBeamline(), and TiltOffset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TiltOffset()

BDSExtent BDSExtent::TiltOffset ( const BDSTiltOffset tiltOffset) const

Provide a new copy of this extent with both a tilt and an offset applied.

Definition at line 105 of file BDSExtent.cc.

References BDSExtent(), BDSTiltOffset::GetOffset(), BDSTiltOffset::GetTilt(), Tilted(), and Translate().

Here is the call graph for this function:

◆ Translate() [1/2]

BDSExtent BDSExtent::Translate ( const G4ThreeVector &  offset) const
inline

Provide a new copy of this extent with an offset applied.

Definition at line 125 of file BDSExtent.hh.

References Translate().

Referenced by BDSFieldEInterpolated::Extent(), BDSFieldMagInterpolated::Extent(), BDSGeometryComponent::InheritExtents(), BDS::InspectDisplacedSolid(), BDSGeometryFactorySQL::PlaceComponents(), TiltOffset(), and Translate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Translate() [2/2]

BDSExtent BDSExtent::Translate ( G4double  dx,
G4double  dy,
G4double  dz 
) const

Provide a new copy of this extent with an offset applied.

Definition at line 114 of file BDSExtent.cc.

References BDSExtent(), extXNeg, extXPos, extYNeg, extYPos, extZNeg, and extZPos.

Here is the call graph for this function:

◆ TransverseBoundingRadius()

G4double BDSExtent::TransverseBoundingRadius ( ) const

Return a radius that would encompass the maximum x,y extent.

Definition at line 183 of file BDSExtent.cc.

References extXNeg, extXPos, extYNeg, and extYPos.

Referenced by BDSParallelWorldSampler::Place().

Here is the caller graph for this function:

◆ TransverselyGreaterEquals()

G4bool BDSExtent::TransverselyGreaterEquals ( const BDSExtent r) const
inline

Comparison operator for x,y only. Ignores z (length).

Definition at line 104 of file BDSExtent.hh.

References TransverselyLessThan().

Here is the call graph for this function:

◆ TransverselyGreaterThan()

G4bool BDSExtent::TransverselyGreaterThan ( const BDSExtent r) const
inline

Comparison operator for x,y only. Ignores z (length).

Definition at line 102 of file BDSExtent.hh.

References TransverselyLessThan().

Referenced by BDSElement::BuildContainerLogicalVolume(), BDS::BuildEndPieceBeamline(), and TransverselyLessEquals().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransverselyLessEquals()

G4bool BDSExtent::TransverselyLessEquals ( const BDSExtent r) const
inline

Comparison operator for x,y only. Ignores z (length).

Definition at line 103 of file BDSExtent.hh.

References TransverselyGreaterThan().

Here is the call graph for this function:

◆ TransverselyLessThan()

G4bool BDSExtent::TransverselyLessThan ( const BDSExtent r) const
inline

Comparison operator for x,y only. Ignores z (length).

Definition at line 191 of file BDSExtent.hh.

References extXNeg, extXPos, extYNeg, and extYPos.

Referenced by BDSMagnetOuterFactory::CreateExternal(), BDS::InspectIntersectionSolid(), BDS::InspectSubtractionSolid(), BDS::InspectUnionSolid(), TransverselyGreaterEquals(), and TransverselyGreaterThan().

Here is the caller graph for this function:

◆ XNeg()

G4double BDSExtent::XNeg ( ) const
inline

◆ XPos()

G4double BDSExtent::XPos ( ) const
inline

◆ YNeg()

G4double BDSExtent::YNeg ( ) const
inline

◆ YPos()

G4double BDSExtent::YPos ( ) const
inline

◆ ZNeg()

G4double BDSExtent::ZNeg ( ) const
inline

Accessor.

Definition at line 69 of file BDSExtent.hh.

References extZNeg.

Referenced by BDSCrystalFactory::CreateCrystalTorus(), BDSGeometryFactoryBase::ExpandExtent(), and BDS::MaximumCombinedExtent().

Here is the caller graph for this function:

◆ ZPos()

G4double BDSExtent::ZPos ( ) const
inline

Accessor.

Definition at line 70 of file BDSExtent.hh.

References extZPos.

Referenced by BDSCrystalFactory::CreateCrystalTorus(), BDSGeometryFactoryBase::ExpandExtent(), and BDS::MaximumCombinedExtent().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
BDSExtent const &  ext 
)
friend

Output stream.

Definition at line 149 of file BDSExtent.cc.

Field Documentation

◆ extXNeg

G4double BDSExtent::extXNeg
private

◆ extXPos

G4double BDSExtent::extXPos
private

◆ extYNeg

G4double BDSExtent::extYNeg
private

◆ extYPos

G4double BDSExtent::extYPos
private

◆ extZNeg

G4double BDSExtent::extZNeg
private

◆ extZPos

G4double BDSExtent::extZPos
private

The documentation for this class was generated from the following files: