LDMX Software
GammaPhysics.cxx
Go to the documentation of this file.
1
9
10namespace simcore {
11
12GammaPhysics::GammaPhysics(const G4String& name,
13 const framework::config::Parameters& parameters)
14 : G4VPhysicsConstructor(name),
15 model_parameters_{
16 parameters.get<framework::config::Parameters>("photonuclear_model")} {
17}
18
20
22 G4ProcessManager* process_manager = G4Gamma::Gamma()->GetProcessManager();
23 if (process_manager == nullptr) {
24 EXCEPTION_RAISE("GammaPhysics",
25 "Was unable to access the process manager for photons, "
26 "something is very wrong!");
27 }
28 // configure our PN model based on runtime parameters
29 auto pn = PhotoNuclearModel::Factory::get().make(
30 model_parameters_.get<std::string>("class_name"),
31 model_parameters_.get<std::string>("instance_name"), model_parameters_);
32 if (not pn) {
33 EXCEPTION_RAISE("UnableToCreate",
34 "Unable to create a PhotoNuclearModel of type " +
35 model_parameters_.get<std::string>("class_name"));
36 }
37 pn.value()->removeExistingModel(process_manager);
38 pn.value()->constructGammaProcess(process_manager);
57 const auto processes{process_manager->GetProcessList()};
58 for (int i{0}; i < processes->size(); i++) {
59 const auto process{(*processes)[i]};
60 if (process->GetProcessName() == "photonNuclear") {
61 process_manager->SetProcessOrderingToFirst(
62 process, G4ProcessVectorDoItIndex::idxAll);
63 }
64 }
65 // Add the gamma -> mumu to the physics list.
66 process_manager->AddDiscreteProcess(&gamma_conv_process_);
67}
68} // namespace simcore
Class used to enhanced the gamma physics list.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:29
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78
GammaPhysics(const G4String &name, const framework::config::Parameters &parameters)
Class constructor.
G4GammaConversionToMuons gamma_conv_process_
The gamma to muons process.
void ConstructProcess() final
We do two things for this call back during initialization.
void ConstructParticle() final
Construct particles.
framework::config::Parameters model_parameters_
Parameters from the configuration to pass along to the photonuclear model.
All classes in the ldmx-sw project use this namespace.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...