20#include "BDSException.hh"
21#include "BDSTunnelType.hh"
22#include "BDSUtilities.hh"
33 new std::map<BDSTunnelType, std::string> ({
34 {BDSTunnelType::circular,
"circular"},
35 {BDSTunnelType::elliptical,
"elliptical"},
36 {BDSTunnelType::square,
"square"},
37 {BDSTunnelType::rectangular,
"rectangular"},
38 {BDSTunnelType::rectaboveground,
"rectaboveground"},
39 {BDSTunnelType::ilc,
"ilc"}
44 std::map<G4String, BDSTunnelType> types;
45 types[
"circular"] = BDSTunnelType::circular;
46 types[
"elliptical"] = BDSTunnelType::elliptical;
47 types[
"square"] = BDSTunnelType::square;
48 types[
"rectangular"] = BDSTunnelType::rectangular;
49 types[
"ilc"] = BDSTunnelType::ilc;
50 types[
"rectaboveground"] = BDSTunnelType::rectaboveground;
54 auto result = types.find(tunnelType);
55 if (result == types.end() )
57 G4String msg =
"\"" + tunnelType +
"\" is not a valid tunnel type\n";
58 msg +=
"Available tunnel types are:\n";
59 for (
const auto& it : types)
60 {msg +=
"\"" + it.first +
"\"\n";}
65 G4cout << __METHOD_NAME__ <<
" determined tunnel type to be " << result->second << G4endl;
67 return result->second;
General exception with possible name of object and message.
static std::map< BDSTypeSafeEnum< tunneltypes_def, int >, std::string > * dictionary
G4String LowerCase(const G4String &str)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
BDSTunnelType DetermineTunnelType(G4String tunnelType)
Function to determine the enum type of the tunnel (case-insensitive)