18#include "BDSEventGeneratorFileType.hh"
20#include "BDSException.hh"
21#include "BDSUtilities.hh"
32 new std::map<BDSEventGeneratorFileType, std::string> ({
33 {BDSEventGeneratorFileType::hepmc2,
"hepmc2"},
34 {BDSEventGeneratorFileType::hepmc3,
"hepmc3"},
35 {BDSEventGeneratorFileType::hpe,
"hpe"},
36 {BDSEventGeneratorFileType::root,
"root"},
37 {BDSEventGeneratorFileType::treeroot,
"treeroot"},
38 {BDSEventGeneratorFileType::lhef,
"lhef"},
43 std::map<G4String, BDSEventGeneratorFileType> types;
45 types[
"hepmc2"] = BDSEventGeneratorFileType::hepmc2;
46 types[
"hepmc3"] = BDSEventGeneratorFileType::hepmc3;
47 types[
"hpe"] = BDSEventGeneratorFileType::hpe;
48 types[
"root"] = BDSEventGeneratorFileType::root;
49 types[
"treeroot"] = BDSEventGeneratorFileType::treeroot;
50 types[
"lhef"] = BDSEventGeneratorFileType::lhef;
54 auto result = types.find(distrType);
55 if (result == types.end())
57 G4String msg =
"\"" + distrType +
"\" is not a valid event generator file format\n";
58 msg +=
"Available formats are:\n";
59 for (
const auto& it : types)
60 {msg +=
"\"" + it.first +
"\"\n";}
65 G4cout << __METHOD_NAME__ <<
"determined event generator file format to be " << result->second << G4endl;
67 return result->second;
General exception with possible name of object and message.
static std::map< BDSTypeSafeEnum< eventgeneratorfiletypes_def, int >, std::string > * dictionary
BDSEventGeneratorFileType DetermineEventGeneratorFileType(G4String distrType)
Function that gives corresponding enum value for string (case-insensitive).
G4String LowerCase(const G4String &str)
Utility function to simplify lots of syntax changes for pedantic g4 changes.