ATLAS Offline Software
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 
13 namespace 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
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
make_hlt_rep.rep
rep
Definition: make_hlt_rep.py:32
G4UA::G4TrackCounter::Report::nSecondaryTracks
unsigned int nSecondaryTracks
Number of secondary tracks.
Definition: G4TrackCounter.h:38
G4UA::G4TrackCounter::Report::merge
void merge(const Report &rep)
Definition: G4TrackCounter.cxx:15
G4UA::G4TrackCounter::Report::nTotalTracks
unsigned int nTotalTracks
Total number of tracks.
Definition: G4TrackCounter.h:34
G4UA::G4TrackCounter
A simple action which counts tracks.
Definition: G4TrackCounter.h:23
G4UA::G4TrackCounter::Report::n50MeVTracks
unsigned int n50MeVTracks
Number of tracks with kinetic E > 50 MeV.
Definition: G4TrackCounter.h:40
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
G4UA::G4TrackCounter::PreUserTrackingAction
virtual void PreUserTrackingAction(const G4Track *track) override final
Increments the track counters.
Definition: G4TrackCounter.cxx:35
G4UA::G4TrackCounter::getReport
const Report & getReport() const
Retrieve my counts.
Definition: G4TrackCounter.h:54
G4UA::G4TrackCounter::Report::nEvents
unsigned int nEvents
Event counter. Might want a larger int for this.
Definition: G4TrackCounter.h:32
G4UA::G4TrackCounter::BeginOfEventAction
virtual void BeginOfEventAction(const G4Event *event) override final
Increments event counter.
Definition: G4TrackCounter.cxx:27
G4UA::G4TrackCounter::Report
Simple struct for holding the counts Might want to use larger integral types for this....
Definition: G4TrackCounter.h:30
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