19#include "BDSAcceleratorComponent.hh"
20#include "BDSAcceleratorComponentRegistry.hh"
21#include "BDSAcceleratorModel.hh"
22#include "BDSApertureInfo.hh"
23#include "BDSAuxiliaryNavigator.hh"
24#include "BDSBeamline.hh"
25#include "BDSBeamlineBLMBuilder.hh"
26#include "BDSBeamlineEndPieceBuilder.hh"
27#include "BDSBeamlineElement.hh"
28#include "BDSBeamlinePlacementBuilder.hh"
29#include "BDSBeamlineSet.hh"
30#include "BDSBeamPipeInfo.hh"
32#include "BDSBLMRegistry.hh"
33#include "BDSBOptrMultiParticleChangeCrossSection.hh"
34#include "BDSComponentFactory.hh"
35#include "BDSComponentFactoryUser.hh"
36#include "BDSCurvilinearBuilder.hh"
38#include "BDSDetectorConstruction.hh"
39#include "BDSException.hh"
40#include "BDSExtent.hh"
41#include "BDSFieldBuilder.hh"
42#include "BDSFieldObjects.hh"
43#include "BDSFieldQuery.hh"
44#include "BDSFieldQueryInfo.hh"
45#include "BDSFieldLoaderQueryPoints.hh"
47#include "BDSGeometryComponent.hh"
48#include "BDSGeometryExternal.hh"
49#include "BDSGeometryFactory.hh"
50#include "BDSGlobalConstants.hh"
51#include "BDSHistBinMapper.hh"
52#include "BDSIntegratorSet.hh"
54#include "BDSMaterials.hh"
55#include "BDSParser.hh"
56#include "BDSPhysicalVolumeInfo.hh"
57#include "BDSPhysicalVolumeInfoRegistry.hh"
58#include "BDSRegion.hh"
59#include "BDSSamplerInfo.hh"
60#include "BDSSamplerType.hh"
61#include "BDSScorerFactory.hh"
62#include "BDSScorerInfo.hh"
63#include "BDSScorerMeshInfo.hh"
64#include "BDSScoringMeshBox.hh"
65#include "BDSScoringMeshCylinder.hh"
66#include "BDSSDEnergyDeposition.hh"
67#include "BDSSDManager.hh"
68#include "BDSSDType.hh"
69#include "BDSSurvey.hh"
70#include "BDSTeleporter.hh"
71#include "BDSTrajectoryPoint.hh"
72#include "BDSTunnelBuilder.hh"
73#include "BDSUtilities.hh"
74#include "BDSWarning.hh"
76#include "parser/blmplacement.h"
77#include "parser/element.h"
78#include "parser/fastlist.h"
79#include "parser/options.h"
80#include "parser/physicsbiasing.h"
81#include "parser/placement.h"
82#include "parser/samplerplacement.h"
83#include "parser/scorermesh.h"
86#include "G4AffineTransform.hh"
88#include "G4LogicalVolume.hh"
89#include "G4Material.hh"
90#include "G4ProductionCuts.hh"
91#include "G4PVPlacement.hh"
92#include "G4VPrimitiveScorer.hh"
94#include "G4ScoringManager.hh"
96#include "G4Transform3D.hh"
97#include "G4Version.hh"
98#include "G4VisAttributes.hh"
99#include "G4VPhysicalVolume.hh"
100#if G4VERSION_NUMBER > 1039
101#include "G4ChannelingOptrMultiParticleChangeCrossSection.hh"
103#if G4VERSION_NUMBER > 1109
104#include "G4HadronicParameters.hh"
107#ifdef BDSCHECKUSERLIMITS
108#include "G4UserLimits.hh"
111#include "CLHEP/Units/SystemOfUnits.h"
112#include "CLHEP/Vector/EulerAngles.h"
126 placementBL(nullptr),
127 designParticle(nullptr),
128 userComponentFactory(userComponentFactoryIn),
130 buildPlacementFieldsWorld(false),
131 worldLogicalVolume(nullptr)
134 verbose = globals->Verbose();
135 checkOverlaps = globals->CheckOverlaps();
136 circular = globals->Circular();
138 if (globals->RestoreFTPFDiffractionForAGreater10())
139#if G4VERSION_NUMBER > 1109
141 G4cout << __METHOD_NAME__ <<
"restoring diffraction for target / projectiles with A > 10 in the FTFP hadronic model (even if not used)" << G4endl;
142 G4HadronicParameters::Instance()->SetEnableDiffDissociationForBGreater10(
true);
146 if (globals->RestoreFTPFDiffractionForAGreater10Set())
147 {BDS::Warning(__METHOD_NAME__,
"\"restoreFTPFDiffractionForAGreater10\" is only available for Geant4 v11.1 and later");}
154 acceleratorModel = BDSAcceleratorModel::Instance();
155 canSampleAngledFaces =
true;
157 if ( (integratorSetType == BDSIntegratorSetType::bdsimtwo)
158 || (integratorSetType == BDSIntegratorSetType::geant4)
159#
if G4VERSION_NUMBER > 1039
160 || (integratorSetType == BDSIntegratorSetType::geant4dp)
164 canSampleAngledFaces = globals->SampleElementsWithPoleface();
167 UpdateSamplerDiameterAndCountSamplers();
168 PrepareExtraSamplerSDs();
169 CountPlacementFields();
176 G4double maxBendingRatio = 1e-9;
177 for (
const auto& blElement : beamline)
180 auto st = BDS::DetermineSamplerType(blElement.samplerType);
181 if (st != BDSSamplerType::none)
184 G4double length = blElement.l;
185 G4double angle = blElement.angle;
188 G4double ratio = angle / length;
189 maxBendingRatio = std::max(maxBendingRatio, ratio);
193 G4double curvilinearRadius = 0.5*globals->CurvilinearDiameter();
194 G4double tolerance = 0.9;
195 if (maxBendingRatio > 0.4*tolerance)
197 G4double curvilinearRadiusBends = (tolerance / maxBendingRatio)*CLHEP::m;
198 if (curvilinearRadiusBends < curvilinearRadius)
200 G4cout << __METHOD_NAME__ <<
"Reducing curvilinear diameter from " << 2*curvilinearRadius / CLHEP::m
201 <<
"m to " << 2*curvilinearRadiusBends / CLHEP::m <<
"m" << G4endl;
205 G4double sd = globals->SamplerDiameter();
206 if (curvilinearRadius*2 < sd)
208 G4cout << __METHOD_NAME__ <<
"Reducing sampler diameter from " << sd / CLHEP::m <<
"m to the same" << G4endl;
227 for (
const auto& placement : placements)
229 if (!placement.fieldAll.empty() || !placement.bdsimElement.empty())
232 buildPlacementFieldsWorld = nFields > 0;
238 {G4cout << __METHOD_NAME__ <<
"starting accelerator geometry construction\n" << G4endl;}
256 delete componentFactory;
274 {G4cout << __METHOD_NAME__ <<
"detector Construction done" << G4endl;}
281 G4cout << G4endl << __METHOD_NAME__ <<
"printing material table" << G4endl;
282 G4cout << *(G4Material::GetMaterialTable()) << G4endl << G4endl;
283 if (
verbose || debug) {G4cout <<
"Finished listing materials, returning physiWorld" << G4endl;}
285#ifdef BDSCHECKUSERLIMITS
286 PrintUserLimitsSummary(worldPV);
291BDSDetectorConstruction::~BDSDetectorConstruction()
293#if G4VERSION_NUMBER > 1009
298 for (
auto q : fieldQueries)
308 G4cout <<
"New region defined: " << G4endl << *reg << G4endl;
311 delete defaultRegion;
316 std::map<G4String, BDSApertureInfo*> apertures;
325 apertures[a.name] = ap;
334 {G4cout <<
"parsing the beamline element list..."<< G4endl;}
345 G4cout <<
"Registry size "
347 G4cout <<
"Parser beam line size "
353 if (!
circular && mainBeamline.massWorld)
356 {BDS::Warning(
"Total sum of all element angles is approximately 2*pi but the circular option was not specified, this simulation may run indefinitely");}
365 for (
const auto& placement : placements)
367 if (placement.sequence.empty())
382 G4String beamlineName = placement.name +
"_" + placement.sequence;
397 if (sType == BDSSamplerType::none)
406 const G4String& name,
407 const G4Transform3D& initialTransform,
409 G4bool beamlineIsCircular,
410 G4bool isPlacementBeamline)
412 if (beamLine.
empty())
415 if (userComponentFactory)
420 if (beamlineIsCircular)
425 G4cerr <<
"The first element in the beam line is unsuitable for a circular "
426 <<
"model as the first element will " << G4endl <<
"overlap with the "
427 <<
"teleporter and terminator - the necessary mechanics for a circular "
428 <<
"model in Geant4" << G4endl;
429 throw BDSException(__METHOD_NAME__,
"check construction for circular machine");
433 if (beamLine.
size() <= 1)
434 {
throw BDSException(__METHOD_NAME__,
"BDSIM requires the sequence defined with the use command to have at least one element.");}
436 for (
auto elementIt = beamLine.
begin(); elementIt != beamLine.
end(); ++elementIt)
440 auto prevIt = elementIt;
441 while (prevIt != beamLine.
begin())
446 prevElement = &(*prevIt);
452 auto nextIt = elementIt;
454 G4double nextElementInputFace = 0;
455 while (nextIt != beamLine.
end())
459 nextElement = &(*nextIt);
461 nextElementInputFace = nextElement->
e1;
473 G4bool forceNoSamplerOnThisElement =
false;
475 {forceNoSamplerOnThisElement =
true;}
477 {forceNoSamplerOnThisElement =
true;}
479 {forceNoSamplerOnThisElement =
true;}
489 if (beamlineIsCircular && !massWorld->
empty())
492 G4cout << __METHOD_NAME__ <<
"Circular machine - creating terminator & teleporter" << G4endl;
494 G4double teleporterLength = 0;
497 auto hasBeamPipeInfo = [](
BDSBeamlineElement* ble) {
return ble->GetBeamPipeInfo() !=
nullptr;};
498 auto firstElementWithBPInfo = std::find_if(massWorld->
begin(), massWorld->
end(), hasBeamPipeInfo);
499 auto lastElementWithBPInfo = std::find_if(massWorld->
rbegin(), massWorld->
rend(), hasBeamPipeInfo);
501 G4double firstbeamPipeMaxExtent = (*firstElementWithBPInfo)->GetBeamPipeInfo()->Extent().MaximumAbsTransverse();
502 G4double lastbeamPipeMaxExtent = (*lastElementWithBPInfo)->GetBeamPipeInfo()->Extent().MaximumAbsTransverse();
505 G4double teleporterHorizontalWidth = 2 * std::max(firstbeamPipeMaxExtent, lastbeamPipeMaxExtent);
515 teleporterHorizontalWidth,
516 teleporterTransform);
527 if (isPlacementBeamline)
530 survey->
Write(massWorld);
533 delete theComponentFactory;
536 G4cout << __METHOD_NAME__ <<
"\"" << name <<
"\" " << G4endl << *massWorld;
547 beamlineSet.massWorld = massWorld;
548 beamlineSet.curvilinearWorld = clBeamline;
549 beamlineSet.curvilinearBridgeWorld = clBridgeBeamline;
550 beamlineSet.endPieces = endPieces;
571 std::vector<BDSExtentGlobal> extents;
588 const auto& extras = BDSAcceleratorModel::Instance()->
ExtraBeamlines();
590 for (
const auto& bl : extras)
591 {bl.second.GetExtentGlobals(extents);}
600 G4ThreeVector worldR;
602 for (
const auto& ext : extents)
604 for (G4int i = 0; i < 3; i++)
605 {worldR[i] = std::max(worldR[i], ext.GetMaximumExtentAbsolute()[i]);}
608 G4String worldName =
"World";
609 G4VSolid* worldSolid =
nullptr;
610 G4LogicalVolume* worldLV =
nullptr;
612 G4String worldGeometryFile = globals->WorldGeometryFile();
613 if (!worldGeometryFile.empty())
615 if (globals->WorldMaterialSet())
616 {BDS::Warning(__METHOD_NAME__,
"conflicting options - world material option specified but material will be taken from world GDML file");}
617 G4bool ac = globals->AutoColourWorldGeometryFile();
619 std::vector<G4String> namedWorldVacuumVolumes =
BDS::SplitOnWhiteSpace(globals->WorldVacuumVolumeNames());
626 &namedWorldVacuumVolumes,
628 BDSSDType::energydepworldcontents,
629 BDSSDType::energydepvacuum);
635 for (
auto volume : worldVacuumLogicalVolumes)
636 {allWorldVolumes.erase(volume);}
641 G4bool worldContainsAllBeamlines = worldExtentGlobal.
Encompasses(extents);
643 G4cout <<
"External world geometry: \"" << worldGeometryFile <<
"\"" << G4endl;
644 G4cout <<
"Loaded world extent: \n" <<
worldExtent << G4endl;
647 if (!worldContainsAllBeamlines)
649 G4String message =
"Beamlines cannot be constructed, beamline extents are larger than \n";
650 message +=
"the extents of the external world";
660 if (globals->StoreELossWorld()
661 || globals->StoreELossWorldIntegral()
663 || globals->StoreELossWorldContents()
664 || globals->StoreELossWorldContentsIntegral())
668 worldLV->SetSensitiveDetector(BDSSDManager::Instance()->WorldComplete());
674 G4double margin = globals->WorldVolumeMargin();
675 margin = std::max(margin, 2*CLHEP::m);
676 worldR += G4ThreeVector(margin,margin,margin);
678 G4cout << __METHOD_NAME__ <<
"World dimensions: " << worldR / CLHEP::m <<
" m" << G4endl;
680 G4String worldMaterialName = globals->WorldMaterial();
683 worldSolid =
new G4Box(worldName +
"_solid", worldR.x(), worldR.y(), worldR.z());
686 worldLV =
new G4LogicalVolume(worldSolid,
692 if (globals->StoreELossWorld() || globals->StoreELossWorldIntegral())
693 {worldLV->SetSensitiveDetector(BDSSDManager::Instance()->WorldComplete());}
698 G4VisAttributes* debugWorldVis =
new G4VisAttributes(*(globals->ContainerVisAttr()));
699 debugWorldVis->SetForceWireframe(
true);
700 worldLV->SetVisAttributes(debugWorldVis);
703 worldLV->SetUserLimits(globals->DefaultUserLimits());
706 G4VPhysicalVolume* worldPV =
new G4PVPlacement(
nullptr,
729 worldLogicalVolume = worldLV;
760 const auto& extras = BDSAcceleratorModel::Instance()->
ExtraBeamlines();
761 for (
auto const& bl : extras)
770 G4VPhysicalVolume* containerPV,
771 G4bool checkOverlaps,
774 G4bool useCLPlacementTransform,
775 G4bool useIncrementalCopyNumbers,
776 G4bool registerPlacementNamesForOutput)
782 for (
auto element : *beamline)
785 if (
dynamic_cast<BDSGap*
>(element->GetAcceleratorComponent()))
790 auto accComp = element->GetAcceleratorComponent();
791 const G4String regionName = accComp->GetRegion();
792 if (!regionName.empty())
794 G4Region* region = BDSAcceleratorModel::Instance()->
Region(regionName);
795 auto contLV = accComp->GetContainerLogicalVolume();
796 contLV->SetRegion(region);
797 region->AddRootLogicalVolume(contLV);
802 element->GetAcceleratorComponent()->AttachSensitiveDetectors();
805 G4int copyNumber = useIncrementalCopyNumbers ? i : element->GetCopyNo();
806 G4String placementName = element->GetPlacementName() +
"_pv";
807 std::set<G4VPhysicalVolume*> pvs = element->PlaceElement(placementName, containerPV, useCLPlacementTransform,
814 element->GetSPositionMiddle(),
820 if (registerPlacementNamesForOutput)
830 const G4String& objectTypeForErrorMsg)
832 G4Transform3D result;
840 G4RotationMatrix rm = G4RotationMatrix();
843 G4ThreeVector axis = G4ThreeVector(placement.
axisX,
846 rm = G4RotationMatrix(axis, placement.
angle*CLHEP::rad);
854 CLHEP::HepEulerAngles ang = CLHEP::HepEulerAngles(placement.
phi*CLHEP::rad,
855 placement.
theta*CLHEP::rad,
856 placement.
psi*CLHEP::rad);
857 rm = G4RotationMatrix(ang);
867 {
throw BDSException(__METHOD_NAME__,
"no valid beam line yet for " + objectTypeForErrorMsg +
" w.r.t. a beam line.");}
872 G4cerr << __METHOD_NAME__ <<
"No element named \"" << placement.
referenceElement <<
"\" (instance #"
874 << placement.
name <<
"\"" << G4endl;
875 G4cout <<
"Note, this may be because the element is a bend and split into " << G4endl;
876 G4cout <<
"multiple sections with unique names. Run the visualiser to get " << G4endl;
877 G4cout <<
"the name of the segment, or place w.r.t. the element before / after." << G4endl;
878 throw BDSException(
"Error in "+objectTypeForErrorMsg+
".");
883 G4String message = objectTypeForErrorMsg +
" \"" + placement.
name +
"\" is placed using";
884 message +=
" a referenceElement but the z offset is\n non zero. Note, s should be used to";
885 message +=
" offset the placement in this case and z will\n have no effect.";
886 BDS::Warning(message);
889 sCoordinate += placement.
s * CLHEP::m;
893 G4ThreeVector offset = G4ThreeVector();
898 placement.
x * CLHEP::m + offset.x(),
899 placement.
y * CLHEP::m + offset.y());
900 G4Transform3D localRotation(rm, G4ThreeVector());
901 result = beamlinePart * localRotation;
906 {
throw BDSException(__METHOD_NAME__,
"no valid beam line yet placement w.r.t. a beam line.");}
907 G4ThreeVector offset = G4ThreeVector();
912 placement.
x * CLHEP::m + offset.x(),
913 placement.
y * CLHEP::m + offset.y());
915 G4Transform3D localRotation(rm, G4ThreeVector());
916 result = beamlinePart * localRotation;
918 {*S = placement.
s*CLHEP::m;}
922 G4ThreeVector translation = G4ThreeVector(placement.
x*CLHEP::m,
923 placement.
y*CLHEP::m,
924 placement.
z*CLHEP::m);
927 result = G4Transform3D(rm, translation);
975 G4ThreeVector result = G4ThreeVector();
976 G4String side = G4String(placement.
side);
981 G4double pathLength = placement.
s*CLHEP::m;
982 std::pair<G4double, G4double> extentZ = placementExtent.
ExtentZ();
983 G4double sLow = pathLength + extentZ.first;
984 G4double sHigh = pathLength + extentZ.second;
988 if (end != beamLine->
end())
994 for (
auto iter = start; iter != end; ++iter)
1005 result.setY(sectionMaxExtent.
YPos() + placementExtent.
YPos() + ls);
1006 G4double xOffset = sectionMaxExtent.
XPos() - 0.5*sectionMaxExtent.
DX();
1007 result.setX(xOffset);
1009 else if (side ==
"bottom")
1011 result.setY(sectionMaxExtent.
YNeg() + placementExtent.
YNeg() - ls);
1012 G4double xOffset = sectionMaxExtent.
XPos() - 0.5*sectionMaxExtent.
DX();
1013 result.setX(xOffset);
1015 else if (side ==
"left")
1016 {result.setX(sectionMaxExtent.
XPos() + placementExtent.
XPos() + ls);}
1017 else if (side ==
"right")
1018 {result.setX(sectionMaxExtent.
XNeg() + placementExtent.
XNeg() - ls);}
1019 else if (side !=
"")
1020 {
throw BDSException(std::string(
"Unknown side in placement: " + side));}
1027 if (sp.apertureModel.empty())
1032 sp.aper1 * CLHEP::m,
1033 sp.aper2 * CLHEP::m,
1034 sp.aper3 * CLHEP::m,
1035 sp.aper4 * CLHEP::m,
1037 apertureExtent = aperture.
Extent();
1040 {apertureExtent =
BDSExtent(sp.aper1*CLHEP::m, sp.aper1*CLHEP::m, sp.aper2*CLHEP::m);}
1042 {apertureExtent =
BDSExtent(sp.aper1*CLHEP::m, sp.aper1*CLHEP::m, sp.aper1*CLHEP::m);}
1049 apertureExtent = aperture->
Extent();
1054 apertureExtent.
YNeg(), apertureExtent.
YPos(),
1055 1*CLHEP::um, 1*CLHEP::um);
1063 for (
const auto& samplerPlacement : samplerPlacements)
1076 return recipe.Extent();
1083 for (
const auto& mesh : scorerMeshes)
1093#if G4VERSION_NUMBER > 1009
1096 const std::list<std::string>& defaultBias,
1097 const G4String& elementName)
1100 if (biasList.empty() && defaultBias.empty())
1103 std::list<std::string> biasesAll = biasList.empty() ? defaultBias : biasList;
1106 std::set<std::string> biasNamesSorted = {biasesAll.begin(), biasesAll.end()};
1107 G4String biasSetKey;
1108 G4String biasSetPrintOut;
1109 for (
const auto& n : biasNamesSorted)
1111 biasSetKey += n +
"_";
1112 biasSetPrintOut += n +
" ";
1114 biasSetKey =
BDS::StrStrip(biasSetKey,
'_', BDS::StringStripType::trailing);
1116 auto exists = biasSetObjects.find(biasSetKey);
1117 if (exists != biasSetObjects.end())
1118 {
return exists->second;}
1121 G4cout <<
"Bias> Creating unique set of bias objects ( " << biasSetPrintOut <<
")" << G4endl;
1125 for (std::string
const & bs : biasesAll)
1127 auto result = biasObjectList.
find(bs);
1128 if (result == biasObjectList.end())
1129 {
throw BDSException(
"Error: bias named \"" + bs +
"\" not found for element named \"" + elementName +
"\"");}
1133 {G4cout << __METHOD_NAME__ <<
"bias loop : " << bs <<
" " << pb.
particle <<
" " << pb.
process << G4endl;}
1138 if (pb.
flag.size() != pb.processList.size())
1139 {
throw BDSException(__METHOD_NAME__,
"number of flag entries in \"" + pb.
name +
"\" doesn't match number of processes");}
1140 if (pb.
factor.size() != pb.processList.size())
1141 {
throw BDSException(__METHOD_NAME__,
"number of factor entries in \"" + pb.
name +
"\" doesn't match number of processes");}
1142 for (
unsigned int p = 0; p < pb.processList.size(); ++p)
1147 biasSetObjects[biasSetKey] = eg;
1154#if G4VERSION_NUMBER > 1009
1157 {G4cout << __METHOD_NAME__ <<
"registry=" << registry << G4endl;}
1159#if G4VERSION_NUMBER > 1039
1162 std::set<G4LogicalVolume*>* crystals = BDSAcceleratorModel::Instance()->
VolumeSet(
"crystals");
1163 if (!crystals->empty())
1165 G4cout << __METHOD_NAME__ <<
"Using crystal biasing: true" << G4endl;
1166 auto crystalBiasing =
new G4ChannelingOptrMultiParticleChangeCrossSection();
1167 for (
auto crystal : *crystals)
1168 {crystalBiasing->AttachTo(crystal);}
1173 for (
auto blm : blmSet)
1175 G4String biasNamesS = blm->Bias();
1176 if (biasNamesS.empty())
1179 std::list<std::string> biasNames = {biasNamesV.begin(), biasNamesV.end()};
1180 std::list<std::string> emptyDefaultBias;
1182 for (
auto lv : blm->GetAllLogicalVolumes())
1183 {biasForBLM->AttachTo(lv);}
1184 biasForBLM->AttachTo(blm->GetContainerLogicalVolume());
1190 auto defaultBiasVacuumList = std::list<std::string>(defaultBiasVacuumVector.begin(), defaultBiasVacuumVector.end());
1193 auto defaultBiasMaterialList = std::list<std::string>(defaultBiasMaterialVector.begin(), defaultBiasMaterialVector.end());
1194 G4String biasForWorldVolume = g->BiasForWorldVolume();
1196 auto biasForWorldVolumeList = std::list<std::string>(biasForWorldVolumeVector.begin(), biasForWorldVolumeVector.end());
1197 G4String biasForWorldContents = g->BiasForWorldContents();
1199 auto biasForWorldContentsList = std::list<std::string>(biasForWorldContentsVector.begin(), biasForWorldContentsVector.end());
1200 G4String biasForWorldVacuum = g->BiasForWorldVacuum();
1202 auto biasForWorldVacuumList = std::list<std::string>(biasForWorldVacuumVector.begin(), biasForWorldVacuumVector.end());
1204 G4bool useDefaultBiasVacuum = !defaultBiasVacuum.empty();
1205 G4bool useDefaultBiasMaterial = !defaultBiasMaterial.empty();
1207 G4bool useBiasForWorldVolume = !biasForWorldVolume.
empty();
1208 G4bool useBiasForWorldContents = !biasForWorldContents.empty();
1209 G4bool useBiasForWorldVacuum = !biasForWorldVacuum.empty();
1210 G4bool biasesDefined = !biasObjectList.empty();
1212 G4bool overallUseBiasing = useDefaultBiasVacuum || useDefaultBiasMaterial || biasesDefined || useBiasForWorldVolume || useBiasForWorldContents;
1213 G4cout << __METHOD_NAME__ <<
"Using generic biasing: " << BDS::BoolToString(overallUseBiasing) << G4endl;
1214 if (!overallUseBiasing)
1219 for (
auto const & item : allAcceleratorComponents)
1222 {G4cout << __METHOD_NAME__ <<
"checking component named: " << item.first << G4endl;}
1227 G4String accName = accCom->
GetName();
1232 if (!vacuumBiasList.empty() && vacuumLVs.empty())
1233 {BDS::Warning(
"biasVacuum set for component \"" + accName +
"\" but there's no 'vacuum' volume for it and it can't be biased.\nRemove biasVacuum or name it with the namedVacuumVolumes parameter.");}
1234 if ((!vacuumBiasList.empty() || useDefaultBiasVacuum) && !vacuumLVs.empty())
1237 for (
auto lv : vacuumLVs)
1240 {G4cout << __METHOD_NAME__ <<
"vacuum volume name: " << lv <<
" " << lv->GetName() << G4endl;}
1241 egVacuum->AttachTo(lv);
1247 if (!materialBiasList.empty() || useDefaultBiasMaterial)
1252 {G4cout << __METHOD_NAME__ <<
"# of logical volumes for biasing under 'material': " << allLVs.size() << G4endl;}
1253 for (
auto lv : allLVs)
1256 {G4cout << __METHOD_NAME__ <<
"Biasing 'material' logical volume: " << lv <<
" " << lv->GetName() << G4endl;}
1257 egMaterial->AttachTo(lv);
1262 if (useBiasForWorldContents)
1264 std::list<std::string> emptyList;
1267 {egWC->AttachTo(lv);}
1269 if (useBiasForWorldVolume)
1271 std::list<std::string> emptyList;
1273 egWV->AttachTo(worldLogicalVolume);
1275 if (useBiasForWorldVacuum)
1277 std::list<std::string> emptyList;
1279 for (
auto lv : worldVacuumLogicalVolumes)
1280 {egWVac->AttachTo(lv);}
1296 while ((*element).type == GMAD::ElementType::_LINE)
1299 if ((*element).type == GMAD::ElementType::_RBEND)
1315 if (scoringMeshes.empty())
1318 G4ScoringManager* scManager = G4ScoringManager::GetScoringManager();
1319 scManager->SetVerboseLevel(1);
1322 std::map<G4String, BDSScorerInfo> scorerRecipes;
1323 for (
const auto& scorer : scorers)
1326 scorerRecipes.insert(std::make_pair(si.
name, si));
1331 for (
const auto& mesh : scoringMeshes)
1337 G4String meshName = meshRecipe.name;
1347 G4String geometryType =
BDS::LowerCase(G4String(mesh.geometryType));
1349 if (geometryType ==
"box")
1352 mapper = scorerBox->Mapper();
1354 else if (geometryType ==
"cylindrical")
1357 mapper = scorerCylindrical->Mapper();
1361 G4String msg =
"mesh geometry type \"" + geometryType +
"\" is not correct. The possible options are \"box\" and \"cylindrical\"";
1366 std::vector<G4String> meshPrimitiveScorerNames;
1367 std::vector<G4double> meshPrimitiveScorerUnits;
1368 std::vector<G4String> scorerNames;
1371 for (
const auto& word : words)
1373 auto search = scorerRecipes.find(word);
1374 if (search == scorerRecipes.end())
1375 {
throw BDSException(__METHOD_NAME__,
"scorerQuantity \"" + word +
"\" for mesh \"" + meshName +
"\" not found.");}
1377 G4double psUnit = 1.0;
1378 G4VPrimitiveScorer* ps = scorerFactory.
CreateScorer(&(search->second), mapper, &psUnit, worldLV);
1383 G4String uniqueName = meshName +
"/" + ps->GetName();
1384 meshPrimitiveScorerNames.push_back(uniqueName);
1385 meshPrimitiveScorerUnits.push_back(psUnit);
1388 if (geometryType ==
"box")
1389 {scorerBox->SetPrimitiveScorer(ps);}
1390 else if (geometryType ==
"cylindrical")
1391 {scorerCylindrical->SetPrimitiveScorer(ps);}
1398 if (geometryType ==
"box")
1399 {scManager->RegisterScoringMesh(scorerBox);}
1400 else if (geometryType ==
"cylindrical")
1401 {scManager->RegisterScoringMesh(scorerCylindrical);}
1412 std::vector<BDSFieldQueryInfo*> result;
1414 for (
const auto& def : parserQueries)
1416 if (!def.queryMagneticField && !def.queryElectricField)
1417 {
throw BDSException(__METHOD_NAME__,
"neither \"queryMagneticField\" nor \"queryElectricField\" are true (=1) - one must be turned on.");}
1419 if (!def.pointsFile.empty())
1421 std::vector<G4String> columnNames;
1424 G4String(def.outfileMagnetic),
1425 G4String(def.outfileElectric),
1426 G4bool(def.queryMagneticField),
1427 G4bool(def.queryElectricField),
1430 G4bool(def.overwriteExistingFiles),
1431 G4String(def.fieldObject),
1432 def.checkParameters,
1434 def.drawZeroValuePoints,
1441 auto rot = globalTransform3D.getRotation();
1442 rot = rot.inverse();
1443 G4AffineTransform globalTransform(rot, globalTransform3D.getTranslation());
1446 G4String(def.outfileMagnetic),
1447 G4String(def.outfileElectric),
1448 G4bool(def.queryMagneticField),
1449 G4bool(def.queryElectricField),
1450 {def.nx, def.xmin*CLHEP::m, def.xmax*CLHEP::m},
1451 {def.ny, def.ymin*CLHEP::m, def.ymax*CLHEP::m},
1452 {def.nz, def.zmin*CLHEP::m, def.zmax*CLHEP::m},
1453 {def.nt, def.tmin*CLHEP::ns, def.tmax*CLHEP::ns},
1455 G4bool(def.overwriteExistingFiles),
1456 G4String(def.fieldObject),
1457 G4bool(def.printTransform),
1458 def.checkParameters,
1460 def.drawZeroValuePoints,
1468#ifdef BDSCHECKUSERLIMITS
1469void BDSDetectorConstruction::PrintUserLimitsSummary(
const G4VPhysicalVolume* world)
const
1471 G4cout <<
"USERLIMITS START" << G4endl;
1473 PrintUserLimitsPV(world, globalMinEK);
1474 G4cout <<
"USERLIMITS END" << G4endl;
1477void BDSDetectorConstruction::PrintUserLimitsPV(
const G4VPhysicalVolume* aPV, G4double globalMinEK)
const
1479 const auto lv = aPV->GetLogicalVolume();
1480 const auto ul = lv->GetUserLimits();
1484 G4double ekUL = ul->GetUserMinEkine(dummyTrack);
1486 if (ekUL < globalMinEK)
1487 {G4cout << lv->GetName() <<
" Ek Min: " << ekUL <<
" MeV < global: " << globalMinEK <<
" MeV" << G4endl;}
1490 {G4cout << lv->GetName() <<
" no G4UserLimits" << G4endl;}
1491 for (G4int i = 0; i < (G4int)lv->GetNoDaughters(); i++)
1492 {PrintUserLimitsPV(lv->GetDaughter(i), globalMinEK);}
1498 if (!worldLogicalVolume)
1500 G4cout <<
"\nSensitivity Summary:\n" << G4endl;
1502 G4cout <<
"\n\n" << G4endl;
1507 for (G4int i = 0; i < currentDepth; i++)
1509 G4cout << lv->GetName() <<
" ";
1510 auto sensitiveDetector = lv->GetSensitiveDetector();
1511 if (sensitiveDetector)
1512 {G4cout << sensitiveDetector->GetName();}
1517 for (std::size_t i = 0; i < lv->GetNoDaughters(); i++)
A registry of constructed BDSAcceleratorComponent instances that can be searched.
static BDSAcceleratorComponentRegistry * Instance()
Singleton accessor.
std::map< G4String, BDSAcceleratorComponent * > AllComponentsIncludingUnique() const
void PrintNumberOfEachType() const
Print out the number of each type of component registered.
size_t size() const
Size of registry.
Abstract class that represents a component of an accelerator.
virtual void Initialise()
virtual G4String GetName() const
The name of the component without modification.
virtual std::set< G4LogicalVolume * > GetAcceleratorVacuumLogicalVolumes() const
Access the 'vacuum' volume(s) in this component if any. Default is empty set.
virtual std::set< G4LogicalVolume * > GetAcceleratorMaterialLogicalVolumes() const
Return a set of logical volumes excluding the ones in the 'vacuum' set.
std::list< std::string > GetBiasVacuumList() const
Access the bias list copied from parser.
G4String GetType() const
Get a string describing the type of the component.
std::list< std::string > GetBiasMaterialList() const
Access the bias list copied from parser.
void RegisterFields(std::vector< BDSFieldObjects * > &fieldsIn)
Register all field objects.
void RegisterBeamlineSetExtra(const G4String &name, const BDSBeamlineSet &setIn)
Register a set of beam lines to be managed and cleared up at the end of the simulation.
void RegisterWorldLV(G4LogicalVolume *worldIn)
Register constituent of world.
std::set< G4LogicalVolume * > * VolumeSet(const G4String &name)
Returns pointer to a set of logical volumes. If no set by that name exits, create it.
BDSApertureInfo * Aperture(G4String name) const
const std::map< G4String, BDSBeamlineSet > & ExtraBeamlines() const
Accessor.
BDSBeamline * TunnelBeamline() const
Access the beam line containing all the tunnel segments.
void RegisterApertures(const std::map< G4String, BDSApertureInfo * > &aperturesIn)
Register a map of apertures with associated names.
void RegisterScorerPlacement(const G4String &meshName, const G4Transform3D &placement)
Register a copy of the scorer placement so it can be used in the output.
const BDSBeamlineSet & BeamlineSetMain() const
Accessor.
const BDSBeamline * BeamlineMain() const
Accessor.
void RegisterTunnelBeamline(BDSBeamline *beamlineIn)
Register the beam line containing all the tunnel segments.
BDSBeamline * PlacementBeamline() const
Access the beam line of arbitrary placements.
void RegisterWorldPV(G4VPhysicalVolume *worldIn)
Register constituent of world.
void RegisterPlacementBeamline(BDSBeamline *placementBLIn)
Register the beam line of arbitrary placements.
void RegisterBeamlineSetMain(const BDSBeamlineSet &setIn)
Register the main beam line set.
void RegisterScorerHistogramDefinition(const BDSScorerHistogramDef &def)
G4LogicalVolume * WorldLV() const
Access the logical volume of the world.
void RegisterBLMs(BDSBeamline *blmsIn)
Register a beam line of blm placements.
G4Region * Region(const G4String &name) const
Access region information. Will exit if not found.
void RegisterWorldSolid(G4VSolid *worldIn)
Register constituent of world.
void RegisterRegion(BDSRegion *region)
Register a region.
Holder class for all information required to describe an aperture.
static void AttachWorldVolumeToNavigator(G4VPhysicalVolume *worldPVIn)
Setup the navigator w.r.t. to a world volume - typically real world.
static BDSBLMRegistry * Instance()
Accessor for registry.
Multi-particle cross-section changer.
A class that holds a fully constructed BDSAcceleratorComponent as well as any information relevant to...
G4double GetSPositionEnd() const
Accessor.
G4double GetSPositionMiddle() const
Accessor.
Simple struct to return a beamline plus associated beam lines.
void GetExtentGlobals(std::vector< BDSExtentGlobal > &extents) const
Append global extents of all beamlines to supplied vector.
A vector of BDSBeamlineElement instances - a beamline.
const BDSBeamlineElement * GetElement(G4String acceleratorComponentName, G4int i=0) const
Get the ith placement of an element in the beam line. Returns null pointer if not found.
BDSBeamlineElement * back() const
Return a reference to the last element.
G4bool ElementAnglesSumToCircle() const
Check if the sum of the angle of all elements is two pi.
reverse_iterator rend()
Iterator mechanics.
const_iterator FindFromS(G4double S) const
Returns an iterator to the beamline element at s.
G4bool empty() const
Iterator mechanics.
G4Transform3D GetGlobalEuclideanTransform(G4double s, G4double x=0, G4double y=0, G4int *indexOfFoundElement=nullptr) const
BDSExtentGlobal GetExtentGlobal() const
Get the global extents for this beamline.
reverse_iterator rbegin()
Iterator mechanics.
iterator begin()
Iterator mechanics.
void AddComponent(BDSAcceleratorComponent *component, BDSTiltOffset *tiltOffset=nullptr, BDSSamplerInfo *samplerInfo=nullptr)
iterator end()
Iterator mechanics.
G4double GetTotalArcLength() const
Get the total ARC length for the beamline - ie the maximum s position.
Factory for user specified accelerator components.
void SetDesignParticle(const BDSParticleDefinition *designParticleIn)
Update values for nominal rigidity and relativisitic beta of the beam particle.
Factory to produce all types of BDSAcceleratorComponents.
BDSAcceleratorComponent * CreateTeleporter(const G4double teleporterLength, const G4double teleporterWidth, const G4Transform3D &transformIn)
BDSAcceleratorComponent * CreateTerminator(G4double witdth)
BDSAcceleratorComponent * CreateComponent(GMAD::Element const *elementIn, GMAD::Element const *prevElementIn, GMAD::Element const *nextElementIn, G4double currentArcLengthIn=0)
static BDSTiltOffset * CreateTiltOffset(GMAD::Element const *el)
Create the tilt and offset information object by inspecting the parser element.
Factory for simple parallel geometry for curvilinear coordinates.
BDSBeamline * BuildCurvilinearBeamLine1To1(BDSBeamline const *const beamline, const G4bool circular)
Build a beam line of curvilinear geometry based on another beam line.
BDSBeamline * BuildCurvilinearBridgeBeamLine(BDSBeamline const *const beamline)
Build bridging volumes to join the curvilinear ones.
G4bool circular
Whether or not we're building a circular machine.
BDSBeamlineSet BuildBeamline(const GMAD::FastList< GMAD::Element > &beamLine, const G4String &name, const G4Transform3D &initialTransform=G4Transform3D(), G4double initialS=0.0, G4bool beamlineIsCircular=false, G4bool isPlacementBeamline=false)
void UpdateSamplerDiameterAndCountSamplers()
BDSBOptrMultiParticleChangeCrossSection * BuildCrossSectionBias(const std::list< std::string > &biasList, const std::list< std::string > &defaultBias, const G4String &elementName)
Function that creates physics biasing cross section.
void InitialiseRegions()
Create and set parameters for various G4Regions.
std::vector< BDSBOptrMultiParticleChangeCrossSection * > biasObjects
List of bias objects - for memory management.
BDSExtent CalculateExtentOfScorerMesh(const GMAD::ScorerMesh &sm) const
Calculate local extent of scorer mesh in 3D.
BDSAcceleratorModel * acceleratorModel
Accelerator model pointer.
static G4ThreeVector SideToLocalOffset(const GMAD::Placement &placement, const BDSBeamline *beamLine, const BDSExtent &placementExtent)
Attach component with extent2 to component with extent1 with placement.
G4bool verbose
Variable copied from global constants.
BDSBeamline * placementBL
static std::vector< BDSFieldQueryInfo * > PrepareFieldQueries(const BDSBeamline *mainBeamline)
Prepare field queries from parser information.
G4VPhysicalVolume * BuildWorld()
void VerboseSensitivity() const
Print out the sensitivity of every single volume so far constructed in the world.
void InitialiseApertures()
Create all aperture definitions from parser and store in BDSAcceleratorModel.
void CountPlacementFields()
Count number of fields required for placements.
G4bool canSampleAngledFaces
Whether the integrator set permits sampling elements with angled faces.
BDSExtent worldExtent
Record of the world extent.
std::set< G4LogicalVolume * > worldContentsLogicalVolumes
Cache of possibly loaded logical volumes from a world geometry file - used for biasing.
static BDSSamplerInfo * BuildSamplerInfo(const GMAD::Element *element)
BDSExtent CalculateExtentOfSamplerPlacement(const GMAD::SamplerPlacement &sp) const
Calculate local extent of custom user sampler.
void ConstructScoringMeshes()
Construct scoring meshes.
BDSExtentGlobal CalculateExtentOfScorerMeshes(const BDSBeamline *bl) const
G4bool checkOverlaps
Variable copied from global constants.
G4int nSamplers
Count of number of samplers to be built.
void ComponentPlacement(G4VPhysicalVolume *worldPV)
Place beam line, tunnel beam line, end pieces and placements in world.
void BuildBeamlines()
Build the main beam line and then any other required beam lines.
const BDSParticleDefinition * designParticle
Particle definition all components are built w.r.t. Includes rigidity etc.
void BuildTunnel()
Build the tunnel around the already constructed flat beam line.
virtual void ConstructSDandField()
Construct sensitive detectors and fields.
void PrintSensitiveDetectorsOfLV(const G4LogicalVolume *lv, G4int currentDepth) const
Recursive function to print out each sensitive detector name.
void PrepareExtraSamplerSDs()
static void PlaceBeamlineInWorld(BDSBeamline *beamline, G4VPhysicalVolume *containerPV, G4bool checkOverlaps=false, G4bool setRegions=false, G4bool registerInfo=false, G4bool useCLPlacementTransform=false, G4bool useIncrementalCopyNumbers=false, G4bool registerPlacementNamesForOutput=false)
virtual G4VPhysicalVolume * Construct()
static G4Transform3D CreatePlacementTransform(const GMAD::Placement &placement, const BDSBeamline *beamLine, G4double *S=nullptr, BDSExtent *placementExtent=nullptr, const G4String &objectTypeForErrorMsg="placement")
G4bool UnsuitableFirstElement(std::list< GMAD::Element >::const_iterator element)
BDSExtentGlobal CalculateExtentOfSamplerPlacements(const BDSBeamline *beamLine) const
General exception with possible name of object and message.
Holder for +- extents in 3 dimensions with a rotation and translation.
BDSExtentGlobal ExpandToEncompass(const BDSExtentGlobal &other) const
Return a copy of this extent but expanded to encompass another global extent.
G4bool Encompasses(const BDSExtentGlobal &otherExtent)
Return whether the extent encompasses another extent.
Holder for +- extents in 3 dimensions.
G4double XPos() const
Accessor.
G4double XNeg() const
Accessor.
G4double YNeg() const
Accessor.
std::pair< G4double, G4double > ExtentZ() const
Accessor.
G4double DX() const
The difference in a dimension.
G4double YPos() const
Accessor.
static BDSFieldBuilder * Instance()
Singleton pattern accessor.
Holder class for all information required for a field query.
static void AttachWorldVolumeToNavigator(G4VPhysicalVolume *worldPVIn)
Setup the navigator w.r.t. to a world volume.
Gap in accelerator beamline.
G4LogicalVolume * GetContainerLogicalVolume() const
Accessor - see member for more info.
BDSExtent GetExtent() const
Accessor - see member for more info.
virtual void AttachSensitiveDetectors()
Attach a sensitive detector class to all registered sensitive volumes in this component.
virtual std::set< G4LogicalVolume * > GetAllLogicalVolumes() const
Access all logical volumes belonging to this component.
G4VSolid * GetContainerSolid() const
Accessor - see member for more info.
A loaded piece of externally provided geometry.
const std::set< G4LogicalVolume * > & VacuumVolumes() const
Access the vacuum volumes.
BDSGeometryExternal * BuildGeometry(G4String componentName, const G4String &formatAndFilePath, std::map< G4String, G4Colour * > *colourMapping=nullptr, G4bool autoColour=true, G4double suggestedLength=0, G4double suggestedHorizontalWidth=0, std::vector< G4String > *namedVacuumVolumes=nullptr, G4bool makeSensitive=true, BDSSDType sensitivityType=BDSSDType::energydep, BDSSDType vacuumSensitivityType=BDSSDType::energydepvacuum, G4bool stripOuterVolumeAndMakeAssembly=false, G4UserLimits *userLimitsToAttachToAllLVs=nullptr, G4bool dontReloadGeometry=false)
static BDSGeometryFactory * Instance()
Singleton accessor.
A class that holds global options and constants.
void SetCurvilinearDiameterShrunkForBends()
Setter.
static BDSGlobalConstants * Instance()
Access method.
void SetCurvilinearDiameter(G4double curvilinearDiameterIn)
Setter.
void SetSamplerDiameter(G4double samplerDiameterIn)
Setter.
G4bool UseImportanceSampling() const
Is importance sampling being used.
Mapping from axis indices to 1D index.
A class that hold multiple accelerator components.
static BDSMaterials * Instance()
Singleton pattern access.
G4Material * GetMaterial(G4String material) const
Get material by name.
const GMAD::FastList< GMAD::Element > & GetSequence(const std::string &name)
Return sequence.
std::vector< GMAD::Scorer > GetScorers() const
Return the parser list of that object.
static BDSParser * Instance()
Access method.
const GMAD::Options & GetOptions() const
Return options.
std::vector< GMAD::Query > GetQuery() const
Return the parser list of that object.
std::vector< GMAD::SamplerPlacement > GetSamplerPlacements() const
Return the parser list of that object.
const GMAD::FastList< GMAD::PhysicsBiasing > & GetBiasing() const
Return biasing list.
std::vector< GMAD::ScorerMesh > GetScorerMesh() const
Return the parser list of that object.
std::vector< GMAD::Placement > GetPlacements() const
Return the parser list of that object.
void RegisterPVsForOutput(const BDSBeamlineElement *element, const std::set< G4VPhysicalVolume * > &physicalVolumes)
void RegisterExcludedPV(G4VPhysicalVolume *physicalVolume)
void RegisterInfo(G4VPhysicalVolume *physicalVolume, BDSPhysicalVolumeInfo *info, G4bool isReadOutVolume=false, G4bool isTunnel=false)
static BDSPhysicalVolumeInfoRegistry * Instance()
Singleton accessor.
A class holding any information pertaining to a particular physical volume in a BDSIM geant4 model.
Range cuts for a region. Help with defaults.
void ConstructSamplerSDsForParticleSets(const std::map< int, std::set< int > > &samplerFilterIDtoPDGSetIn)
void RegisterPrimitiveScorerNames(const std::vector< G4String > &namesIn, const std::vector< G4double > *units=nullptr)
Loop over a vector and apply above single name function.
All info required to build a sampler but not place it.
Create primitive scorers on demand.
G4VPrimitiveScorer * CreateScorer(const BDSScorerInfo *info, const BDSHistBinMapper *mapper, G4double *unit=nullptr, G4LogicalVolume *worldLV=nullptr)
Main function to create a scorer.
Definition for a scorer histogram.
Recipe class for scorer. Checks values.
G4String name
Scorer name.
Recipe class for a scoring mesh.
Wrapper for G4ScoringBox to allow full access to placement.
Wrapper for G4ScoringCylinder to allow full access to placement.
A class of functions to output Geant4/Mokka/BDSIM parameters for the beamline.
void Write(BDSBeamlineElement *beamlineElement)
write line
A holder for any placement offsets and rotations for a BDSAcceleratorComponent.
static G4double dEThresholdForScattering
A class that constructs tunnel segments around a beamline.
BDSBeamline * BuildTunnelSections(const BDSBeamline *flatBeamLine) const
List with Efficient Lookup.
bool empty() const
Whether the list is empty.
FastListConstIterator find(std::string name, unsigned int count=1) const
int size() const
size of list
const FastList< Element > & GetBeamline() const
Physics biasing class for parser.
std::vector< double > factor
factors corresponding to process
std::vector< PhysicsBiasingType > flag
flag which particles are biased
std::string particle
particle name
std::string process
geant4 process: single string, but can have multiple processes separated with a space
Placement class for parser.
bool axisAngle
Flag to use the axis angle construction of rotation.
std::string name
Name of this placement.
std::string side
which side to attach to: top, bottom, left, right.
double theta
Euler angle for rotation.
double sideOffset
Gap between side and component.
double psi
Euler angle for rotation.
double s
Curvilinear s position to place w.r.t..
int referenceElementNumber
Index of repetition of element if there are multiple uses.
double phi
Euler angle for rotation.
std::string referenceElement
Name of reference element w.r.t. to place to.
Query structure class for parser.
Sampler placement class for parser.
std::string name
Name of this samplerplacement.
std::string samplerType
Plane, Cylinder, Sphere.
ScorerMesh class for parser.
BDSBeamline * BuildEndPieceBeamline(const BDSBeamline *beamline, const G4bool circularMachine)
G4Transform3D CalculateTeleporterDelta(const BDSBeamline *beamline, G4double &teleporterLength)
std::vector< BDSFourVector< G4double > > LoadFieldQueryPoints(const G4String &fileName, std::vector< G4String > *columnNamesIn)
BDSExtent MaximumCombinedExtent(const BDSExtent &first, const BDSExtent &second)
Returns the extent which is the greatest extent in all six directions.
BDSBeamline * BuildPlacementGeometry(const std::vector< GMAD::Placement > &placements, const BDSBeamline *parentBeamLine, BDSComponentFactory *componentFactory)
G4String LowerCase(const G4String &str)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
std::vector< G4String > SplitOnWhiteSpace(const G4String &input)
Split a string on whitespace and return a vector of these 'words'.
BDSBeamline * BuildBLMs(const std::vector< GMAD::BLMPlacement > &blmPlacements, const BDSBeamline *parentBeamLine)
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())
G4String StrStrip(const G4String &str, char ch, StringStripType stripType=StringStripType::both)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
std::string samplerType
element has a sampler of this type (default "none")
double e1
input pole face rotation for bends
std::string samplerName
name of sampler (default empty)