Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Commit dc1d606

Browse files
patch constructor call to model
new patch switched to enums
1 parent c8c5c77 commit dc1d606

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/SimCore/APrimePhysics.cxx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,24 @@ void APrimePhysics::ConstructProcess() {
4242
auto model{parameters_.getParameter<framework::config::Parameters>("model")};
4343
auto model_name{model.getParameter<std::string>("name")};
4444
if (model_name == "vertex_library" or model_name == "g4db") {
45+
static const std::map<std::string,g4db::G4DarkBreMModel::ScalingMethod> method_lut = {
46+
{ "forward_only", g4db::G4DarkBreMModel::ScalingMethod::ForwardOnly },
47+
{ "cm_scaling" , g4db::G4DarkBreMModel::ScalingMethod::CMScaling },
48+
{ "undefined" , g4db::G4DarkBreMModel::ScalingMethod::Undefined }
49+
};
50+
auto scaling_method_it{method_lut.find(model.getParameter<std::string>("method"))};
51+
if (scaling_method_it == method_lut.end()) {
52+
EXCEPTION_RAISE("BadConf","Unrecognized scaling method '"+
53+
model.getParameter<std::string>("method") + "',"
54+
" options are 'forward_only', 'cm_scaling', or 'undefined'.");
55+
}
4556
auto proc = new G4DarkBremsstrahlung(
4657
std::make_shared<g4db::G4DarkBreMModel>(
47-
model.getParameter<std::string>("method"),
58+
model.getParameter<std::string>("library_path"),
59+
false /* dark brem off muons instead of electrons - we always DB off electrons here */,
4860
model.getParameter<double>("threshold"),
4961
model.getParameter<double>("epsilon"),
50-
model.getParameter<std::string>("library_path"),
51-
false /* dark brem off muons instead of electrons - we always DB off electrons here */),
62+
scaling_method_it->second),
5263
parameters_.getParameter<bool>("only_one_per_event"),
5364
1., /* global bias - should use bias operator instead */
5465
parameters_.getParameter<bool>("cache_xsec"));

0 commit comments

Comments
 (0)