LDMX Software
BertiniSingleNeutronModel.cxx
1
2#include "SimCore/PhotoNuclearModels/BertiniSingleNeutronModel.h"
3namespace simcore {
4
5bool BertiniSingleNeutronProcess::acceptEvent() const {
6 int nhard{0};
7 int nhard_neutron{0};
8 int secondaries{theParticleChange.GetNumberOfSecondaries()};
9 for (int i{0}; i < secondaries; ++i) {
10 const auto secondary{theParticleChange.GetSecondary(i)->GetParticle()};
11 const auto pdg_code{secondary->GetDefinition()->GetPDGEncoding()};
12 if (skipCountingParticle(pdg_code)) {
13 continue;
14 }
15 const auto energy{secondary->GetKineticEnergy()};
16 if (energy > threshold_) {
17 nhard++;
18 if (pdg_code == 2112) {
19 nhard_neutron++;
20 }
21 }
22 }
23 return nhard == 1 && nhard_neutron == 1;
24}
25
27 G4ProcessManager* processManager) {
28 auto photo_nuclear_process{
29 new G4HadronInelasticProcess("photonNuclear", G4Gamma::Definition())};
30 auto model{new BertiniSingleNeutronProcess{threshold_, zmin_, emin_,
31 count_light_ions_}};
32 model->SetMaxEnergy(15 * CLHEP::GeV);
33 addPNCrossSectionData(photo_nuclear_process);
34 photo_nuclear_process->RegisterMe(model);
35 processManager->AddDiscreteProcess(photo_nuclear_process);
36}
37} // namespace simcore
38
39DECLARE_PHOTONUCLEAR_MODEL(simcore::BertiniSingleNeutronModel)
constexpr bool skipCountingParticle(const int pdgcode) const
Whether or not to include a particular particle type in any counting.
void constructGammaProcess(G4ProcessManager *processManager)
The primary part of the model interface, responsible for adding the desired G4HadronicInteraction to ...
virtual void addPNCrossSectionData(G4HadronInelasticProcess *process) const
Default implementation for adding XS data for the process.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...