18#include "BDSCrystalType.hh"
20#include "BDSException.hh"
21#include "BDSUtilities.hh"
32 new std::map<BDSCrystalType, std::string> ({
33 {BDSCrystalType::box,
"box"},
34 {BDSCrystalType::cylinder,
"cylinder"},
35 {BDSCrystalType::torus,
"torus"}
40 std::map<G4String, BDSCrystalType> types;
41 types[
"box"] = BDSCrystalType::box;
42 types[
"cylinder"] = BDSCrystalType::cylinder;
43 types[
"torus"] = BDSCrystalType::torus;
47 auto result = types.find(crystalType);
48 if (result == types.end())
50 G4String msg =
"\"" + crystalType +
"\" is not a valid crystal shape\n";
51 msg +=
"Available crystal shapes are:\n";
52 for (
const auto& it : types)
53 {msg +=
"\"" + it.first +
"\"\n";}
58 G4cout << __METHOD_NAME__ <<
" determined crystal shape to be " << result->second << G4endl;
60 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.