ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
G4UA::PhotonKiller Class Reference

NEEDS DOCUMENTATION. More...

#include <PhotonKiller.h>

Inheritance diagram for G4UA::PhotonKiller:
Collaboration diagram for G4UA::PhotonKiller:

Public Member Functions

 PhotonKiller ()
 
virtual void UserSteppingAction (const G4Step *) override final
 
virtual void PreUserTrackingAction (const G4Track *) override final
 

Private Attributes

int m_count
 
float m_energy
 

Detailed Description

NEEDS DOCUMENTATION.

Definition at line 16 of file PhotonKiller.h.

Constructor & Destructor Documentation

◆ PhotonKiller()

G4UA::PhotonKiller::PhotonKiller ( )

Definition at line 17 of file PhotonKiller.cxx.

18  : m_count(0), m_energy(0)
19  {}

Member Function Documentation

◆ PreUserTrackingAction()

void G4UA::PhotonKiller::PreUserTrackingAction ( const G4Track *  )
finaloverridevirtual

Definition at line 22 of file PhotonKiller.cxx.

23  {
24  // reset counters
25  m_count=0;
26  m_energy=0;
27  }

◆ UserSteppingAction()

void G4UA::PhotonKiller::UserSteppingAction ( const G4Step *  aStep)
finaloverridevirtual

Definition at line 30 of file PhotonKiller.cxx.

31  {
32  if ( fabs(m_energy-aStep->GetTrack()->GetKineticEnergy())<0.00001 ){
33  // same energy as last time
34  m_count++;
35  } else {
36  m_count=0;
37  m_energy = aStep->GetTrack()->GetKineticEnergy();
38  return;
39  }
40 
41  if (aStep->GetTrack()->GetKineticEnergy() < 0.0001){ // Less than one hundred eV
42  if ( (m_count>3 && aStep->GetTrack()->GetDefinition() == G4Gamma::Gamma() ) ||
43  (m_count>10000) ){ // more than three steps with less than one keV of energy...
44  // Drop the photon
45  aStep->GetTrack()->SetTrackStatus( fStopAndKill );
46  }
47  } else if (m_count>1000000){
48  // Looper Killer functionality
49  aStep->GetTrack()->SetTrackStatus( fStopAndKill );
50  G4RunManagerKernel *rmk = G4RunManagerKernel::GetRunManagerKernel();
51  rmk->GetEventManager()->AbortCurrentEvent();
52  rmk->GetEventManager()->GetNonconstCurrentEvent()->SetEventAborted();
53  }
54  }

Member Data Documentation

◆ m_count

int G4UA::PhotonKiller::m_count
private

Definition at line 23 of file PhotonKiller.h.

◆ m_energy

float G4UA::PhotonKiller::m_energy
private

Definition at line 24 of file PhotonKiller.h.


The documentation for this class was generated from the following files:
G4UA::PhotonKiller::m_count
int m_count
Definition: PhotonKiller.h:23
VP1PartSpect::Gamma
@ Gamma
Definition: VP1PartSpectFlags.h:22
G4UA::PhotonKiller::m_energy
float m_energy
Definition: PhotonKiller.h:24