-
main-coverity-MCTruth
main-coverity-MCTruth
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
G4TrackCounter.cxx 1.57 KiB
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#include "G4TrackCounter.h"
#include "MCTruth/TrackHelper.h"
#include "G4Track.hh"
namespace G4UA
{
//---------------------------------------------------------------------------
// Merge results
//---------------------------------------------------------------------------
void G4TrackCounter::Report::merge(const G4TrackCounter::Report& rep)
{
nEvents += rep.nEvents;
nTotalTracks += rep.nTotalTracks;
nPrimaryTracks += rep.nPrimaryTracks;
nSecondaryTracks += rep.nSecondaryTracks;
n50MeVTracks += rep.n50MeVTracks;
}
//---------------------------------------------------------------------------
// Increment event counter
//---------------------------------------------------------------------------
void G4TrackCounter::BeginOfEventAction(const G4Event* /*event*/)
{
m_report.nEvents++;
}
//---------------------------------------------------------------------------
// Increment track counters
//---------------------------------------------------------------------------
void G4TrackCounter::PreUserTrackingAction(const G4Track* track)
{
m_report.nTotalTracks++;
TrackHelper helper(track);
// Primary tracks
if(helper.IsPrimary() || helper.IsRegeneratedPrimary())
m_report.nPrimaryTracks++;
// Secondary tracks
if(helper.IsRegisteredSecondary())
m_report.nSecondaryTracks++;
// 50 MeV tracks
const double minE = 50.;
if(track->GetKineticEnergy() > minE)
m_report.n50MeVTracks++;
}
} // namespace G4UA