1#include "SimCore/PhotoNuclearModels/BertiniExactlyNProductsModel.h"
7bool BertiniExactlyNProductsProcess::acceptEvent()
const {
8 int secondaries{theParticleChange.GetNumberOfSecondaries()};
10 std::vector<int> matching_count(pdg_ids_.size(), 0);
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 const auto energy{secondary->GetKineticEnergy()};
17 if (energy > threshold_) {
19 for (
size_t j{0}; j < matching_count.size(); ++j) {
20 if (pdg_code == pdg_ids_[j]) ++matching_count[j];
26 std::accumulate(matching_count.begin(), matching_count.end(), 0);
29 std::find(std::begin(matching_count), std::end(matching_count), 0) ==
30 std::end(matching_count);
32 if (total_matched == n_products_ && n_hard == total_matched &&
33 (!check_allmatch_ || all_matched)) {
41 G4ProcessManager* process_manager) {
42 auto photo_nuclear_process{
43 new G4HadronInelasticProcess(
"photonNuclear", G4Gamma::Definition())};
46 threshold_, zmin_, emin_, pdg_ids_, check_allmatch_, n_products_}};
47 model->SetMaxEnergy(15 * CLHEP::GeV);
49 photo_nuclear_process->RegisterMe(model);
50 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 ...