LDMX Software
BertiniNothingHardModel.cxx
1#include "SimCore/PhotoNuclearModels/BertiniNothingHardModel.h"
2
3#include <G4Gamma.hh>
4#include <G4HadronInelasticProcess.hh>
5namespace simcore {
6
7bool BertiniNothingHardProcess::acceptEvent() const {
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 return false;
18 }
19 }
20 return true;
21}
22
24 G4ProcessManager* processManager) {
25 auto photo_nuclear_process{
26 new G4HadronInelasticProcess("photonNuclear", G4Gamma::Definition())};
27 auto model{new BertiniNothingHardProcess{threshold_, zmin_, emin_,
28 count_light_ions_}};
29 model->SetMaxEnergy(15 * CLHEP::GeV);
30 addPNCrossSectionData(photo_nuclear_process);
31 photo_nuclear_process->RegisterMe(model);
32 processManager->AddDiscreteProcess(photo_nuclear_process);
33}
34} // namespace simcore
35
36DECLARE_PHOTONUCLEAR_MODEL(simcore::BertiniNothingHardModel)
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 ...