LDMX Software
GenieNuclearPhysics.cxx
Go to the documentation of this file.
1
7
8#include "G4Electron.hh"
9#include "G4ProcessManager.hh"
10#include "G4ProcessTable.hh"
12
13namespace simcore {
14
15const std::string GenieNuclearPhysics::NAME = "GenieNuclear";
16
19 : G4VPhysicsConstructor(NAME), params_{params} {
20 enable_ = params_.get<bool>("enable", false);
21}
22
24 // No new particles — we only replace an existing process
25}
26
28 if (!enable_) {
29 ldmx_log(info) << "GENIE electronuclear process is not enabled";
30 return;
31 }
32
33 ldmx_log(info) << "Setting up GENIE electronuclear process...";
34
35 G4ProcessManager* process_manager =
36 G4Electron::Definition()->GetProcessManager();
37 if (!process_manager) {
38 EXCEPTION_RAISE("GenieNuclearPhysics",
39 "Unable to access the electron process manager!");
40 }
41
42 // Find and remove the built-in electronNuclear process
43 G4VProcess* existing =
44 G4ProcessTable::GetProcessTable()->FindProcess("electronNuclear", "e-");
45 if (existing) {
46 ldmx_log(info) << "Removing built-in electronNuclear process";
47 process_manager->RemoveProcess(existing);
48 } else {
49 ldmx_log(info)
50 << "No built-in electronNuclear process found — adding GENIE process";
51 }
52
53 // Create and register the GENIE-based process
54 auto* genie_process = new GenieElectroNuclearProcess(params_);
55 process_manager->AddDiscreteProcess(genie_process);
56
57 // Set ordering to first so biasing framework always sees it
58 process_manager->SetProcessOrderingToFirst(genie_process,
59 G4ProcessVectorDoItIndex::idxAll);
60
61 ldmx_log(info) << "GENIE electronuclear process registered successfully";
62}
63
64} // namespace simcore
G4VDiscreteProcess that uses GENIE to simulate electronuclear interactions as the electron traverses ...
G4VPhysicsConstructor that registers the GENIE electronuclear process with the electron.
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
Geant4 discrete process that fires GENIE electronuclear interactions.
framework::config::Parameters params_
Stored configuration to forward to the process.
GenieNuclearPhysics(const framework::config::Parameters &params)
Constructor.
void ConstructProcess() override
Remove the built-in electronNuclear process and register the GENIE-based replacement.
static const std::string NAME
Name of this physics constructor.
bool enable_
Is the GENIE process enabled?
void ConstructParticle() override
No new particles to construct.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...