|
LDMX Software
|
Geant4 discrete process that fires GENIE electronuclear interactions. More...
#include <GenieElectroNuclearProcess.h>
Public Member Functions | |
| GenieElectroNuclearProcess (const framework::config::Parameters ¶ms) | |
| Constructor. | |
| ~GenieElectroNuclearProcess () override | |
| Destructor. | |
| G4bool | IsApplicable (const G4ParticleDefinition &p) override |
| G4VParticleChange * | PostStepDoIt (const G4Track &track, const G4Step &step) override |
| Called by Geant4 when this process fires. | |
| void | setOnlyOnePerEvent (bool val) |
| Set whether to allow only one interaction per event. | |
Static Public Attributes | |
| static const std::string | PROCESS_NAME = "electronNuclear" |
| Process name — matches the built-in so the bias operator works unchanged. | |
Protected Member Functions | |
| G4double | GetMeanFreePath (const G4Track &track, G4double prevStepSize, G4ForceCondition *condition) override |
| Calculate the mean free path for the electronuclear process. | |
Private Member Functions | |
| void | initializeGENIE () |
| Initialize the GENIE framework (tune, message thresholds, splines) | |
| void | loadAvailableTargets () |
| Parse the spline file for the set of target nuclei that have cross-section splines available. | |
| bool | splineAvailable (int target_code) const |
| void | setupDrivers () |
| Set up GEVGDrivers for each target isotope (manual mode) | |
| void | discoverIsotopesForElement (const G4Element *element) |
| Discover isotopes from a G4Element and set up GENIE drivers (auto mode) | |
| void | discoverFromVolume () |
| One-shot auto-discovery of target isotopes from the configured volume. | |
Private Attributes | |
| std::vector< std::unique_ptr< genie::GEVGDriver > > | evg_drivers_ |
| One GENIE event generator driver per target isotope. | |
| genie::HepMC3Converter | hep_mc3_converter_ |
| Converter from GENIE EventRecord to HepMC3. | |
| std::vector< int > | targets_ |
| GENIE target codes (10LZZZAAAI format) | |
| std::vector< double > | abundances_ |
| Relative abundances for each target. | |
| std::string | tune_ |
| GENIE tune name. | |
| std::string | spline_file_ |
| Path to GENIE cross-section spline file. | |
| std::string | message_threshold_file_ |
| Path to GENIE message threshold configuration. | |
| bool | only_one_per_event_ {true} |
| Only allow one EN interaction per event (then deactivate) | |
| bool | genie_initialized_ {false} |
| Flag to lazily sync GENIE random seed on first event. | |
| bool | auto_discover_ {false} |
| Whether targets are auto-discovered from the Geant4 geometry. | |
| std::string | discover_volume_ |
| Name of the volume to auto-discover targets from (e.g. | |
| std::set< int > | discovered_z_ |
| Z values already checked for isotope discovery. | |
| std::set< int > | available_targets_ |
| Target nuclei (10LZZZAAAI codes) that have splines in the spline file. | |
| std::map< int, std::vector< std::pair< int, double > > > | z_to_targets_ |
| Lookup map: element Z -> list of (driver_index, abundance). | |
| std::vector< double > | partial_sum_sigma_ |
| Partial cross-section sums per element, used to select the target isotope in PostStepDoIt via weighted random sampling. | |
Geant4 discrete process that fires GENIE electronuclear interactions.
Replaces the built-in Geant4 "electronNuclear" process so that the existing ElectroNuclear bias operator works without modification. Follows the same architectural pattern as G4DarkBremsstrahlung.
The electron is tracked normally through upstream material (tagger, etc.) with natural energy loss. When Geant4 selects this process to fire, GENIE generates the interaction using the electron's actual energy at that point. The GENIE final-state particles are injected as Geant4 secondaries and the primary electron is killed.
Definition at line 40 of file GenieElectroNuclearProcess.h.
| simcore::GenieElectroNuclearProcess::GenieElectroNuclearProcess | ( | const framework::config::Parameters & | params | ) |
Constructor.
Initializes GENIE (tune, splines, event generator drivers) and builds the Z-to-target lookup map for fast material matching.
| params | Configuration parameters (targets, abundances, tune, etc.) |
Definition at line 53 of file GenieElectroNuclearProcess.cxx.
References abundances_, auto_discover_, discover_volume_, framework::config::Parameters::get(), initializeGENIE(), message_threshold_file_, only_one_per_event_, setupDrivers(), spline_file_, targets_, tune_, and z_to_targets_.
|
override |
Destructor.
Definition at line 112 of file GenieElectroNuclearProcess.cxx.
References abundances_, and targets_.
|
private |
One-shot auto-discovery of target isotopes from the configured volume.
Looks up every G4LogicalVolume matching discover_volume_ (using the same name/region tests as the ElectroNuclear bias operator), and sets up GENIE drivers for the elements of their materials. Called once on the first GetMeanFreePath, after the geometry has been built.
Definition at line 294 of file GenieElectroNuclearProcess.cxx.
References discover_volume_, discoverIsotopesForElement(), and evg_drivers_.
Referenced by GetMeanFreePath().
|
private |
Discover isotopes from a G4Element and set up GENIE drivers (auto mode)
Definition at line 209 of file GenieElectroNuclearProcess.cxx.
References abundances_, discovered_z_, evg_drivers_, splineAvailable(), targets_, and z_to_targets_.
Referenced by discoverFromVolume().
|
overrideprotected |
Calculate the mean free path for the electronuclear process.
Loops over elements in the current material, looks up matching GENIE targets by Z, queries GENIE for the cross section, and returns 1/SIGMA.
Definition at line 345 of file GenieElectroNuclearProcess.cxx.
References auto_discover_, discoverFromVolume(), evg_drivers_, IsApplicable(), partial_sum_sigma_, and z_to_targets_.
|
private |
Initialize the GENIE framework (tune, message thresholds, splines)
Definition at line 121 of file GenieElectroNuclearProcess.cxx.
References loadAvailableTargets(), message_threshold_file_, spline_file_, and tune_.
Referenced by GenieElectroNuclearProcess().
|
override |
Definition at line 341 of file GenieElectroNuclearProcess.cxx.
Referenced by GetMeanFreePath().
|
private |
Parse the spline file for the set of target nuclei that have cross-section splines available.
Used to skip discovered isotopes without splines, which GENIE would otherwise compute on the fly (prohibitively slow).
Definition at line 147 of file GenieElectroNuclearProcess.cxx.
References available_targets_, and spline_file_.
Referenced by initializeGENIE().
|
override |
Called by Geant4 when this process fires.
Generates a GENIE event at the electron's current energy, injects final-state particles as secondaries, stores the HepMC3 record, and kills the primary electron.
Definition at line 408 of file GenieElectroNuclearProcess.cxx.
References evg_drivers_, genie_initialized_, hep_mc3_converter_, only_one_per_event_, partial_sum_sigma_, PROCESS_NAME, and z_to_targets_.
|
inline |
Set whether to allow only one interaction per event.
Definition at line 74 of file GenieElectroNuclearProcess.h.
References only_one_per_event_.
|
private |
Set up GEVGDrivers for each target isotope (manual mode)
Definition at line 186 of file GenieElectroNuclearProcess.cxx.
References evg_drivers_, spline_file_, splineAvailable(), and targets_.
Referenced by GenieElectroNuclearProcess().
|
private |
target_code, or if the available-target list could not be determined (fail open). Definition at line 180 of file GenieElectroNuclearProcess.cxx.
References available_targets_.
Referenced by discoverIsotopesForElement(), and setupDrivers().
|
private |
Relative abundances for each target.
Definition at line 130 of file GenieElectroNuclearProcess.h.
Referenced by discoverIsotopesForElement(), GenieElectroNuclearProcess(), and ~GenieElectroNuclearProcess().
|
private |
Whether targets are auto-discovered from the Geant4 geometry.
Definition at line 148 of file GenieElectroNuclearProcess.h.
Referenced by GenieElectroNuclearProcess(), and GetMeanFreePath().
|
private |
Target nuclei (10LZZZAAAI codes) that have splines in the spline file.
Empty if the spline file could not be parsed (then no filtering is done).
Definition at line 159 of file GenieElectroNuclearProcess.h.
Referenced by loadAvailableTargets(), and splineAvailable().
|
private |
Name of the volume to auto-discover targets from (e.g.
"target_region"). Uses the same naming convention as the ElectroNuclear bias operator.
Definition at line 152 of file GenieElectroNuclearProcess.h.
Referenced by discoverFromVolume(), and GenieElectroNuclearProcess().
|
private |
Z values already checked for isotope discovery.
Definition at line 155 of file GenieElectroNuclearProcess.h.
Referenced by discoverIsotopesForElement().
|
private |
One GENIE event generator driver per target isotope.
Definition at line 121 of file GenieElectroNuclearProcess.h.
Referenced by discoverFromVolume(), discoverIsotopesForElement(), GetMeanFreePath(), PostStepDoIt(), and setupDrivers().
|
private |
Flag to lazily sync GENIE random seed on first event.
Definition at line 145 of file GenieElectroNuclearProcess.h.
Referenced by PostStepDoIt().
|
private |
Converter from GENIE EventRecord to HepMC3.
Definition at line 124 of file GenieElectroNuclearProcess.h.
Referenced by PostStepDoIt().
|
private |
Path to GENIE message threshold configuration.
Definition at line 139 of file GenieElectroNuclearProcess.h.
Referenced by GenieElectroNuclearProcess(), and initializeGENIE().
|
private |
Only allow one EN interaction per event (then deactivate)
Definition at line 142 of file GenieElectroNuclearProcess.h.
Referenced by GenieElectroNuclearProcess(), PostStepDoIt(), and setOnlyOnePerEvent().
|
private |
Partial cross-section sums per element, used to select the target isotope in PostStepDoIt via weighted random sampling.
Indexed the same as the material's element vector.
Definition at line 173 of file GenieElectroNuclearProcess.h.
Referenced by GetMeanFreePath(), and PostStepDoIt().
|
static |
Process name — matches the built-in so the bias operator works unchanged.
Definition at line 43 of file GenieElectroNuclearProcess.h.
Referenced by PostStepDoIt(), and simcore::RunManager::TerminateOneEvent().
|
private |
Path to GENIE cross-section spline file.
Definition at line 136 of file GenieElectroNuclearProcess.h.
Referenced by GenieElectroNuclearProcess(), initializeGENIE(), loadAvailableTargets(), and setupDrivers().
|
private |
GENIE target codes (10LZZZAAAI format)
Definition at line 127 of file GenieElectroNuclearProcess.h.
Referenced by discoverIsotopesForElement(), GenieElectroNuclearProcess(), setupDrivers(), and ~GenieElectroNuclearProcess().
|
private |
GENIE tune name.
Definition at line 133 of file GenieElectroNuclearProcess.h.
Referenced by GenieElectroNuclearProcess(), and initializeGENIE().
|
private |
Lookup map: element Z -> list of (driver_index, abundance).
Built at construction time for fast material matching in GetMeanFreePath.
Definition at line 166 of file GenieElectroNuclearProcess.h.
Referenced by discoverIsotopesForElement(), GenieElectroNuclearProcess(), GetMeanFreePath(), and PostStepDoIt().