18#include "BDSAcceleratorModel.hh"
20#include "BDSException.hh"
21#include "BDSGeometryExternal.hh"
22#include "BDSGeometryFactorySQL.hh"
23#include "BDSGlobalConstants.hh"
24#include "BDSMaterials.hh"
25#include "BDSMySQLTable.hh"
26#include "BDSMySQLVariable.hh"
27#include "BDSMySQLWrapper.hh"
28#include "BDSSDSampler.hh"
29#include "BDSSampler.hh"
30#include "BDSSamplerRegistry.hh"
31#include "BDSSDManager.hh"
32#include "BDSUtilities.hh"
37#include "G4EllipticalCone.hh"
38#include "G4EllipticalTube.hh"
39#include "G4IntersectionSolid.hh"
40#include "G4LogicalVolume.hh"
41#include "G4Polycone.hh"
42#include "G4PVPlacement.hh"
43#include "G4RotationMatrix.hh"
45#include "G4SubtractionSolid.hh"
49#include "G4UnionSolid.hh"
50#include "G4UserLimits.hh"
51#include "G4Version.hh"
52#include "G4VisAttributes.hh"
53#include "G4VPhysicalVolume.hh"
63#include <unordered_map>
68BDSGeometryFactorySQL::BDSGeometryFactorySQL()
102 Parameterisation =
"";
108 ApproximationRegion = 0;
114 unShiftedExtents.clear();
116 precisionRegionSQL =
nullptr;
117 approximationRegionSQL =
nullptr;
118 rotateComponent =
nullptr;
119 itsMarkerVol =
nullptr;
121 UniformField.clear();
134 sensitiveComponents.clear();
136 alignInVolume =
nullptr;
137 alignOutVolume =
nullptr;
139 uniformFieldVolField.clear();
140 quadVolBgrad.clear();
141 sextVolBgrad.clear();
147 std::map<G4String, G4Colour*>* colourMapping,
149 G4double suggestedLength,
150 G4double suggestedHorizontalWidth,
151 std::vector<G4String>* ,
162 G4cout << __METHOD_NAME__ <<
"loading SQL file: " << fileName << G4endl;
163 G4cout << __METHOD_NAME__ <<
"containing directory: " << containingDir << G4endl;
168 {
throw BDSException(__METHOD_NAME__,
"Cannot open file \"" + fileName +
"\"");}
174 G4double outerR = suggestedHorizontalWidth*0.5;
175 G4VSolid* containerSolid =
new G4Box(
"container_solid",
178 suggestedLength*0.5);
183 itsMarkerVol =
new G4LogicalVolume(containerSolid,
188 VOL_LIST.push_back(itsMarkerVol);
189 G4String fileListLine;
191 while (ifs >> fileListLine)
194 {ifs.getline(buffer,1000);}
196 {BuildSQLObjects(containingDir + fileListLine);}
210 std::set<G4LogicalVolume*> tempVols;
211 for (
auto lv : VOL_LIST)
212 {tempVols.insert(lv);}
214 std::map<G4String, G4Colour*> mapping;
216 {mapping = *colourMapping;}
230void BDSGeometryFactorySQL::BuildSQLObjects(G4String file)
233 G4cout << __METHOD_NAME__ <<
"loading single file " << file << G4endl;
237 itsSQLTable=sql.ConstructTable();
239 for (G4int i=0; i<(G4int)itsSQLTable.size(); i++)
242 itsSQLTable[i]->Print();
244 TableName = itsSQLTable[i]->GetName();
246 G4cout << __METHOD_NAME__ <<
" i = " << i <<
", TableName = " << TableName << G4endl;
248 G4int pos = TableName.find(
"_");
249 std::string ObjectType = TableName.substr(pos+1,TableName.length() - pos);
250 NVariables = itsSQLTable[i]->GetVariable(0)->GetNVariables();
251 for (G4int k=0; k<NVariables; k++)
253 SetCommonParams(itsSQLTable[i], k);
254 G4LogicalVolume* logVol;
256 {logVol = BuildCone(itsSQLTable[i],k);}
258 {logVol = BuildEllipticalCone(itsSQLTable[i],k);}
260 {logVol = BuildPolyCone(itsSQLTable[i],k);}
262 {logVol = BuildBox(itsSQLTable[i],k);}
264 {logVol = BuildTrap(itsSQLTable[i],k);}
266 {logVol = BuildTorus(itsSQLTable[i],k);}
268 {logVol = BuildSampler(itsSQLTable[i],k);}
270 {logVol = BuildTube(itsSQLTable[i],k);}
272 {logVol = BuildEllipticalTube(itsSQLTable[i],k);}
276 {
throw BDSException(__METHOD_NAME__ + ObjectType +
" not known.");}
278 SetLogVolAtt(logVol, lengthUserLimit);
279 VOL_LIST.push_back(logVol);
280 allLogicalVolumes.insert(logVol);
287void BDSGeometryFactorySQL::AssignVariable<G4double>(
BDSMySQLTable* aSQLTable, G4int k, G4String variableName, G4double& variable)
295void BDSGeometryFactorySQL::AssignVariable<G4int>(
BDSMySQLTable* aSQLTable, G4int k, G4String variableName, G4int& variable)
303void BDSGeometryFactorySQL::AssignVariable<G4String>(
BDSMySQLTable* aSQLTable, G4int k, G4String variableName, G4String& variable)
310void BDSGeometryFactorySQL::SetCommonParams(
BDSMySQLTable* aSQLTable, G4int k)
313 VisRed = VisGreen = VisBlue = 0.5;
319 ApproximationRegion=0;
328 AssignVariable(aSQLTable,k,
"APPROXIMATIONREGION",ApproximationRegion);
332 {Name = TableName+std::to_string(k) +
"_SQL";}
334 {Name = TableName+std::to_string(k);}
335 Name = itsMarkerVol->GetName()+
"_"+Name;
337 G4cout << __METHOD_NAME__ <<
" k = " << k <<
", Name = " << Name << G4endl;
341void BDSGeometryFactorySQL::SetPlacementParams(
BDSMySQLTable* aSQLTable, G4int k)
344 PosX = PosY = PosZ = 0.;
345 RotPsi = RotTheta = RotPhi = 0.;
346 K1 = K2 = K3 = K4 = 0.;
349 Parameterisation =
"";
354 FieldX = FieldY = FieldZ = 0.0;
382 PARENTNAME= itsMarkerVol->GetName() +
"_" + PARENTNAME;
386 {Name = TableName+std::to_string(k) +
"_SQL";}
388 {Name = TableName+std::to_string(k);}
390 Name = itsMarkerVol->GetName()+
"_"+Name;
392 G4cout << __METHOD_NAME__ <<
" k = " << k <<
", Name = " << Name << G4endl;
396G4VisAttributes* BDSGeometryFactorySQL::VisAtt()
398 G4VisAttributes* va =
new G4VisAttributes(G4Colour(VisRed, VisGreen, VisBlue, VisAlpha));
399 char testChar = VisType[0];
402 case 'W': va->SetForceWireframe(
true);
break;
403 case 'I': va->SetVisibility(
false);
break;
404 case 'S': va->SetForceSolid(
true);
break;
405 case 'w': va->SetForceWireframe(
true);
break;
406 case 'i': va->SetVisibility(
false);
break;
407 case 's': va->SetForceSolid(
true);
break;
409 allVisAttributes.insert(va);
413G4UserLimits* BDSGeometryFactorySQL::UserLimits(G4double maxStepLength)
419void BDSGeometryFactorySQL::SetLogVolAtt(G4LogicalVolume* logVol, G4double k)
421 logVol->SetVisAttributes(VisAtt());
422 logVol->SetUserLimits(UserLimits(k));
423 SetLogVolRegion(logVol);
426void BDSGeometryFactorySQL::SetLogVolRegion(G4LogicalVolume* logVol)
428 G4Region* region =
nullptr;
431 G4cout <<
"Approximation region should be define in gmad syntax now!" << G4endl;
432 region = BDSAcceleratorModel::Instance()->
Region(
"precision");
434 if(ApproximationRegion)
436 G4cout <<
"Approximation region should be define in gmad syntax now!" << G4endl;
437 region = BDSAcceleratorModel::Instance()->
Region(
"approximation");
441 logVol->SetRegion(region);
442 region->AddRootLogicalVolume(logVol);
446G4LogicalVolume* BDSGeometryFactorySQL::BuildCone(
BDSMySQLTable* aSQLTable, G4int k)
449 G4double rInnerStart;
451 G4double rOuterStart;
458 dphi = CLHEP::twopi*CLHEP::radian;
459 length = rOuterStart = rOuterEnd = 10.*CLHEP::mm;
460 rInnerStart = rInnerEnd = 0.0;
470 G4Cons* aCone =
new G4Cons(Name+
"_Cone",
478 allSolids.insert(aCone);
480 G4double maxR = std::max(rOuterStart, rOuterEnd);
481 unShiftedExtents[aCone] =
BDSExtent(maxR, maxR, length*0.5);
483 G4LogicalVolume* aConeVol =
new G4LogicalVolume(aCone,
487 lengthUserLimit=length;
491G4LogicalVolume* BDSGeometryFactorySQL::BuildEllipticalCone(
BDSMySQLTable* aSQLTable, G4int k)
493 G4double lengthZ = 0;
494 G4double pxSemiAxis = 0;
495 G4double pySemiAxis = 0;
496 G4double pzTopCut = 0;
499 lengthZ = 10.*CLHEP::mm;
506 G4EllipticalCone* aEllipticalCone =
new G4EllipticalCone(Name+
"_EllipticalCone",
511 allSolids.insert(aEllipticalCone);
513 G4double maxX = pxSemiAxis*lengthZ*0.5;
514 G4double maxY = pySemiAxis*lengthZ*0.5;
515 unShiftedExtents[aEllipticalCone] =
BDSExtent(maxX, maxY, lengthZ*0.5);
517 G4LogicalVolume* aEllipticalConeVol =
518 new G4LogicalVolume(aEllipticalCone,
522 lengthUserLimit=lengthZ*0.5;
523 return aEllipticalConeVol;
526G4LogicalVolume* BDSGeometryFactorySQL::BuildPolyCone(
BDSMySQLTable* aSQLTable, G4int k)
534 dphi = CLHEP::twopi*CLHEP::radian;
539 std::vector<G4double> rInner = std::vector<G4double>(numZplanes+1);
540 std::vector<G4double> rOuter = std::vector<G4double>(numZplanes+1);
541 std::vector<G4double> zPos = std::vector<G4double>(numZplanes+1);
543 for (G4int planenum=0; planenum<numZplanes; planenum++)
545 G4String rInner_ID =
"RINNER" + std::to_string(planenum+1);
546 G4String rOuter_ID =
"ROUTER" + std::to_string(planenum+1);
547 G4String zPos_ID =
"PLANEPOS" + std::to_string(planenum+1);
557 G4Polycone* aPolyCone =
new G4Polycone(Name+
"_PolyCone",
564 allSolids.insert(aPolyCone);
566 G4double maxR = *std::max_element(rOuter.begin(), rOuter.end());
567 G4double maxZ = *std::max_element(zPos.begin(), zPos.end());
568 unShiftedExtents[aPolyCone] =
BDSExtent(maxR, maxR, maxZ);
570 G4LogicalVolume* aPolyConeVol =
571 new G4LogicalVolume(aPolyCone,
575 lengthUserLimit=fabs(zPos[0]-zPos[numZplanes-1])/2;
580G4LogicalVolume* BDSGeometryFactorySQL::BuildBox(
BDSMySQLTable* aSQLTable, G4int k)
586 lengthX = lengthY = lengthZ = 1.*CLHEP::mm;
592 G4Box* aBox =
new G4Box(Name+
"_Box",
596 allSolids.insert(aBox);
598 unShiftedExtents[aBox] =
BDSExtent(lengthX*0.5, lengthY*0.5, lengthZ*0.5);
600 G4LogicalVolume* aBoxVol =
601 new G4LogicalVolume(aBox,
605 lengthUserLimit = lengthZ;
609G4LogicalVolume* BDSGeometryFactorySQL::BuildTrap(
BDSMySQLTable* aSQLTable, G4int k)
612 G4double trapTheta = 0;
613 G4double lengthXPlus = 0;
614 G4double lengthXMinus = 0;
615 G4double lengthYPlus = 0;
616 G4double lengthYMinus = 0;
617 G4double lengthZ = 0;
626 G4Trap* aTrap =
new G4Trap(Name+
"_Trd",
637 allSolids.insert(aTrap);
640 G4LogicalVolume* aTrapVol =
641 new G4LogicalVolume(aTrap,
645 lengthUserLimit = lengthZ*0.5;
649G4LogicalVolume* BDSGeometryFactorySQL::BuildTorus(
BDSMySQLTable* aSQLTable, G4int k)
658 rSwept = 20.*CLHEP::mm;
659 rOuter = 10.*CLHEP::mm;
662 dphi=2*CLHEP::pi*CLHEP::radian;
671 G4Torus* aTorus =
new G4Torus(Name+
"_Torus",
677 allSolids.insert(aTorus);
679 G4LogicalVolume* aTorusVol =
680 new G4LogicalVolume(aTorus,
684 lengthUserLimit = rOuter*0.5;
688G4LogicalVolume* BDSGeometryFactorySQL::BuildSampler(
BDSMySQLTable* aSQLTable, G4int k)
691 G4double rInnerStart;
693 G4double rOuterStart;
697 length = rOuterStart = rOuterEnd = 10.*CLHEP::mm;
698 rInnerStart = rInnerEnd = 0.0;
708 Name = sqlName->GetStrValue(k);
709 sqlName->SetStrValue(k,Name+
"_SQL");
710 Name = sqlName->GetStrValue(k);
713 {Name = TableName+std::to_string(k)+
"_SQL";}
715 Name = itsMarkerVol->GetName()+
"_"+Name;
717 G4Cons* aSampler =
new G4Cons(Name+
"_samp",
724 CLHEP::twopi*CLHEP::radian);
725 allSolids.insert(aSampler);
726 G4LogicalVolume* aSamplerVol =
727 new G4LogicalVolume(aSampler,
731 lengthUserLimit = length*0.5;
733 aSamplerVol->SetSensitiveDetector(BDSSDManager::Instance()->SamplerPlane());
742G4LogicalVolume* BDSGeometryFactorySQL::BuildTube(
BDSMySQLTable* aSQLTable, G4int k)
751 length = 100.*CLHEP::mm;
752 rOuter = 10.*CLHEP::mm;
755 dphi=2*CLHEP::pi*CLHEP::radian;
763 G4Tubs* aTubs =
new G4Tubs(Name+
"_Tubs",
769 allSolids.insert(aTubs);
770 G4LogicalVolume* aTubsVol =
771 new G4LogicalVolume(aTubs,
775 lengthUserLimit = length*0.5;
779G4LogicalVolume* BDSGeometryFactorySQL::BuildEllipticalTube(
BDSMySQLTable* aSQLTable, G4int k)
786 lengthX = 100.*CLHEP::mm;
787 lengthY = 50.*CLHEP::mm;
788 lengthZ = 200.*CLHEP::mm;
794 G4EllipticalTube* aEllipticalTube =
new G4EllipticalTube(Name+
"_EllipticalTube",
800 allSolids.insert(aEllipticalTube);
801 G4LogicalVolume* aEllipticalTubeVol =
802 new G4LogicalVolume(aEllipticalTube,
805 G4double maxLength = lengthX;
806 if (lengthY>lengthX&&lengthY>lengthZ)
807 {maxLength = lengthY;}
808 else if(lengthZ>lengthY&&lengthZ>lengthX)
809 {maxLength = lengthZ;}
810 lengthUserLimit = maxLength*0.5;
811 return aEllipticalTubeVol;
867G4RotationMatrix* BDSGeometryFactorySQL::RotateComponent(G4double psi,G4double phi,G4double theta)
869 rotateComponent =
new G4RotationMatrix;
870 if(psi==0 && phi==0 && theta==0)
871 {
return rotateComponent;}
873 G4RotationMatrix* LocalRotation =
new G4RotationMatrix;
874 G4ThreeVector* localX =
new G4ThreeVector(1.,0.,0.);
875 G4ThreeVector* localY =
new G4ThreeVector(0.,1.,0.);
876 G4ThreeVector* localZ =
new G4ThreeVector(0.,0.,1.);
878 LocalRotation->rotate(psi,*localZ);
879 localX->rotate(psi,*localZ);
880 localY->rotate(psi,*localZ);
882 LocalRotation->rotate(phi,*localY);
883 localX->rotate(phi,*localY);
884 localZ->rotate(phi,*localY);
886 LocalRotation->rotate(theta,*localX);
887 localY->rotate(theta,*localX);
888 localZ->rotate(theta,*localX);
890 rotateComponent->transform(*LocalRotation);
891 rotateComponent->invert();
893 return rotateComponent;
897 std::vector<G4LogicalVolume*> VOL_LISTIn)
899 for (G4int k=0; k<NVariables; k++)
901 SetPlacementParams(aSQLTable, k);
903 if(!PARENTNAME.empty())
905 PARENTNAME+=
"_LogVol";
906 for (G4int i=0; i<(G4int)VOL_LISTIn.size(); i++)
908#if G4VERSION_NUMBER > 1099
909 if (G4StrUtil::icompare(PARENTNAME, VOL_LISTIn[i]->GetName()) == 0)
911 if(PARENTNAME.compareTo(VOL_LISTIn[i]->GetName(), G4String::ignoreCase)==0)
921 G4String tmpname = Name+
"_LogVol";
923 for (G4int i=0; i<(G4int)VOL_LISTIn.size(); i++)
925#if G4VERSION_NUMBER > 1099
926 if (G4StrUtil::icompare(tmpname, VOL_LISTIn[i]->GetName()) == 0)
928 if(tmpname.compareTo(VOL_LISTIn[i]->GetName(), G4String::ignoreCase)==0)
937 {sensitiveComponents.insert(VOL_LISTIn[ID]);}
938 G4ThreeVector PlacementPoint(PosX,PosY,PosZ);
940 if(!InheritStyle.empty())
942#if G4VERSION_NUMBER > 1099
943 if (G4StrUtil::icompare(InheritStyle,
"SUBTRACT") == 0)
945 if(InheritStyle.compareTo(
"SUBTRACT", G4String::ignoreCase)==0)
948 G4VSolid* original = VOL_LISTIn[PARENTID]->GetSolid();
949 G4VSolid* sub = VOL_LISTIn[ID]->GetSolid();
950 VOL_LISTIn[PARENTID]->SetSolid(
new G4SubtractionSolid(VOL_LISTIn[PARENTID]->GetName(),
953 RotateComponent(RotPsi,RotPhi,RotTheta),
957#if G4VERSION_NUMBER > 1099
958 if (G4StrUtil::icompare(InheritStyle,
"INTERSECT") == 0)
960 else if(InheritStyle.compareTo(
"INTERSECT", G4String::ignoreCase)==0)
963 G4VSolid* original = VOL_LISTIn[PARENTID]->GetSolid();
964 G4VSolid* sub = VOL_LISTIn[ID]->GetSolid();
965 VOL_LISTIn[PARENTID]->SetSolid(
new G4IntersectionSolid(VOL_LISTIn[PARENTID]->GetName(),
968 RotateComponent(RotPsi,RotPhi,RotTheta),
972#if G4VERSION_NUMBER > 1099
973 if (G4StrUtil::icompare(InheritStyle,
"UNION") == 0)
975 else if(InheritStyle.compareTo(
"UNION", G4String::ignoreCase)==0)
978 G4VSolid* original = VOL_LISTIn[PARENTID]->GetSolid();
979 G4VSolid* sub = VOL_LISTIn[ID]->GetSolid();
980 VOL_LISTIn[PARENTID]->SetSolid(
new G4UnionSolid(VOL_LISTIn[PARENTID]->GetName(),
983 RotateComponent(RotPsi,RotPhi,RotTheta),
989 G4cout << __METHOD_NAME__ <<
" k = " << k <<
", volume = " << VOL_LISTIn[ID]->GetName() << G4endl;
992 G4LogicalVolume* volume = VOL_LISTIn[ID];
993 G4int copyNumber = 0;
996 {copyNumber = result->second;}
999 G4VSolid* solid = volume->GetSolid();
1000 BDSExtent ext = unShiftedExtents[solid];
1004 G4VPhysicalVolume* PhysiComp =
1005 new G4PVPlacement(RotateComponent(RotPsi,RotPhi,RotTheta),
1009 VOL_LISTIn[PARENTID],
1018 G4cerr<<
"\nBDSGeometryFactorySQL.cc:486: Trying to align in-beam to SQL volume to " << PhysiComp->GetName() <<
" but alignment already set to " << alignInVolume->GetName() << G4endl;
1019 G4Exception(
"Aborting Program",
"-1", FatalException,
"");
1023 {alignInVolume = PhysiComp;}
1030 G4cerr<<
"\nBDSGeometryFactorySQL.cc:486: Trying to align out-beam to SQL volume to " << PhysiComp->GetName() <<
" but alignment already set to " << alignOutVolume->GetName() << G4endl;
1031 G4Exception(
"Aborting Program",
"-1", FatalException,
"");
1034 {alignOutVolume = PhysiComp;}
1039#if G4VERSION_NUMBER > 1099
1040 if (G4StrUtil::icompare(MagType,
"QUAD") == 0)
1042 if(MagType.compareTo(
"QUAD", G4String::ignoreCase)==0)
1047 QuadBgrad.push_back(- brho * K1 / CLHEP::m2);
1048 Quadvol.push_back(PhysiComp->GetName());
1049 quadVolBgrad[PhysiComp->GetName()]=(- brho * K1 / CLHEP::m2);
1051#if G4VERSION_NUMBER > 1099
1052 if (G4StrUtil::icompare(MagType,
"SEXT") == 0)
1054 if(MagType.compareTo(
"SEXT", G4String::ignoreCase)==0)
1059 SextBgrad.push_back(- brho * K2 / CLHEP::m3);
1060 Sextvol.push_back(PhysiComp->GetName());
1061 sextVolBgrad[PhysiComp->GetName()]=(- brho * K2 / CLHEP::m3);
1063#if G4VERSION_NUMBER > 1099
1064 if (G4StrUtil::icompare(MagType,
"OCT") == 0)
1066 if(MagType.compareTo(
"OCT", G4String::ignoreCase)==0)
1071 OctBgrad.push_back(- brho * K3 / (CLHEP::m2*CLHEP::m2));
1072 Octvol.push_back(PhysiComp->GetName());
1073 octVolBgrad[PhysiComp->GetName()]=(- brho * K3 / (CLHEP::m2*CLHEP::m2));
1076 if(FieldX || FieldY || FieldZ)
1081 G4cout <<
"BDSGeometryFactorySQL> volume " << PhysiComp->GetName() <<
" has the following uniform field: " << FieldX <<
" " << FieldY <<
" " << FieldZ <<
" " << G4endl;
1083 UniformField.emplace_back(G4ThreeVector(FieldX*CLHEP::tesla,
1084 FieldY*CLHEP::tesla,
1085 FieldZ*CLHEP::tesla));
1086 Fieldvol.push_back(PhysiComp->GetName());
1087 uniformFieldVolField[PhysiComp->GetName()]=G4ThreeVector(FieldX*CLHEP::tesla,
1088 FieldY*CLHEP::tesla,
1089 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(const std::set< G4LogicalVolume * > &lvs, const 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, G4bool makeSensitive=true, BDSSDType sensitivityType=BDSSDType::energydep, BDSSDType vacuumSensitivityType=BDSSDType::energydepvacuum, 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)
Improve type-safety of native enum data type in C++.
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.