19#include "BDSBeamPipeInfo.hh"
20#include "BDSBeamPipeType.hh"
22#include "BDSException.hh"
23#include "BDSExtent.hh"
24#include "BDSMaterials.hh"
25#include "BDSUtilities.hh"
28#include "G4Material.hh"
36 G4Material* vacuumMaterialIn,
37 G4double beamPipeThicknessIn,
38 G4Material* beamPipeMaterialIn,
39 const G4ThreeVector& inputFaceNormalIn,
40 const G4ThreeVector& outputFaceNormalIn,
41 const G4String& pointsFileNameIn,
42 const G4String& pointsUnitIn):
43 beamPipeType(beamPipeTypeIn),
44 aper1(aper1In), aper2(aper2In), aper3(aper3In), aper4(aper4In),
45 aperOffsetX(0), aperOffsetY(0),
46 vacuumMaterial(vacuumMaterialIn),
47 beamPipeThickness(beamPipeThicknessIn),
48 beamPipeMaterial(beamPipeMaterialIn),
49 inputFaceNormal(inputFaceNormalIn),
50 outputFaceNormal(outputFaceNormalIn),
51 pointsFileName(pointsFileNameIn),
52 pointsUnit(pointsUnitIn)
62 const G4String& vacuumMaterialIn,
63 G4double beamPipeThicknessIn,
64 const G4String& beamPipeMaterialIn,
65 const G4ThreeVector& inputFaceNormalIn,
66 const G4ThreeVector& outputFaceNormalIn):
67 aper1(aper1In), aper2(aper2In), aper3(aper3In), aper4(aper4In),
68 aperOffsetX(0), aperOffsetY(0),
69 beamPipeThickness(beamPipeThicknessIn),
70 inputFaceNormal(inputFaceNormalIn),
71 outputFaceNormal(outputFaceNormalIn),
85 const G4String& beamPipeTypeIn,
90 const G4String& vacuumMaterialIn,
91 G4double beamPipeThicknessIn,
92 const G4String& beamPipeMaterialIn,
93 const G4ThreeVector& inputFaceNormalIn,
94 const G4ThreeVector& outputFaceNormalIn):
95 aperOffsetX(0), aperOffsetY(0),
96 inputFaceNormal(inputFaceNormalIn),
97 outputFaceNormal(outputFaceNormalIn)
99 if (beamPipeTypeIn.empty())
133 if (vacuumMaterialIn ==
"")
137 if (beamPipeMaterialIn ==
"")
148 G4String fname = typeAndFileName.second;
166 case BDSBeamPipeType::circular:
168 case BDSBeamPipeType::elliptical:
170 case BDSBeamPipeType::rectangular:
172 case BDSBeamPipeType::lhc:
174 case BDSBeamPipeType::lhcdetailed:
176 case BDSBeamPipeType::rectellipse:
178 case BDSBeamPipeType::racetrack:
180 case BDSBeamPipeType::octagonal:
182 case BDSBeamPipeType::clicpcl:
195 case BDSBeamPipeType::circular:
196 case BDSBeamPipeType::circularvacuum:
202 case BDSBeamPipeType::elliptical:
203 case BDSBeamPipeType::rectangular:
204 case BDSBeamPipeType::octagonal:
210 case BDSBeamPipeType::lhc:
211 case BDSBeamPipeType::lhcdetailed:
212 case BDSBeamPipeType::rectellipse:
218 case BDSBeamPipeType::racetrack:
224 case BDSBeamPipeType::clicpcl:
230 extentYLow, extentYHigh,
244 G4double extX = extentInner.
XPos();
245 G4double extY = extentInner.
YPos();
269 G4cout << __METHOD_NAME__ << G4endl;
270 G4cout <<
"aper1: " <<
aper1 <<
" check it? " << setAper1 << G4endl;
271 G4cout <<
"aper2: " <<
aper2 <<
" check it? " << setAper2 << G4endl;
272 G4cout <<
"aper3: " <<
aper3 <<
" check it? " << setAper3 << G4endl;
273 G4cout <<
"aper4: " <<
aper4 <<
" check it? " << setAper4 << G4endl;
275 G4bool shouldExit =
false;
279 {G4cerr <<
"\"aper1\" not set, but required to be" << G4endl; shouldExit =
true;}
285 {G4cerr <<
"\"aper2\" not set, but required to be" << G4endl; shouldExit =
true;}
291 {G4cerr <<
"\"aper3\" not set, but required to be" << G4endl; shouldExit =
true;}
297 {G4cerr <<
"\"aper4\" not set, but required to be" << G4endl; shouldExit =
true;}
301 {
throw BDSException(__METHOD_NAME__,
"aperture parameter missing");}
324 {
throw BDSException(__METHOD_NAME__,
"\"aper3\" > \"aper1\" (or \"beamPipeRadius\") for lhc aperture model - will not produce desired shape");}
327 {
throw BDSException(__METHOD_NAME__,
"\"aper3\" > \"aper2\" (or \"beamPipeRadius\") for lhc aperture model - will not produce desired shape");}
352 {
throw BDSException(__METHOD_NAME__,
"aper3 is >= aper1 - invalid for an octagonal aperture");}
354 {
throw BDSException(__METHOD_NAME__,
"aper4 is >= aper2 - invalid for an octagonal aperture");}
Holder class for all information required to describe a beam pipe model.
G4double IndicativeRadiusInner() const
Return an indicative inner extent for the beam pipe vacuum.
G4Material * beamPipeMaterial
Public member for direct access.
G4double aper3
Public member for direct access.
G4String pointsUnit
Public member for direct access.
BDSBeamPipeInfo()=delete
Deleted default constructor to ensure one of supplied constructors is used.
void InfoOKForLHC()
Aperture info check for lhc aperture.
G4double aper1
Public member for direct access.
void InfoOKForOctagonal()
Aperture info check for octagonal aperture.
G4Material * vacuumMaterial
Public member for direct access.
void CheckAndSetPointsInfo(const G4String &beamPipeTypeIn)
Parse the type string to extract the file name and the optional units and assign to member variables.
void InfoOKForClicPCL()
Aperture info check for CLIC PCL aperture.
G4double beamPipeThickness
Public member for direct access.
void InfoOKForRaceTrack()
Aperture info check for racetrack aperture.
void InfoOKForElliptical()
Aperture info check for elliptical aperture.
BDSExtent ExtentInner() const
Return an extent for just the raw aperture.
void InfoOKForRectEllipse()
Aperture info check for rectellipse aperture.
G4String pointsFileName
Public member for direct access.
G4double aper4
Public member for direct access.
void InfoOKForLHCDetailed()
Aperture info check for lhc detailed aperture.
void InfoOKForCircular()
Aperture info check for circular aperture.
void CheckRequiredParametersSet(G4bool setAper1, G4bool setAper2, G4bool setAper3, G4bool setAper4)
void InfoOKForRectangular()
Aperture info check for rectangular aperture.
G4double IndicativeRadius() const
Return an indicative extent of the beam pipe - typically the maximum of x or y extent.
G4double aper2
Public member for direct access.
BDSBeamPipeType beamPipeType
Public member for direct access.
General exception with possible name of object and message.
Holder for +- extents in 3 dimensions.
G4double XPos() const
Accessor.
G4double MaximumAbsTransverse() const
Return the maximum absolute value considering only x,y.
G4double MinimumAbsTransverse() const
Return the minimum absolute value considering only x,y.
G4double YPos() const
Accessor.
static BDSMaterials * Instance()
Singleton pattern access.
G4Material * GetMaterial(G4String material) const
Get material by name.
type underlying() const
return underlying value (can be used in switch statement)
std::pair< G4String, G4String > SplitOnColon(const G4String &formatAndPath)
G4bool StrContains(const G4String &str, const G4String &test)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
BDSBeamPipeType DetermineBeamPipeType(G4String apertureType)
Function that gives corresponding enum value for string (case-insensitive).
G4bool IsFinite(G4double value, G4double tolerance=std::numeric_limits< double >::epsilon())