19#include "BDSComponentFactory.hh"
23#include "BDSAwakeScintillatorScreen.hh"
24#include "BDSAwakeSpectrometer.hh"
26#include "BDSCavityElement.hh"
27#include "BDSCollimatorCrystal.hh"
28#include "BDSCollimatorElliptical.hh"
29#include "BDSCollimatorJaw.hh"
30#include "BDSCollimatorTipJaw.hh"
31#include "BDSCollimatorRectangular.hh"
32#include "BDSCollimatorBeamMask.hh"
33#include "BDSColours.hh"
34#include "BDSColourFromMaterial.hh"
35#include "BDSComponentFactoryUser.hh"
38#include "BDSDicomIntersectVolume.hh"
40#include "BDSDegrader.hh"
43#include "BDSElement.hh"
44#include "BDSGaborLens.hh"
45#include "BDSLaserWire.hh"
46#include "BDSLaserWireNew.hh"
47#include "BDSLaserwireBuilder.hh"
49#include "BDSMagnet.hh"
50#include "BDSMuonCooler.hh"
51#include "BDSSamplerPlane.hh"
52#include "BDSScreen.hh"
53#include "BDSShield.hh"
54#include "BDSTarget.hh"
55#include "BDSTeleporter.hh"
56#include "BDSTerminator.hh"
57#include "BDSTiltOffset.hh"
58#include "BDSTransform3D.hh"
59#include "BDSWireScanner.hh"
60#include "BDSUndulator.hh"
61#include "BDSWarning.hh"
64#include "BDSAcceleratorComponentRegistry.hh"
65#include "BDSBeamlineIntegral.hh"
66#include "BDSBeamPipeFactory.hh"
67#include "BDSBeamPipeInfo.hh"
68#include "BDSBeamPipeType.hh"
69#include "BDSBendBuilder.hh"
71#include "BDSCavityInfo.hh"
72#include "BDSCavityFieldType.hh"
73#include "BDSCavityType.hh"
74#include "BDSCrystalInfo.hh"
75#include "BDSCrystalType.hh"
77#include "BDSException.hh"
78#include "BDSExecOptions.hh"
79#include "BDSFieldEMRFCavity.hh"
80#include "BDSFieldInfo.hh"
81#include "BDSFieldFactory.hh"
82#include "BDSFieldType.hh"
83#include "BDSGlobalConstants.hh"
85#include "BDSGasCapillary.hh"
86#include "BDSGasJet.hh"
87#include "BDSIntegratorSet.hh"
88#include "BDSIntegratorSetType.hh"
89#include "BDSIntegratorType.hh"
90#include "BDSIntegratorDipoleFringe.hh"
92#include "BDSMagnetOuterFactory.hh"
93#include "BDSMagnetOuterInfo.hh"
94#include "BDSMagnetGeometryType.hh"
95#include "BDSMagnetStrength.hh"
96#include "BDSMagnetType.hh"
97#include "BDSMaterials.hh"
98#include "BDSMuonCoolerBuilder.hh"
99#include "BDSParser.hh"
100#include "BDSParticleDefinition.hh"
101#include "BDSUtilities.hh"
104#include "G4String.hh"
105#include "G4Transform3D.hh"
107#include "CLHEP/Units/SystemOfUnits.h"
108#include "CLHEP/Units/PhysicalConstants.h"
110#include "parser/element.h"
111#include "parser/elementtype.h"
112#include "parser/cavitymodel.h"
113#include "parser/newcolour.h"
114#include "parser/crystal.h"
115#include "parser/laser.h"
127 G4bool usualPrintOut):
128 userComponentFactory(userComponentFactoryIn),
133 defaultModulator(nullptr),
134 integralUpToThisComponent(nullptr),
135 synchronousTAtMiddleOfThisComponent(0),
140 {G4cout << __METHOD_NAME__ <<
"using \"" << integratorSetType <<
"\" set of integrators" << G4endl;}
143 PrepareCavityModels();
151BDSComponentFactory::~BDSComponentFactory()
154 {
delete info.second;}
156 {
delete info.second;}
158 {
delete laser.second;}
176 switch (elementIn->
type)
178 case ElementType::_MARKER:
179 case ElementType::_LINE:
180 case ElementType::_REV_LINE:
186 G4cout << elementIn->name <<
"\t " << integral.arcLength/CLHEP::m <<
"\t " << integral.synchronousTAtEnd << G4endl;
194 G4double angleIn = 0.0;
195 G4double angleOut = 0.0;
196 G4bool registered =
false;
199 G4bool differentFromDefinition =
false;
202 G4cout << __METHOD_NAME__ <<
"named: \"" <<
element->name <<
"\"" << G4endl;
204 G4String searchName =
element->name;
206 {searchName +=
"_" + std::to_string(integral.
rigidityCount);}
219 {differentFromDefinition =
true;}
227 {differentFromDefinition =
true;}
233 {differentFromDefinition =
true;}
241 {differentFromDefinition =
true;}
246 {differentFromDefinition =
true;}
256 if (prevType == ElementType::_DRIFT && nextType != ElementType::_DRIFT)
258 else if (prevType != ElementType::_DRIFT && nextType == ElementType::_DRIFT)
268 {differentFromDefinition =
true;}
275 {differentFromDefinition =
true;}
280 {differentFromDefinition =
true;}
286 if (registered && !differentFromDefinition)
289 G4cout << __METHOD_NAME__ <<
"using already manufactured component" << G4endl;
298 if (differentFromDefinition)
319 case ElementType::_DRIFT:
320 {component = CreateDrift(angleIn, angleOut);
break;}
321 case ElementType::_RF:
323 component = CreateRF(RFFieldDirection::z);
324 differentFromDefinition =
true;
327 case ElementType::_RFX:
329 component = CreateRF(RFFieldDirection::x);
330 differentFromDefinition =
true;
333 case ElementType::_RFY:
335 component = CreateRF(RFFieldDirection::y);
336 differentFromDefinition =
true;
339 case ElementType::_SBEND:
340 {component = CreateSBend();
break;}
341 case ElementType::_RBEND:
342 {component = CreateRBend();
break;}
343 case ElementType::_HKICKER:
344 {component = CreateKicker(KickerType::horizontal);
break;}
345 case ElementType::_VKICKER:
346 {component = CreateKicker(KickerType::vertical);
break;}
347 case ElementType::_KICKER:
348 case ElementType::_TKICKER:
349 {component = CreateKicker(KickerType::general);
break;}
350 case ElementType::_QUAD:
351 {component = CreateQuad();
break;}
352 case ElementType::_SEXTUPOLE:
353 {component = CreateSextupole();
break;}
354 case ElementType::_OCTUPOLE:
355 {component = CreateOctupole();
break;}
356 case ElementType::_DECAPOLE:
357 {component = CreateDecapole();
break;}
358 case ElementType::_MULT:
362 component = CreateThinMultipole(angleIn);
365 component = CreateMultipole();
368 case ElementType::_THINMULT:
369 {component = CreateThinMultipole(angleIn);
break;}
370 case ElementType::_ELEMENT:
371 {component = CreateElement();
break;}
372 case ElementType::_SOLENOID:
373 {component = CreateSolenoid();
break;}
374 case ElementType::_ECOL:
375 {component = CreateEllipticalCollimator();
break;}
376 case ElementType::_RCOL:
377 {component = CreateRectangularCollimator();
break;}
378 case ElementType::_BMCOL:
379 {component = CreateBeamMaskCollimator();
break;}
380 case ElementType::_GASCAP:
381 {component = CreateGasCapillary();
break;}
382 case ElementType::_GASJET:
383 {component = CreateGasJet();
break;}
384 case ElementType::_TARGET:
385 {component = CreateTarget();
break;}
386 case ElementType::_JCOL:
387 {component = CreateJawCollimator();
break;}
388 case ElementType::_JCOLTIP:
389 {component = CreateTipJawCollimator();
break;}
390 case ElementType::_MUONCOOLER:
391 {component = CreateMuonCooler();
break;}
392 case ElementType::_MUONSPOILER:
393 {component = CreateMuonSpoiler();
break;}
394 case ElementType::_SHIELD:
395 {component = CreateShield();
break;}
396 case ElementType::_DEGRADER:
397 {component = CreateDegrader();
break;}
398 case ElementType::_WIRESCANNER:
399 {component = CreateWireScanner();
break;}
400 case ElementType::_GAP:
401 {component = CreateGap();
break;}
402 case ElementType::_CRYSTALCOL:
403 {component = CreateCrystalCollimator();
break;}
404 case ElementType::_LASERWIREOLD:
405 {component = CreateLaser();
break;}
406 case ElementType::_SCREEN:
407 {component = CreateScreen();
break;}
408 case ElementType::_TRANSFORM3D:
409 {component = CreateTransform3D();
break;}
410 case ElementType::_THINRMATRIX:
411 {component = CreateThinRMatrix(angleIn,
elementName);
break;}
412 case ElementType::_PARALLELTRANSPORTER:
413 {component = CreateParallelTransporter();
break;}
414 case ElementType::_RMATRIX:
415 {component = CreateRMatrix();
break;}
416 case ElementType::_UNDULATOR:
417 {component = CreateUndulator();
break;}
418 case ElementType::_LASERWIRE:
419 {component = CreateLaserwire(synchronousTAtMiddleOfThisComponent);
break;}
420 case ElementType::_USERCOMPONENT:
423 {
throw BDSException(__METHOD_NAME__,
"no user component factory registered");}
437 case ElementType::_DUMP:
438 {component = CreateDump();
break;}
439 case ElementType::_GABORLENS:
440 {component = CreateGaborLens();
break;}
441 case ElementType::_CT:
443 {component = CreateCT();
break;}
445 {
throw BDSException(__METHOD_NAME__,
"ct element can't be used - not compiled with dicom module!");}
447 case ElementType::_AWAKESCREEN:
449 {component = CreateAwakeScreen();
break;}
451 throw BDSException(__METHOD_NAME__,
"Awake Screen can't be used - not compiled with AWAKE module!");
453 case ElementType::_AWAKESPECTROMETER:
455 {component = CreateAwakeSpectrometer();
break;}
457 {
throw BDSException(__METHOD_NAME__,
"Awake Spectrometer can't be used - not compiled with AWAKE module!");}
460 case ElementType::_MARKER:
461 case ElementType::_LINE:
462 case ElementType::_REV_LINE:
463 {component =
nullptr;
break;}
466 G4cerr << __METHOD_NAME__ <<
"unknown type " <<
element->
type << G4endl;
474 e.AppendToMessage(
"\nBDSComponentFactory> Problem creating element \"" +
element->name +
"\"");
493 case ElementType::_ECOL:
494 case ElementType::_RCOL:
495 case ElementType::_JCOL:
496 case ElementType::_JCOLTIP:
497 case ElementType::_BMCOL:
519 const G4double teleporterHorizontalWidth,
520 const G4Transform3D& transformIn)
523 (*st)[
"length"] = teleporterLength;
526 BDSIntegratorType::teleporter,
531 G4cout <<
"---->creating Teleporter, " <<
"l = " << teleporterLength/CLHEP::m <<
"m" << G4endl;
533 return(
new BDSTeleporter(teleporterLength, teleporterHorizontalWidth, vacuumFieldInfo));
546 G4double prevTilt = 0;
547 G4double nextTilt = 0;
552 G4ThreeVector inputFaceNormal = faces.first.rotateZ(prevTilt - currentTilt);
553 G4ThreeVector outputFaceNormal = faces.second.rotateZ(nextTilt - currentTilt);
555 const G4double length =
element->
l*CLHEP::m;
561 length, extent, extent);
563 if (facesWillIntersect)
565 G4cerr << __METHOD_NAME__ <<
"Drift \"" <<
elementName
571 G4cerr <<
"\" and \"";
576 G4cerr <<
"\" is too short given its width and the angle of its faces." << G4endl;
593 case RFFieldDirection::x:
594 {fieldType = BDSFieldType::rfconstantinx;
break;}
595 case RFFieldDirection::y:
596 {fieldType = BDSFieldType::rfconstantiny;
break;}
597 case RFFieldDirection::z:
601 fieldType = BDS::FieldTypeFromCavityFieldType(cft);
617 G4double cavityLength =
element->
l * CLHEP::m;
622 if (fieldType == BDSFieldType::rfconstantinx || fieldType == BDSFieldType::rfconstantiny)
623 {buildCavityFringes =
false;}
625 G4bool buildIncomingFringe = buildCavityFringes;
632 G4bool buildOutgoingFringe = buildCavityFringes;
639 if (buildIncomingFringe)
641 if (buildOutgoingFringe)
658 vacuumField->SetModulatorInfo(modulator);
667 G4double stepFraction = 0.025;
686 G4double cavityApertureRadius = cavityInfo->
irisRadius;
701 if (buildIncomingFringe)
705 (*stIn)[
"rmat11"] = 1;
706 (*stIn)[
"rmat21"] = 0;
707 (*stIn)[
"rmat22"] = 1;
708 (*stIn)[
"rmat33"] = 1;
709 (*stIn)[
"rmat43"] = 0;
710 (*stIn)[
"rmat44"] = 1;
712 (*stIn)[
"isentrance"] =
true;
713 auto cavityFringeIn = CreateCavityFringe(0, stIn,
elementName +
"_fringe_in", cavityApertureRadius, modulator);
727 if (buildOutgoingFringe)
731 (*stOut)[
"rmat11"] = 1;
732 (*stOut)[
"rmat21"] = 0;
733 (*stOut)[
"rmat22"] = 1;
734 (*stOut)[
"rmat33"] = 1;
735 (*stOut)[
"rmat43"] = 0;
736 (*stOut)[
"rmat44"] = 1;
738 (*stOut)[
"isentrance"] =
false;
739 auto cavityFringeIn = CreateCavityFringe(0, stOut,
elementName +
"_fringe_out", cavityApertureRadius, modulator);
762 (*st)[
"angle"] = angle;
765 (*st)[
"length"] =
element->
l * CLHEP::m;
767 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
775 G4cout <<
"Angle (rad) " << (*st)[
"angle"] / CLHEP::rad << G4endl;
776 G4cout <<
"Field (T) " << (*st)[
"field"] / CLHEP::tesla << G4endl;
783 incomingFaceAngle, outgoingFaceAngle,
801 G4double arcLength = 0, chordLength = 0, field = 0, angle = 0;
804 (*st)[
"angle"] = angle;
807 (*st)[
"length"] = arcLength;
809 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
822 -incomingFaceAngle, -outgoingFaceAngle,
831 incomingFaceAngle -= 0.5*angle;
832 outgoingFaceAngle -= 0.5*angle;
836 incomingFaceAngle, outgoingFaceAngle,
849 case KickerType::horizontal:
859 case KickerType::vertical:
869 case KickerType::general:
875 {BDS::Warning(__METHOD_NAME__,
"'kick' parameter defined in element \"" +
elementName +
"\" but will be ignored as general kicker.");}
889 G4double chordLength;
894 (*st)[
"scaling"] = scaling;
895 (*st)[
"hkick"] = scaling * hkick;
896 (*st)[
"vkick"] = scaling * vkick;
897 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
909 (*fringeStOut)[
"isentrance"] =
false;
912 G4bool finiteEntrFringe =
false;
913 G4bool finiteExitFringe =
false;
916 {finiteEntrFringe =
true;}
919 {finiteExitFringe =
true;}
922 G4bool buildEntranceFringe =
false;
923 G4bool buildExitFringe =
false;
925 {buildEntranceFringe =
true;}
927 {buildExitFringe =
true;}
930 buildEntranceFringe =
false;
931 buildExitFringe =
false;
934 G4bool isThin =
false;
937 fieldType = BDSFieldType::bfieldzero;
938 intType = BDSIntegratorType::kickerthin;
950 if (buildEntranceFringe || buildExitFringe)
952 G4cout << __METHOD_NAME__ <<
"WARNING - finite B field required for kicker pole face and fringe fields,"
953 " effects are unavailable for element ""\"" <<
elementName <<
"\"." << G4endl;
955 buildEntranceFringe =
false;
956 buildExitFringe =
false;
958 else if (type == KickerType::general)
965 if (buildEntranceFringe || buildExitFringe)
967 G4cerr << __METHOD_NAME__ <<
" Poleface and fringe field effects are unavailable "
968 <<
"for the thin (t)kicker element ""\"" <<
elementName <<
"\"." << G4endl;
970 buildEntranceFringe =
false;
971 buildExitFringe =
false;
982 (*st)[
"field"] =
element->
B * CLHEP::tesla * scaling;
983 (*fringeStIn) [
"field"] = (*st)[
"field"];
984 (*fringeStOut) [
"field"] = (*st)[
"field"];
988 if (type == KickerType::vertical)
998 G4double angleX = std::asin(hkick * scaling);
999 G4double angleY = std::asin(vkick * scaling);
1001 if (std::isnan(angleX))
1002 {
throw BDSException(__METHOD_NAME__,
"hkick too strong for element \"" +
element->name +
"\" ");}
1003 if (std::isnan(angleY))
1004 {
throw BDSException(__METHOD_NAME__,
"vkick too strong for element \"" +
element->name +
"\" ");}
1008 G4double fieldX = 0;
1009 G4double fieldY = 0;
1018 case KickerType::horizontal:
1019 case KickerType::general:
1020 {fieldX =
element->
B * CLHEP::tesla * scaling;
break;}
1021 case KickerType::vertical:
1022 {fieldY =
element->
B * CLHEP::tesla * scaling;
break;}
1033 G4double fieldChordLengthX = chordLength / std::cos(0.5*angleX);
1036 G4double bendingRadiusX = fieldChordLengthX * 0.5 / sin(std::abs(angleX) * 0.5);
1039 G4double arcLengthX = std::abs(bendingRadiusX * angleX);
1047 G4double fieldChordLengthY = chordLength / std::cos(0.5*angleY);
1048 G4double bendingRadiusY = fieldChordLengthY * 0.5 / sin(std::abs(angleY) * 0.5);
1049 G4double arcLengthY = std::abs(bendingRadiusY * angleY);
1056 G4ThreeVector field = G4ThreeVector(fieldY, fieldX, 0);
1057 G4double fieldMag = field.mag();
1058 G4ThreeVector unitField = field.unit();
1060 (*st)[
"field"] = fieldMag;
1061 (*st)[
"bx"] = unitField.x();
1062 (*st)[
"by"] = unitField.y();
1066 (*fringeStIn)[
"field"] = (*st)[
"field"];
1067 (*fringeStOut)[
"field"] = (*st)[
"field"];
1068 if (fieldX < 0 || fieldY < 0)
1070 (*fringeStIn)[
"field"] *= -1;
1071 (*fringeStOut)[
"field"] *= -1;
1075 (*fringeStIn) [
"bx"] = (*st)[
"bx"];
1076 (*fringeStIn) [
"by"] = (*st)[
"by"];
1077 (*fringeStOut)[
"bx"] = (*st)[
"bx"];
1078 (*fringeStOut)[
"by"] = (*st)[
"by"];
1081 G4double defaultVHRatio = 1.5;
1084 case KickerType::horizontal:
1085 case KickerType::general:
1086 {t = BDSMagnetType::hkicker;
break;}
1087 case KickerType::vertical:
1089 t = BDSMagnetType::vkicker;
1090 defaultVHRatio = 1./defaultVHRatio;
1094 {t = BDSMagnetType::hkicker;
break;}
1115 G4double defaultHorizontalWidth = 0.3 * globalDefaultHW;
1117 G4double bpDX = bpExt.
DX();
1118 G4double bpDY = bpExt.
DY();
1119 if (bpDX > defaultHorizontalWidth && bpDX < globalDefaultHW)
1120 {defaultHorizontalWidth = globalDefaultHW;}
1121 else if (bpDY > defaultHorizontalWidth && bpDY > globalDefaultHW)
1122 {defaultHorizontalWidth = globalDefaultHW;}
1125 defaultHorizontalWidth, defaultVHRatio, 0.9);
1161 G4double kickerChordLength = chordLength;
1162 if (buildEntranceFringe)
1164 if (buildExitFringe)
1167 if (buildEntranceFringe)
1169 G4String entrFringeName = baseName +
"_e1_fringe";
1179 G4String kickerName = baseName;
1190 if (buildEntranceFringe)
1192 G4String exitFringeName = baseName +
"_e2_fringe";
1195 fringeStOut,
BRho(),
1262 beamPipeInfo->
beamPipeType = BDSBeamPipeType::circularvacuum;
1264 -angleIn, angleIn, beamPipeInfo);
1265 magnetOuterInfo->geometryType = BDSMagnetGeometryType::none;
1288 beamPipeInfo->
aper1,
1291 return thinMultipole;
1297 {
throw BDSException(__METHOD_NAME__,
"insufficient length for element \"" +
element->name +
"\" - must specify a suitable length");}
1304 G4double l =
element->
l * CLHEP::m;
1315 &vacuumBiasVolumeNames,
1329 G4double chordLength =
element->
l * CLHEP::m;
1331 (*st)[
"length"] = chordLength * 0.8;
1332 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
1336 (*st)[
"field"] = scaling *
element->
B * CLHEP::tesla;
1337 (*st)[
"ks"] = (*st)[
"field"] /
BRho();
1341 (*st)[
"field"] = (scaling *
element->
ks / CLHEP::m) *
BRho();
1351 auto strength = [](G4double phi){
1357 (*s)[
"rmat41"] = -phi;
1358 (*s)[
"rmat23"] = phi;
1362 G4bool buildIncomingFringe =
true;
1367 G4bool buildOutgoingFringe =
true;
1373 G4double solenoidBodyLength =
element->
l * CLHEP::m;
1375 if (buildIncomingFringe)
1377 if (buildOutgoingFringe)
1381 G4double lengthScaling = solenoidBodyLength / (
element->
l * CLHEP::m);
1382 G4double s = 0.5*(*st)[
"ks"] * lengthScaling;
1387 if (buildIncomingFringe)
1389 auto stIn = strength(s);
1390 auto solenoidIn = CreateThinRMatrix(0, stIn,
elementName +
"_fringe_in",
1391 BDSIntegratorType::rmatrixthin, BDSFieldType::rmatrix, 0, modulator);
1407 vacuumField->SetModulatorInfo(modulator);
1410 vacuumField->SetScalingRadius(outerInfo->innerRadius);
1419 BDSFieldType::solenoid,
1432 G4double outerRadius = outerInfo->horizontalWidth * 0.5;
1433 G4double coilRadius = beamPipeRadius + 0.25*(outerRadius - beamPipeRadius);
1434 outerField->SetScalingRadius(coilRadius);
1437 auto solenoid =
new BDSMagnet(BDSMagnetType::solenoid,
1448 if (buildOutgoingFringe)
1450 auto stOut = strength(-s);
1451 auto solenoidOut = CreateThinRMatrix(0, stOut,
elementName +
"_fringe_out",
1452 BDSIntegratorType::rmatrixthin, BDSFieldType::rmatrix, 0, modulator);
1462 return CreateMagnet(
element, st, BDSFieldType::paralleltransporter, BDSMagnetType::paralleltransporter);
1469 G4bool circularOuter =
false;
1471 if (apertureType ==
"circular")
1472 {circularOuter =
true;}
1491 G4bool circularOuter =
false;
1493 if (outerShape ==
"circular")
1494 {circularOuter =
true;}
1519 G4bool circularOuter =
false;
1521 if (outerShape ==
"circular")
1522 {circularOuter =
true;}
1561 G4bool circularOuter =
false;
1563 if (apertureType ==
"circular")
1564 {circularOuter =
true;}
1579 G4bool circularOuter =
false;
1581 if (apertureType ==
"circular")
1582 {circularOuter =
true;}
1609 element->jawTiltLeft*CLHEP::rad,
1631 element->jawTiltLeft*CLHEP::rad,
1637 collimatorTipMaterial,
1648 G4double elLength =
element->
l*CLHEP::m;
1656 outerField =
new BDSFieldInfo(BDSFieldType::muonspoiler,
1663 G4double limit = elLength / 20.0;
1665 if (ul != defaultUL)
1670 return new BDSMagnet(BDSMagnetType::muonspoiler,
1689 element->horizontalWidth * CLHEP::m,
1722 G4double degraderOffset;
1724 {
throw BDSException(__METHOD_NAME__,
"both \"materialThickness\" and \"degraderOffset\" are either undefined or < 0");}
1726 {
throw BDSException(__METHOD_NAME__,
"\"degraderOffset\" cannot be < 0");}
1728 {
throw BDSException(__METHOD_NAME__,
"\"materialThickness\" cannot be greater than the element length");}
1742 degraderOffset = (0.5*thicknessPerWedge) * (std::sin(CLHEP::halfpi - theta) / std::sin(theta));
1748 G4double baseWidth = bpi->aper1;
1770 {
throw BDSException(__METHOD_NAME__,
"\"angle\" parameter set for wirescanner \"" +
elementName +
"\" but this should not be set. Please unset and use \"wireAngle\".");}
1772 G4ThreeVector wireOffset = G4ThreeVector(
element->wireOffsetX * CLHEP::m,
1773 element->wireOffsetY * CLHEP::m,
1774 element->wireOffsetZ * CLHEP::m);
1782 element->wireAngle*CLHEP::rad,
1797 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
1814 G4double limit = (*st)[
"length"] * 0.075;
1816 if (ul != defaultUL)
1833 G4double chordLength =
element->
l*CLHEP::m;
1836 G4cout << __METHOD_NAME__ <<
"using default length of 1 mm for dump" << G4endl;
1837 chordLength = 1*CLHEP::mm;
1840 G4bool circular =
false;
1842 if (apertureType ==
"circular")
1844 else if (apertureType !=
"rectangular" && !apertureType.empty())
1845 {
throw BDSException(__METHOD_NAME__,
"unknown shape for dump: \"" + apertureType +
"\"");}
1863 new BDSDicomIntersectVolume();
1886 if (!
element->crystalBoth.empty())
1891 else if (
element->crystalBoth.empty() && !
element->crystalRight.empty() && !
element->crystalLeft.empty())
1896 else if (
element->crystalRight.empty())
1903 G4cout << G4endl << G4endl << __METHOD_NAME__
1904 <<
"Left crystal being used but right angle set - perhaps check input for element "
1909 G4cout << G4endl << G4endl << __METHOD_NAME__
1910 <<
"Right crystal being used but left angle set - perhaps check input for element "
1921 element->crystalAngleYAxisLeft*CLHEP::rad,
1922 element->crystalAngleYAxisRight*CLHEP::rad));
1931 G4double length =
element->
l*CLHEP::m;
1932 G4double lambda = laser->
Wavelength()*CLHEP::m;
1935 G4ThreeVector position = G4ThreeVector(0,0,0);
1946 size.setX(
element->screenXSize*CLHEP::m);
1948 G4cout << __METHOD_NAME__ <<
" - size = " << size << G4endl;
1958 "same number of materials as layers - check 'layerMaterials'");
1964 std::list<std::string>::const_iterator itm;
1965 std::list<double>::const_iterator itt;
1966 std::list<int>::const_iterator itIsSampler;
1974 G4cout << __METHOD_NAME__ <<
" - screen layer: thickness: "
1975 << *(itt) <<
", material " << (*itm)
1976 <<
", isSampler: " << (*itIsSampler) << G4endl;
1992 return (
new BDSAwakeScintillatorScreen(
elementName,
2009 (*awakeStrength)[
"by"] = 1;
2014 BDSIntegratorType::g4classicalrk4,
2047 {BDS::Warning(__METHOD_NAME__,
"component \""+
element->name+
"\" has axisAngle=1 but one or more of (phi,theta,psi) are non-zero - check");}
2060 {BDS::Warning(__METHOD_NAME__,
"component \""+
element->name+
"\" does not have axisAngle=1 but one or more axisAngle variables are non-zero - check");}
2074 G4cout <<
"---->creating Terminator" << G4endl;
2088 BDSFieldType::paralleltransporter,
2089 BDSMagnetType::paralleltransporter);
2094 BDSFieldType::paralleltransporter,
2095 BDSMagnetType::paralleltransporter);
2109 const G4String& name)
2113 return CreateThinRMatrix(angleIn, st, name, BDSIntegratorType::rmatrixthin, BDSFieldType::rmatrix, 0, modulator);
2118 const G4String& name,
2121 G4double beamPipeRadius,
2125 beamPipeInfo->
beamPipeType = BDSBeamPipeType::circularvacuum;
2129 {beamPipeInfo->
aper1 = beamPipeRadius;}
2132 magnetOuterInfo->geometryType = BDSMagnetGeometryType::none;
2141 vacuumField->SetBeamPipeRadius(beamPipeInfo->
aper1);
2142 vacuumField->SetModulatorInfo(fieldModulator);
2155 beamPipeInfo->
aper1,
2163 const G4String& name,
2164 G4double irisRadius,
2169 BDSAcceleratorComponent* cavityFringe = CreateThinRMatrix(angleIn, st, name, intType, fieldType, irisRadius, fieldModulator);
2170 return cavityFringe;
2186 G4ThreeVector(0,0,-1),
2187 G4ThreeVector(0,0,1));
2189 const BDSFieldType gaborLensField = BDSFieldType::gaborlens;
2193 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
2195 (*st)[
"length"] =
element->
l * CLHEP::m;
2207 G4Material* outerMaterial;
2208 if (
element->material.empty())
2243 laser->
SetT0(syncrhonousTime);
2250 G4String colour = laser->GetLaserColour();
2270 const G4String& nameSuffix)
const
2275 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
2286 vacuumField->SetScalingRadius(outerInfo->innerRadius);
2291 G4bool externalOuterField = !(el->
fieldOuter.empty());
2316 G4bool printWarning)
2321 {BDS::Warning(
"---> NOT creating element \"" + el->name +
"\" -> l < 1e-7 m: l = " + std::to_string(el->
l) +
" m");}
2333 " is greater than " + std::to_string(maxAngle));}
2336 " is greater than " + std::to_string(maxAngle));}
2344 if (mgt == BDSMagnetGeometryType::lhcleft)
2346 if (mgt == BDSMagnetGeometryType::lhcright)
2349 G4double angle = (*st)[
"angle"];
2350 G4double hkickAng = -(*st)[
"hkick"];
2351 G4double vkickAng = -(*st)[
"vkick"];
2357 if ((angle < 0) && (
element->yokeOnInside))
2358 {yokeOnLeft =
true;}
2359 else if ((angle > 0) && (!(
element->yokeOnInside)))
2360 {yokeOnLeft =
true;}
2362 {yokeOnLeft =
false;}
2375 const G4Transform3D& fieldTransform,
2378 G4double outerFieldScaling,
2384 case BDSFieldType::dipole:
2385 {outerType = BDSFieldType::multipoleouterdipole;
break;}
2386 case BDSFieldType::quadrupole:
2387 {outerType = BDSFieldType::multipoleouterquadrupole;
break;}
2388 case BDSFieldType::sextupole:
2389 {outerType = BDSFieldType::multipoleoutersextupole;
break;}
2390 case BDSFieldType::octupole:
2391 {outerType = BDSFieldType::multipoleouteroctupole;
break;}
2392 case BDSFieldType::decapole:
2393 {outerType = BDSFieldType::multipoleouterdecapole;
break;}
2394 case BDSFieldType::skewquadrupole:
2395 {outerType = BDSFieldType::skewmultipoleouterquadrupole;
break;}
2396 case BDSFieldType::skewsextupole:
2397 {outerType = BDSFieldType::skewmultipoleoutersextupole;
break;}
2398 case BDSFieldType::skewoctupole:
2399 {outerType = BDSFieldType::skewmultipoleouteroctupole;
break;}
2400 case BDSFieldType::skewdecapole:
2401 {outerType = BDSFieldType::skewmultipoleouterdecapole;
break;}
2402 case BDSFieldType::dipole3d:
2403 case BDSFieldType::solenoid:
2404 {outerType = BDSFieldType::solenoidsheet;
break;}
2406 {
return nullptr;
break;}
2410 (*stCopy)[
"scalingOuter"] = outerFieldScaling;
2418 outerField->SetModulatorInfo(modulatorInfo);
2422 outerField->SetScalingRadius(outerInfo->innerRadius);
2423 outerField->SetSecondFieldOnLeft(outerInfo->yokeOnLeft);
2424 auto gt = outerInfo->geometryType;
2426 if ((gt == BDSMagnetGeometryType::lhcleft || gt == BDSMagnetGeometryType::lhcright) && yfmLHC)
2428 if (fieldType == BDSFieldType::dipole)
2429 {outerField->
SetFieldType(BDSFieldType::multipoleouterdipolelhc);}
2430 else if (fieldType == BDSFieldType::quadrupole)
2431 {outerField->
SetFieldType(BDSFieldType::multipoleouterquadrupolelhc);}
2432 else if (fieldType == BDSFieldType::sextupole)
2433 {outerField->
SetFieldType(BDSFieldType::multipoleoutersextupolelhc);}
2446 G4double defaultHorizontalWidth,
2447 G4double defaultVHRatio,
2448 G4double defaultCoilWidthFraction,
2449 G4double defaultCoilHeightFraction)
2452 G4double angle = (*st)[
"angle"];
2455 defaultHorizontalWidth, defaultVHRatio, defaultCoilWidthFraction,
2456 defaultCoilHeightFraction);
2464 if (el->magnetGeometryType.empty() || globals->IgnoreLocalMagnetGeometry())
2465 {result = globals->MagnetGeometryType();}
2473 const G4double angleIn,
2474 const G4double angleOut,
2476 const G4bool yokeOnLeft,
2477 G4double defaultHorizontalWidth,
2478 G4double defaultVHRatio,
2479 G4double defaultCoilWidthFraction,
2480 G4double defaultCoilHeightFraction)
2485 info->name = elementNameIn;
2489 if (! (el->magnetGeometryType.empty() || globals->IgnoreLocalMagnetGeometry()) )
2491 info->geometryTypeAndPath = el->magnetGeometryType;
2493 {BDS::Warning(__METHOD_NAME__,
"stripOuterVolume for element \"" + el->name +
"\" will have no effect");}
2497 info->angleIn = angleIn;
2498 info->angleOut = angleOut;
2507 G4Material* outerMaterial;
2508 if (el->material.empty())
2510 G4String defaultMaterialName = globals->OuterMaterialName();
2515 info->outerMaterial = outerMaterial;
2518 info->yokeOnLeft = yokeOnLeft;
2521 {info->
hStyle = globals->HStyle();}
2526 {info->vhRatio = G4double(el->
vhRatio);}
2527 else if (globals->VHRatio() > 0)
2528 {info->vhRatio = globals->VHRatio();}
2529 else if (defaultVHRatio > 0)
2530 {info->vhRatio = defaultVHRatio;}
2532 {info->vhRatio = info->
hStyle ? 0.8 : 1.0;}
2536 else if (globals->CoilWidthFraction() > 0)
2537 {info->coilWidthFraction = globals->CoilWidthFraction();}
2538 else if (defaultCoilHeightFraction > 0)
2539 {info->coilWidthFraction = defaultCoilWidthFraction;}
2541 {info->coilWidthFraction = info->
hStyle ? 0.8 : 0.65;}
2545 else if (globals->CoilHeightFraction() > 0)
2546 {info->coilHeightFraction = globals->CoilHeightFraction();}
2547 else if (defaultCoilHeightFraction > 0)
2548 {info->coilHeightFraction = defaultCoilHeightFraction;}
2550 {info->coilHeightFraction = 0.8;}
2559 G4double defaultHorizontalWidth)
2561 G4double horizontalWidth = el->horizontalWidth*CLHEP::m;
2562 if (horizontalWidth < 1e-6)
2564 if (defaultHorizontalWidth > 0)
2565 {horizontalWidth = defaultHorizontalWidth;}
2569 return horizontalWidth;
2574 G4Material* result =
nullptr;
2583 const G4ThreeVector& inputFaceNormalIn,
2584 const G4ThreeVector& outputFaceNormalIn)
2594 el->
aper1 * CLHEP::m,
2595 el->
aper2 * CLHEP::m,
2596 el->
aper3 * CLHEP::m,
2597 el->
aper4 * CLHEP::m,
2602 outputFaceNormalIn);
2606 G4String msg =
"\nProblem in element: \"" + el->name +
"\"";
2607 e.AppendToMessage(msg);
2621 const G4double angleIn,
2622 const G4double angleOut)
2632 G4cout << __METHOD_NAME__ <<
"offsetX,Y: " << el->
offsetX <<
" " << el->
offsetY <<
" tilt: " << el->
tilt << G4endl;
2634 G4double xOffset = el->
offsetX * CLHEP::m;
2635 G4double yOffset = el->
offsetY * CLHEP::m;
2636 G4double tilt = el->
tilt * CLHEP::rad;
2646 return tiltOffset ? tiltOffset->
Transform3D() : G4Transform3D();
2659 G4double horizontalWidth,
2660 const G4String& name)
2662 G4double radiusFromAngleLength = std::abs(arcLength / angle);
2663 if (horizontalWidth > 2*radiusFromAngleLength)
2665 G4cerr <<
"Error: the combination of length, angle and horizontalWidth in element named \"" << name
2666 <<
"\" will result in overlapping faces!" << G4endl <<
"Please reduce the horizontalWidth" << G4endl;
2676 G4Material* material =
nullptr;
2677 if (!model.material.empty())
2682 model.irisRadius*CLHEP::m,
2683 model.thickness*CLHEP::m,
2684 model.equatorRadius*CLHEP::m,
2685 model.halfCellLength*CLHEP::m,
2686 model.numberOfPoints,
2687 model.numberOfCells,
2688 model.equatorHorizontalAxis*CLHEP::m,
2689 model.equatorVerticalAxis*CLHEP::m,
2690 model.irisHorizontalAxis*CLHEP::m,
2691 model.irisVerticalAxis*CLHEP::m,
2692 model.tangentLineAngle);
2702 G4double sigma0 = 0;
2704 {sigma0 = 0.5 * laser.w0;}
2706 {sigma0 = laser.sigma0;}
2708 {
throw BDSException(__METHOD_NAME__,
"Neither \"w0\" or \"sigma0\" are defined \"" + laser.name +
"\"");}
2710 G4ThreeVector polarization(laser.laserPolarization1,laser.laserPolarization2,laser.laserPolarization3);
2713 laser.pulseDuration*CLHEP::s,
2714 laser.pulseEnergy*CLHEP::joule,
2716 laser.laserArrivalTime*CLHEP::s,
2719 laser.ignoreRayleighRange);
2720 lasers[laser.name] = las;
2727 G4String laserBeam = G4String(el->
laserBeam);
2728 auto result =
lasers.find(laserBeam);
2729 if (result ==
lasers.end())
2731 G4cout <<
"Unknown laser \"" << laserBeam <<
"\" - please define it" << G4endl;
2748 (G4double) colour.red,
2749 (G4double) colour.green,
2750 (G4double) colour.blue,
2751 (G4double) colour.alpha);
2764 G4String(model.data),
2766 G4double(model.lengthX)*CLHEP::m,
2767 G4double(model.lengthY)*CLHEP::m,
2768 G4double(model.lengthZ)*CLHEP::m,
2769 G4double(model.sizeA)*CLHEP::m,
2770 G4double(model.sizeB)*CLHEP::m,
2771 G4double(model.sizeC)*CLHEP::m,
2772 G4double(model.alpha)*CLHEP::halfpi,
2773 G4double(model.beta)*CLHEP::halfpi,
2774 G4double(model.gamma)*CLHEP::halfpi,
2775 G4int (model.spaceGroup),
2776 G4double(model.bendingAngleYAxis)*CLHEP::rad,
2777 G4double(model.bendingAngleZAxis)*CLHEP::rad,
2778 G4double(model.miscutAngleY)*CLHEP::rad);
2789 G4cout <<
"Defined crystals are:" << G4endl;
2791 {G4cout << kv.first << G4endl;}
2792 throw BDSException(__METHOD_NAME__,
"unknown crystal \"" + crystalName +
"\" - please define it");
2801 G4double frequency)
const
2808 if (modelName.empty())
2814 {
throw BDSException(__METHOD_NAME__,
"unknown cavity model identifier \"" + el->
cavityModel +
"\" - please define it");}
2822 if (cavityRadius > horizontalWidth)
2824 G4String msg =
"Cavity horizontalWidth for element \"" +
elementName +
"\" is smaller " +
"than the cavity model radius.";
2832 if (el->material.empty())
2834 G4String msg =
"cavity material is not defined for cavity \"" +
elementName +
"\"";
2835 msg +=
" or for cavity model \"" + el->
cavityModel +
"\" - please define it";
2846 G4double frequency)
const
2851 G4double aper1 = aperture->
aper1;
2854 G4double defaultHorizontalWidth = 20*CLHEP::cm;
2855 if (aper1 < defaultHorizontalWidth)
2856 {horizontalWidth = std::min(defaultHorizontalWidth, horizontalWidth);}
2858 G4double equatorRadius = horizontalWidth - thickness;
2859 if (equatorRadius <= 0)
2861 G4String msg =
"horizontalWidth - beampipeThickness <= 0 for element \"" + el->name +
"\" -> this quantity must be positive";
2866 G4double length = el->
l * CLHEP::m;
2867 G4double cellLength = length;
2874 cellLength = 2*CLHEP::c_light / frequency;
2875 G4double nCavities = length / cellLength;
2876 nCells = G4int(std::floor(nCavities));
2882 cellLength = length;
2898 G4double cavityLength,
2901 G4double eField = 0;
2902 G4double scaling = el->
scaling;
2903 G4double frequency = el->
frequency * CLHEP::rad;
2904 G4double phase = el->
phase * CLHEP::rad;
2907 G4int acceleratingFieldDirectionFactor = BDS::Sign(incomingParticle.
BRho());
2911 case BDSFieldType::rfconstantinx:
2912 case BDSFieldType::rfconstantiny:
2914 eField = scaling * el->
gradient * CLHEP::volt / CLHEP::m;
2917 case BDSFieldType::rfconstantinz:
2920 {eField = scaling * el->
gradient * CLHEP::volt / CLHEP::m;}
2922 {eField = scaling * el->
E * CLHEP::volt / cavityLength;}
2925 case BDSFieldType::rfpillbox:
2928 {eField = scaling * el->
gradient * CLHEP::volt / CLHEP::m;}
2932 eField = scaling * el->
E * CLHEP::volt / cavityLength;
2934 eField /= transitTimeFactor;
2941 eField *= acceleratingFieldDirectionFactor;
2947 G4double& arcLength,
2948 G4double& chordLength,
2954 chordLength = el->
l * CLHEP::m;
2955 G4double arcLengthLocal = chordLength;
2960 field = el->
B * CLHEP::tesla;
2961 angle = el->
angle * CLHEP::rad;
2965 G4double radiusOfCurvatureOfDipole = 0.5 * chordLength / std::sin(0.5 * angle);
2966 arcLengthLocal = radiusOfCurvatureOfDipole * angle;
2969 {arcLengthLocal = chordLength;}
2973 field = el->
B * CLHEP::tesla;
2974 G4double bendingRadius = brhoIn / field;
2975 angle = 2.0*std::asin(chordLength*0.5 / bendingRadius);
2976 if (std::isnan(angle))
2977 {
throw BDSException(
"Field too strong for element " + el->name +
", magnet bending angle will be greater than pi.");}
2979 arcLengthLocal = bendingRadius * angle;
2983 angle = el->
angle * CLHEP::rad;
2989 G4double bendingRadius = chordLength * 0.5 / std::sin(std::abs(angle) * 0.5);
2990 arcLengthLocal = bendingRadius * angle;
2991 field = brhoIn * angle / std::abs(arcLengthLocal);
2998 arcLength = std::abs(arcLengthLocal);
3000 if (std::abs(angle) > CLHEP::pi/2.0)
3001 {
throw BDSException(
"Error: the rbend " + el->name +
" cannot be constructed as its bending angle is defined to be greater than pi/2.");}
3006 G4double cavityLength,
3012 G4double chordLength = cavityLength;
3013 (*st)[
"equatorradius"] = 1*CLHEP::m;
3014 (*st)[
"length"] = chordLength;
3015 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
3019 case BDSFieldType::rfpillbox:
3020 case BDSFieldType::rfconstantinz:
3021 {(*st)[
"ez"] = 1.0;
break;}
3022 case BDSFieldType::rfconstantinx:
3023 {(*st)[
"ex"] = 1.0;
break;}
3024 case BDSFieldType::rfconstantiny:
3025 {(*st)[
"ey"] = 1.0;
break;}
3027 {(*st)[
"ez"] = 1.0;
break;}
3031 G4double lengthScaling = cavityLength / (
element->
l * CLHEP::m);
3033 if ((fieldType == BDSFieldType::rfconstantinx || fieldType == BDSFieldType::rfconstantiny) &&
BDS::IsFinite(el->
E) )
3034 {
throw BDSException(__METHOD_NAME__,
"only \"gradient\" is accepted for rfconstantinx or rfconstantiny components and not \"E\"");}
3037 (*st)[
"efield"] = eField / lengthScaling;
3039 G4double frequency = std::abs(el->
frequency * CLHEP::hertz);
3040 (*st)[
"frequency"] = frequency;
3043 G4double phase = el->
phase * CLHEP::rad;
3047 {
throw BDSException(__METHOD_NAME__,
"component: " + el->name +
" has both tOffset and phase specified - only one can be used.");}
3048 phase = el->
tOffset*CLHEP::s * frequency * CLHEP::twopi;
3050 (*st)[
"phase"] = phase;
3068 G4String colour = el->
colour;
3071 else if (colour.empty())
3078 const G4String& defaultMaterialName)
3080 G4String materialName = el->material;
3081 if (materialName.empty())
3089 G4String materialName = el->material;
3090 if (materialName.empty())
3091 {
throw BDSException(__METHOD_NAME__,
"element \"" + el->name +
"\" has no material specified.");}
3097 const G4String& defaultMaterialName)
3100 if (materialName.empty())
3109 if (materialName.empty())
3110 {
throw BDSException(__METHOD_NAME__,
"element \"" + el->name +
"\" has no tip material specified.");}
3122 for (
auto comp : *line)
3127 if (mag && el->
type != ElementType::_RF)
3132 <<
"\" is a magnet, but has fieldAll defined." << G4endl
3133 <<
"Can only have fieldOuter and or fieldVacuum specified." << G4endl;
3143 mag->SetOuterField(info);
3151 mag->SetVacuumField(info);
3163 {BDS::Warning(
"component \"" + el->name +
"\" has \"scalingFieldOuter\" != 1.0 -> this will have no effect for \"fieldAll\"");}
3172 if (!el->fieldModulator.empty())
3175 {
throw BDSException(__METHOD_NAME__,
"\""+
elementName+
"\" uses a field map with a modulator but also a modulator\ndouble modulation is not allowed");}
3179 info->SetModulatorInfo(modDef);
3188 G4double scaling = el->
scaling;
3189 G4double arcLength = el->
l * CLHEP::m;
3190 (*st)[
"length"] = arcLength;
3191 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
3194 {(*st)[
"length"] = 1*CLHEP::m;}
3195 auto kn = el->
knl.begin();
3196 auto ks = el->
ksl.begin();
3199 auto nkey = normKeys.begin();
3200 auto skey = skewKeys.begin();
3202 for (; kn != el->
knl.end(); kn++, nkey++)
3203 {(*st)[*nkey] = scaling * (*kn);}
3204 for (; ks != el->
ksl.end(); ks++, skey++)
3205 {(*st)[*skey] = scaling * (*ks);}
3213 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
3215 G4double scaling = el->
scaling;
3218 (*st)[
"kick1"] = scaling * el->
kick1;
3219 (*st)[
"kick2"] = scaling * el->
kick2;
3220 (*st)[
"kick3"] = scaling * el->
kick3;
3221 (*st)[
"kick4"] = scaling * el->
kick4;
3223 (*st)[
"rmat11"] = scaling * el->
rmat11;
3224 (*st)[
"rmat12"] = scaling * el->
rmat12;
3225 (*st)[
"rmat13"] = scaling * el->
rmat13;
3226 (*st)[
"rmat14"] = scaling * el->
rmat14;
3228 (*st)[
"rmat21"] = scaling * el->
rmat21;
3229 (*st)[
"rmat22"] = scaling * el->
rmat22;
3230 (*st)[
"rmat23"] = scaling * el->
rmat23;
3231 (*st)[
"rmat24"] = scaling * el->
rmat24;
3233 (*st)[
"rmat31"] = scaling * el->
rmat31;
3234 (*st)[
"rmat32"] = scaling * el->
rmat32;
3235 (*st)[
"rmat33"] = scaling * el->
rmat33;
3236 (*st)[
"rmat34"] = scaling * el->
rmat34;
3238 (*st)[
"rmat41"] = scaling * el->
rmat41;
3239 (*st)[
"rmat42"] = scaling * el->
rmat42;
3240 (*st)[
"rmat43"] = scaling * el->
rmat43;
3241 (*st)[
"rmat44"] = scaling * el->
rmat44;
3247 const G4double arcLength)
const
3252 {
return BRho() * angle / arcLength;}
3256 const G4double arcLength)
const
3261 {
return field * arcLength /
BRho();}
3266 G4double& field)
const
3268 G4double arcLength = el->
l * CLHEP::m;
3271 field = el->
B * CLHEP::tesla;
3272 angle = el->
angle * CLHEP::rad;
3276 field = el->
B * CLHEP::tesla;
3281 angle = el->
angle * CLHEP::rad;
3287 {
throw BDSException(
"Error: the unsplit sbend "+ el->name +
" cannot be constructed as its bending angle is defined to be greater than pi/2.");}
3289 else if (std::abs(angle) > CLHEP::pi*2.0)
3290 {
throw BDSException(
"Error: the sbend "+ el->name +
" cannot be constructed as its bending angle is defined to be greater than 2 pi.");}
3295 G4double bendAngle = 0;
3296 if (el->
type == ElementType::_RBEND)
3298 G4double arcLength = 0, chordLength = 0, field = 0;
3301 else if (el->
type == ElementType::_SBEND)
3306 else if (el->
type == ElementType::_ELEMENT)
3307 {bendAngle = -1*el->
angle*CLHEP::rad;}
3320 G4double outgoingFaceAngle = 0;
3324 G4double e2 = el->
e2*CLHEP::rad;
3325 if (el->
type == ElementType::_ELEMENT)
3327 G4double factor = bendAngle < 0 ? -1 : 1;
3328 outgoingFaceAngle += factor * e2;
3329 return outgoingFaceAngle;
3331 else if (el->
type == ElementType::_RBEND)
3334 {
return outgoingFaceAngle;}
3337 outgoingFaceAngle += 0.5 * bendAngle;
3343 {
return outgoingFaceAngle;}
3352 G4double factor = bendAngle < 0 ? -1 : 1;
3353 outgoingFaceAngle += factor * e2;
3356 return outgoingFaceAngle;
3367 G4double incomingFaceAngle = 0;
3371 G4double e1 = el->
e1*CLHEP::rad;
3372 if (el->
type == ElementType::_ELEMENT)
3374 G4double factor = bendAngle < 0 ? -1 : 1;
3375 incomingFaceAngle += factor * e1;
3376 return incomingFaceAngle;
3378 else if (el->
type == ElementType::_RBEND)
3381 {
return incomingFaceAngle;}
3384 incomingFaceAngle += 0.5 * bendAngle;
3390 {
return incomingFaceAngle;}
3399 G4double factor = bendAngle < 0 ? -1 : 1;
3400 incomingFaceAngle += factor * e1;
3403 return incomingFaceAngle;
3407 G4bool inDevelopment)
const
3416 if (!
element->fieldModulator.empty())
3417 {
throw BDSException(__METHOD_NAME__,
"fieldModulator is currently in development for element \"" +
elementName +
"\"");}
3426 if ((*st)[
"kg"] < 0)
3431 const G4double c = CLHEP::c_light;
3433 const G4double gamma = designParticle.
Gamma();
3434 const G4double momentum = designParticle.
Momentum();
3435 const G4double mass = designParticle.
Mass();
3437 G4double convFactor = gamma * std::pow(c,2) / (4*std::pow(momentum,2));
3443 b2 = (*st)[
"kg"] / convFactor * CLHEP::tesla;
3444 (*st)[
"field"] = std::sqrt(b2) ;
3448 b2 = std::pow((*st)[
"field"],2);
3449 (*st)[
"kg"] = b2 * convFactor / CLHEP::m;
3453 (*st)[
"plasmaEfield"] = -1.0 * b2 * std::pow(c,2) / (4*mass);
static BDSAcceleratorComponentRegistry * Instance()
Singleton accessor.
BDSAcceleratorComponent * GetComponent(const G4String &name, G4double rigidtyAtConstructionTime)
void RegisterComponent(BDSAcceleratorComponent *component, G4double rigidtyAtConstructionTime, bool isModified=false)
Abstract class that represents a component of an accelerator.
virtual void Initialise()
virtual void SetBiasMaterialLVList(const std::list< std::string > &biasMaterialLVListIn)
Copy the bias list to this element.
virtual void SetMinimumKineticEnergy(G4double)
virtual void SetBiasVacuumList(const std::list< std::string > &biasVacuumListIn)
Copy the bias list to this element.
void SetField(BDSFieldInfo *fieldInfoIn)
Set the field definition for the whole component.
virtual void SetBiasMaterialList(const std::list< std::string > &biasMaterialListIn)
Copy the bias list to this element.
virtual void SetRegion(const G4String ®ionIn)
Set the region name for this component.
static BDSBeamPipeFactory * Instance()
Singleton accessor.
Holder class for all information required to describe a beam pipe model.
G4double aper1
Public member for direct access.
G4ThreeVector outputFaceNormal
Public member for direct access.
G4double beamPipeThickness
Public member for direct access.
G4double IndicativeRadius() const
Return an indicative extent of the beam pipe - typically the maximum of x or y extent.
BDSBeamPipeType beamPipeType
Public member for direct access.
G4ThreeVector inputFaceNormal
Public member for direct access.
A class that holds the current integrated quantities along a beam line.
void Integrate(const GMAD::Element &componentAsDefined)
G4int rigidityCount
Which change in rigidity we're at. Starts at 0, +1 after each change. Used for naming.
G4double ProvideSynchronousTAtCentreOfNextElement(const GMAD::Element *el) const
RF Cavity. Uses factories to construct appropriate geometry.
Holder for all Geometrical information required to create an RF cavity.
G4double equatorRadius
Equator radius - half width of widest part.
G4double irisRadius
Iris radius - half width of narrowest part.
G4Material * material
Material.
G4double thickness
Thickness of wall material.
A class for a beam mask collimator.
A piece of vacuum beam pipe with a crystal for channelling.
A class for an elliptical collimator.
Collimator with only two jaw and no top bit.
A class for a rectangular collimator.
Collimator with jaws having a bulk material and a tip of a different material.
static BDSColourFromMaterial * Instance()
Singleton pattern.
G4Colour * GetColour(const G4Material *material, const G4String &prefixToStripFromName="")
Get colour from name.
Colour class that holds all colours used in BDSIM.
G4Colour * GetColour(G4double red, G4double green, G4double blue, G4double alpha=1)
Get a cached anonymous colour by values.
static BDSColours * Instance()
singleton pattern
void DefineColour(const G4String &name, G4double red, G4double green, G4double blue, G4double alpha=1, G4bool normaliseTo255=true)
Define a new colour.
Factory for user specified accelerator components.
G4bool CanConstructComponentByName(const G4String &componentTypeName) const
Check whether a component can be constructed - ie if the name exists.
BDSAcceleratorComponent * ConstructComponent(const G4String &componentTypeName, GMAD::Element const *elementIn, GMAD::Element const *prevElementIn, GMAD::Element const *nextElementIn, const BDSBeamlineIntegral &integral)
static G4bool YokeOnLeft(const GMAD::Element *el, const BDSMagnetStrength *st)
std::map< G4String, BDSCrystalInfo * > crystalInfos
Maps of crystal info instances by name.
G4double OutgoingFaceAngle(const GMAD::Element *el) const
G4double AngleFromField(const G4double field, const G4double arcLength) const
void INDEVELOPMENTERROR() const
TBC - remove when modulators are implemented fully.
BDSComponentFactoryUser * userComponentFactory
User component factory if any.
KickerType
Private enum for kicker types.
BDSAcceleratorComponent * CreateComponent(GMAD::Element const *elementIn, GMAD::Element const *prevElementIn, GMAD::Element const *nextElementIn, BDSBeamlineIntegral &integral)
G4double FieldFromAngle(const G4double angle, const G4double arcLength) const
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.
void CalculateGaborLensStrength(BDSMagnetStrength *st) const
Calculate the electric field strength of the confined plasma in a Gabor lens.
BDSComponentFactory()=delete
No default constructor.
BDSAcceleratorComponent * CreateTeleporter(const G4double teleporterLength, const G4double teleporterWidth, const G4Transform3D &transformIn)
BDSModulatorInfo * defaultModulator
Default modulator for all components.
G4Material * PrepareVacuumMaterial(GMAD::Element const *el) const
Prepare the vacuum material from the element or resort to default in options.
static G4Transform3D CreateFieldTransform(const BDSTiltOffset *tiltOffset)
Create a transform from a tilt offset. If nullptr, returns identity transform.
BDSMagnet * CreateMagnet(const GMAD::Element *el, BDSMagnetStrength *st, BDSFieldType fieldType, BDSMagnetType magnetType, G4double angle=0.0, const G4String &nameSuffix="") const
Helper method for common magnet construction.
BDSMagnetStrength * PrepareMagnetStrengthForMultipoles(GMAD::Element const *el) const
Prepare magnet strength for multipoles.
GMAD::Element const * element
element for storing instead of passing around
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.
G4double thinElementLength
Length of a thin element.
static void CalculateAngleAndFieldRBend(const GMAD::Element *el, G4double brhoIn, G4double &arcLength, G4double &chordLength, G4double &field, G4double &angle)
BDSCavityInfo * PrepareCavityModelInfoForElement(GMAD::Element const *el, G4double frequency) const
GMAD::Element const * nextElement
element access to previous element (can be nullptr)
BDSCavityInfo * PrepareCavityModelInfo(GMAD::Element const *el, G4double frequency) const
BDSLaser * PrepareLaser(GMAD::Element const *el) const
G4bool yokeFields
Cache of whether to include yoke magnetic fields.
static G4bool coloursInitialised
static G4double EFieldFromElement(GMAD::Element const *el, BDSFieldType fieldType, G4double cavityLength, const BDSParticleDefinition &incomingParticle)
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.
void PrepareColours()
Prepare all colours defined in the parser.
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)
BDSAcceleratorComponent * CreateTerminator(G4double witdth)
BDSMagnetStrength * PrepareMagnetStrengthForRMatrix(GMAD::Element const *el) const
Prepare magnet strength for rmatrix.
G4bool includeFringeFields
Cache of whether to include fringe fields.
void SetFieldDefinitions(GMAD::Element const *el, BDSAcceleratorComponent *component) const
static void CheckBendLengthAngleWidthCombo(G4double arcLength, G4double angle, G4double horizontalWidth, const G4String &name="not given")
void PrepareCrystals()
Prepare all crystals in defined the parser.
static G4Colour * PrepareColour(GMAD::Element const *element, const G4Material *material=nullptr)
G4double lengthSafety
Length safety from global constants.
BDSMagnetStrength * PrepareCavityStrength(GMAD::Element const *el, BDSFieldType fieldType, G4double cavityLength, BDSMagnetStrength *&fringeIn, BDSMagnetStrength *&fringeOut) const
G4String elementName
Variable used to pass around the possibly modified name of an element.
std::map< G4String, BDSLaser * > lasers
Map of laser instances by name. Owned by this class.
static G4Material * PrepareTipMaterial(GMAD::Element const *element, const G4String &defaultMaterialName)
Checks if a material is named in Element::tipMaterial, else uses the supplied default.
std::map< G4String, G4int > modifiedElements
void GetKickValue(G4double &hkick, G4double &vkick, const KickerType type) const
BDSBeamlineIntegral * integralUpToThisComponent
To save passing it through many functions arguments.
G4double BendAngle(const GMAD::Element *el) const
Calculate the angle of a bend whether it's an rbend or an sbend.
G4double IncomingFaceAngle(const GMAD::Element *el) const
void CalculateAngleAndFieldSBend(GMAD::Element const *el, G4double &angle, G4double &field) const
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 BDSTiltOffset * CreateTiltOffset(GMAD::Element const *el)
Create the tilt and offset information object by inspecting the parser element.
void SetModulatorDefinition(GMAD::Element const *el, BDSFieldInfo *info) const
void PrepareCavityModels()
void PrepareLasers()
Prepare all lasers defined in the parser.
const BDSIntegratorSet * integratorSet
Local copy of reference to integrator set to use.
BDSModulatorInfo * ModulatorDefinition(const GMAD::Element *el, G4bool inDevelopment=false) const
void SetBeta0(BDSMagnetStrength *stIn) const
Simple setter used to add Beta0 to a strength instance.
BDSCrystalInfo * PrepareCrystalInfo(const G4String &crystalName) const
static BDSBeamPipeInfo * PrepareBeamPipeInfo(GMAD::Element const *el, const G4ThreeVector &inputFaceNormal=G4ThreeVector(0, 0,-1), const G4ThreeVector &outputFaceNormal=G4ThreeVector(0, 0, 1))
static BDSMagnetGeometryType MagnetGeometryType(const GMAD::Element *el)
G4double BRho() const
Simple accessor to simplify repetitive code.
std::map< G4String, BDSCavityInfo * > cavityInfos
Map of cavity model info instances by name.
G4bool HasSufficientMinimumLength(GMAD::Element const *el, G4bool printWarning=true)
Test the component length is sufficient for practical construction.
static G4double ScalingFieldOuter(const GMAD::Element *ele)
Get the scaling factor for a particular outer field depending on the global and individual setting.
GMAD::Element const * prevElement
element access to previous element (can be nullptr)
Holder for all information required to create a crystal.
Degrader based on wedge design used in the PSI medical accelerator.
A piece of vacuum beam pipe.
A class for a generic piece of external geometry.
General exception with possible name of object and message.
Holder for +- extents in 3 dimensions.
G4double DX() const
The difference in a dimension.
G4double DY() const
The difference in a dimension.
static G4double TransitTimeFactor(G4double frequency, G4double phase, G4double zLength, G4double beta)
General function put here as it represents the equations in this class.
static BDSFieldFactory * Instance()
Public accessor method for singleton pattern.
BDSFieldInfo * GetDefinition(const G4String &name) const
BDSModulatorInfo * GetModulatorDefinition(const G4String &modulatorName) const
All info required to build complete field of any type.
void SetTransformBeamline(const G4Transform3D &transformIn)
Set the beam line transform.
void CompoundBScaling(G4double extraBScalingIn)
*= for BScaling.
G4bool ProvideGlobal() const
Accessor.
void SetFieldType(BDSFieldType fieldTypeIn)
Set Transform - could be done afterwards once instance of this class is passed around.
void SetFieldAsThin()
Set thin to allow geant tracking error controls to be set seperately for thin elements.
BDSModulatorInfo * ModulatorInfo() const
Accessor.
BDSFieldType FieldType() const
Accessor.
void SetUserLimits(G4UserLimits *userLimitsIn)
Delete and replace the user limits which this class owns (only if not default ul).
Gabor lens based on prototype design at Imperial College (https://doi.org/10.3390/app11104357)
Gap in accelerator beamline.
Base class for gas capillary.
void SetExtent(const BDSExtent &extIn)
Set extent.
A class that holds global options and constants.
static BDSGlobalConstants * Instance()
Access method.
Which integrator to use for each type of magnet / field object.
G4bool IsMatrixIntegratorSet() const
Accessor for bool of is the integrator set matrix style.
BDSIntegratorType Integrator(const BDSFieldType field) const
Get appropriate integrator based on the field type.
Class to provide laser intensity at any point.
G4double Wavelength() const
Accessor.
G4double Sigma0() const
Accessor.
void SetT0(G4double T0In)
Accessor.
A class that hold multiple accelerator components.
void AddComponent(BDSAcceleratorComponent *component)
Add a component to the line.
static BDSMagnetOuterFactory * Instance()
Singleton accessor.
Holder struct of all information required to create the outer geometry of a magnet.
G4bool hStyle
H Style for dipoles. If not, it's assumed C style.
Efficient storage of magnet strengths.
static std::vector< G4String > SkewComponentKeys()
Accessor for skew component keys - k1 - k12.
static std::vector< G4String > NormalComponentKeys()
Accessor for normal component keys - k1 - k12.
Abstract base class that implements features common to all magnets.
static BDSMaterials * Instance()
Singleton pattern access.
G4Material * GetMaterial(G4String material) const
Get material by name.
Holder class for all information required to describe a modulator.
static BDSParser * Instance()
Access method.
std::vector< GMAD::CavityModel > GetCavityModels() const
Return the parser list of that object.
GMAD::CoolingChannel GetCoolingChannel(const std::string &objectName)
Return a cooling channel object by name. Throws an exception if it doesn't exist.
std::vector< GMAD::Crystal > GetCrystals() const
Return the parser list of that object.
std::vector< GMAD::NewColour > GetColours() const
Return the parser list of that object.
std::vector< GMAD::Laser > GetLasers() const
Return the parser list of that object.
Wrapper for particle definition.
G4double Mass() const
Accessor.
G4double Momentum() const
Accessor.
G4double BRho() const
Accessor.
G4double Beta() const
Accessor.
G4double Velocity() const
Accessor.
G4double Gamma() const
Accessor.
A multilayer screen in a beam pipe.
void AddScreenLayer(G4double thickness, G4String material, G4int isSampler=0)
Add a screen layer.
A square mask of solid material with a square aperture.
A class for a box or cylinder piece of 1 material.
An element that unnaturally shifts the beam across its length - a fudge volume.
Class for small control volume for circular macines.
A holder for any placement offsets and rotations for a BDSAcceleratorComponent.
G4Transform3D Transform3D() const
Get a transform to represent this tilt offset.
type underlying() const
return underlying value (can be used in switch statement)
Single cylindrical wire inside beam pipe.
Cooling channel parameters.
const BDSIntegratorSet * IntegratorSet(G4String set)
Return the appropriate set of integrators to use for each magnet type.
BDSMagnetGeometryType DetermineMagnetGeometryType(G4String geometryType)
function to determine the enum type of the magnet geometry (case-insensitive)
G4bool WillIntersect(const G4ThreeVector &incomingNormal, const G4ThreeVector &outgoingNormal, const G4double &zSeparation, const BDSExtent &incomingExtent, const BDSExtent &outgoingExtent)
BDSCrystalType DetermineCrystalType(G4String crystalType)
function to determine the enum type of the cavity geometry (case-insensitive)
G4double SecondFringeFieldCorrection(BDSMagnetStrength const *strength, G4bool entranceOrExit)
Function to calculate the value of the second fringe field correction term.
BDSCavityFieldType DetermineCavityFieldType(G4String cavityFieldType)
function to determine the enum type of the cavity field type (case-insensitive)
BDSMuonCooler * BuildMuonCooler(const G4String &elementName, G4double chordLength, G4double horizontalWidth, const GMAD::CoolingChannel &definition, BDSBeamPipeInfo *beamPipeInfo, G4double designRigidity)
G4UserLimits * CreateUserLimits(G4UserLimits *defaultUL, G4double length, G4double fraction=1.6)
BDSMagnet * BuildDipoleFringe(const GMAD::Element *element, G4double angleIn, G4double angleOut, const G4String &name, BDSMagnetStrength *st, G4double brho, const BDSIntegratorSet *integratorSet, BDSFieldType dipoleFieldType, BDSModulatorInfo *fieldModulator=nullptr)
BDSLine * BuildRBendLine(const G4String &elementName, const GMAD::Element *element, const GMAD::Element *prevElement, const GMAD::Element *nextElement, G4double brho, BDSMagnetStrength *st, const BDSIntegratorSet *integratorSet, G4double incomingFaceAngle, G4double outgoingFaceAngle, G4bool buildFringeFields, BDSModulatorInfo *fieldModulator=nullptr)
std::vector< G4String > SplitOnWhiteSpace(const G4String &input)
Split a string on whitespace and return a vector of these 'words'.
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())
G4double ArcLengthFromChordLength(G4double chordLength, G4double angle)
Calculate the arc length from the chord length for a given angle.
BDSCavityType DetermineCavityType(G4String cavityType)
function to determine the enum type of the cavity geometry (case-insensitive)
BDSAcceleratorComponent * BuildSBendLine(const G4String &elementName, const GMAD::Element *element, BDSMagnetStrength *st, G4double brho, const BDSIntegratorSet *integratorSet, G4double incomingFaceAngle, G4double outgoingFaceAngle, G4bool buildFringeFields, const GMAD::Element *prevElement, const GMAD::Element *nextElement, BDSModulatorInfo *fieldModulator=nullptr)
std::pair< G4ThreeVector, G4ThreeVector > CalculateFaces(G4double angleInIn, G4double angleOutIn)
Calculate input and output normal vector.
G4double FringeFieldCorrection(BDSMagnetStrength const *strength, G4bool entranceOrExit)
Function to calculate the value of the fringe field correction term.
Parser namespace for GMAD language. Combination of Geant4 and MAD.
ElementType
types of elements
std::string typestr(ElementType type)
conversion from enum to string
double hkick
fractional delta px for hkicker
std::string dicomDataFile
for CT, file for DICOM construction data
std::string spec
Arbitrary specification to pass to beamline builder.
double twindow
thickness of window
double aper4
beampipe information, new aperture model
std::string beampipeMaterial
beampipe information, new aperture model
double ysize2
size of the beam mask second aperture
double laserOffsetTheta
for laserwire
double rmat33
rmatrix elements, only 4x4
double rmat11
rmatrix elements, only 4x4
double rmat43
rmatrix elements, only 4x4
double laserOffsetPhi
for laserwire
std::list< std::string > layerMaterials
for screen
double scaling
Overall scaling of field strength.
std::string cavityFieldType
Name for type of field to use in a cavity.
double windowScreenGap
air gap between window and screen
std::string tipMaterial
tip material
double gradient
for rf cavities in V / m
double degraderOffset
for degrader
double aper2
beampipe information, new aperture model
double anodeLength
for gabor lens
double fintx
fringe field integral at the dipole exit
double kick4
rmatrix elements, only 4x4
double rmat42
rmatrix elements, only 4x4
double aper1
beampipe information, new aperture model
double rmat41
rmatrix elements, only 4x4
std::string outerShape
'rectangular' or 'circular'. used in gascap and bmcol
double laserOffsetY
for laserwire
double awakeMagnetOffsetX
for AWAKE spectrometer
double zdir
for 3d transform and laser
std::string namedVacuumVolumes
For imported geometry - identify vacuum volumes.
double anodeThickness
for gabor lens
bool stripOuterVolume
For Element. Make it an assembly.
double screenPSize
for AWAKE spectrometer
double xdir
for 3d transform and laser
double rmat34
rmatrix elements, only 4x4
double psi
for 3d transforms
double rmat31
rmatrix elements, only 4x4
double wedgeLength
for degrader
double vhRatio
ratio of vertial to horizontal for some magnets
double waveLength
for laser wire and 3d transforms
double rmat22
rmatrix elements, only 4x4
std::string userTypeName
User component element type name.
double offsetY2
offset of the beam mask second aperture
double kick3
rmatrix elements, only 4x4
double rmat24
rmatrix elements, only 4x4
double tOffset
time offset used for phase calculation (ns)
std::list< std::string > biasMaterialList
double xsizeRight
individual collimator jaw half widths
double coilWidthFraction
Fraction of available h space the coil will take up.
double rmat44
rmatrix elements, only 4x4
std::string fieldAll
Field for everything.
double electrodeRadius
for gabor lens
double jawTiltRight
jaw collimator jaw tilts (angle in x-z plane)
std::string region
region with range cuts
double wireDiameter
@[ for wirescanner
double tmount
thickness of the screen mount
std::list< double > ksl
skew multipole expansion
int numberWedges
for degrader
double kick1
rmatrix elements, only 4x4
std::list< std::string > biasMaterialLVList
physics biasing list for specific LVs
std::list< double > knl
multipole expansion coefficients
std::string windowmaterial
for AWAKE spectrometer
double e2
output pole face rotation for bends
double phase
phase of rf cavity (rad)
double ysizeOut
collimator aperture or laser spotsize for laser
std::string fieldVacuum
Vacuum field.
bool autoColour
Automagically colour the external geometry.
double angle
bending angle
double electrodeThickness
for gabor lens
int hStyle
-1 = unset; 0 = false (ie c style); 1 = true, use hstyle
std::string geometryFile
For Element. File for external geometry.
std::string vacuumMaterial
beampipe information, new aperture model
double vkick
fractional delta py for vkicker
double laserOffsetZ
for laserwire
double E
voltage for rf cavities in V that will be assumed over length l
double coilHeightFraction
Fraction of availalbe v space the coil will take up.
std::list< int > layerIsSampler
for screen
double laserOffsetX
for laserwire
bool elementLengthIsArcLength
For Element. Treat the length as arc length, if not chord.
double screenEndZ
for AWAKE spectrometer
double ysize
collimator aperture or laser spotsize for laser
std::string coolingDefinition
For muon cooler.
double rmat23
rmatrix elements, only 4x4
std::string colour
Override colour for certain items.
double rmat13
rmatrix elements, only 4x4
double anodeRadius
for gabor lens
double materialThickness
for degrader
double kick
fractional delta p for either h or v kicker
double rmat14
rmatrix elements, only 4x4
double beampipeThickness
beampipe information, new aperture model
std::string dicomDataPath
for CT, file for DICOM construction data
double minimumKineticEnergy
minimum kinetic energy for user limits - respected on element by element basis
std::string scintmaterial
for AWAKE spectrometer
double ydir
for 3d transform and laser
double undulatorMagnetHeight
for undulator
double tipThickness
for jaw collimator with tip
std::string cavityModel
Name of geometry model object for rfconstantinz cavities.
double e1
input pole face rotation for bends
std::string fieldOuter
Outer field.
std::string laserBeam
for laserwire
double undulatorPeriod
for undulator
double electrodeLength
for gabor lens
double tilt2
tilt of the beam mask second aperture
double undulatorGap
for undulator
double poleStartZ
for AWAKE spectrometer
std::string mountmaterial
for AWAKE spectrometer
double aper3
beampipe information, new aperture model
ElementType type
element enum
std::list< std::string > biasVacuumList
physics biasing list for the vacuum
std::list< double > layerThicknesses
for screen
double scalingFieldOuter
Extra arbitrary scaling for outer field - compounded with 'scaling'.
double degraderHeight
for degrader
double tscint
thickness of scintillating part of screen
double screenWidth
for AWAKE spectrometer
double frequency
frequency for rf cavity in Hz
double kick2
rmatrix elements, only 4x4
double rmat12
rmatrix elements, only 4x4
std::string apertureType
beampipe information, new aperture model
double rmat21
rmatrix elements, only 4x4
double rmat32
rmatrix elements, only 4x4