LDMX Software
BertiniSingleNeutronModel.cxx
1
2#include "SimCore/PhotoNuclearModels/BertiniSingleNeutronModel.h"
3
4#include <G4Gamma.hh>
5#include <G4HadronInelasticProcess.hh>
6namespace simcore {
7
8bool BertiniSingleNeutronProcess::acceptEvent() const {
9 int nhard{0};
10 int nhard_neutron{0};
11 int secondaries{theParticleChange.GetNumberOfSecondaries()};
12 for (int i{0}; i < secondaries; ++i) {
13 const auto secondary{theParticleChange.GetSecondary(i)->GetParticle()};
14 const auto pdg_code{secondary->GetDefinition()->GetPDGEncoding()};
15 if (skipCountingParticle(pdg_code)) {
16 continue;
17 }
18 const auto energy{secondary->GetKineticEnergy()};
19 if (energy > threshold_) {
20 nhard++;
21 if (pdg_code == 2112) {
22 nhard_neutron++;
23 }
24 }
25 }
26 return nhard == 1 && nhard_neutron == 1;
27}
28
30 G4ProcessManager* processManager) {
31 auto photo_nuclear_process{
32 new G4HadronInelasticProcess("photonNuclear", G4Gamma::Definition())};
33 auto model{new BertiniSingleNeutronProcess{threshold_, zmin_, emin_,
34 count_light_ions_}};
35 model->SetMaxEnergy(15 * CLHEP::GeV);
36 addPNCrossSectionData(photo_nuclear_process);
37 photo_nuclear_process->RegisterMe(model);
38 processManager->AddDiscreteProcess(photo_nuclear_process);
39}
40} // namespace simcore
41
42DECLARE_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 ...