ATLAS Offline Software
Loading...
Searching...
No Matches
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.
virtual void PreUserTrackingAction (const G4Track *track) override final
 Increments the track counters.
const ReportgetReport () const
 Retrieve my counts.

Private Attributes

Report m_report
 Track counts for this thread.

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 }
Report m_report
Track counts for this thread.

◆ 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 {
37 m_report.nTotalTracks++;
38 TrackHelper helper(track);
39
40 // Primary tracks
41 if(helper.IsPrimary() || helper.IsRegeneratedPrimary())
42 m_report.nPrimaryTracks++;
43
44 // Secondary tracks
45 if(helper.IsRegisteredSecondary())
46 m_report.nSecondaryTracks++;
47
48 // 50 MeV tracks
49 const double minE = 50.;
50 if(track->GetKineticEnergy() > minE)
51 m_report.n50MeVTracks++;
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: