ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Utilities
G4UserActions
src
G4TrackCounter.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
G4TrackCounter.h
"
6
#include "
MCTruth/TrackHelper.h
"
7
#include "G4Track.hh"
8
9
namespace
G4UA
10
{
11
12
//---------------------------------------------------------------------------
13
// Merge results
14
//---------------------------------------------------------------------------
15
void
G4TrackCounter::Report::merge
(
const
G4TrackCounter::Report
& rep)
16
{
17
nEvents
+= rep.nEvents;
18
nTotalTracks
+= rep.nTotalTracks;
19
nPrimaryTracks
+= rep.nPrimaryTracks;
20
nSecondaryTracks
+= rep.nSecondaryTracks;
21
n50MeVTracks
+= rep.n50MeVTracks;
22
}
23
24
//---------------------------------------------------------------------------
25
// Increment event counter
26
//---------------------------------------------------------------------------
27
void
G4TrackCounter::BeginOfEventAction
(
const
G4Event*
/*event*/
)
28
{
29
m_report
.nEvents++;
30
}
31
32
//---------------------------------------------------------------------------
33
// Increment track counters
34
//---------------------------------------------------------------------------
35
void
G4TrackCounter::PreUserTrackingAction
(
const
G4Track* track)
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
}
53
54
}
// namespace G4UA
G4TrackCounter.h
TrackHelper.h
G4UA::G4TrackCounter::PreUserTrackingAction
virtual void PreUserTrackingAction(const G4Track *track) override final
Increments the track counters.
Definition
G4TrackCounter.cxx:35
G4UA::G4TrackCounter::m_report
Report m_report
Track counts for this thread.
Definition
G4TrackCounter.h:60
G4UA::G4TrackCounter::BeginOfEventAction
virtual void BeginOfEventAction(const G4Event *event) override final
Increments event counter.
Definition
G4TrackCounter.cxx:27
TrackHelper
Definition
TrackHelper.h:20
G4UA
for nSW
Definition
CalibrationDefaultProcessing.h:19
G4UA::G4TrackCounter::Report
Simple struct for holding the counts Might want to use larger integral types for this....
Definition
G4TrackCounter.h:30
G4UA::G4TrackCounter::Report::nPrimaryTracks
unsigned int nPrimaryTracks
Number of primary tracks.
Definition
G4TrackCounter.h:36
G4UA::G4TrackCounter::Report::n50MeVTracks
unsigned int n50MeVTracks
Number of tracks with kinetic E > 50 MeV.
Definition
G4TrackCounter.h:40
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
G4UA::G4TrackCounter::Report::nEvents
unsigned int nEvents
Event counter. Might want a larger int for this.
Definition
G4TrackCounter.h:32
G4UA::G4TrackCounter::Report::merge
void merge(const Report &rep)
Definition
G4TrackCounter.cxx:15
Generated on
for ATLAS Offline Software by
1.17.0