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