19#include "BDSAcceleratorModel.hh"
21#include "BDSException.hh"
22#include "BDSGeometryExternal.hh"
23#include "BDSGeometryFactorySQL.hh"
24#include "BDSGlobalConstants.hh"
25#include "BDSMaterials.hh"
26#include "BDSMySQLTable.hh"
27#include "BDSMySQLVariable.hh"
28#include "BDSMySQLWrapper.hh"
29#include "BDSSDSampler.hh"
30#include "BDSSampler.hh"
31#include "BDSSamplerRegistry.hh"
32#include "BDSSDManager.hh"
33#include "BDSUtilities.hh"
38#include "G4EllipticalCone.hh"
39#include "G4EllipticalTube.hh"
40#include "G4IntersectionSolid.hh"
41#include "G4LogicalVolume.hh"
42#include "G4Polycone.hh"
43#include "G4PVPlacement.hh"
44#include "G4RotationMatrix.hh"
46#include "G4SubtractionSolid.hh"
50#include "G4UnionSolid.hh"
51#include "G4UserLimits.hh"
52#include "G4Version.hh"
53#include "G4VisAttributes.hh"
54#include "G4VPhysicalVolume.hh"
64#include <unordered_map>
69BDSGeometryFactorySQL::BDSGeometryFactorySQL()
103 Parameterisation =
"";
109 ApproximationRegion = 0;
115 unShiftedExtents.clear();
117 precisionRegionSQL =
nullptr;
118 approximationRegionSQL =
nullptr;
119 rotateComponent =
nullptr;
120 itsMarkerVol =
nullptr;
122 UniformField.clear();
135 sensitiveComponents.clear();
137 alignInVolume =
nullptr;
138 alignOutVolume =
nullptr;
140 uniformFieldVolField.clear();
141 quadVolBgrad.clear();
142 sextVolBgrad.clear();
148 std::map<G4String, G4Colour*>* colourMapping,
150 G4double suggestedLength,
151 G4double suggestedHorizontalWidth,
152 std::vector<G4String>* ,
160 G4cout << __METHOD_NAME__ <<
"loading SQL file: " << fileName << G4endl;
161 G4cout << __METHOD_NAME__ <<
"containing directory: " << containingDir << G4endl;
166 {
throw BDSException(__METHOD_NAME__,
"Cannot open file \"" + fileName +
"\"");}
172 G4double outerR = suggestedHorizontalWidth*0.5;
173 G4VSolid* containerSolid =
new G4Box(
"container_solid",
176 suggestedLength*0.5);
181 itsMarkerVol =
new G4LogicalVolume(containerSolid,
186 VOL_LIST.push_back(itsMarkerVol);
187 G4String fileListLine;
189 while (ifs >> fileListLine)
192 {ifs.getline(buffer,1000);}
194 {BuildSQLObjects(containingDir + fileListLine);}
208 std::set<G4LogicalVolume*> tempVols;
209 for (
auto lv : VOL_LIST)
210 {tempVols.insert(lv);}
223void BDSGeometryFactorySQL::BuildSQLObjects(G4String file)
226 G4cout << __METHOD_NAME__ <<
"loading single file " << file << G4endl;
230 itsSQLTable=sql.ConstructTable();
232 for (G4int i=0; i<(G4int)itsSQLTable.size(); i++)
235 itsSQLTable[i]->Print();
237 TableName = itsSQLTable[i]->GetName();
239 G4cout << __METHOD_NAME__ <<
" i = " << i <<
", TableName = " << TableName << G4endl;
241 G4int pos = TableName.find(
"_");
242 std::string ObjectType = TableName.substr(pos+1,TableName.length() - pos);
243 NVariables = itsSQLTable[i]->GetVariable(0)->GetNVariables();
244 for (G4int k=0; k<NVariables; k++)
246 SetCommonParams(itsSQLTable[i], k);
247 G4LogicalVolume* logVol;
249 {logVol = BuildCone(itsSQLTable[i],k);}
251 {logVol = BuildEllipticalCone(itsSQLTable[i],k);}
253 {logVol = BuildPolyCone(itsSQLTable[i],k);}
255 {logVol = BuildBox(itsSQLTable[i],k);}
257 {logVol = BuildTrap(itsSQLTable[i],k);}
259 {logVol = BuildTorus(itsSQLTable[i],k);}
261 {logVol = BuildSampler(itsSQLTable[i],k);}
263 {logVol = BuildTube(itsSQLTable[i],k);}
265 {logVol = BuildEllipticalTube(itsSQLTable[i],k);}
269 {
throw BDSException(__METHOD_NAME__ + ObjectType +
" not known.");}
271 SetLogVolAtt(logVol, lengthUserLimit);
272 VOL_LIST.push_back(logVol);
273 allLogicalVolumes.insert(logVol);
280void BDSGeometryFactorySQL::AssignVariable<G4double>(
BDSMySQLTable* aSQLTable, G4int k, G4String variableName, G4double& variable)
288void BDSGeometryFactorySQL::AssignVariable<G4int>(
BDSMySQLTable* aSQLTable, G4int k, G4String variableName, G4int& variable)
296void BDSGeometryFactorySQL::AssignVariable<G4String>(
BDSMySQLTable* aSQLTable, G4int k, G4String variableName, G4String& variable)
303void BDSGeometryFactorySQL::SetCommonParams(
BDSMySQLTable* aSQLTable, G4int k)
306 VisRed = VisGreen = VisBlue = 0.5;
312 ApproximationRegion=0;
321 AssignVariable(aSQLTable,k,
"APPROXIMATIONREGION",ApproximationRegion);
325 {Name = TableName+std::to_string(k) +
"_SQL";}
327 {Name = TableName+std::to_string(k);}
328 Name = itsMarkerVol->GetName()+
"_"+Name;
330 G4cout << __METHOD_NAME__ <<
" k = " << k <<
", Name = " << Name << G4endl;
334void BDSGeometryFactorySQL::SetPlacementParams(
BDSMySQLTable* aSQLTable, G4int k)
337 PosX = PosY = PosZ = 0.;
338 RotPsi = RotTheta = RotPhi = 0.;
339 K1 = K2 = K3 = K4 = 0.;
342 Parameterisation =
"";
347 FieldX = FieldY = FieldZ = 0.0;
375 PARENTNAME= itsMarkerVol->GetName() +
"_" + PARENTNAME;
379 {Name = TableName+std::to_string(k) +
"_SQL";}
381 {Name = TableName+std::to_string(k);}
383 Name = itsMarkerVol->GetName()+
"_"+Name;
385 G4cout << __METHOD_NAME__ <<
" k = " << k <<
", Name = " << Name << G4endl;
389G4VisAttributes* BDSGeometryFactorySQL::VisAtt()
391 G4VisAttributes* va =
new G4VisAttributes(G4Colour(VisRed, VisGreen, VisBlue, VisAlpha));
392 char testChar = VisType[0];
395 case 'W': va->SetForceWireframe(
true);
break;
396 case 'I': va->SetVisibility(
false);
break;
397 case 'S': va->SetForceSolid(
true);
break;
398 case 'w': va->SetForceWireframe(
true);
break;
399 case 'i': va->SetVisibility(
false);
break;
400 case 's': va->SetForceSolid(
true);
break;
402 allVisAttributes.insert(va);
406G4UserLimits* BDSGeometryFactorySQL::UserLimits(G4double maxStepLength)
412void BDSGeometryFactorySQL::SetLogVolAtt(G4LogicalVolume* logVol, G4double k)
414 logVol->SetVisAttributes(VisAtt());
415 logVol->SetUserLimits(UserLimits(k));
416 SetLogVolRegion(logVol);
419void BDSGeometryFactorySQL::SetLogVolRegion(G4LogicalVolume* logVol)
421 G4Region* region =
nullptr;
424 G4cout <<
"Approximation region should be define in gmad syntax now!" << G4endl;
425 region = BDSAcceleratorModel::Instance()->
Region(
"precision");
427 if(ApproximationRegion)
429 G4cout <<
"Approximation region should be define in gmad syntax now!" << G4endl;
430 region = BDSAcceleratorModel::Instance()->
Region(
"approximation");
434 logVol->SetRegion(region);
435 region->AddRootLogicalVolume(logVol);
439G4LogicalVolume* BDSGeometryFactorySQL::BuildCone(
BDSMySQLTable* aSQLTable, G4int k)
442 G4double rInnerStart;
444 G4double rOuterStart;
451 dphi = CLHEP::twopi*CLHEP::radian;
452 length = rOuterStart = rOuterEnd = 10.*CLHEP::mm;
453 rInnerStart = rInnerEnd = 0.0;
463 G4Cons* aCone =
new G4Cons(Name+
"_Cone",
471 allSolids.insert(aCone);
473 G4double maxR = std::max(rOuterStart, rOuterEnd);
474 unShiftedExtents[aCone] =
BDSExtent(maxR, maxR, length*0.5);
476 G4LogicalVolume* aConeVol =
new G4LogicalVolume(aCone,
480 lengthUserLimit=length;
484G4LogicalVolume* BDSGeometryFactorySQL::BuildEllipticalCone(
BDSMySQLTable* aSQLTable, G4int k)
486 G4double lengthZ = 0;
487 G4double pxSemiAxis = 0;
488 G4double pySemiAxis = 0;
489 G4double pzTopCut = 0;
492 lengthZ = 10.*CLHEP::mm;
499 G4EllipticalCone* aEllipticalCone =
new G4EllipticalCone(Name+
"_EllipticalCone",
504 allSolids.insert(aEllipticalCone);
506 G4double maxX = pxSemiAxis*lengthZ*0.5;
507 G4double maxY = pySemiAxis*lengthZ*0.5;
508 unShiftedExtents[aEllipticalCone] =
BDSExtent(maxX, maxY, lengthZ*0.5);
510 G4LogicalVolume* aEllipticalConeVol =
511 new G4LogicalVolume(aEllipticalCone,
515 lengthUserLimit=lengthZ*0.5;
516 return aEllipticalConeVol;
519G4LogicalVolume* BDSGeometryFactorySQL::BuildPolyCone(
BDSMySQLTable* aSQLTable, G4int k)
527 dphi = CLHEP::twopi*CLHEP::radian;
532 std::vector<G4double> rInner = std::vector<G4double>(numZplanes+1);
533 std::vector<G4double> rOuter = std::vector<G4double>(numZplanes+1);
534 std::vector<G4double> zPos = std::vector<G4double>(numZplanes+1);
536 for (G4int planenum=0; planenum<numZplanes; planenum++)
538 G4String rInner_ID =
"RINNER" + std::to_string(planenum+1);
539 G4String rOuter_ID =
"ROUTER" + std::to_string(planenum+1);
540 G4String zPos_ID =
"PLANEPOS" + std::to_string(planenum+1);
550 G4Polycone* aPolyCone =
new G4Polycone(Name+
"_PolyCone",
557 allSolids.insert(aPolyCone);
559 G4double maxR = *std::max_element(rOuter.begin(), rOuter.end());
560 G4double maxZ = *std::max_element(zPos.begin(), zPos.end());
561 unShiftedExtents[aPolyCone] =
BDSExtent(maxR, maxR, maxZ);
563 G4LogicalVolume* aPolyConeVol =
564 new G4LogicalVolume(aPolyCone,
568 lengthUserLimit=fabs(zPos[0]-zPos[numZplanes-1])/2;
573G4LogicalVolume* BDSGeometryFactorySQL::BuildBox(
BDSMySQLTable* aSQLTable, G4int k)
579 lengthX = lengthY = lengthZ = 1.*CLHEP::mm;
585 G4Box* aBox =
new G4Box(Name+
"_Box",
589 allSolids.insert(aBox);
591 unShiftedExtents[aBox] =
BDSExtent(lengthX*0.5, lengthY*0.5, lengthZ*0.5);
593 G4LogicalVolume* aBoxVol =
594 new G4LogicalVolume(aBox,
598 lengthUserLimit = lengthZ;
602G4LogicalVolume* BDSGeometryFactorySQL::BuildTrap(
BDSMySQLTable* aSQLTable, G4int k)
605 G4double trapTheta = 0;
606 G4double lengthXPlus = 0;
607 G4double lengthXMinus = 0;
608 G4double lengthYPlus = 0;
609 G4double lengthYMinus = 0;
610 G4double lengthZ = 0;
619 G4Trap* aTrap =
new G4Trap(Name+
"_Trd",
630 allSolids.insert(aTrap);
633 G4LogicalVolume* aTrapVol =
634 new G4LogicalVolume(aTrap,
638 lengthUserLimit = lengthZ*0.5;
642G4LogicalVolume* BDSGeometryFactorySQL::BuildTorus(
BDSMySQLTable* aSQLTable, G4int k)
651 rSwept = 20.*CLHEP::mm;
652 rOuter = 10.*CLHEP::mm;
655 dphi=2*CLHEP::pi*CLHEP::radian;
664 G4Torus* aTorus =
new G4Torus(Name+
"_Torus",
670 allSolids.insert(aTorus);
672 G4LogicalVolume* aTorusVol =
673 new G4LogicalVolume(aTorus,
677 lengthUserLimit = rOuter*0.5;
681G4LogicalVolume* BDSGeometryFactorySQL::BuildSampler(
BDSMySQLTable* aSQLTable, G4int k)
684 G4double rInnerStart;
686 G4double rOuterStart;
690 length = rOuterStart = rOuterEnd = 10.*CLHEP::mm;
691 rInnerStart = rInnerEnd = 0.0;
701 Name = sqlName->GetStrValue(k);
702 sqlName->SetStrValue(k,Name+
"_SQL");
703 Name = sqlName->GetStrValue(k);
706 {Name = TableName+std::to_string(k)+
"_SQL";}
708 Name = itsMarkerVol->GetName()+
"_"+Name;
710 G4Cons* aSampler =
new G4Cons(Name+
"_samp",
717 CLHEP::twopi*CLHEP::radian);
718 allSolids.insert(aSampler);
719 G4LogicalVolume* aSamplerVol =
720 new G4LogicalVolume(aSampler,
724 lengthUserLimit = length*0.5;
726 aSamplerVol->SetSensitiveDetector(BDSSDManager::Instance()->SamplerPlane());
735G4LogicalVolume* BDSGeometryFactorySQL::BuildTube(
BDSMySQLTable* aSQLTable, G4int k)
744 length = 100.*CLHEP::mm;
745 rOuter = 10.*CLHEP::mm;
748 dphi=2*CLHEP::pi*CLHEP::radian;
756 G4Tubs* aTubs =
new G4Tubs(Name+
"_Tubs",
762 allSolids.insert(aTubs);
763 G4LogicalVolume* aTubsVol =
764 new G4LogicalVolume(aTubs,
768 lengthUserLimit = length*0.5;
772G4LogicalVolume* BDSGeometryFactorySQL::BuildEllipticalTube(
BDSMySQLTable* aSQLTable, G4int k)
779 lengthX = 100.*CLHEP::mm;
780 lengthY = 50.*CLHEP::mm;
781 lengthZ = 200.*CLHEP::mm;
787 G4EllipticalTube* aEllipticalTube =
new G4EllipticalTube(Name+
"_EllipticalTube",
793 allSolids.insert(aEllipticalTube);
794 G4LogicalVolume* aEllipticalTubeVol =
795 new G4LogicalVolume(aEllipticalTube,
798 G4double maxLength = lengthX;
799 if (lengthY>lengthX&&lengthY>lengthZ)
800 {maxLength = lengthY;}
801 else if(lengthZ>lengthY&&lengthZ>lengthX)
802 {maxLength = lengthZ;}
803 lengthUserLimit = maxLength*0.5;
804 return aEllipticalTubeVol;
860G4RotationMatrix* BDSGeometryFactorySQL::RotateComponent(G4double psi,G4double phi,G4double theta)
862 rotateComponent =
new G4RotationMatrix;
863 if(psi==0 && phi==0 && theta==0)
864 {
return rotateComponent;}
866 G4RotationMatrix* LocalRotation =
new G4RotationMatrix;
867 G4ThreeVector* localX =
new G4ThreeVector(1.,0.,0.);
868 G4ThreeVector* localY =
new G4ThreeVector(0.,1.,0.);
869 G4ThreeVector* localZ =
new G4ThreeVector(0.,0.,1.);
871 LocalRotation->rotate(psi,*localZ);
872 localX->rotate(psi,*localZ);
873 localY->rotate(psi,*localZ);
875 LocalRotation->rotate(phi,*localY);
876 localX->rotate(phi,*localY);
877 localZ->rotate(phi,*localY);
879 LocalRotation->rotate(theta,*localX);
880 localY->rotate(theta,*localX);
881 localZ->rotate(theta,*localX);
883 rotateComponent->transform(*LocalRotation);
884 rotateComponent->invert();
886 return rotateComponent;
890 std::vector<G4LogicalVolume*> VOL_LISTIn)
892 for (G4int k=0; k<NVariables; k++)
894 SetPlacementParams(aSQLTable, k);
896 if(!PARENTNAME.empty())
898 PARENTNAME+=
"_LogVol";
899 for (G4int i=0; i<(G4int)VOL_LISTIn.size(); i++)
901#if G4VERSION_NUMBER > 1099
902 if (G4StrUtil::icompare(PARENTNAME, VOL_LISTIn[i]->GetName()) == 0)
904 if(PARENTNAME.compareTo(VOL_LISTIn[i]->GetName(), G4String::ignoreCase)==0)
914 G4String tmpname = Name+
"_LogVol";
916 for (G4int i=0; i<(G4int)VOL_LISTIn.size(); i++)
918#if G4VERSION_NUMBER > 1099
919 if (G4StrUtil::icompare(tmpname, VOL_LISTIn[i]->GetName()) == 0)
921 if(tmpname.compareTo(VOL_LISTIn[i]->GetName(), G4String::ignoreCase)==0)
930 {sensitiveComponents.insert(VOL_LISTIn[ID]);}
931 G4ThreeVector PlacementPoint(PosX,PosY,PosZ);
933 if(!InheritStyle.empty())
935#if G4VERSION_NUMBER > 1099
936 if (G4StrUtil::icompare(InheritStyle,
"SUBTRACT") == 0)
938 if(InheritStyle.compareTo(
"SUBTRACT", G4String::ignoreCase)==0)
941 G4VSolid* original = VOL_LISTIn[PARENTID]->GetSolid();
942 G4VSolid* sub = VOL_LISTIn[ID]->GetSolid();
943 VOL_LISTIn[PARENTID]->SetSolid(
new G4SubtractionSolid(VOL_LISTIn[PARENTID]->GetName(),
946 RotateComponent(RotPsi,RotPhi,RotTheta),
950#if G4VERSION_NUMBER > 1099
951 if (G4StrUtil::icompare(InheritStyle,
"INTERSECT") == 0)
953 else if(InheritStyle.compareTo(
"INTERSECT", G4String::ignoreCase)==0)
956 G4VSolid* original = VOL_LISTIn[PARENTID]->GetSolid();
957 G4VSolid* sub = VOL_LISTIn[ID]->GetSolid();
958 VOL_LISTIn[PARENTID]->SetSolid(
new G4IntersectionSolid(VOL_LISTIn[PARENTID]->GetName(),
961 RotateComponent(RotPsi,RotPhi,RotTheta),
965#if G4VERSION_NUMBER > 1099
966 if (G4StrUtil::icompare(InheritStyle,
"UNION") == 0)
968 else if(InheritStyle.compareTo(
"UNION", G4String::ignoreCase)==0)
971 G4VSolid* original = VOL_LISTIn[PARENTID]->GetSolid();
972 G4VSolid* sub = VOL_LISTIn[ID]->GetSolid();
973 VOL_LISTIn[PARENTID]->SetSolid(
new G4UnionSolid(VOL_LISTIn[PARENTID]->GetName(),
976 RotateComponent(RotPsi,RotPhi,RotTheta),
982 G4cout << __METHOD_NAME__ <<
" k = " << k <<
", volume = " << VOL_LISTIn[ID]->GetName() << G4endl;
985 G4LogicalVolume* volume = VOL_LISTIn[ID];
986 G4int copyNumber = 0;
989 {copyNumber = result->second;}
992 G4VSolid* solid = volume->GetSolid();
997 G4VPhysicalVolume* PhysiComp =
998 new G4PVPlacement(RotateComponent(RotPsi,RotPhi,RotTheta),
1002 VOL_LISTIn[PARENTID],
1011 G4cerr<<
"\nBDSGeometryFactorySQL.cc:486: Trying to align in-beam to SQL volume to " << PhysiComp->GetName() <<
" but alignment already set to " << alignInVolume->GetName() << G4endl;
1012 G4Exception(
"Aborting Program",
"-1", FatalException,
"");
1016 {alignInVolume = PhysiComp;}
1023 G4cerr<<
"\nBDSGeometryFactorySQL.cc:486: Trying to align out-beam to SQL volume to " << PhysiComp->GetName() <<
" but alignment already set to " << alignOutVolume->GetName() << G4endl;
1024 G4Exception(
"Aborting Program",
"-1", FatalException,
"");
1027 {alignOutVolume = PhysiComp;}
1032#if G4VERSION_NUMBER > 1099
1033 if (G4StrUtil::icompare(MagType,
"QUAD") == 0)
1035 if(MagType.compareTo(
"QUAD", G4String::ignoreCase)==0)
1040 QuadBgrad.push_back(- brho * K1 / CLHEP::m2);
1041 Quadvol.push_back(PhysiComp->GetName());
1042 quadVolBgrad[PhysiComp->GetName()]=(- brho * K1 / CLHEP::m2);
1044#if G4VERSION_NUMBER > 1099
1045 if (G4StrUtil::icompare(MagType,
"SEXT") == 0)
1047 if(MagType.compareTo(
"SEXT", G4String::ignoreCase)==0)
1052 SextBgrad.push_back(- brho * K2 / CLHEP::m3);
1053 Sextvol.push_back(PhysiComp->GetName());
1054 sextVolBgrad[PhysiComp->GetName()]=(- brho * K2 / CLHEP::m3);
1056#if G4VERSION_NUMBER > 1099
1057 if (G4StrUtil::icompare(MagType,
"OCT") == 0)
1059 if(MagType.compareTo(
"OCT", G4String::ignoreCase)==0)
1064 OctBgrad.push_back(- brho * K3 / (CLHEP::m2*CLHEP::m2));
1065 Octvol.push_back(PhysiComp->GetName());
1066 octVolBgrad[PhysiComp->GetName()]=(- brho * K3 / (CLHEP::m2*CLHEP::m2));
1069 if(FieldX || FieldY || FieldZ)
1074 G4cout <<
"BDSGeometryFactorySQL> volume " << PhysiComp->GetName() <<
" has the following uniform field: " << FieldX <<
" " << FieldY <<
" " << FieldZ <<
" " << G4endl;
1076 UniformField.emplace_back(G4ThreeVector(FieldX*CLHEP::tesla,
1077 FieldY*CLHEP::tesla,
1078 FieldZ*CLHEP::tesla));
1079 Fieldvol.push_back(PhysiComp->GetName());
1080 uniformFieldVolField[PhysiComp->GetName()]=G4ThreeVector(FieldX*CLHEP::tesla,
1081 FieldY*CLHEP::tesla,
1082 FieldZ*CLHEP::tesla);
G4Region * Region(const G4String &name) const
Access region information. Will exit if not found.
General exception with possible name of object and message.
Holder for +- extents in 3 dimensions.
BDSExtent Translate(const G4ThreeVector &offset) const
Provide a new copy of this extent with an offset applied.
void RegisterRotationMatrix(G4RotationMatrix *rotationMatrix)
void RegisterLogicalVolume(G4LogicalVolume *logicalVolume)
void RegisterPhysicalVolume(G4VPhysicalVolume *physicalVolume)
void RegisterVisAttributes(G4VisAttributes *visAttribute)
void RegisterSolid(G4VSolid *solid)
A loaded piece of externally provided geometry.
void ExpandExtent(const BDSExtent &extent)
Expand the acuumulated extents using a (possibly asymmetric) extent instance.
virtual void CleanUp()
Virtual clean up that derived classes can override that calls CleanUpBase().
virtual std::set< G4VisAttributes * > ApplyColourMapping(std::set< G4LogicalVolume * > &lvs, std::map< G4String, G4Colour * > *mapping, G4bool autoColour, const G4String &preprocessPrefix="")
void PlaceComponents(BDSMySQLTable *aSQLTable, std::vector< G4LogicalVolume * > VOL_LIST)
void CleanUpSQL()
Non-virtual clean up as used in constructor.
virtual BDSGeometryExternal * Build(G4String componentName, G4String fileName, std::map< G4String, G4Colour * > *colourMapping=nullptr, G4bool autoColour=true, G4double suggestedLength=0, G4double suggestedHorizontalWidth=0, std::vector< G4String > *vacuumBiasVolumeNames=nullptr, G4UserLimits *userLimitsToAttachToAllLVs=nullptr)
void AssignVariable(BDSMySQLTable *aSQLTable, G4int k, G4String variableName, T &variable)
Search SQL table for variableName and if exists assign to variable.
virtual void CleanUp()
Clean up members.
static G4double defaultRigidity
Cache of default rigidity for possibly constructing fields (only SQL)
std::map< G4LogicalVolume *, G4int > samplerIDs
static BDSGlobalConstants * Instance()
Access method.
static BDSMaterials * Instance()
Singleton pattern access.
G4Material * GetMaterial(G4String material) const
Get material by name.
Representation of a mysql table.
A variable representation for mysql loader.
G4double GetDblValue(G4int itemN) const
Accessor.
G4int GetIntValue(G4int itemN) const
Accessor.
G4String GetStrValue(G4int itemN) const
Accessor.
Wrapper for mysql file handling.
static BDSSamplerRegistry * Instance()
Accessor for registry.
G4int RegisterSampler(const G4String &name, BDSSampler *sampler, const G4Transform3D &transform=G4Transform3D(), G4double S=-1000, const BDSBeamlineElement *element=nullptr, BDSSamplerType type=BDSSamplerType::plane, G4double radius=0)
G4bool StrContains(const G4String &str, const G4String &test)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
G4String GetFullPath(G4String filename, bool excludeNameFromPath=false, bool useCWDForPrefix=false)
G4UserLimits * CreateUserLimits(G4UserLimits *defaultUL, G4double length, G4double fraction=1.6)
G4int StrCompare(const G4String &str, const G4String &, G4String::caseCompare mode=G4String::ignoreCase)
Utility function to simplify lots of syntax changes for pedantic g4 changes.