BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Factory to produce all types of BDSAcceleratorComponents. More...
#include <BDSComponentFactory.hh>
Public Member Functions | |
BDSComponentFactory (const BDSParticleDefinition *designParticleIn, BDSComponentFactoryUser *userComponentFactoryIn=nullptr, G4bool usualPrintOut=true) | |
BDSAcceleratorComponent * | CreateComponent (GMAD::Element const *elementIn, GMAD::Element const *prevElementIn, GMAD::Element const *nextElementIn, G4double currentArcLengthIn=0) |
BDSAcceleratorComponent * | CreateTerminator (G4double witdth) |
BDSAcceleratorComponent * | CreateTeleporter (const G4double teleporterLength, const G4double teleporterWidth, const G4Transform3D &transformIn) |
BDSCrystalInfo * | PrepareCrystalInfo (const G4String &crystalName) const |
Static Public Member Functions | |
static BDSTiltOffset * | CreateTiltOffset (GMAD::Element const *el) |
Create the tilt and offset information object by inspecting the parser element. | |
static G4Transform3D | CreateFieldTransform (const BDSTiltOffset *tiltOffset) |
Create a transform from a tilt offset. If nullptr, returns identity transform. | |
static G4Transform3D | CreateFieldTransform (GMAD::Element const *el) |
static BDSBeamPipeInfo * | PrepareBeamPipeInfo (GMAD::Element const *el, const G4ThreeVector &inputFaceNormal=G4ThreeVector(0, 0,-1), const G4ThreeVector &outputFaceNormal=G4ThreeVector(0, 0, 1)) |
static BDSBeamPipeInfo * | PrepareBeamPipeInfo (GMAD::Element const *el, G4double angleIn, G4double angleOut) |
static G4bool | YokeOnLeft (const GMAD::Element *el, const BDSMagnetStrength *st) |
static G4double | PrepareHorizontalWidth (GMAD::Element const *el, G4double defaultHorizontalWidth=-1) |
Prepare the element horizontal width in Geant4 units - if not set, use the global default. | |
static G4double | ScalingFieldOuter (const GMAD::Element *ele) |
Get the scaling factor for a particular outer field depending on the global and individual setting. | |
static BDSFieldInfo * | PrepareMagnetOuterFieldInfo (const BDSMagnetStrength *vacuumSt, const BDSFieldType &fieldType, const BDSBeamPipeInfo *bpInfo, const BDSMagnetOuterInfo *outerInfo, const G4Transform3D &fieldTransform, const BDSIntegratorSet *integratorSetIn, G4double brhoIn, G4double outerFieldScaling=1.0, BDSModulatorInfo *modulatorInfo=nullptr) |
Prepare the field definition for the yoke of a magnet. | |
static BDSMagnetOuterInfo * | PrepareMagnetOuterInfo (const G4String &elementNameIn, const GMAD::Element *el, const BDSMagnetStrength *st, const BDSBeamPipeInfo *beamPipe, G4double defaultHorizontalWidth=-1, G4double defaultVHRatio=1.0, G4double defaultCoilWidthFraction=-1, G4double defaultCoilHeightFraction=-1) |
static BDSMagnetGeometryType | MagnetGeometryType (const GMAD::Element *el) |
static BDSMagnetOuterInfo * | PrepareMagnetOuterInfo (const G4String &elementNameIn, const GMAD::Element *el, const G4double angleIn, const G4double angleOut, const BDSBeamPipeInfo *beamPipe, const G4bool yokeOnLeft=false, G4double defaultHorizontalWidth=-1, G4double defaultVHRatio=-1, G4double defaultCoilWidthFraction=-1, G4double defaultCoilHeightFraction=-1) |
static G4Colour * | PrepareColour (GMAD::Element const *element) |
Checks if colour is specified for element, else uses the default for that element type. | |
static G4Material * | PrepareMaterial (GMAD::Element const *element, const G4String &defaultMaterialName) |
Checks if a material is named in Element::material, else uses the supplied default. | |
static G4Material * | PrepareMaterial (GMAD::Element const *element) |
Try and get a material and exit if no such material. | |
static void | CheckBendLengthAngleWidthCombo (G4double arcLength, G4double angle, G4double horizontalWidth, const G4String &name="not given") |
static void | PoleFaceRotationsNotTooLarge (const GMAD::Element *el, G4double maxAngle=0.5 *CLHEP::halfpi) |
Check whether the pole face rotation angles are too big for practical construction. | |
static G4double | EFieldFromElement (GMAD::Element const *el, G4double cavityLength) |
Private Types | |
enum class | KickerType { horizontal , vertical , general } |
Private enum for kicker types. More... | |
enum class | RFFieldDirection { x , y , z } |
Private enum for RF cavity principle accelerating direction. More... | |
Private Attributes | |
const BDSParticleDefinition * | designParticle |
Particle w.r.t. which elements are built. | |
G4double | brho |
Rigidity in T*m (G4units) for beam particles. | |
G4double | beta0 |
Cache of relativistic beta for primary particle. | |
BDSComponentFactoryUser * | userComponentFactory |
User component factory if any. | |
G4double | lengthSafety |
Length safety from global constants. | |
G4double | thinElementLength |
Length of a thin element. | |
G4bool | includeFringeFields |
Cache of whether to include fringe fields. | |
G4bool | yokeFields |
Cache of whether to include yoke magnetic fields. | |
BDSModulatorInfo * | defaultModulator |
Default modulator for all components. | |
G4double | currentArcLength |
Updated each time CreateComponent is called - supplied from outside. Only here to pass around all functions easily. | |
GMAD::Element const * | element = nullptr |
element for storing instead of passing around | |
GMAD::Element const * | prevElement = nullptr |
element access to previous element (can be nullptr) | |
GMAD::Element const * | nextElement = nullptr |
element access to previous element (can be nullptr) | |
std::map< G4String, BDSCavityInfo * > | cavityInfos |
Map of cavity model info instances by name. | |
std::map< G4String, BDSCrystalInfo * > | crystalInfos |
Maps of crystal info instances by name. | |
const BDSIntegratorSet * | integratorSet |
Local copy of reference to integrator set to use. | |
const BDSIntegratorSetType | integratorSetType |
Local copy of enum of the integrator set, i.e. which one it is specifically. | |
std::map< G4String, G4int > | modifiedElements |
G4String | elementName |
Variable used to pass around the possibly modified name of an element. | |
Static Private Attributes | |
static G4bool | coloursInitialised = false |
Factory to produce all types of BDSAcceleratorComponents.
Creates from a parser Element the appropriate object (that inherits BDSAcceleratorComponent) and returns it. Will return nullptr if invalid type or nothing to be constructed for that particular type. Calculations on field strength and angle as well as basic parameter validity (minimum length) are done here.
The main interface requires both a previous and next GMAD::Element that the element is constructed with respect to. This is so that drifts can be matched to the faces of bends with pole face rotations etc. If required in future, a simple interface for a single element could be added that uses this one with nullptrs.
Functions for common functionality, checks and preparation of recipe classes are provided publicly (and statically) for use elsewhere.
Definition at line 76 of file BDSComponentFactory.hh.
|
strongprivate |
Private enum for kicker types.
Definition at line 237 of file BDSComponentFactory.hh.
|
strongprivate |
Private enum for RF cavity principle accelerating direction.
Definition at line 240 of file BDSComponentFactory.hh.
|
explicit |
Definition at line 111 of file BDSComponentFactory.cc.
BDSComponentFactory::~BDSComponentFactory | ( | ) |
Definition at line 141 of file BDSComponentFactory.cc.
|
private |
Update the BDSMagnetStrength key synchronousT0 with the time at the centre of the element.
Definition at line 3041 of file BDSComponentFactory.cc.
References currentArcLength.
Referenced by CreateMagnet(), PrepareCavityStrength(), PrepareMagnetStrengthForMultipoles(), and PrepareMagnetStrengthForRMatrix().
|
private |
Calculate the angle through a length of field - uses member rigidity and charge. Length & field in g4 m / tesla units
Definition at line 2832 of file BDSComponentFactory.cc.
References brho, and BDS::IsFinite().
Referenced by CalculateAngleAndFieldSBend().
|
private |
Calculate the angle of a bend whether it's an rbend or an sbend.
Definition at line 2928 of file BDSComponentFactory.cc.
References GMAD::Element::angle, CalculateAngleAndFieldRBend(), CalculateAngleAndFieldSBend(), and GMAD::Element::type.
Referenced by IncomingFaceAngle(), and OutgoingFaceAngle().
|
private |
Calculate the field and angle of an rbend from information in the element noting the 'l' in an element is the chord length of an rbend. Variables passed by reference and are updated as output. Note, this uses the MADX convention of +ve angle -> deflection in -ve x.
Definition at line 2870 of file BDSComponentFactory.cc.
References GMAD::Element::angle, GMAD::Element::angleSet, GMAD::Element::B, brho, BDS::IsFinite(), and GMAD::Element::l.
Referenced by BendAngle().
|
private |
Calculate field and angle of a sector bend. Note, this uses the MADX convention of +ve angle -> deflection in -ve x.
Definition at line 2841 of file BDSComponentFactory.cc.
References GMAD::Element::angle, AngleFromField(), GMAD::Element::angleSet, GMAD::Element::B, FieldFromAngle(), BDSGlobalConstants::Instance(), BDS::IsFinite(), and GMAD::Element::l.
Referenced by BendAngle().
|
static |
Utility function to check if the combination of horizontal width, angle and length will result in overlapping entrance and exit faces and therefore whether to abort.
Definition at line 2390 of file BDSComponentFactory.cc.
Referenced by BDS::BuildSBendLine().
|
private |
Definition at line 1821 of file BDSComponentFactory.cc.
|
private |
Definition at line 1832 of file BDSComponentFactory.cc.
|
private |
Definition at line 1987 of file BDSComponentFactory.cc.
BDSAcceleratorComponent * BDSComponentFactory::CreateComponent | ( | GMAD::Element const * | elementIn, |
GMAD::Element const * | prevElementIn, | ||
GMAD::Element const * | nextElementIn, | ||
G4double | currentArcLengthIn = 0 |
||
) |
Create component from parser Element pointers to next and previous Element are used to ensure the component will fit and may optionally be made to be so in the case of a drift. The optional last argument is the current s position at the end of the beam line for components that are distance or phase dependent such as an RF cavity.
Definition at line 159 of file BDSComponentFactory.cc.
References GMAD::Element::biasMaterialList, GMAD::Element::biasVacuumList, BDSComponentFactoryUser::CanConstructComponentByName(), BDSComponentFactoryUser::ConstructComponent(), currentArcLength, element, elementName, BDSAcceleratorComponentRegistry::GetComponent(), HasSufficientMinimumLength(), includeFringeFields, IncomingFaceAngle(), BDSAcceleratorComponent::Initialise(), BDSAcceleratorComponentRegistry::Instance(), BDSGlobalConstants::Instance(), BDS::IsFinite(), GMAD::Element::l, GMAD::Element::minimumKineticEnergy, modifiedElements, nextElement, OutgoingFaceAngle(), prevElement, GMAD::Element::region, BDSAcceleratorComponentRegistry::RegisterComponent(), BDSAcceleratorComponent::SetBiasMaterialList(), BDSAcceleratorComponent::SetBiasVacuumList(), SetFieldDefinitions(), BDSAcceleratorComponent::SetMinimumKineticEnergy(), BDSAcceleratorComponent::SetRegion(), GMAD::Element::type, userComponentFactory, and GMAD::Element::userTypeName.
Referenced by BDSDetectorConstruction::BuildBeamline(), and BDS::BuildPlacementGeometry().
|
private |
Definition at line 1711 of file BDSComponentFactory.cc.
|
private |
Definition at line 1687 of file BDSComponentFactory.cc.
|
private |
Definition at line 1180 of file BDSComponentFactory.cc.
|
private |
Definition at line 1549 of file BDSComponentFactory.cc.
|
private |
Definition at line 488 of file BDSComponentFactory.cc.
|
private |
Definition at line 1663 of file BDSComponentFactory.cc.
|
private |
Definition at line 1238 of file BDSComponentFactory.cc.
|
private |
Definition at line 1448 of file BDSComponentFactory.cc.
|
static |
Create a transform from a tilt offset. If nullptr, returns identity transform.
Definition at line 2377 of file BDSComponentFactory.cc.
References BDSTiltOffset::Transform3D().
Referenced by BDS::BuildDipoleFringe(), BDS::BuildRBendLine(), BDS::BuildSBendLine(), BDS::BuildSingleSBend(), CreateFieldTransform(), CreateMagnet(), and SetFieldDefinitions().
|
static |
Create a transform for the field for a given element to account for the difference from the curvilinear coordinates for the tilt and offset of the magnet.
Definition at line 2382 of file BDSComponentFactory.cc.
References CreateFieldTransform(), and CreateTiltOffset().
|
private |
Definition at line 1701 of file BDSComponentFactory.cc.
|
private |
Definition at line 1470 of file BDSComponentFactory.cc.
|
private |
Definition at line 826 of file BDSComponentFactory.cc.
|
private |
Definition at line 1757 of file BDSComponentFactory.cc.
|
private |
Helper method for common magnet construction.
Definition at line 1999 of file BDSComponentFactory.cc.
References AddSynchronousTimeInformation(), brho, CreateFieldTransform(), element, elementName, GMAD::Element::fieldOuter, BDSIntegratorSet::Integrator(), integratorSet, GMAD::Element::l, ModulatorDefinition(), PrepareBeamPipeInfo(), PrepareMagnetOuterFieldInfo(), PrepareMagnetOuterInfo(), ScalingFieldOuter(), and yokeFields.
|
private |
Definition at line 1192 of file BDSComponentFactory.cc.
|
private |
Definition at line 1491 of file BDSComponentFactory.cc.
|
private |
Definition at line 1168 of file BDSComponentFactory.cc.
|
private |
Definition at line 1405 of file BDSComponentFactory.cc.
|
private |
Definition at line 1144 of file BDSComponentFactory.cc.
|
private |
Definition at line 734 of file BDSComponentFactory.cc.
|
private |
Definition at line 1411 of file BDSComponentFactory.cc.
|
private |
Definition at line 537 of file BDSComponentFactory.cc.
|
private |
Definition at line 1906 of file BDSComponentFactory.cc.
|
private |
Definition at line 693 of file BDSComponentFactory.cc.
|
private |
Definition at line 1771 of file BDSComponentFactory.cc.
|
private |
Definition at line 1156 of file BDSComponentFactory.cc.
|
private |
Definition at line 1528 of file BDSComponentFactory.cc.
|
private |
Definition at line 1265 of file BDSComponentFactory.cc.
|
private |
Definition at line 1432 of file BDSComponentFactory.cc.
BDSAcceleratorComponent * BDSComponentFactory::CreateTeleporter | ( | const G4double | teleporterLength, |
const G4double | teleporterWidth, | ||
const G4Transform3D & | transformIn | ||
) |
Public creation for object that accounts for slight offset between ends of a ring. The z component of the delta three vector is used for the length of the teleporter.
Definition at line 470 of file BDSComponentFactory.cc.
References brho.
Referenced by BDSDetectorConstruction::BuildBeamline().
BDSAcceleratorComponent * BDSComponentFactory::CreateTerminator | ( | G4double | witdth | ) |
Public creation for object that dynamically stops all particles once the primary has completed a certain number of turns.
Definition at line 1898 of file BDSComponentFactory.cc.
Referenced by BDSDetectorConstruction::BuildBeamline().
|
private |
Definition at line 1203 of file BDSComponentFactory.cc.
|
private |
Definition at line 1943 of file BDSComponentFactory.cc.
|
private |
Definition at line 1935 of file BDSComponentFactory.cc.
|
static |
Create the tilt and offset information object by inspecting the parser element.
Definition at line 2362 of file BDSComponentFactory.cc.
References BDS::IsFinite(), GMAD::Element::offsetX, GMAD::Element::offsetY, and GMAD::Element::tilt.
Referenced by BDSDetectorConstruction::BuildBeamline(), and CreateFieldTransform().
|
private |
Definition at line 1873 of file BDSComponentFactory.cc.
|
private |
Definition at line 1618 of file BDSComponentFactory.cc.
|
private |
Definition at line 1596 of file BDSComponentFactory.cc.
|
static |
Get either the "gradient" member or the voltage and divide by the cavityLength argument (provided in case of reduced length) to get the E field in Geant4 units.
Definition at line 2587 of file BDSComponentFactory.cc.
References GMAD::Element::E, GMAD::Element::gradient, BDS::IsFinite(), and GMAD::Element::scaling.
Referenced by BDSBeamlineIntegral::Integrate(), and PrepareCavityStrength().
|
private |
Calculate the field from a given angle through a length of field - uses member rigidity and charge. Length & angle in g4 m / rad units.
Definition at line 2823 of file BDSComponentFactory.cc.
References brho, and BDS::IsFinite().
Referenced by CalculateAngleAndFieldSBend().
|
private |
Pull out the right value - either 'kick' or 'h/vkick' for the appropriate type of kicker from the current member element.
Definition at line 786 of file BDSComponentFactory.cc.
References GMAD::Element::angle, element, elementName, GMAD::Element::hkick, BDS::IsFinite(), GMAD::Element::kick, and GMAD::Element::vkick.
|
private |
Test the component length is sufficient for practical construction.
Definition at line 2048 of file BDSComponentFactory.cc.
References GMAD::Element::l.
Referenced by CreateComponent().
|
private |
Calculate the incoming angel of the face (in the horizontal plane) for a given element. Calculates the bend angle and applies e1 / e2 pole face rotations the correct way depending on sign of angle. The angle is w.r.t. incoming curvilinear coordinates, so for an rbend with e1=0, the returned angle will be half the bend angle. For an sbend, with e1=0, it'll be 0.
Definition at line 2994 of file BDSComponentFactory.cc.
References BendAngle(), GMAD::Element::e1, BDSGlobalConstants::Instance(), integratorSet, BDS::IsFinite(), BDSIntegratorSet::IsMatrixIntegratorSet(), GMAD::Element::k1, and GMAD::Element::type.
Referenced by CreateComponent().
|
private |
TBC - remove when modulators are implemented fully.
Definition at line 3055 of file BDSComponentFactory.cc.
References element, and elementName.
Referenced by ModulatorDefinition().
|
static |
Determine the magnet geometry type. If not specified or the global option to ignore local magnet geometry definitions is on, then the global default is used
Definition at line 2192 of file BDSComponentFactory.cc.
References BDS::DetermineMagnetGeometryType(), and BDSGlobalConstants::Instance().
Referenced by PrepareMagnetOuterInfo(), and YokeOnLeft().
|
private |
Return the modulator definition for a given element if one is specified in fieldModulator, else return the global default which could also be nullptr.
Definition at line 3047 of file BDSComponentFactory.cc.
References defaultModulator, BDSFieldFactory::GetModulatorDefinition(), INDEVELOPMENTERROR(), and BDSFieldFactory::Instance().
Referenced by CreateMagnet(), and SetModulatorDefinition().
|
private |
Calculate the outgoing angle of the face (in the horizontal plane) for a given element. Calculates the bend angle and applies e1 / e2 pole face rotations the correct way depending on sign of angle. The angle is w.r.t. outgoing curvilinear coordinates, so for an rbend with e2=0, the returned angle will be half the bend angle. For an sbend, with e2=0, it'll be 0.
Definition at line 2947 of file BDSComponentFactory.cc.
References BendAngle(), GMAD::Element::e2, BDSGlobalConstants::Instance(), integratorSet, BDS::IsFinite(), BDSIntegratorSet::IsMatrixIntegratorSet(), GMAD::Element::k1, and GMAD::Element::type.
Referenced by CreateComponent().
|
static |
Check whether the pole face rotation angles are too big for practical construction.
Definition at line 2061 of file BDSComponentFactory.cc.
References GMAD::Element::e1, GMAD::Element::e2, and element.
|
static |
Prepare the recipe for a piece of beam pipe. Static and public so it can be used by SBendBuilder.
Definition at line 2315 of file BDSComponentFactory.cc.
References GMAD::Element::aper1, GMAD::Element::aper2, GMAD::Element::aper3, GMAD::Element::aper4, GMAD::Element::apertureType, GMAD::Element::beampipeMaterial, GMAD::Element::beampipeThickness, BDSBeamPipeInfo::inputFaceNormal, BDSGlobalConstants::Instance(), BDSBeamPipeInfo::outputFaceNormal, and GMAD::Element::vacuumMaterial.
Referenced by BDS::BuildDipoleFringe(), BDS::BuildRBendLine(), BDS::BuildSBendLine(), BDS::BuildSingleSBend(), CreateMagnet(), PrepareBeamPipeInfo(), and PrepareCavityModelInfoForElement().
|
static |
Interface to other PrepareBeamPipeInfo() for convenience to avoid preparing face normal vectors repeatedly.
Definition at line 2353 of file BDSComponentFactory.cc.
References BDS::CalculateFaces(), and PrepareBeamPipeInfo().
|
private |
Utility function to prepare model info. Retrieve from cache of ones translated parser objects or create a default based on the element's aperture if none specified. Will always return a unique object that's not owned by this class. We need the frequency in case there are no good defaults and we'll make the cavity size according to the wavelength of the rf field.
Definition at line 2491 of file BDSComponentFactory.cc.
References cavityInfos, GMAD::Element::cavityModel, elementName, BDSCavityInfo::equatorRadius, BDSMaterials::GetMaterial(), BDSMaterials::Instance(), lengthSafety, BDSCavityInfo::material, PrepareCavityModelInfoForElement(), PrepareHorizontalWidth(), and BDSCavityInfo::thickness.
|
private |
Create a default cavity model based on an element's aperture and material. Will always return a unique object that's not owned by this class.
prepare aperture information for this element to base default cavity on.
Definition at line 2536 of file BDSComponentFactory.cc.
References BDSBeamPipeInfo::aper1, BDSBeamPipeInfo::beamPipeThickness, BDSMaterials::Instance(), BDS::IsFinite(), GMAD::Element::l, PrepareBeamPipeInfo(), and PrepareHorizontalWidth().
Referenced by PrepareCavityModelInfo().
|
private |
Prepare all RF cavity models in the component factory. Kept here and copies delivered. This class deletes them upon destruction.
Definition at line 2404 of file BDSComponentFactory.cc.
References cavityInfos, BDS::DetermineCavityType(), BDSMaterials::GetMaterial(), BDSMaterials::Instance(), and BDSParser::Instance().
|
private |
Utility function to prepare field strength object for rf cavity. This takes a pointer for both incoming and outgoing strengths that this function will allocate by reference.
Definition at line 2599 of file BDSComponentFactory.cc.
References AddSynchronousTimeInformation(), currentArcLength, GMAD::Element::E, EFieldFromElement(), element, GMAD::Element::frequency, BDS::IsFinite(), GMAD::Element::l, GMAD::Element::phase, SetBeta0(), GMAD::Element::tOffset, and BDSTypeSafeEnum< def, inner >::underlying().
|
static |
Checks if colour is specified for element, else uses the default for that element type.
Definition at line 2665 of file BDSComponentFactory.cc.
References GMAD::Element::colour, BDSColours::GetColour(), BDSColours::Instance(), GMAD::Element::type, and GMAD::typestr().
Referenced by PrepareMagnetOuterInfo().
|
private |
Prepare all colours defined in the parser.
Definition at line 2431 of file BDSComponentFactory.cc.
References coloursInitialised, BDSColours::DefineColour(), BDSColours::Instance(), and BDSParser::Instance().
BDSCrystalInfo * BDSComponentFactory::PrepareCrystalInfo | ( | const G4String & | crystalName | ) | const |
Utility function to prepare crystal recipe for an element. Produces a unique object this class doesn't own.
Definition at line 2475 of file BDSComponentFactory.cc.
References crystalInfos.
|
private |
Prepare all crystals in defined the parser.
Definition at line 2448 of file BDSComponentFactory.cc.
References crystalInfos, BDS::DetermineCrystalType(), BDSMaterials::GetMaterial(), BDSMaterials::Instance(), and BDSParser::Instance().
|
static |
Prepare the element horizontal width in Geant4 units - if not set, use the global default.
Definition at line 2291 of file BDSComponentFactory.cc.
References BDSGlobalConstants::Instance().
Referenced by BDS::BuildSBendLine(), PrepareCavityModelInfo(), PrepareCavityModelInfoForElement(), and PrepareMagnetOuterInfo().
|
static |
Prepare the field definition for the yoke of a magnet.
Definition at line 2104 of file BDSComponentFactory.cc.
References BDSBeamPipeInfo::IndicativeRadius(), BDSGlobalConstants::Instance(), BDSIntegratorSet::Integrator(), BDSFieldInfo::SetFieldType(), and BDSTypeSafeEnum< def, inner >::underlying().
Referenced by BDS::BuildRBendLine(), BDS::BuildSBendLine(), and CreateMagnet().
|
static |
Prepare the recipe for magnet outer geometry for an element. This uses a strength instance which (we assume) represents the element. Evenly splits angle between input and output faces.
Definition at line 2175 of file BDSComponentFactory.cc.
References PrepareMagnetOuterInfo(), and YokeOnLeft().
Referenced by BDS::BuildDipoleFringe(), BDS::BuildRBendLine(), BDS::BuildSBendLine(), BDS::BuildSingleSBend(), CreateMagnet(), and PrepareMagnetOuterInfo().
|
static |
Prepare the recipe for magnet outer geometry with full control of the angled faces and which side the yoke is on. The angle in and out are the face angles relative to a chord for a straight section of outer magnet geometry.
Definition at line 2204 of file BDSComponentFactory.cc.
References GMAD::Element::autoColour, GMAD::Element::coilHeightFraction, GMAD::Element::coilWidthFraction, BDSMaterials::GetMaterial(), BDSMagnetOuterInfo::hStyle, GMAD::Element::hStyle, BDSBeamPipeInfo::IndicativeRadius(), BDSGlobalConstants::Instance(), BDSMaterials::Instance(), MagnetGeometryType(), PrepareColour(), PrepareHorizontalWidth(), GMAD::Element::stripOuterVolume, and GMAD::Element::vhRatio.
|
private |
Prepare magnet strength for multipoles.
Definition at line 2762 of file BDSComponentFactory.cc.
References AddSynchronousTimeInformation(), BDS::IsFinite(), GMAD::Element::knl, GMAD::Element::ksl, GMAD::Element::l, BDSMagnetStrength::NormalComponentKeys(), GMAD::Element::scaling, SetBeta0(), BDSMagnetStrength::SkewComponentKeys(), and GMAD::Element::type.
|
private |
Prepare magnet strength for rmatrix.
Definition at line 2788 of file BDSComponentFactory.cc.
References AddSynchronousTimeInformation(), GMAD::Element::kick1, GMAD::Element::kick2, GMAD::Element::kick3, GMAD::Element::kick4, GMAD::Element::rmat11, GMAD::Element::rmat12, GMAD::Element::rmat13, GMAD::Element::rmat14, GMAD::Element::rmat21, GMAD::Element::rmat22, GMAD::Element::rmat23, GMAD::Element::rmat24, GMAD::Element::rmat31, GMAD::Element::rmat32, GMAD::Element::rmat33, GMAD::Element::rmat34, GMAD::Element::rmat41, GMAD::Element::rmat42, GMAD::Element::rmat43, GMAD::Element::rmat44, and GMAD::Element::scaling.
|
static |
Try and get a material and exit if no such material.
Definition at line 2684 of file BDSComponentFactory.cc.
References BDSMaterials::GetMaterial(), and BDSMaterials::Instance().
|
static |
Checks if a material is named in Element::material, else uses the supplied default.
Definition at line 2674 of file BDSComponentFactory.cc.
References BDSMaterials::GetMaterial(), and BDSMaterials::Instance().
|
private |
Prepare the vacuum material from the element or resort to default in options.
Definition at line 2305 of file BDSComponentFactory.cc.
References element, BDSMaterials::GetMaterial(), BDSGlobalConstants::Instance(), BDSMaterials::Instance(), and GMAD::Element::vacuumMaterial.
|
static |
Get the scaling factor for a particular outer field depending on the global and individual setting.
Definition at line 2099 of file BDSComponentFactory.cc.
References BDSGlobalConstants::Instance(), and GMAD::Element::scalingFieldOuter.
Referenced by BDS::BuildRBendLine(), BDS::BuildSBendLine(), CreateMagnet(), and SetFieldDefinitions().
|
inlineprivate |
Simple setter used to add Beta0 to a strength instance.
Definition at line 227 of file BDSComponentFactory.hh.
References beta0.
Referenced by PrepareCavityStrength(), and PrepareMagnetStrengthForMultipoles().
|
private |
Set the field definition on a BDSAcceleratorComponent from the string definition name in a parser element. In the case of a BDSMagnet, (exclusively) set the vacuum and outer field in place of the one general field.
Definition at line 2693 of file BDSComponentFactory.cc.
References BDSFieldInfo::CompoundBScaling(), CreateFieldTransform(), element, elementName, GMAD::Element::fieldAll, GMAD::Element::fieldOuter, GMAD::Element::fieldVacuum, BDSFieldFactory::Instance(), BDSFieldInfo::ProvideGlobal(), ScalingFieldOuter(), GMAD::Element::scalingFieldOuter, BDSAcceleratorComponent::SetField(), SetFieldDefinitions(), SetModulatorDefinition(), BDSFieldInfo::SetTransformBeamline(), and GMAD::Element::type.
Referenced by CreateComponent(), and SetFieldDefinitions().
|
private |
Check the info doesn't already have a modulator definition (exception if it does). and update it.
Definition at line 2747 of file BDSComponentFactory.cc.
References elementName, ModulatorDefinition(), and BDSFieldInfo::ModulatorInfo().
Referenced by SetFieldDefinitions().
|
static |
Determine which side the yoke of an asymmetric bend should go on based on the angle of the bend and the overriding setting in the element.
Definition at line 2072 of file BDSComponentFactory.cc.
References element, BDS::IsFinite(), and MagnetGeometryType().
Referenced by BDS::BuildRBendLine(), BDS::BuildSBendLine(), and PrepareMagnetOuterInfo().
|
private |
Cache of relativistic beta for primary particle.
Definition at line 215 of file BDSComponentFactory.hh.
Referenced by SetBeta0().
|
private |
Rigidity in T*m (G4units) for beam particles.
Definition at line 214 of file BDSComponentFactory.hh.
Referenced by AngleFromField(), CalculateAngleAndFieldRBend(), CreateMagnet(), CreateTeleporter(), and FieldFromAngle().
|
private |
Map of cavity model info instances by name.
Definition at line 359 of file BDSComponentFactory.hh.
Referenced by PrepareCavityModelInfo(), and PrepareCavityModels().
|
staticprivate |
Only allow colours to be constructed from parser definitions once. Static so we can use a component factory many times without calling multiple times.
Definition at line 442 of file BDSComponentFactory.hh.
Referenced by PrepareColours().
|
private |
Maps of crystal info instances by name.
Definition at line 362 of file BDSComponentFactory.hh.
Referenced by PrepareCrystalInfo(), and PrepareCrystals().
|
private |
Updated each time CreateComponent is called - supplied from outside. Only here to pass around all functions easily.
Definition at line 224 of file BDSComponentFactory.hh.
Referenced by AddSynchronousTimeInformation(), CreateComponent(), and PrepareCavityStrength().
|
private |
Default modulator for all components.
Definition at line 221 of file BDSComponentFactory.hh.
Referenced by ModulatorDefinition().
|
private |
Particle w.r.t. which elements are built.
Definition at line 213 of file BDSComponentFactory.hh.
|
private |
element for storing instead of passing around
Definition at line 230 of file BDSComponentFactory.hh.
Referenced by CreateComponent(), CreateMagnet(), GetKickValue(), INDEVELOPMENTERROR(), PoleFaceRotationsNotTooLarge(), PrepareCavityStrength(), PrepareVacuumMaterial(), SetFieldDefinitions(), and YokeOnLeft().
|
private |
Variable used to pass around the possibly modified name of an element.
Definition at line 438 of file BDSComponentFactory.hh.
Referenced by CreateComponent(), CreateMagnet(), GetKickValue(), INDEVELOPMENTERROR(), PrepareCavityModelInfo(), SetFieldDefinitions(), and SetModulatorDefinition().
|
private |
Cache of whether to include fringe fields.
Definition at line 219 of file BDSComponentFactory.hh.
Referenced by CreateComponent().
|
private |
Local copy of reference to integrator set to use.
Definition at line 365 of file BDSComponentFactory.hh.
Referenced by CreateMagnet(), IncomingFaceAngle(), and OutgoingFaceAngle().
|
private |
Local copy of enum of the integrator set, i.e. which one it is specifically.
Definition at line 368 of file BDSComponentFactory.hh.
|
private |
Length safety from global constants.
Definition at line 217 of file BDSComponentFactory.hh.
Referenced by PrepareCavityModelInfo().
|
private |
Registry of modified elements stored by original name and number of times modified - 0 counting. This is so when we modify elements beyond their definition they get a unique name as they're literally not the same object as the unmodified one so they don't share the placement counter for unique naming. This allows accurate geometry trees in the visualiser.
Definition at line 435 of file BDSComponentFactory.hh.
Referenced by CreateComponent().
|
private |
element access to previous element (can be nullptr)
Definition at line 234 of file BDSComponentFactory.hh.
Referenced by CreateComponent().
|
private |
element access to previous element (can be nullptr)
Definition at line 232 of file BDSComponentFactory.hh.
Referenced by CreateComponent().
|
private |
Length of a thin element.
Definition at line 218 of file BDSComponentFactory.hh.
|
private |
User component factory if any.
Definition at line 216 of file BDSComponentFactory.hh.
Referenced by CreateComponent().
|
private |
Cache of whether to include yoke magnetic fields.
Definition at line 220 of file BDSComponentFactory.hh.
Referenced by CreateMagnet().