LDMX Software
Public Member Functions | Private Attributes | List of all members
simcore::BertiniEventTopologyProcess Class Referenceabstract

Public Member Functions

 BertiniEventTopologyProcess (bool count_light_ions=true)
 
virtual bool acceptEvent () const =0
 
virtual bool acceptProjectile (const G4HadProjectile &projectile) const =0
 
virtual bool acceptTarget (const G4Nucleus &targetNucleus) const =0
 
G4HadFinalState * ApplyYourself (const G4HadProjectile &projectile, G4Nucleus &targetNucleus) override
 
void cleanupSecondaries ()
 
constexpr bool isLightIon (const int pdgCode) const
 Check if the PDG code corresponds to a light ion nucleus.
 
constexpr bool skipCountingParticle (const int pdgcode) const
 Whether or not to include a particular particle type in any counting.
 
virtual void incrementEventWeight (int N)
 

Private Attributes

bool count_light_ions_
 

Detailed Description

Definition at line 33 of file BertiniEventTopologyProcess.h.

Constructor & Destructor Documentation

◆ BertiniEventTopologyProcess()

simcore::BertiniEventTopologyProcess::BertiniEventTopologyProcess ( bool  count_light_ions = true)
inline

Definition at line 35 of file BertiniEventTopologyProcess.h.

36 : G4CascadeInterface{}, count_light_ions_{count_light_ions} {}

Member Function Documentation

◆ ApplyYourself()

G4HadFinalState * simcore::BertiniEventTopologyProcess::ApplyYourself ( const G4HadProjectile &  projectile,
G4Nucleus &  targetNucleus 
)
override

Definition at line 13 of file BertiniEventTopologyProcess.cxx.

14 {
15 int attempts{1};
16 if (!acceptProjectile(projectile) || !acceptTarget(targetNucleus)) {
17 // Bertini will handle the particle change on its own here
18 return G4CascadeInterface::ApplyYourself(projectile, targetNucleus);
19 }
20
21 while (true) {
22 theParticleChange.Clear();
23 theParticleChange.SetStatusChange(stopAndKill);
24 G4CascadeInterface::ApplyYourself(projectile, targetNucleus);
25 if (acceptEvent()) {
26 incrementEventWeight(attempts);
27 return &theParticleChange;
28 }
29 attempts++;
30 cleanupSecondaries();
31 }
32}

◆ cleanupSecondaries()

void simcore::BertiniEventTopologyProcess::cleanupSecondaries ( )

Definition at line 4 of file BertiniEventTopologyProcess.cxx.

4 {
5 int secondaries{theParticleChange.GetNumberOfSecondaries()};
6 // Geant4 won't clean up this memory for us by default
7 for (int i{0}; i < secondaries; ++i) {
8 auto secondary{theParticleChange.GetSecondary(i)->GetParticle()};
9 delete secondary;
10 }
11}

◆ incrementEventWeight()

virtual void simcore::BertiniEventTopologyProcess::incrementEventWeight ( int  N)
inlinevirtual

Definition at line 125 of file BertiniEventTopologyProcess.h.

125 {
126 auto event_info{static_cast<UserEventInformation*>(
127 G4EventManager::GetEventManager()->GetUserInformation())};
128 event_info->incWeight(1. / N);
129 }

◆ isLightIon()

constexpr bool simcore::BertiniEventTopologyProcess::isLightIon ( const int  pdgCode) const
inlineconstexpr

Check if the PDG code corresponds to a light ion nucleus.

Nuclear PDG codes are given by ±10LZZZAAAI So to find the atomic number, we first divide by 10 (to lose the I-component) and then take the modulo with 1000.

Definition at line 92 of file BertiniEventTopologyProcess.h.

92 {
93 //
94 if (pdgCode > 1000000000) {
95 // Check if the atomic number is less than or equal to 4
96 return ((pdgCode / 10) % 1000) <= 4;
97 }
98 return false;
99 }

Referenced by skipCountingParticle().

◆ skipCountingParticle()

constexpr bool simcore::BertiniEventTopologyProcess::skipCountingParticle ( const int  pdgcode) const
inlineconstexpr

Whether or not to include a particular particle type in any counting.

Unless count_light_ions_ is set, we don't count anything with a nuclear PDG code. This is consistent with the counting behaviour used in the PhotoNuclearDQM.

If count_light_ions_ is set, we also match PDG codes for nuclei with atomic number < 4. 

See also
isLightIon

Definition at line 113 of file BertiniEventTopologyProcess.h.

113 {
114 return !(pdgcode < 10000 || (count_light_ions_ && isLightIon(pdgcode)));
115 }
constexpr bool isLightIon(const int pdgCode) const
Check if the PDG code corresponds to a light ion nucleus.

References isLightIon().

Member Data Documentation

◆ count_light_ions_

bool simcore::BertiniEventTopologyProcess::count_light_ions_
private

Definition at line 132 of file BertiniEventTopologyProcess.h.


The documentation for this class was generated from the following files: