19#include "BDSCavityType.hh"
21#include "BDSException.hh"
22#include "BDSUtilities.hh"
33 new std::map<BDSCavityType, std::string> ({
34 {BDSCavityType::elliptical,
"elliptical"},
35 {BDSCavityType::rectangular,
"rectangular"},
36 {BDSCavityType::pillbox,
"pillbox"}
41 std::map<G4String, BDSCavityType> types;
42 types[
"elliptical"] = BDSCavityType::elliptical;
43 types[
"rectangular"] = BDSCavityType::rectangular;
44 types[
"pillbox"] = BDSCavityType::pillbox;
48 auto result = types.find(cavityType);
49 if (result == types.end())
51 G4String msg =
"\"" + cavityType +
"\" is not a valid cavity type\n";
52 msg +=
"Available cavity types are:\n";
53 for (
const auto& it : types)
54 {msg +=
"\"" + it.first +
"\"\n";}
59 G4cout << __METHOD_NAME__ <<
" determined cavity type to be " << result->second << G4endl;
61 return result->second;
General exception with possible name of object and message.
static std::map< BDSTypeSafeEnum< cavitytypes_def, int >, std::string > * dictionary
G4String LowerCase(const G4String &str)
Utility function to simplify lots of syntax changes for pedantic g4 changes.
BDSCavityType DetermineCavityType(G4String cavityType)
function to determine the enum type of the cavity geometry (case-insensitive)