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