ATLAS Offline Software
G4TrackCounterTool.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 "G4TrackCounterTool.h"
6 
7 namespace G4UA
8 {
9 
10  //---------------------------------------------------------------------------
11  // Constructor
12  //---------------------------------------------------------------------------
14  G4TrackCounterTool(const std::string& type, const std::string& name,
15  const IInterface* parent)
17  {
18  }
19 
20  //---------------------------------------------------------------------------
21  // Initialize
22  //---------------------------------------------------------------------------
24  {
25  ATH_MSG_DEBUG( "Initializing " << name() );
26  return StatusCode::SUCCESS;
27  }
28 
29  //---------------------------------------------------------------------------
30  // Merge results from all threads
31  //---------------------------------------------------------------------------
33  {
34  ATH_MSG_DEBUG( "Finalizing " << name() );
35 
36  // Accumulate the results across threads
40 
41  // Report the totals
42  ATH_MSG_INFO("nEvents " << report.nEvents);
43  ATH_MSG_INFO("nPrimaryTracks " << report.nPrimaryTracks);
44  ATH_MSG_INFO("nSecondaryTracks " << report.nSecondaryTracks);
45  ATH_MSG_INFO("n50MeVTracks " << report.n50MeVTracks);
46 
47  return StatusCode::SUCCESS;
48  }
49 
50  //---------------------------------------------------------------------------
51  // Create the action on request
52  //---------------------------------------------------------------------------
53  std::unique_ptr<G4TrackCounter>
55  {
56  ATH_MSG_DEBUG("Making a G4TrackCounter action");
57  auto action = std::make_unique<G4TrackCounter>();
58  actionList.eventActions.push_back( action.get() );
59  actionList.trackingActions.push_back( action.get() );
60  return action;
61  }
62 
63 }
G4UA::G4AtlasUserActions
Struct for passing around user actions.
Definition: IUserActionTool.h:32
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
G4UA::G4AtlasUserActions::trackingActions
std::vector< G4UserTrackingAction * > trackingActions
Definition: IUserActionTool.h:35
checkTP.report
report
Definition: checkTP.py:127
G4UA::ThreadSpecificUserAction::accumulate
void accumulate(ResultType &result, Mapper mapOp, Reducer reduceOp)
Accumulate results across user actions with specified operations.
Definition: ThreadSpecificUserAction.h:88
G4UA::G4TrackCounter::Report::merge
void merge(const Report &rep)
Definition: G4TrackCounter.cxx:15
G4TrackCounterTool.h
G4UA::G4TrackCounter
A simple action which counts tracks.
Definition: G4TrackCounter.h:23
G4UA::G4TrackCounterTool::makeAndFillAction
virtual std::unique_ptr< G4TrackCounter > makeAndFillAction(G4AtlasUserActions &) override final
Create action for this thread.
Definition: G4TrackCounterTool.cxx:54
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
G4UA::UserActionToolBase< G4TrackCounter >::m_actions
ThreadSpecificUserAction< G4TrackCounter > m_actions
Thread-specific storage of the user action.
Definition: UserActionToolBase.h:63
test_pyathena.parent
parent
Definition: test_pyathena.py:15
G4UA::G4TrackCounter::getReport
const Report & getReport() const
Retrieve my counts.
Definition: G4TrackCounter.h:54
G4UA::G4TrackCounterTool::G4TrackCounterTool
G4TrackCounterTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: G4TrackCounterTool.cxx:14
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
G4UA::UserActionToolBase
abstract template utility base-class for G4 user-action tools.
Definition: UserActionToolBase.h:33
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
G4UA::G4TrackCounter::Report
Simple struct for holding the counts Might want to use larger integral types for this....
Definition: G4TrackCounter.h:30
G4UA::G4AtlasUserActions::eventActions
std::vector< G4UserEventAction * > eventActions
Definition: IUserActionTool.h:34
G4UA::G4TrackCounterTool::initialize
virtual StatusCode initialize() override final
Initialize tool.
Definition: G4TrackCounterTool.cxx:23
G4UA::G4TrackCounterTool::finalize
virtual StatusCode finalize() override final
Finalize and merge results from all threads.
Definition: G4TrackCounterTool.cxx:32