ATLAS Offline Software
G4SimTimerTool.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 "G4SimTimerTool.h"
6 
7 namespace G4UA
8 {
9 
10  //---------------------------------------------------------------------------
11  // Constructor
12  //---------------------------------------------------------------------------
14  const std::string& name,
15  const IInterface* parent)
17  {
18  }
19 
20  //---------------------------------------------------------------------------
21  // Initialize - temporarily here for debugging
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 results across threads
40 
41  // Report the results
42  auto meanSigma = report.meanAndSigma();
43  ATH_MSG_INFO("Finalized timing results for " << report.nEvent <<
44  " events (not all events used)");
45  ATH_MSG_INFO("Average time per event was " <<
46  std::setprecision(4) << meanSigma.first << " +- " <<
47  std::setprecision(4) << meanSigma.second);
48  return StatusCode::SUCCESS;
49  }
50 
51  //---------------------------------------------------------------------------
52  // Create the action on request
53  //---------------------------------------------------------------------------
54  std::unique_ptr<G4SimTimer>
56  {
57  ATH_MSG_DEBUG("Making a G4SimTimer action");
58  auto action = std::make_unique<G4SimTimer>();
59  actionList.eventActions.push_back( action.get() );
60  return action;
61  }
62 
63 }
G4UA::G4SimTimerTool::initialize
virtual StatusCode initialize() override
Initialize the tool.
Definition: G4SimTimerTool.cxx:23
G4UA::G4AtlasUserActions
Struct for passing around user actions.
Definition: IUserActionTool.h:32
G4UA::G4SimTimerTool::finalize
virtual StatusCode finalize() override
Finalize and merge results from all worker threads.
Definition: G4SimTimerTool.cxx:32
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
G4UA::G4SimTimer::Report
Simple struct which holds timing results for an action instance.
Definition: G4SimTimer.h:47
G4UA::G4SimTimer::getReport
const Report & getReport() const
Retrieve my timing results.
Definition: G4SimTimer.h:77
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::G4SimTimer::Report::merge
void merge(const Report &rep)
Definition: G4SimTimer.h:60
G4UA::G4SimTimerTool::makeAndFillAction
virtual std::unique_ptr< G4SimTimer > makeAndFillAction(G4AtlasUserActions &) override final
Create aciton for this thread.
Definition: G4SimTimerTool.cxx:55
G4UA::G4SimTimer
A user action for monitoring G4 runtime at event and run level.
Definition: G4SimTimer.h:41
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< G4SimTimer >::m_actions
ThreadSpecificUserAction< G4SimTimer > m_actions
Thread-specific storage of the user action.
Definition: UserActionToolBase.h:63
test_pyathena.parent
parent
Definition: test_pyathena.py:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
G4SimTimerTool.h
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::G4AtlasUserActions::eventActions
std::vector< G4UserEventAction * > eventActions
Definition: IUserActionTool.h:34
G4UA::G4SimTimerTool::G4SimTimerTool
G4SimTimerTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: G4SimTimerTool.cxx:13