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>* ,
163 G4cout << __METHOD_NAME__ <<
"loading SQL file: " << fileName << G4endl;
164 G4cout << __METHOD_NAME__ <<
"containing directory: " << containingDir << G4endl;
169 {
throw BDSException(__METHOD_NAME__,
"Cannot open file \"" + fileName +
"\"");}
175 G4double outerR = suggestedHorizontalWidth*0.5;
176 G4VSolid* containerSolid =
new G4Box(
"container_solid",
179 suggestedLength*0.5);
184 itsMarkerVol =
new G4LogicalVolume(containerSolid,
189 VOL_LIST.push_back(itsMarkerVol);
190 G4String fileListLine;
192 while (ifs >> fileListLine)
195 {ifs.getline(buffer,1000);}
197 {BuildSQLObjects(containingDir + fileListLine);}
211 std::set<G4LogicalVolume*> tempVols;
212 for (
auto lv : VOL_LIST)
213 {tempVols.insert(lv);}
215 std::map<G4String, G4Colour*> mapping;
217 {mapping = *colourMapping;}
231void BDSGeometryFactorySQL::BuildSQLObjects(G4String file)
234 G4cout << __METHOD_NAME__ <<
"loading single file " << file << G4endl;
238 itsSQLTable=sql.ConstructTable();
240 for (G4int i=0; i<(G4int)itsSQLTable.size(); i++)
243 itsSQLTable[i]->Print();
245 TableName = itsSQLTable[i]->GetName();
247 G4cout << __METHOD_NAME__ <<
" i = " << i <<
", TableName = " << TableName << G4endl;
249 G4int pos = TableName.find(
"_");
250 std::string ObjectType = TableName.substr(pos+1,TableName.length() - pos);
251 NVariables = itsSQLTable[i]->GetVariable(0)->GetNVariables();
252 for (G4int k=0; k<NVariables; k++)
254 SetCommonParams(itsSQLTable[i], k);
255 G4LogicalVolume* logVol;
257 {logVol = BuildCone(itsSQLTable[i],k);}
259 {logVol = BuildEllipticalCone(itsSQLTable[i],k);}
261 {logVol = BuildPolyCone(itsSQLTable[i],k);}
263 {logVol = BuildBox(itsSQLTable[i],k);}
265 {logVol = BuildTrap(itsSQLTable[i],k);}
267 {logVol = BuildTorus(itsSQLTable[i],k);}
269 {logVol = BuildSampler(itsSQLTable[i],k);}
271 {logVol = BuildTube(itsSQLTable[i],k);}
273 {logVol = BuildEllipticalTube(itsSQLTable[i],k);}
277 {
throw BDSException(__METHOD_NAME__ + ObjectType +
" not known.");}
279 SetLogVolAtt(logVol, lengthUserLimit);
280 VOL_LIST.push_back(logVol);
281 allLogicalVolumes.insert(logVol);
288void BDSGeometryFactorySQL::AssignVariable<G4double>(
BDSMySQLTable* aSQLTable, G4int k, G4String variableName, G4double& variable)
296void BDSGeometryFactorySQL::AssignVariable<G4int>(
BDSMySQLTable* aSQLTable, G4int k, G4String variableName, G4int& variable)
304void BDSGeometryFactorySQL::AssignVariable<G4String>(
BDSMySQLTable* aSQLTable, G4int k, G4String variableName, G4String& variable)
311void BDSGeometryFactorySQL::SetCommonParams(
BDSMySQLTable* aSQLTable, G4int k)
314 VisRed = VisGreen = VisBlue = 0.5;
320 ApproximationRegion=0;
329 AssignVariable(aSQLTable,k,
"APPROXIMATIONREGION",ApproximationRegion);
333 {Name = TableName+std::to_string(k) +
"_SQL";}
335 {Name = TableName+std::to_string(k);}
336 Name = itsMarkerVol->GetName()+
"_"+Name;
338 G4cout << __METHOD_NAME__ <<
" k = " << k <<
", Name = " << Name << G4endl;
342void BDSGeometryFactorySQL::SetPlacementParams(
BDSMySQLTable* aSQLTable, G4int k)
345 PosX = PosY = PosZ = 0.;
346 RotPsi = RotTheta = RotPhi = 0.;
347 K1 = K2 = K3 = K4 = 0.;
350 Parameterisation =
"";
355 FieldX = FieldY = FieldZ = 0.0;
383 PARENTNAME= itsMarkerVol->GetName() +
"_" + PARENTNAME;
387 {Name = TableName+std::to_string(k) +
"_SQL";}
389 {Name = TableName+std::to_string(k);}
391 Name = itsMarkerVol->GetName()+
"_"+Name;
393 G4cout << __METHOD_NAME__ <<
" k = " << k <<
", Name = " << Name << G4endl;
397G4VisAttributes* BDSGeometryFactorySQL::VisAtt()
399 G4VisAttributes* va =
new G4VisAttributes(G4Colour(VisRed, VisGreen, VisBlue, VisAlpha));
400 char testChar = VisType[0];
403 case 'W': va->SetForceWireframe(
true);
break;
404 case 'I': va->SetVisibility(
false);
break;
405 case 'S': va->SetForceSolid(
true);
break;
406 case 'w': va->SetForceWireframe(
true);
break;
407 case 'i': va->SetVisibility(
false);
break;
408 case 's': va->SetForceSolid(
true);
break;
410 allVisAttributes.insert(va);
414G4UserLimits* BDSGeometryFactorySQL::UserLimits(G4double maxStepLength)
420void BDSGeometryFactorySQL::SetLogVolAtt(G4LogicalVolume* logVol, G4double k)
422 logVol->SetVisAttributes(VisAtt());
423 logVol->SetUserLimits(UserLimits(k));
424 SetLogVolRegion(logVol);
427void BDSGeometryFactorySQL::SetLogVolRegion(G4LogicalVolume* logVol)
429 G4Region* region =
nullptr;
432 G4cout <<
"Approximation region should be define in gmad syntax now!" << G4endl;
433 region = BDSAcceleratorModel::Instance()->
Region(
"precision");
435 if(ApproximationRegion)
437 G4cout <<
"Approximation region should be define in gmad syntax now!" << G4endl;
438 region = BDSAcceleratorModel::Instance()->
Region(
"approximation");
442 logVol->SetRegion(region);
443 region->AddRootLogicalVolume(logVol);
447G4LogicalVolume* BDSGeometryFactorySQL::BuildCone(
BDSMySQLTable* aSQLTable, G4int k)
450 G4double rInnerStart;
452 G4double rOuterStart;
459 dphi = CLHEP::twopi*CLHEP::radian;
460 length = rOuterStart = rOuterEnd = 10.*CLHEP::mm;
461 rInnerStart = rInnerEnd = 0.0;
471 G4Cons* aCone =
new G4Cons(Name+
"_Cone",
479 allSolids.insert(aCone);
481 G4double maxR = std::max(rOuterStart, rOuterEnd);
482 unShiftedExtents[aCone] =
BDSExtent(maxR, maxR, length*0.5);
484 G4LogicalVolume* aConeVol =
new G4LogicalVolume(aCone,
488 lengthUserLimit=length;
492G4LogicalVolume* BDSGeometryFactorySQL::BuildEllipticalCone(
BDSMySQLTable* aSQLTable, G4int k)
494 G4double lengthZ = 0;
495 G4double pxSemiAxis = 0;
496 G4double pySemiAxis = 0;
497 G4double pzTopCut = 0;
500 lengthZ = 10.*CLHEP::mm;
507 G4EllipticalCone* aEllipticalCone =
new G4EllipticalCone(Name+
"_EllipticalCone",
512 allSolids.insert(aEllipticalCone);
514 G4double maxX = pxSemiAxis*lengthZ*0.5;
515 G4double maxY = pySemiAxis*lengthZ*0.5;
516 unShiftedExtents[aEllipticalCone] =
BDSExtent(maxX, maxY, lengthZ*0.5);
518 G4LogicalVolume* aEllipticalConeVol =
519 new G4LogicalVolume(aEllipticalCone,
523 lengthUserLimit=lengthZ*0.5;
524 return aEllipticalConeVol;
527G4LogicalVolume* BDSGeometryFactorySQL::BuildPolyCone(
BDSMySQLTable* aSQLTable, G4int k)
535 dphi = CLHEP::twopi*CLHEP::radian;
540 std::vector<G4double> rInner = std::vector<G4double>(numZplanes+1);
541 std::vector<G4double> rOuter = std::vector<G4double>(numZplanes+1);
542 std::vector<G4double> zPos = std::vector<G4double>(numZplanes+1);
544 for (G4int planenum=0; planenum<numZplanes; planenum++)
546 G4String rInner_ID =
"RINNER" + std::to_string(planenum+1);
547 G4String rOuter_ID =
"ROUTER" + std::to_string(planenum+1);
548 G4String zPos_ID =
"PLANEPOS" + std::to_string(planenum+1);
558 G4Polycone* aPolyCone =
new G4Polycone(Name+
"_PolyCone",
565 allSolids.insert(aPolyCone);
567 G4double maxR = *std::max_element(rOuter.begin(), rOuter.end());
568 G4double maxZ = *std::max_element(zPos.begin(), zPos.end());
569 unShiftedExtents[aPolyCone] =
BDSExtent(maxR, maxR, maxZ);
571 G4LogicalVolume* aPolyConeVol =
572 new G4LogicalVolume(aPolyCone,
576 lengthUserLimit=fabs(zPos[0]-zPos[numZplanes-1])/2;
581G4LogicalVolume* BDSGeometryFactorySQL::BuildBox(
BDSMySQLTable* aSQLTable, G4int k)
587 lengthX = lengthY = lengthZ = 1.*CLHEP::mm;
593 G4Box* aBox =
new G4Box(Name+
"_Box",
597 allSolids.insert(aBox);
599 unShiftedExtents[aBox] =
BDSExtent(lengthX*0.5, lengthY*0.5, lengthZ*0.5);
601 G4LogicalVolume* aBoxVol =
602 new G4LogicalVolume(aBox,
606 lengthUserLimit = lengthZ;
610G4LogicalVolume* BDSGeometryFactorySQL::BuildTrap(
BDSMySQLTable* aSQLTable, G4int k)
613 G4double trapTheta = 0;
614 G4double lengthXPlus = 0;
615 G4double lengthXMinus = 0;
616 G4double lengthYPlus = 0;
617 G4double lengthYMinus = 0;
618 G4double lengthZ = 0;
627 G4Trap* aTrap =
new G4Trap(Name+
"_Trd",
638 allSolids.insert(aTrap);
641 G4LogicalVolume* aTrapVol =
642 new G4LogicalVolume(aTrap,
646 lengthUserLimit = lengthZ*0.5;
650G4LogicalVolume* BDSGeometryFactorySQL::BuildTorus(
BDSMySQLTable* aSQLTable, G4int k)
659 rSwept = 20.*CLHEP::mm;
660 rOuter = 10.*CLHEP::mm;
663 dphi=2*CLHEP::pi*CLHEP::radian;
672 G4Torus* aTorus =
new G4Torus(Name+
"_Torus",
678 allSolids.insert(aTorus);
680 G4LogicalVolume* aTorusVol =
681 new G4LogicalVolume(aTorus,
685 lengthUserLimit = rOuter*0.5;
689G4LogicalVolume* BDSGeometryFactorySQL::BuildSampler(
BDSMySQLTable* aSQLTable, G4int k)
692 G4double rInnerStart;
694 G4double rOuterStart;
698 length = rOuterStart = rOuterEnd = 10.*CLHEP::mm;
699 rInnerStart = rInnerEnd = 0.0;
709 Name = sqlName->GetStrValue(k);
710 sqlName->SetStrValue(k,Name+
"_SQL");
711 Name = sqlName->GetStrValue(k);
714 {Name = TableName+std::to_string(k)+
"_SQL";}
716 Name = itsMarkerVol->GetName()+
"_"+Name;
718 G4Cons* aSampler =
new G4Cons(Name+
"_samp",
725 CLHEP::twopi*CLHEP::radian);
726 allSolids.insert(aSampler);
727 G4LogicalVolume* aSamplerVol =
728 new G4LogicalVolume(aSampler,
732 lengthUserLimit = length*0.5;
734 aSamplerVol->SetSensitiveDetector(BDSSDManager::Instance()->SamplerPlane());
743G4LogicalVolume* BDSGeometryFactorySQL::BuildTube(
BDSMySQLTable* aSQLTable, G4int k)
752 length = 100.*CLHEP::mm;
753 rOuter = 10.*CLHEP::mm;
756 dphi=2*CLHEP::pi*CLHEP::radian;
764 G4Tubs* aTubs =
new G4Tubs(Name+
"_Tubs",
770 allSolids.insert(aTubs);
771 G4LogicalVolume* aTubsVol =
772 new G4LogicalVolume(aTubs,
776 lengthUserLimit = length*0.5;
780G4LogicalVolume* BDSGeometryFactorySQL::BuildEllipticalTube(
BDSMySQLTable* aSQLTable, G4int k)
787 lengthX = 100.*CLHEP::mm;
788 lengthY = 50.*CLHEP::mm;
789 lengthZ = 200.*CLHEP::mm;
795 G4EllipticalTube* aEllipticalTube =
new G4EllipticalTube(Name+
"_EllipticalTube",
801 allSolids.insert(aEllipticalTube);
802 G4LogicalVolume* aEllipticalTubeVol =
803 new G4LogicalVolume(aEllipticalTube,
806 G4double maxLength = lengthX;
807 if (lengthY>lengthX&&lengthY>lengthZ)
808 {maxLength = lengthY;}
809 else if(lengthZ>lengthY&&lengthZ>lengthX)
810 {maxLength = lengthZ;}
811 lengthUserLimit = maxLength*0.5;
812 return aEllipticalTubeVol;
868G4RotationMatrix* BDSGeometryFactorySQL::RotateComponent(G4double psi,G4double phi,G4double theta)
870 rotateComponent =
new G4RotationMatrix;
871 if(psi==0 && phi==0 && theta==0)
872 {
return rotateComponent;}
874 G4RotationMatrix* LocalRotation =
new G4RotationMatrix;
875 G4ThreeVector* localX =
new G4ThreeVector(1.,0.,0.);
876 G4ThreeVector* localY =
new G4ThreeVector(0.,1.,0.);
877 G4ThreeVector* localZ =
new G4ThreeVector(0.,0.,1.);
879 LocalRotation->rotate(psi,*localZ);
880 localX->rotate(psi,*localZ);
881 localY->rotate(psi,*localZ);
883 LocalRotation->rotate(phi,*localY);
884 localX->rotate(phi,*localY);
885 localZ->rotate(phi,*localY);
887 LocalRotation->rotate(theta,*localX);
888 localY->rotate(theta,*localX);
889 localZ->rotate(theta,*localX);
891 rotateComponent->transform(*LocalRotation);
892 rotateComponent->invert();
894 return rotateComponent;
898 std::vector<G4LogicalVolume*> VOL_LISTIn)
900 for (G4int k=0; k<NVariables; k++)
902 SetPlacementParams(aSQLTable, k);
904 if(!PARENTNAME.empty())
906 PARENTNAME+=
"_LogVol";
907 for (G4int i=0; i<(G4int)VOL_LISTIn.size(); i++)
909#if G4VERSION_NUMBER > 1099
910 if (G4StrUtil::icompare(PARENTNAME, VOL_LISTIn[i]->GetName()) == 0)
912 if(PARENTNAME.compareTo(VOL_LISTIn[i]->GetName(), G4String::ignoreCase)==0)
922 G4String tmpname = Name+
"_LogVol";
924 for (G4int i=0; i<(G4int)VOL_LISTIn.size(); i++)
926#if G4VERSION_NUMBER > 1099
927 if (G4StrUtil::icompare(tmpname, VOL_LISTIn[i]->GetName()) == 0)
929 if(tmpname.compareTo(VOL_LISTIn[i]->GetName(), G4String::ignoreCase)==0)
938 {sensitiveComponents.insert(VOL_LISTIn[ID]);}
939 G4ThreeVector PlacementPoint(PosX,PosY,PosZ);
941 if(!InheritStyle.empty())
943#if G4VERSION_NUMBER > 1099
944 if (G4StrUtil::icompare(InheritStyle,
"SUBTRACT") == 0)
946 if(InheritStyle.compareTo(
"SUBTRACT", G4String::ignoreCase)==0)
949 G4VSolid* original = VOL_LISTIn[PARENTID]->GetSolid();
950 G4VSolid* sub = VOL_LISTIn[ID]->GetSolid();
951 VOL_LISTIn[PARENTID]->SetSolid(
new G4SubtractionSolid(VOL_LISTIn[PARENTID]->GetName(),
954 RotateComponent(RotPsi,RotPhi,RotTheta),
958#if G4VERSION_NUMBER > 1099
959 if (G4StrUtil::icompare(InheritStyle,
"INTERSECT") == 0)
961 else if(InheritStyle.compareTo(
"INTERSECT", G4String::ignoreCase)==0)
964 G4VSolid* original = VOL_LISTIn[PARENTID]->GetSolid();
965 G4VSolid* sub = VOL_LISTIn[ID]->GetSolid();
966 VOL_LISTIn[PARENTID]->SetSolid(
new G4IntersectionSolid(VOL_LISTIn[PARENTID]->GetName(),
969 RotateComponent(RotPsi,RotPhi,RotTheta),
973#if G4VERSION_NUMBER > 1099
974 if (G4StrUtil::icompare(InheritStyle,
"UNION") == 0)
976 else if(InheritStyle.compareTo(
"UNION", G4String::ignoreCase)==0)
979 G4VSolid* original = VOL_LISTIn[PARENTID]->GetSolid();
980 G4VSolid* sub = VOL_LISTIn[ID]->GetSolid();
981 VOL_LISTIn[PARENTID]->SetSolid(
new G4UnionSolid(VOL_LISTIn[PARENTID]->GetName(),
984 RotateComponent(RotPsi,RotPhi,RotTheta),
990 G4cout << __METHOD_NAME__ <<
" k = " << k <<
", volume = " << VOL_LISTIn[ID]->GetName() << G4endl;
993 G4LogicalVolume* volume = VOL_LISTIn[ID];
994 G4int copyNumber = 0;
997 {copyNumber = result->second;}
1000 G4VSolid* solid = volume->GetSolid();
1001 BDSExtent ext = unShiftedExtents[solid];
1005 G4VPhysicalVolume* PhysiComp =
1006 new G4PVPlacement(RotateComponent(RotPsi,RotPhi,RotTheta),
1010 VOL_LISTIn[PARENTID],
1019 G4cerr<<
"\nBDSGeometryFactorySQL.cc:486: Trying to align in-beam to SQL volume to " << PhysiComp->GetName() <<
" but alignment already set to " << alignInVolume->GetName() << G4endl;
1020 G4Exception(
"Aborting Program",
"-1", FatalException,
"");
1024 {alignInVolume = PhysiComp;}
1031 G4cerr<<
"\nBDSGeometryFactorySQL.cc:486: Trying to align out-beam to SQL volume to " << PhysiComp->GetName() <<
" but alignment already set to " << alignOutVolume->GetName() << G4endl;
1032 G4Exception(
"Aborting Program",
"-1", FatalException,
"");
1035 {alignOutVolume = PhysiComp;}
1040#if G4VERSION_NUMBER > 1099
1041 if (G4StrUtil::icompare(MagType,
"QUAD") == 0)
1043 if(MagType.compareTo(
"QUAD", G4String::ignoreCase)==0)
1048 QuadBgrad.push_back(- brho * K1 / CLHEP::m2);
1049 Quadvol.push_back(PhysiComp->GetName());
1050 quadVolBgrad[PhysiComp->GetName()]=(- brho * K1 / CLHEP::m2);
1052#if G4VERSION_NUMBER > 1099
1053 if (G4StrUtil::icompare(MagType,
"SEXT") == 0)
1055 if(MagType.compareTo(
"SEXT", G4String::ignoreCase)==0)
1060 SextBgrad.push_back(- brho * K2 / CLHEP::m3);
1061 Sextvol.push_back(PhysiComp->GetName());
1062 sextVolBgrad[PhysiComp->GetName()]=(- brho * K2 / CLHEP::m3);
1064#if G4VERSION_NUMBER > 1099
1065 if (G4StrUtil::icompare(MagType,
"OCT") == 0)
1067 if(MagType.compareTo(
"OCT", G4String::ignoreCase)==0)
1072 OctBgrad.push_back(- brho * K3 / (CLHEP::m2*CLHEP::m2));
1073 Octvol.push_back(PhysiComp->GetName());
1074 octVolBgrad[PhysiComp->GetName()]=(- brho * K3 / (CLHEP::m2*CLHEP::m2));
1077 if(FieldX || FieldY || FieldZ)
1082 G4cout <<
"BDSGeometryFactorySQL> volume " << PhysiComp->GetName() <<
" has the following uniform field: " << FieldX <<
" " << FieldY <<
" " << FieldZ <<
" " << G4endl;
1084 UniformField.emplace_back(G4ThreeVector(FieldX*CLHEP::tesla,
1085 FieldY*CLHEP::tesla,
1086 FieldZ*CLHEP::tesla));
1087 Fieldvol.push_back(PhysiComp->GetName());
1088 uniformFieldVolField[PhysiComp->GetName()]=G4ThreeVector(FieldX*CLHEP::tesla,
1089 FieldY*CLHEP::tesla,
1090 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.