18#include "BDSComponentFactory.hh"
22#include "BDSAwakeScintillatorScreen.hh"
23#include "BDSAwakeSpectrometer.hh"
25#include "BDSCavityElement.hh"
26#include "BDSCollimatorCrystal.hh"
27#include "BDSCollimatorElliptical.hh"
28#include "BDSCollimatorJaw.hh"
29#include "BDSCollimatorJawTip.hh"
30#include "BDSCollimatorRectangular.hh"
31#include "BDSCollimatorBeamMask.hh"
32#include "BDSColours.hh"
33#include "BDSColourFromMaterial.hh"
34#include "BDSComponentFactoryUser.hh"
37#include "BDSDicomIntersectVolume.hh"
39#include "BDSDegrader.hh"
42#include "BDSElement.hh"
43#include "BDSGaborLens.hh"
44#include "BDSLaserWire.hh"
45#include "BDSLaserWireNew.hh"
46#include "BDSLaserwireBuilder.hh"
48#include "BDSMagnet.hh"
49#include "BDSMuonCooler.hh"
50#include "BDSSamplerPlane.hh"
51#include "BDSScreen.hh"
52#include "BDSShield.hh"
53#include "BDSTarget.hh"
54#include "BDSTeleporter.hh"
55#include "BDSTerminator.hh"
56#include "BDSTiltOffset.hh"
57#include "BDSTransform3D.hh"
58#include "BDSWireScanner.hh"
59#include "BDSUndulator.hh"
60#include "BDSWarning.hh"
63#include "BDSAcceleratorComponentRegistry.hh"
64#include "BDSBeamlineIntegral.hh"
65#include "BDSBeamPipeFactory.hh"
66#include "BDSBeamPipeInfo.hh"
67#include "BDSBeamPipeType.hh"
68#include "BDSBendBuilder.hh"
70#include "BDSCavityInfo.hh"
71#include "BDSCavityFieldType.hh"
72#include "BDSCavityType.hh"
73#include "BDSCrystalInfo.hh"
74#include "BDSCrystalType.hh"
76#include "BDSException.hh"
77#include "BDSExecOptions.hh"
78#include "BDSFieldEMRFCavity.hh"
79#include "BDSFieldInfo.hh"
80#include "BDSFieldFactory.hh"
81#include "BDSFieldType.hh"
82#include "BDSGlobalConstants.hh"
84#include "BDSGasCapillary.hh"
85#include "BDSGasJet.hh"
86#include "BDSIntegratorSet.hh"
87#include "BDSIntegratorSetType.hh"
88#include "BDSIntegratorType.hh"
89#include "BDSIntegratorDipoleFringe.hh"
91#include "BDSMagnetOuterFactory.hh"
92#include "BDSMagnetOuterInfo.hh"
93#include "BDSMagnetGeometryType.hh"
94#include "BDSMagnetStrength.hh"
95#include "BDSMagnetType.hh"
96#include "BDSMaterials.hh"
97#include "BDSMuonCoolerBuilder.hh"
98#include "BDSParser.hh"
99#include "BDSParticleDefinition.hh"
100#include "BDSUtilities.hh"
103#include "G4String.hh"
104#include "G4Transform3D.hh"
106#include "CLHEP/Units/SystemOfUnits.h"
107#include "CLHEP/Units/PhysicalConstants.h"
109#include "parser/element.h"
110#include "parser/elementtype.h"
111#include "parser/cavitymodel.h"
112#include "parser/newcolour.h"
113#include "parser/crystal.h"
114#include "parser/laser.h"
126 G4bool usualPrintOut):
127 userComponentFactory(userComponentFactoryIn),
132 defaultModulator(nullptr),
133 integralUpToThisComponent(nullptr),
134 synchronousTAtMiddleOfThisComponent(0),
139 {G4cout << __METHOD_NAME__ <<
"using \"" << integratorSetType <<
"\" set of integrators" << G4endl;}
142 PrepareCavityModels();
150BDSComponentFactory::~BDSComponentFactory()
153 {
delete info.second;}
155 {
delete info.second;}
157 {
delete laser.second;}
175 switch (elementIn->
type)
177 case ElementType::_MARKER:
178 case ElementType::_LINE:
179 case ElementType::_REV_LINE:
185 G4cout << elementIn->name <<
"\t " << integral.arcLength/CLHEP::m <<
"\t " << integral.synchronousTAtEnd << G4endl;
193 G4double angleIn = 0.0;
194 G4double angleOut = 0.0;
195 G4bool registered =
false;
198 G4bool differentFromDefinition =
false;
201 G4cout << __METHOD_NAME__ <<
"named: \"" <<
element->name <<
"\"" << G4endl;
203 G4String searchName =
element->name;
205 {searchName +=
"_" + std::to_string(integral.
rigidityCount);}
218 {differentFromDefinition =
true;}
226 {differentFromDefinition =
true;}
232 {differentFromDefinition =
true;}
240 {differentFromDefinition =
true;}
245 {differentFromDefinition =
true;}
255 if (prevType == ElementType::_DRIFT && nextType != ElementType::_DRIFT)
257 else if (prevType != ElementType::_DRIFT && nextType == ElementType::_DRIFT)
267 {differentFromDefinition =
true;}
274 {differentFromDefinition =
true;}
279 {differentFromDefinition =
true;}
285 if (registered && !differentFromDefinition)
288 G4cout << __METHOD_NAME__ <<
"using already manufactured component" << G4endl;
297 if (differentFromDefinition)
318 case ElementType::_DRIFT:
319 {component = CreateDrift(angleIn, angleOut);
break;}
320 case ElementType::_RF:
322 component = CreateRF(RFFieldDirection::z);
323 differentFromDefinition =
true;
326 case ElementType::_RFX:
328 component = CreateRF(RFFieldDirection::x);
329 differentFromDefinition =
true;
332 case ElementType::_RFY:
334 component = CreateRF(RFFieldDirection::y);
335 differentFromDefinition =
true;
338 case ElementType::_SBEND:
339 {component = CreateSBend();
break;}
340 case ElementType::_RBEND:
341 {component = CreateRBend();
break;}
342 case ElementType::_HKICKER:
343 {component = CreateKicker(KickerType::horizontal);
break;}
344 case ElementType::_VKICKER:
345 {component = CreateKicker(KickerType::vertical);
break;}
346 case ElementType::_KICKER:
347 case ElementType::_TKICKER:
348 {component = CreateKicker(KickerType::general);
break;}
349 case ElementType::_QUAD:
350 {component = CreateQuad();
break;}
351 case ElementType::_SEXTUPOLE:
352 {component = CreateSextupole();
break;}
353 case ElementType::_OCTUPOLE:
354 {component = CreateOctupole();
break;}
355 case ElementType::_DECAPOLE:
356 {component = CreateDecapole();
break;}
357 case ElementType::_MULT:
361 component = CreateThinMultipole(angleIn);
364 component = CreateMultipole();
367 case ElementType::_THINMULT:
368 {component = CreateThinMultipole(angleIn);
break;}
369 case ElementType::_ELEMENT:
370 {component = CreateElement();
break;}
371 case ElementType::_SOLENOID:
372 {component = CreateSolenoid();
break;}
373 case ElementType::_ECOL:
374 {component = CreateEllipticalCollimator();
break;}
375 case ElementType::_RCOL:
376 {component = CreateRectangularCollimator();
break;}
377 case ElementType::_BMCOL:
378 {component = CreateBeamMaskCollimator();
break;}
379 case ElementType::_GASCAP:
380 {component = CreateGasCapillary();
break;}
381 case ElementType::_GASJET:
382 {component = CreateGasJet();
break;}
383 case ElementType::_TARGET:
384 {component = CreateTarget();
break;}
385 case ElementType::_JCOL:
386 {component = CreateJawCollimator();
break;}
387 case ElementType::_JCOLTIP:
388 {component = CreateTipJawCollimator();
break;}
389 case ElementType::_MUONCOOLER:
390 {component = CreateMuonCooler();
break;}
391 case ElementType::_MUONSPOILER:
392 {component = CreateMuonSpoiler();
break;}
393 case ElementType::_SHIELD:
394 {component = CreateShield();
break;}
395 case ElementType::_DEGRADER:
396 {component = CreateDegrader();
break;}
397 case ElementType::_WIRESCANNER:
398 {component = CreateWireScanner();
break;}
399 case ElementType::_GAP:
400 {component = CreateGap();
break;}
401 case ElementType::_CRYSTALCOL:
402 {component = CreateCrystalCollimator();
break;}
403 case ElementType::_LASERWIREOLD:
404 {component = CreateLaser();
break;}
405 case ElementType::_SCREEN:
406 {component = CreateScreen();
break;}
407 case ElementType::_TRANSFORM3D:
408 {component = CreateTransform3D();
break;}
409 case ElementType::_THINRMATRIX:
410 {component = CreateThinRMatrix(angleIn,
elementName);
break;}
411 case ElementType::_PARALLELTRANSPORTER:
412 {component = CreateParallelTransporter();
break;}
413 case ElementType::_RMATRIX:
414 {component = CreateRMatrix();
break;}
415 case ElementType::_UNDULATOR:
416 {component = CreateUndulator();
break;}
417 case ElementType::_LASERWIRE:
418 {component = CreateLaserwire(synchronousTAtMiddleOfThisComponent);
break;}
419 case ElementType::_USERCOMPONENT:
422 {
throw BDSException(__METHOD_NAME__,
"no user component factory registered");}
436 case ElementType::_DUMP:
437 {component = CreateDump();
break;}
438 case ElementType::_GABORLENS:
439 {component = CreateGaborLens();
break;}
440 case ElementType::_CT:
442 {component = CreateCT();
break;}
444 {
throw BDSException(__METHOD_NAME__,
"ct element can't be used - not compiled with dicom module!");}
446 case ElementType::_AWAKESCREEN:
448 {component = CreateAwakeScreen();
break;}
450 throw BDSException(__METHOD_NAME__,
"Awake Screen can't be used - not compiled with AWAKE module!");
452 case ElementType::_AWAKESPECTROMETER:
454 {component = CreateAwakeSpectrometer();
break;}
456 {
throw BDSException(__METHOD_NAME__,
"Awake Spectrometer can't be used - not compiled with AWAKE module!");}
459 case ElementType::_MARKER:
460 case ElementType::_LINE:
461 case ElementType::_REV_LINE:
462 {component =
nullptr;
break;}
465 G4cerr << __METHOD_NAME__ <<
"unknown type " <<
element->
type << G4endl;
473 e.AppendToMessage(
"\nBDSComponentFactory> Problem creating element \"" +
element->name +
"\"");
492 case ElementType::_ECOL:
493 case ElementType::_RCOL:
494 case ElementType::_JCOL:
495 case ElementType::_JCOLTIP:
496 case ElementType::_BMCOL:
518 const G4double teleporterHorizontalWidth,
519 const G4Transform3D& transformIn)
522 (*st)[
"length"] = teleporterLength;
525 BDSIntegratorType::teleporter,
530 G4cout <<
"---->creating Teleporter, " <<
"l = " << teleporterLength/CLHEP::m <<
"m" << G4endl;
532 return(
new BDSTeleporter(teleporterLength, teleporterHorizontalWidth, vacuumFieldInfo));
545 G4double prevTilt = 0;
546 G4double nextTilt = 0;
551 G4ThreeVector inputFaceNormal = faces.first.rotateZ(prevTilt - currentTilt);
552 G4ThreeVector outputFaceNormal = faces.second.rotateZ(nextTilt - currentTilt);
554 const G4double length =
element->
l*CLHEP::m;
560 length, extent, extent);
562 if (facesWillIntersect)
564 G4cerr << __METHOD_NAME__ <<
"Drift \"" <<
elementName
570 G4cerr <<
"\" and \"";
575 G4cerr <<
"\" is too short given its width and the angle of its faces." << G4endl;
592 case RFFieldDirection::x:
593 {fieldType = BDSFieldType::rfconstantinx;
break;}
594 case RFFieldDirection::y:
595 {fieldType = BDSFieldType::rfconstantiny;
break;}
596 case RFFieldDirection::z:
600 fieldType = BDS::FieldTypeFromCavityFieldType(cft);
616 G4double cavityLength =
element->
l * CLHEP::m;
621 if (fieldType == BDSFieldType::rfconstantinx || fieldType == BDSFieldType::rfconstantiny)
622 {buildCavityFringes =
false;}
624 G4bool buildIncomingFringe = buildCavityFringes;
631 G4bool buildOutgoingFringe = buildCavityFringes;
638 if (buildIncomingFringe)
640 if (buildOutgoingFringe)
657 vacuumField->SetModulatorInfo(modulator);
666 G4double stepFraction = 0.025;
685 G4double cavityApertureRadius = cavityInfo->
irisRadius;
700 if (buildIncomingFringe)
704 (*stIn)[
"rmat11"] = 1;
705 (*stIn)[
"rmat21"] = 0;
706 (*stIn)[
"rmat22"] = 1;
707 (*stIn)[
"rmat33"] = 1;
708 (*stIn)[
"rmat43"] = 0;
709 (*stIn)[
"rmat44"] = 1;
711 (*stIn)[
"isentrance"] =
true;
712 auto cavityFringeIn = CreateCavityFringe(0, stIn,
elementName +
"_fringe_in", cavityApertureRadius, modulator);
726 if (buildOutgoingFringe)
730 (*stOut)[
"rmat11"] = 1;
731 (*stOut)[
"rmat21"] = 0;
732 (*stOut)[
"rmat22"] = 1;
733 (*stOut)[
"rmat33"] = 1;
734 (*stOut)[
"rmat43"] = 0;
735 (*stOut)[
"rmat44"] = 1;
737 (*stOut)[
"isentrance"] =
false;
738 auto cavityFringeIn = CreateCavityFringe(0, stOut,
elementName +
"_fringe_out", cavityApertureRadius, modulator);
761 (*st)[
"angle"] = angle;
764 (*st)[
"length"] =
element->
l * CLHEP::m;
766 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
774 G4cout <<
"Angle (rad) " << (*st)[
"angle"] / CLHEP::rad << G4endl;
775 G4cout <<
"Field (T) " << (*st)[
"field"] / CLHEP::tesla << G4endl;
782 incomingFaceAngle, outgoingFaceAngle,
800 G4double arcLength = 0, chordLength = 0, field = 0, angle = 0;
803 (*st)[
"angle"] = angle;
806 (*st)[
"length"] = arcLength;
808 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
821 -incomingFaceAngle, -outgoingFaceAngle,
830 incomingFaceAngle -= 0.5*angle;
831 outgoingFaceAngle -= 0.5*angle;
835 incomingFaceAngle, outgoingFaceAngle,
848 case KickerType::horizontal:
858 case KickerType::vertical:
868 case KickerType::general:
874 {BDS::Warning(__METHOD_NAME__,
"'kick' parameter defined in element \"" +
elementName +
"\" but will be ignored as general kicker.");}
888 G4double chordLength;
893 (*st)[
"scaling"] = scaling;
894 (*st)[
"hkick"] = scaling * hkick;
895 (*st)[
"vkick"] = scaling * vkick;
896 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
908 (*fringeStOut)[
"isentrance"] =
false;
911 G4bool finiteEntrFringe =
false;
912 G4bool finiteExitFringe =
false;
915 {finiteEntrFringe =
true;}
918 {finiteExitFringe =
true;}
921 G4bool buildEntranceFringe =
false;
922 G4bool buildExitFringe =
false;
924 {buildEntranceFringe =
true;}
926 {buildExitFringe =
true;}
929 buildEntranceFringe =
false;
930 buildExitFringe =
false;
933 G4bool isThin =
false;
936 fieldType = BDSFieldType::bfieldzero;
937 intType = BDSIntegratorType::kickerthin;
949 if (buildEntranceFringe || buildExitFringe)
951 G4cout << __METHOD_NAME__ <<
"WARNING - finite B field required for kicker pole face and fringe fields,"
952 " effects are unavailable for element ""\"" <<
elementName <<
"\"." << G4endl;
954 buildEntranceFringe =
false;
955 buildExitFringe =
false;
957 else if (type == KickerType::general)
964 if (buildEntranceFringe || buildExitFringe)
966 G4cerr << __METHOD_NAME__ <<
" Poleface and fringe field effects are unavailable "
967 <<
"for the thin (t)kicker element ""\"" <<
elementName <<
"\"." << G4endl;
969 buildEntranceFringe =
false;
970 buildExitFringe =
false;
981 (*st)[
"field"] =
element->
B * CLHEP::tesla * scaling;
982 (*fringeStIn) [
"field"] = (*st)[
"field"];
983 (*fringeStOut) [
"field"] = (*st)[
"field"];
987 if (type == KickerType::vertical)
997 G4double angleX = std::asin(hkick * scaling);
998 G4double angleY = std::asin(vkick * scaling);
1000 if (std::isnan(angleX))
1001 {
throw BDSException(__METHOD_NAME__,
"hkick too strong for element \"" +
element->name +
"\" ");}
1002 if (std::isnan(angleY))
1003 {
throw BDSException(__METHOD_NAME__,
"vkick too strong for element \"" +
element->name +
"\" ");}
1007 G4double fieldX = 0;
1008 G4double fieldY = 0;
1017 case KickerType::horizontal:
1018 case KickerType::general:
1019 {fieldX =
element->
B * CLHEP::tesla * scaling;
break;}
1020 case KickerType::vertical:
1021 {fieldY =
element->
B * CLHEP::tesla * scaling;
break;}
1032 G4double fieldChordLengthX = chordLength / std::cos(0.5*angleX);
1035 G4double bendingRadiusX = fieldChordLengthX * 0.5 / sin(std::abs(angleX) * 0.5);
1038 G4double arcLengthX = std::abs(bendingRadiusX * angleX);
1046 G4double fieldChordLengthY = chordLength / std::cos(0.5*angleY);
1047 G4double bendingRadiusY = fieldChordLengthY * 0.5 / sin(std::abs(angleY) * 0.5);
1048 G4double arcLengthY = std::abs(bendingRadiusY * angleY);
1055 G4ThreeVector field = G4ThreeVector(fieldY, fieldX, 0);
1056 G4double fieldMag = field.mag();
1057 G4ThreeVector unitField = field.unit();
1059 (*st)[
"field"] = fieldMag;
1060 (*st)[
"bx"] = unitField.x();
1061 (*st)[
"by"] = unitField.y();
1065 (*fringeStIn)[
"field"] = (*st)[
"field"];
1066 (*fringeStOut)[
"field"] = (*st)[
"field"];
1067 if (fieldX < 0 || fieldY < 0)
1069 (*fringeStIn)[
"field"] *= -1;
1070 (*fringeStOut)[
"field"] *= -1;
1074 (*fringeStIn) [
"bx"] = (*st)[
"bx"];
1075 (*fringeStIn) [
"by"] = (*st)[
"by"];
1076 (*fringeStOut)[
"bx"] = (*st)[
"bx"];
1077 (*fringeStOut)[
"by"] = (*st)[
"by"];
1080 G4double defaultVHRatio = 1.5;
1083 case KickerType::horizontal:
1084 case KickerType::general:
1085 {t = BDSMagnetType::hkicker;
break;}
1086 case KickerType::vertical:
1088 t = BDSMagnetType::vkicker;
1089 defaultVHRatio = 1./defaultVHRatio;
1093 {t = BDSMagnetType::hkicker;
break;}
1114 G4double defaultHorizontalWidth = 0.3 * globalDefaultHW;
1116 G4double bpDX = bpExt.
DX();
1117 G4double bpDY = bpExt.
DY();
1118 if (bpDX > defaultHorizontalWidth && bpDX < globalDefaultHW)
1119 {defaultHorizontalWidth = globalDefaultHW;}
1120 else if (bpDY > defaultHorizontalWidth && bpDY > globalDefaultHW)
1121 {defaultHorizontalWidth = globalDefaultHW;}
1124 defaultHorizontalWidth, defaultVHRatio, 0.9);
1160 G4double kickerChordLength = chordLength;
1161 if (buildEntranceFringe)
1163 if (buildExitFringe)
1166 if (buildEntranceFringe)
1168 G4String entrFringeName = baseName +
"_e1_fringe";
1178 G4String kickerName = baseName;
1189 if (buildEntranceFringe)
1191 G4String exitFringeName = baseName +
"_e2_fringe";
1194 fringeStOut,
BRho(),
1261 beamPipeInfo->
beamPipeType = BDSBeamPipeType::circularvacuum;
1263 -angleIn, angleIn, beamPipeInfo);
1264 magnetOuterInfo->geometryType = BDSMagnetGeometryType::none;
1287 beamPipeInfo->
aper1,
1290 return thinMultipole;
1296 {
throw BDSException(__METHOD_NAME__,
"insufficient length for element \"" +
element->name +
"\" - must specify a suitable length");}
1303 G4double l =
element->
l * CLHEP::m;
1314 &vacuumBiasVolumeNames,
1328 G4double chordLength =
element->
l * CLHEP::m;
1330 (*st)[
"length"] = chordLength * 0.8;
1331 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
1335 (*st)[
"field"] = scaling *
element->
B * CLHEP::tesla;
1336 (*st)[
"ks"] = (*st)[
"field"] /
BRho();
1340 (*st)[
"field"] = (scaling *
element->
ks / CLHEP::m) *
BRho();
1350 auto strength = [](G4double phi){
1356 (*s)[
"rmat41"] = -phi;
1357 (*s)[
"rmat23"] = phi;
1361 G4bool buildIncomingFringe =
true;
1366 G4bool buildOutgoingFringe =
true;
1372 G4double solenoidBodyLength =
element->
l * CLHEP::m;
1374 if (buildIncomingFringe)
1376 if (buildOutgoingFringe)
1380 G4double lengthScaling = solenoidBodyLength / (
element->
l * CLHEP::m);
1381 G4double s = 0.5*(*st)[
"ks"] * lengthScaling;
1386 if (buildIncomingFringe)
1388 auto stIn = strength(s);
1389 auto solenoidIn = CreateThinRMatrix(0, stIn,
elementName +
"_fringe_in",
1390 BDSIntegratorType::rmatrixthin, BDSFieldType::rmatrix, 0, modulator);
1406 vacuumField->SetModulatorInfo(modulator);
1409 vacuumField->SetScalingRadius(outerInfo->innerRadius);
1418 BDSFieldType::solenoid,
1431 G4double outerRadius = outerInfo->horizontalWidth * 0.5;
1432 G4double coilRadius = beamPipeRadius + 0.25*(outerRadius - beamPipeRadius);
1433 outerField->SetScalingRadius(coilRadius);
1436 auto solenoid =
new BDSMagnet(BDSMagnetType::solenoid,
1447 if (buildOutgoingFringe)
1449 auto stOut = strength(-s);
1450 auto solenoidOut = CreateThinRMatrix(0, stOut,
elementName +
"_fringe_out",
1451 BDSIntegratorType::rmatrixthin, BDSFieldType::rmatrix, 0, modulator);
1461 return CreateMagnet(
element, st, BDSFieldType::paralleltransporter, BDSMagnetType::paralleltransporter);
1468 G4bool circularOuter =
false;
1470 if (apertureType ==
"circular")
1471 {circularOuter =
true;}
1490 G4bool circularOuter =
false;
1492 if (outerShape ==
"circular")
1493 {circularOuter =
true;}
1518 G4bool circularOuter =
false;
1520 if (outerShape ==
"circular")
1521 {circularOuter =
true;}
1560 G4bool circularOuter =
false;
1562 if (apertureType ==
"circular")
1563 {circularOuter =
true;}
1578 G4bool circularOuter =
false;
1580 if (apertureType ==
"circular")
1581 {circularOuter =
true;}
1608 element->jawTiltLeft*CLHEP::rad,
1630 element->jawTiltLeft*CLHEP::rad,
1636 collimatorTipMaterial,
1647 G4double elLength =
element->
l*CLHEP::m;
1655 outerField =
new BDSFieldInfo(BDSFieldType::muonspoiler,
1662 G4double limit = elLength / 20.0;
1664 if (ul != defaultUL)
1669 return new BDSMagnet(BDSMagnetType::muonspoiler,
1688 element->horizontalWidth * CLHEP::m,
1721 G4double degraderOffset;
1723 {
throw BDSException(__METHOD_NAME__,
"both \"materialThickness\" and \"degraderOffset\" are either undefined or < 0");}
1725 {
throw BDSException(__METHOD_NAME__,
"\"degraderOffset\" cannot be < 0");}
1727 {
throw BDSException(__METHOD_NAME__,
"\"materialThickness\" cannot be greater than the element length");}
1741 degraderOffset = (0.5*thicknessPerWedge) * (std::sin(CLHEP::halfpi - theta) / std::sin(theta));
1747 G4double baseWidth = bpi->aper1;
1769 {
throw BDSException(__METHOD_NAME__,
"\"angle\" parameter set for wirescanner \"" +
elementName +
"\" but this should not be set. Please unset and use \"wireAngle\".");}
1771 G4ThreeVector wireOffset = G4ThreeVector(
element->wireOffsetX * CLHEP::m,
1772 element->wireOffsetY * CLHEP::m,
1773 element->wireOffsetZ * CLHEP::m);
1781 element->wireAngle*CLHEP::rad,
1796 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
1813 G4double limit = (*st)[
"length"] * 0.075;
1815 if (ul != defaultUL)
1832 G4double chordLength =
element->
l*CLHEP::m;
1835 G4cout << __METHOD_NAME__ <<
"using default length of 1 mm for dump" << G4endl;
1836 chordLength = 1*CLHEP::mm;
1839 G4bool circular =
false;
1841 if (apertureType ==
"circular")
1843 else if (apertureType !=
"rectangular" && !apertureType.empty())
1844 {
throw BDSException(__METHOD_NAME__,
"unknown shape for dump: \"" + apertureType +
"\"");}
1862 new BDSDicomIntersectVolume();
1885 if (!
element->crystalBoth.empty())
1890 else if (
element->crystalBoth.empty() && !
element->crystalRight.empty() && !
element->crystalLeft.empty())
1895 else if (
element->crystalRight.empty())
1902 G4cout << G4endl << G4endl << __METHOD_NAME__
1903 <<
"Left crystal being used but right angle set - perhaps check input for element "
1908 G4cout << G4endl << G4endl << __METHOD_NAME__
1909 <<
"Right crystal being used but left angle set - perhaps check input for element "
1920 element->crystalAngleYAxisLeft*CLHEP::rad,
1921 element->crystalAngleYAxisRight*CLHEP::rad));
1930 G4double length =
element->
l*CLHEP::m;
1931 G4double lambda = laser->
Wavelength()*CLHEP::m;
1934 G4ThreeVector position = G4ThreeVector(0,0,0);
1945 size.setX(
element->screenXSize*CLHEP::m);
1947 G4cout << __METHOD_NAME__ <<
" - size = " << size << G4endl;
1957 "same number of materials as layers - check 'layerMaterials'");
1963 std::list<std::string>::const_iterator itm;
1964 std::list<double>::const_iterator itt;
1965 std::list<int>::const_iterator itIsSampler;
1973 G4cout << __METHOD_NAME__ <<
" - screen layer: thickness: "
1974 << *(itt) <<
", material " << (*itm)
1975 <<
", isSampler: " << (*itIsSampler) << G4endl;
1991 return (
new BDSAwakeScintillatorScreen(
elementName,
2008 (*awakeStrength)[
"by"] = 1;
2013 BDSIntegratorType::g4classicalrk4,
2046 {BDS::Warning(__METHOD_NAME__,
"component \""+
element->name+
"\" has axisAngle=1 but one or more of (phi,theta,psi) are non-zero - check");}
2059 {BDS::Warning(__METHOD_NAME__,
"component \""+
element->name+
"\" does not have axisAngle=1 but one or more axisAngle variables are non-zero - check");}
2073 G4cout <<
"---->creating Terminator" << G4endl;
2087 BDSFieldType::paralleltransporter,
2088 BDSMagnetType::paralleltransporter);
2093 BDSFieldType::paralleltransporter,
2094 BDSMagnetType::paralleltransporter);
2108 const G4String& name)
2112 return CreateThinRMatrix(angleIn, st, name, BDSIntegratorType::rmatrixthin, BDSFieldType::rmatrix, 0, modulator);
2117 const G4String& name,
2120 G4double beamPipeRadius,
2124 beamPipeInfo->
beamPipeType = BDSBeamPipeType::circularvacuum;
2128 {beamPipeInfo->
aper1 = beamPipeRadius;}
2131 magnetOuterInfo->geometryType = BDSMagnetGeometryType::none;
2140 vacuumField->SetBeamPipeRadius(beamPipeInfo->
aper1);
2141 vacuumField->SetModulatorInfo(fieldModulator);
2154 beamPipeInfo->
aper1,
2162 const G4String& name,
2163 G4double irisRadius,
2168 BDSAcceleratorComponent* cavityFringe = CreateThinRMatrix(angleIn, st, name, intType, fieldType, irisRadius, fieldModulator);
2169 return cavityFringe;
2185 G4ThreeVector(0,0,-1),
2186 G4ThreeVector(0,0,1));
2188 const BDSFieldType gaborLensField = BDSFieldType::gaborlens;
2192 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
2194 (*st)[
"length"] =
element->
l * CLHEP::m;
2206 G4Material* outerMaterial;
2207 if (
element->material.empty())
2242 laser->
SetT0(syncrhonousTime);
2247 G4String colour = laser->GetLaserColour();
2266 const G4String& nameSuffix)
const
2271 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
2282 vacuumField->SetScalingRadius(outerInfo->innerRadius);
2287 G4bool externalOuterField = !(el->
fieldOuter.empty());
2312 G4bool printWarning)
2317 {BDS::Warning(
"---> NOT creating element \"" + el->name +
"\" -> l < 1e-7 m: l = " + std::to_string(el->
l) +
" m");}
2329 " is greater than " + std::to_string(maxAngle));}
2332 " is greater than " + std::to_string(maxAngle));}
2340 if (mgt == BDSMagnetGeometryType::lhcleft)
2342 if (mgt == BDSMagnetGeometryType::lhcright)
2345 G4double angle = (*st)[
"angle"];
2346 G4double hkickAng = -(*st)[
"hkick"];
2347 G4double vkickAng = -(*st)[
"vkick"];
2353 if ((angle < 0) && (
element->yokeOnInside))
2354 {yokeOnLeft =
true;}
2355 else if ((angle > 0) && (!(
element->yokeOnInside)))
2356 {yokeOnLeft =
true;}
2358 {yokeOnLeft =
false;}
2371 const G4Transform3D& fieldTransform,
2374 G4double outerFieldScaling,
2380 case BDSFieldType::dipole:
2381 {outerType = BDSFieldType::multipoleouterdipole;
break;}
2382 case BDSFieldType::quadrupole:
2383 {outerType = BDSFieldType::multipoleouterquadrupole;
break;}
2384 case BDSFieldType::sextupole:
2385 {outerType = BDSFieldType::multipoleoutersextupole;
break;}
2386 case BDSFieldType::octupole:
2387 {outerType = BDSFieldType::multipoleouteroctupole;
break;}
2388 case BDSFieldType::decapole:
2389 {outerType = BDSFieldType::multipoleouterdecapole;
break;}
2390 case BDSFieldType::skewquadrupole:
2391 {outerType = BDSFieldType::skewmultipoleouterquadrupole;
break;}
2392 case BDSFieldType::skewsextupole:
2393 {outerType = BDSFieldType::skewmultipoleoutersextupole;
break;}
2394 case BDSFieldType::skewoctupole:
2395 {outerType = BDSFieldType::skewmultipoleouteroctupole;
break;}
2396 case BDSFieldType::skewdecapole:
2397 {outerType = BDSFieldType::skewmultipoleouterdecapole;
break;}
2398 case BDSFieldType::dipole3d:
2399 case BDSFieldType::solenoid:
2400 {outerType = BDSFieldType::solenoidsheet;
break;}
2402 {
return nullptr;
break;}
2406 (*stCopy)[
"scalingOuter"] = outerFieldScaling;
2414 outerField->SetModulatorInfo(modulatorInfo);
2418 outerField->SetScalingRadius(outerInfo->innerRadius);
2419 outerField->SetSecondFieldOnLeft(outerInfo->yokeOnLeft);
2420 auto gt = outerInfo->geometryType;
2422 if ((gt == BDSMagnetGeometryType::lhcleft || gt == BDSMagnetGeometryType::lhcright) && yfmLHC)
2424 if (fieldType == BDSFieldType::dipole)
2425 {outerField->
SetFieldType(BDSFieldType::multipoleouterdipolelhc);}
2426 else if (fieldType == BDSFieldType::quadrupole)
2427 {outerField->
SetFieldType(BDSFieldType::multipoleouterquadrupolelhc);}
2428 else if (fieldType == BDSFieldType::sextupole)
2429 {outerField->
SetFieldType(BDSFieldType::multipoleoutersextupolelhc);}
2442 G4double defaultHorizontalWidth,
2443 G4double defaultVHRatio,
2444 G4double defaultCoilWidthFraction,
2445 G4double defaultCoilHeightFraction)
2448 G4double angle = (*st)[
"angle"];
2451 defaultHorizontalWidth, defaultVHRatio, defaultCoilWidthFraction,
2452 defaultCoilHeightFraction);
2460 if (el->magnetGeometryType.empty() || globals->IgnoreLocalMagnetGeometry())
2461 {result = globals->MagnetGeometryType();}
2469 const G4double angleIn,
2470 const G4double angleOut,
2472 const G4bool yokeOnLeft,
2473 G4double defaultHorizontalWidth,
2474 G4double defaultVHRatio,
2475 G4double defaultCoilWidthFraction,
2476 G4double defaultCoilHeightFraction)
2481 info->name = elementNameIn;
2485 if (! (el->magnetGeometryType.empty() || globals->IgnoreLocalMagnetGeometry()) )
2487 info->geometryTypeAndPath = el->magnetGeometryType;
2489 {BDS::Warning(__METHOD_NAME__,
"stripOuterVolume for element \"" + el->name +
"\" will have no effect");}
2493 info->angleIn = angleIn;
2494 info->angleOut = angleOut;
2503 G4Material* outerMaterial;
2504 if (el->material.empty())
2506 G4String defaultMaterialName = globals->OuterMaterialName();
2511 info->outerMaterial = outerMaterial;
2514 info->yokeOnLeft = yokeOnLeft;
2517 {info->
hStyle = globals->HStyle();}
2522 {info->vhRatio = G4double(el->
vhRatio);}
2523 else if (globals->VHRatio() > 0)
2524 {info->vhRatio = globals->VHRatio();}
2525 else if (defaultVHRatio > 0)
2526 {info->vhRatio = defaultVHRatio;}
2528 {info->vhRatio = info->
hStyle ? 0.8 : 1.0;}
2532 else if (globals->CoilWidthFraction() > 0)
2533 {info->coilWidthFraction = globals->CoilWidthFraction();}
2534 else if (defaultCoilHeightFraction > 0)
2535 {info->coilWidthFraction = defaultCoilWidthFraction;}
2537 {info->coilWidthFraction = info->
hStyle ? 0.8 : 0.65;}
2541 else if (globals->CoilHeightFraction() > 0)
2542 {info->coilHeightFraction = globals->CoilHeightFraction();}
2543 else if (defaultCoilHeightFraction > 0)
2544 {info->coilHeightFraction = defaultCoilHeightFraction;}
2546 {info->coilHeightFraction = 0.8;}
2555 G4double defaultHorizontalWidth)
2557 G4double horizontalWidth = el->horizontalWidth*CLHEP::m;
2558 if (horizontalWidth < 1e-6)
2560 if (defaultHorizontalWidth > 0)
2561 {horizontalWidth = defaultHorizontalWidth;}
2565 return horizontalWidth;
2570 G4Material* result =
nullptr;
2579 const G4ThreeVector& inputFaceNormalIn,
2580 const G4ThreeVector& outputFaceNormalIn)
2590 el->
aper1 * CLHEP::m,
2591 el->
aper2 * CLHEP::m,
2592 el->
aper3 * CLHEP::m,
2593 el->
aper4 * CLHEP::m,
2598 outputFaceNormalIn);
2602 G4String msg =
"\nProblem in element: \"" + el->name +
"\"";
2603 e.AppendToMessage(msg);
2617 const G4double angleIn,
2618 const G4double angleOut)
2628 G4cout << __METHOD_NAME__ <<
"offsetX,Y: " << el->
offsetX <<
" " << el->
offsetY <<
" tilt: " << el->
tilt << G4endl;
2630 G4double xOffset = el->
offsetX * CLHEP::m;
2631 G4double yOffset = el->
offsetY * CLHEP::m;
2632 G4double tilt = el->
tilt * CLHEP::rad;
2642 return tiltOffset ? tiltOffset->
Transform3D() : G4Transform3D();
2655 G4double horizontalWidth,
2656 const G4String& name)
2658 G4double radiusFromAngleLength = std::abs(arcLength / angle);
2659 if (horizontalWidth > 2*radiusFromAngleLength)
2661 G4cerr <<
"Error: the combination of length, angle and horizontalWidth in element named \"" << name
2662 <<
"\" will result in overlapping faces!" << G4endl <<
"Please reduce the horizontalWidth" << G4endl;
2672 G4Material* material =
nullptr;
2673 if (!model.material.empty())
2678 model.irisRadius*CLHEP::m,
2679 model.thickness*CLHEP::m,
2680 model.equatorRadius*CLHEP::m,
2681 model.halfCellLength*CLHEP::m,
2682 model.numberOfPoints,
2683 model.numberOfCells,
2684 model.equatorHorizontalAxis*CLHEP::m,
2685 model.equatorVerticalAxis*CLHEP::m,
2686 model.irisHorizontalAxis*CLHEP::m,
2687 model.irisVerticalAxis*CLHEP::m,
2688 model.tangentLineAngle);
2698 G4double sigma0 = 0;
2700 {sigma0 = 0.5 * laser.w0;}
2702 {sigma0 = laser.sigma0;}
2704 {
throw BDSException(__METHOD_NAME__,
"Neither \"w0\" or \"sigma0\" are defined \"" + laser.name +
"\"");}
2706 G4ThreeVector polarization(laser.laserPolarization1,laser.laserPolarization2,laser.laserPolarization3);
2709 laser.pulseDuration*CLHEP::s,
2710 laser.pulseEnergy*CLHEP::joule,
2712 laser.laserArrivalTime*CLHEP::s,
2715 laser.ignoreRayleighRange);
2716 lasers[laser.name] = las;
2723 G4String laserBeam = G4String(el->
laserBeam);
2724 auto result =
lasers.find(laserBeam);
2725 if (result ==
lasers.end())
2727 G4cout <<
"Unknown laser \"" << laserBeam <<
"\" - please define it" << G4endl;
2744 (G4double) colour.red,
2745 (G4double) colour.green,
2746 (G4double) colour.blue,
2747 (G4double) colour.alpha);
2760 G4String(model.data),
2762 G4double(model.lengthX)*CLHEP::m,
2763 G4double(model.lengthY)*CLHEP::m,
2764 G4double(model.lengthZ)*CLHEP::m,
2765 G4double(model.sizeA)*CLHEP::m,
2766 G4double(model.sizeB)*CLHEP::m,
2767 G4double(model.sizeC)*CLHEP::m,
2768 G4double(model.alpha)*CLHEP::halfpi,
2769 G4double(model.beta)*CLHEP::halfpi,
2770 G4double(model.gamma)*CLHEP::halfpi,
2771 G4int (model.spaceGroup),
2772 G4double(model.bendingAngleYAxis)*CLHEP::rad,
2773 G4double(model.bendingAngleZAxis)*CLHEP::rad,
2774 G4double(model.miscutAngleY)*CLHEP::rad);
2785 G4cout <<
"Defined crystals are:" << G4endl;
2787 {G4cout << kv.first << G4endl;}
2788 throw BDSException(__METHOD_NAME__,
"unknown crystal \"" + crystalName +
"\" - please define it");
2797 G4double frequency)
const
2804 if (modelName.empty())
2810 {
throw BDSException(__METHOD_NAME__,
"unknown cavity model identifier \"" + el->
cavityModel +
"\" - please define it");}
2818 if (cavityRadius > horizontalWidth)
2820 G4String msg =
"Cavity horizontalWidth for element \"" +
elementName +
"\" is smaller " +
"than the cavity model radius.";
2828 if (el->material.empty())
2830 G4String msg =
"cavity material is not defined for cavity \"" +
elementName +
"\"";
2831 msg +=
" or for cavity model \"" + el->
cavityModel +
"\" - please define it";
2842 G4double frequency)
const
2847 G4double aper1 = aperture->
aper1;
2850 G4double defaultHorizontalWidth = 20*CLHEP::cm;
2851 if (aper1 < defaultHorizontalWidth)
2852 {horizontalWidth = std::min(defaultHorizontalWidth, horizontalWidth);}
2854 G4double equatorRadius = horizontalWidth - thickness;
2855 if (equatorRadius <= 0)
2857 G4String msg =
"horizontalWidth - beampipeThickness <= 0 for element \"" + el->name +
"\" -> this quantity must be positive";
2862 G4double length = el->
l * CLHEP::m;
2863 G4double cellLength = length;
2870 cellLength = 2*CLHEP::c_light / frequency;
2871 G4double nCavities = length / cellLength;
2872 nCells = G4int(std::floor(nCavities));
2878 cellLength = length;
2894 G4double cavityLength,
2897 G4double eField = 0;
2898 G4double scaling = el->
scaling;
2899 G4double frequency = el->
frequency * CLHEP::rad;
2900 G4double phase = el->
phase * CLHEP::rad;
2903 G4int acceleratingFieldDirectionFactor = BDS::Sign(incomingParticle.
BRho());
2907 case BDSFieldType::rfconstantinx:
2908 case BDSFieldType::rfconstantiny:
2910 eField = scaling * el->
gradient * CLHEP::volt / CLHEP::m;
2913 case BDSFieldType::rfconstantinz:
2916 {eField = scaling * el->
gradient * CLHEP::volt / CLHEP::m;}
2918 {eField = scaling * el->
E * CLHEP::volt / cavityLength;}
2921 case BDSFieldType::rfpillbox:
2924 {eField = scaling * el->
gradient * CLHEP::volt / CLHEP::m;}
2928 eField = scaling * el->
E * CLHEP::volt / cavityLength;
2930 eField /= transitTimeFactor;
2937 eField *= acceleratingFieldDirectionFactor;
2943 G4double& arcLength,
2944 G4double& chordLength,
2950 chordLength = el->
l * CLHEP::m;
2951 G4double arcLengthLocal = chordLength;
2956 field = el->
B * CLHEP::tesla;
2957 angle = el->
angle * CLHEP::rad;
2961 G4double radiusOfCurvatureOfDipole = 0.5 * chordLength / std::sin(0.5 * angle);
2962 arcLengthLocal = radiusOfCurvatureOfDipole * angle;
2965 {arcLengthLocal = chordLength;}
2969 field = el->
B * CLHEP::tesla;
2970 G4double bendingRadius = brhoIn / field;
2971 angle = 2.0*std::asin(chordLength*0.5 / bendingRadius);
2972 if (std::isnan(angle))
2973 {
throw BDSException(
"Field too strong for element " + el->name +
", magnet bending angle will be greater than pi.");}
2975 arcLengthLocal = bendingRadius * angle;
2979 angle = el->
angle * CLHEP::rad;
2985 G4double bendingRadius = chordLength * 0.5 / std::sin(std::abs(angle) * 0.5);
2986 arcLengthLocal = bendingRadius * angle;
2987 field = brhoIn * angle / std::abs(arcLengthLocal);
2994 arcLength = std::abs(arcLengthLocal);
2996 if (std::abs(angle) > CLHEP::pi/2.0)
2997 {
throw BDSException(
"Error: the rbend " + el->name +
" cannot be constructed as its bending angle is defined to be greater than pi/2.");}
3002 G4double cavityLength,
3008 G4double chordLength = cavityLength;
3009 (*st)[
"equatorradius"] = 1*CLHEP::m;
3010 (*st)[
"length"] = chordLength;
3011 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
3015 case BDSFieldType::rfpillbox:
3016 case BDSFieldType::rfconstantinz:
3017 {(*st)[
"ez"] = 1.0;
break;}
3018 case BDSFieldType::rfconstantinx:
3019 {(*st)[
"ex"] = 1.0;
break;}
3020 case BDSFieldType::rfconstantiny:
3021 {(*st)[
"ey"] = 1.0;
break;}
3023 {(*st)[
"ez"] = 1.0;
break;}
3027 G4double lengthScaling = cavityLength / (
element->
l * CLHEP::m);
3029 if ((fieldType == BDSFieldType::rfconstantinx || fieldType == BDSFieldType::rfconstantiny) &&
BDS::IsFinite(el->
E) )
3030 {
throw BDSException(__METHOD_NAME__,
"only \"gradient\" is accepted for rfconstantinx or rfconstantiny components and not \"E\"");}
3033 (*st)[
"efield"] = eField / lengthScaling;
3035 G4double frequency = std::abs(el->
frequency * CLHEP::hertz);
3036 (*st)[
"frequency"] = frequency;
3039 G4double phase = el->
phase * CLHEP::rad;
3043 {
throw BDSException(__METHOD_NAME__,
"component: " + el->name +
" has both tOffset and phase specified - only one can be used.");}
3044 phase = el->
tOffset*CLHEP::s * frequency * CLHEP::twopi;
3046 (*st)[
"phase"] = phase;
3064 G4String colour = el->
colour;
3067 else if (colour.empty())
3074 const G4String& defaultMaterialName)
3076 G4String materialName = el->material;
3077 if (materialName.empty())
3085 G4String materialName = el->material;
3086 if (materialName.empty())
3087 {
throw BDSException(__METHOD_NAME__,
"element \"" + el->name +
"\" has no material specified.");}
3093 const G4String& defaultMaterialName)
3096 if (materialName.empty())
3105 if (materialName.empty())
3106 {
throw BDSException(__METHOD_NAME__,
"element \"" + el->name +
"\" has no tip material specified.");}
3118 for (
auto comp : *line)
3123 if (mag && el->
type != ElementType::_RF)
3128 <<
"\" is a magnet, but has fieldAll defined." << G4endl
3129 <<
"Can only have fieldOuter and or fieldVacuum specified." << G4endl;
3139 mag->SetOuterField(info);
3147 mag->SetVacuumField(info);
3159 {BDS::Warning(
"component \"" + el->name +
"\" has \"scalingFieldOuter\" != 1.0 -> this will have no effect for \"fieldAll\"");}
3168 if (!el->fieldModulator.empty())
3171 {
throw BDSException(__METHOD_NAME__,
"\""+
elementName+
"\" uses a field map with a modulator but also a modulator\ndouble modulation is not allowed");}
3175 info->SetModulatorInfo(modDef);
3184 G4double scaling = el->
scaling;
3185 G4double arcLength = el->
l * CLHEP::m;
3186 (*st)[
"length"] = arcLength;
3187 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
3190 {(*st)[
"length"] = 1*CLHEP::m;}
3191 auto kn = el->
knl.begin();
3192 auto ks = el->
ksl.begin();
3195 auto nkey = normKeys.begin();
3196 auto skey = skewKeys.begin();
3198 for (; kn != el->
knl.end(); kn++, nkey++)
3199 {(*st)[*nkey] = scaling * (*kn);}
3200 for (; ks != el->
ksl.end(); ks++, skey++)
3201 {(*st)[*skey] = scaling * (*ks);}
3209 (*st)[
"synchronousT0"] = synchronousTAtMiddleOfThisComponent;
3211 G4double scaling = el->
scaling;
3214 (*st)[
"kick1"] = scaling * el->
kick1;
3215 (*st)[
"kick2"] = scaling * el->
kick2;
3216 (*st)[
"kick3"] = scaling * el->
kick3;
3217 (*st)[
"kick4"] = scaling * el->
kick4;
3219 (*st)[
"rmat11"] = scaling * el->
rmat11;
3220 (*st)[
"rmat12"] = scaling * el->
rmat12;
3221 (*st)[
"rmat13"] = scaling * el->
rmat13;
3222 (*st)[
"rmat14"] = scaling * el->
rmat14;
3224 (*st)[
"rmat21"] = scaling * el->
rmat21;
3225 (*st)[
"rmat22"] = scaling * el->
rmat22;
3226 (*st)[
"rmat23"] = scaling * el->
rmat23;
3227 (*st)[
"rmat24"] = scaling * el->
rmat24;
3229 (*st)[
"rmat31"] = scaling * el->
rmat31;
3230 (*st)[
"rmat32"] = scaling * el->
rmat32;
3231 (*st)[
"rmat33"] = scaling * el->
rmat33;
3232 (*st)[
"rmat34"] = scaling * el->
rmat34;
3234 (*st)[
"rmat41"] = scaling * el->
rmat41;
3235 (*st)[
"rmat42"] = scaling * el->
rmat42;
3236 (*st)[
"rmat43"] = scaling * el->
rmat43;
3237 (*st)[
"rmat44"] = scaling * el->
rmat44;
3243 const G4double arcLength)
const
3248 {
return BRho() * angle / arcLength;}
3252 const G4double arcLength)
const
3257 {
return field * arcLength /
BRho();}
3262 G4double& field)
const
3264 G4double arcLength = el->
l * CLHEP::m;
3267 field = el->
B * CLHEP::tesla;
3268 angle = el->
angle * CLHEP::rad;
3272 field = el->
B * CLHEP::tesla;
3277 angle = el->
angle * CLHEP::rad;
3283 {
throw BDSException(
"Error: the unsplit sbend "+ el->name +
" cannot be constructed as its bending angle is defined to be greater than pi/2.");}
3285 else if (std::abs(angle) > CLHEP::pi*2.0)
3286 {
throw BDSException(
"Error: the sbend "+ el->name +
" cannot be constructed as its bending angle is defined to be greater than 2 pi.");}
3291 G4double bendAngle = 0;
3292 if (el->
type == ElementType::_RBEND)
3294 G4double arcLength = 0, chordLength = 0, field = 0;
3297 else if (el->
type == ElementType::_SBEND)
3302 else if (el->
type == ElementType::_ELEMENT)
3303 {bendAngle = -1*el->
angle*CLHEP::rad;}
3316 G4double outgoingFaceAngle = 0;
3320 G4double e2 = el->
e2*CLHEP::rad;
3321 if (el->
type == ElementType::_ELEMENT)
3323 G4double factor = bendAngle < 0 ? -1 : 1;
3324 outgoingFaceAngle += factor * e2;
3325 return outgoingFaceAngle;
3327 else if (el->
type == ElementType::_RBEND)
3330 {
return outgoingFaceAngle;}
3333 outgoingFaceAngle += 0.5 * bendAngle;
3339 {
return outgoingFaceAngle;}
3348 G4double factor = bendAngle < 0 ? -1 : 1;
3349 outgoingFaceAngle += factor * e2;
3352 return outgoingFaceAngle;
3363 G4double incomingFaceAngle = 0;
3367 G4double e1 = el->
e1*CLHEP::rad;
3368 if (el->
type == ElementType::_ELEMENT)
3370 G4double factor = bendAngle < 0 ? -1 : 1;
3371 incomingFaceAngle += factor * e1;
3372 return incomingFaceAngle;
3374 else if (el->
type == ElementType::_RBEND)
3377 {
return incomingFaceAngle;}
3380 incomingFaceAngle += 0.5 * bendAngle;
3386 {
return incomingFaceAngle;}
3395 G4double factor = bendAngle < 0 ? -1 : 1;
3396 incomingFaceAngle += factor * e1;
3399 return incomingFaceAngle;
3403 G4bool inDevelopment)
const
3412 if (!
element->fieldModulator.empty())
3413 {
throw BDSException(__METHOD_NAME__,
"fieldModulator is currently in development for element \"" +
elementName +
"\"");}
3422 if ((*st)[
"kg"] < 0)
3427 const G4double c = CLHEP::c_light;
3429 const G4double gamma = designParticle.
Gamma();
3430 const G4double momentum = designParticle.
Momentum();
3431 const G4double mass = designParticle.
Mass();
3433 G4double convFactor = gamma * std::pow(c,2) / (4*std::pow(momentum,2));
3439 b2 = (*st)[
"kg"] / convFactor * CLHEP::tesla;
3440 (*st)[
"field"] = std::sqrt(b2) ;
3444 b2 = std::pow((*st)[
"field"],2);
3445 (*st)[
"kg"] = b2 * convFactor / CLHEP::m;
3449 (*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 jaws having a bulk material and a tip of a different material.
Collimator with only two jaw and no top bit.
A class for a rectangular collimator.
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 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 wavelength
for laser wire and 3d transforms
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