1#include "SimCore/PhotoNuclearModels/BertiniExactlyNProductsModel.h"
4#include <G4HadronInelasticProcess.hh>
9bool BertiniExactlyNProductsProcess::acceptEvent()
const {
10 int secondaries{theParticleChange.GetNumberOfSecondaries()};
12 std::vector<int> matching_count(pdg_ids_.size(), 0);
14 for (
int i{0}; i < secondaries; ++i) {
15 const auto secondary{theParticleChange.GetSecondary(i)->GetParticle()};
16 const auto pdg_code{secondary->GetDefinition()->GetPDGEncoding()};
17 const auto energy{secondary->GetKineticEnergy()};
19 if (energy > threshold_) {
21 for (
size_t j{0}; j < matching_count.size(); ++j) {
22 if (pdg_code == pdg_ids_[j]) ++matching_count[j];
28 std::accumulate(matching_count.begin(), matching_count.end(), 0);
31 std::find(std::begin(matching_count), std::end(matching_count), 0) ==
32 std::end(matching_count);
34 if (total_matched == n_products_ && n_hard == total_matched &&
35 (!check_allmatch_ || all_matched)) {
43 G4ProcessManager* process_manager) {
44 auto photo_nuclear_process{
45 new G4HadronInelasticProcess(
"photonNuclear", G4Gamma::Definition())};
48 threshold_, zmin_, emin_, pdg_ids_, check_allmatch_, n_products_}};
49 model->SetMaxEnergy(15 * CLHEP::GeV);
51 photo_nuclear_process->RegisterMe(model);
52 process_manager->AddDiscreteProcess(photo_nuclear_process);
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 ...