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