ATLAS Offline Software
Loading...
Searching...
No Matches
G4TrackCounter.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef G4USERACTIONS__G4UA_G4TRACKCOUNTER_H
6#define G4USERACTIONS__G4UA_G4TRACKCOUNTER_H
7
8// Geant4 includes
9#include "G4UserEventAction.hh"
10#include "G4UserTrackingAction.hh"
11
12
13namespace G4UA
14{
15
21 class G4TrackCounter : public G4UserEventAction,
22 public G4UserTrackingAction
23 {
24
25 public:
26
29 struct Report
30 {
32 unsigned int nEvents=0;
34 unsigned int nTotalTracks=0;
36 unsigned int nPrimaryTracks=0;
38 unsigned int nSecondaryTracks=0;
40 unsigned int n50MeVTracks=0;
41
42 void merge(const Report& rep);
43 };
44
48 virtual void BeginOfEventAction(const G4Event* event) override final;
49
51 virtual void PreUserTrackingAction(const G4Track* track) override final;
52
54 const Report& getReport() const
55 { return m_report; }
56
57 private:
58
61
62 }; // class G4TrackCounter
63
64} // namespace G4UA
65
66#endif
A simple action which counts tracks.
virtual void PreUserTrackingAction(const G4Track *track) override final
Increments the track counters.
const Report & getReport() const
Retrieve my counts.
Report m_report
Track counts for this thread.
virtual void BeginOfEventAction(const G4Event *event) override final
Increments event counter.
Definition merge.py:1
Simple struct for holding the counts Might want to use larger integral types for this....
unsigned int nPrimaryTracks
Number of primary tracks.
unsigned int n50MeVTracks
Number of tracks with kinetic E > 50 MeV.
unsigned int nSecondaryTracks
Number of secondary tracks.
unsigned int nTotalTracks
Total number of tracks.
unsigned int nEvents
Event counter. Might want a larger int for this.