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

A simple action which counts tracks. More...

#include <G4TrackCounter.h>

Inheritance diagram for G4UA::G4TrackCounter:
Collaboration diagram for G4UA::G4TrackCounter:

Classes

struct  Report
 Simple struct for holding the counts Might want to use larger integral types for this... More...
 

Public Member Functions

virtual void BeginOfEventAction (const G4Event *event) override final
 Increments event counter. More...
 
virtual void PreUserTrackingAction (const G4Track *track) override final
 Increments the track counters. More...
 
const ReportgetReport () const
 Retrieve my counts. More...
 

Private Attributes

Report m_report
 Track counts for this thread. More...
 

Detailed Description

A simple action which counts tracks.

This action currently implements BeginEvent and PreTracking interfaces.

Definition at line 21 of file G4TrackCounter.h.

Member Function Documentation

◆ BeginOfEventAction()

void G4UA::G4TrackCounter::BeginOfEventAction ( const G4Event *  event)
finaloverridevirtual

Increments event counter.

I feel like there must be a better way to get this info. Hmm, the G4Run has a numberOfEvent field...

Definition at line 27 of file G4TrackCounter.cxx.

28  {
29  m_report.nEvents++;
30  }

◆ getReport()

const Report& G4UA::G4TrackCounter::getReport ( ) const
inline

Retrieve my counts.

Definition at line 54 of file G4TrackCounter.h.

55  { return m_report; }

◆ PreUserTrackingAction()

void G4UA::G4TrackCounter::PreUserTrackingAction ( const G4Track *  track)
finaloverridevirtual

Increments the track counters.

Definition at line 35 of file G4TrackCounter.cxx.

36  {
39 
40  // Primary tracks
41  if(helper.IsPrimary() || helper.IsRegeneratedPrimary())
43 
44  // Secondary tracks
45  if(helper.IsRegisteredSecondary())
47 
48  // 50 MeV tracks
49  const double minE = 50.;
50  if(track->GetKineticEnergy() > minE)
52  }

Member Data Documentation

◆ m_report

Report G4UA::G4TrackCounter::m_report
private

Track counts for this thread.

Definition at line 60 of file G4TrackCounter.h.


The documentation for this class was generated from the following files:
G4UA::G4TrackCounter::Report::nSecondaryTracks
unsigned int nSecondaryTracks
Number of secondary tracks.
Definition: G4TrackCounter.h:38
G4UA::G4TrackCounter::Report::nTotalTracks
unsigned int nTotalTracks
Total number of tracks.
Definition: G4TrackCounter.h:34
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
G4UA::G4TrackCounter::Report::n50MeVTracks
unsigned int n50MeVTracks
Number of tracks with kinetic E > 50 MeV.
Definition: G4TrackCounter.h:40
TrackHelper
Definition: TrackHelper.h:14
G4UA::G4TrackCounter::Report::nEvents
unsigned int nEvents
Event counter. Might want a larger int for this.
Definition: G4TrackCounter.h:32
G4UA::G4TrackCounter::m_report
Report m_report
Track counts for this thread.
Definition: G4TrackCounter.h:60
G4UA::G4TrackCounter::Report::nPrimaryTracks
unsigned int nPrimaryTracks
Number of primary tracks.
Definition: G4TrackCounter.h:36
xAOD::track
@ track
Definition: TrackingPrimitives.h:512