ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
G4UA::G4TrackCounterTool Class Reference

Tool which manages the G4TrackCounter action. This tool creates the G4TrackCounter for each thread and merges the track counts from all threads in finalization. More...

#include <G4TrackCounterTool.h>

Inheritance diagram for G4UA::G4TrackCounterTool:
Collaboration diagram for G4UA::G4TrackCounterTool:

Public Member Functions

 G4TrackCounterTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor. More...
 
virtual StatusCode initialize () override final
 Initialize tool. More...
 
virtual StatusCode finalize () override final
 Finalize and merge results from all threads. More...
 
virtual StatusCode fillUserAction (G4AtlasUserActions &actionLists) override final
 Fill the user action lists. More...
 

Protected Member Functions

virtual std::unique_ptr< G4TrackCountermakeAndFillAction (G4AtlasUserActions &) override final
 Create action for this thread. More...
 

Protected Attributes

ThreadSpecificUserAction< G4TrackCounterm_actions
 Thread-specific storage of the user action. More...
 

Detailed Description

Tool which manages the G4TrackCounter action. This tool creates the G4TrackCounter for each thread and merges the track counts from all threads in finalization.

Author
Steve Farrell Steve.nosp@m.n.Fa.nosp@m.rrell.nosp@m.@cer.nosp@m.n.ch

Definition at line 24 of file G4TrackCounterTool.h.

Constructor & Destructor Documentation

◆ G4TrackCounterTool()

G4UA::G4TrackCounterTool::G4TrackCounterTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Standard constructor.

Definition at line 13 of file G4TrackCounterTool.cxx.

16  : UserActionToolBase<G4TrackCounter>(type, name, parent)
17  {
18  }

Member Function Documentation

◆ fillUserAction()

virtual StatusCode G4UA::UserActionToolBase< G4TrackCounter >::fillUserAction ( G4AtlasUserActions actionLists)
inlinefinaloverridevirtualinherited

Fill the user action lists.

Definition at line 45 of file UserActionToolBase.h.

46  {
47  auto myAction = makeAndFillAction(actionLists);
48  if(myAction == nullptr) {
49  ATH_MSG_ERROR( "Failed to construct user action in " << name() );
50  return StatusCode::FAILURE;
51  }
52  m_actions.set( std::move(myAction) );
53  return StatusCode::SUCCESS;
54  }

◆ finalize()

StatusCode G4UA::G4TrackCounterTool::finalize ( )
finaloverridevirtual

Finalize and merge results from all threads.

Definition at line 32 of file G4TrackCounterTool.cxx.

33  {
34  ATH_MSG_DEBUG( "Finalizing " << name() );
35 
36  // Accumulate the results across threads
37  G4TrackCounter::Report report;
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  }

◆ initialize()

StatusCode G4UA::G4TrackCounterTool::initialize ( )
finaloverridevirtual

Initialize tool.

Definition at line 23 of file G4TrackCounterTool.cxx.

24  {
25  ATH_MSG_DEBUG( "Initializing " << name() );
26  return StatusCode::SUCCESS;
27  }

◆ makeAndFillAction()

std::unique_ptr< G4TrackCounter > G4UA::G4TrackCounterTool::makeAndFillAction ( G4AtlasUserActions actionList)
finaloverrideprotectedvirtual

Create action for this thread.

Implements G4UA::UserActionToolBase< G4TrackCounter >.

Definition at line 54 of file G4TrackCounterTool.cxx.

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  }

Member Data Documentation

◆ m_actions

Thread-specific storage of the user action.

Definition at line 63 of file UserActionToolBase.h.


The documentation for this class was generated from the following files:
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
G4UA::ThreadSpecificUserAction::set
void set(std::unique_ptr< ActionType > action)
Assign the object of the current thread.
Definition: ThreadSpecificUserAction.h:61
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
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
G4UA::UserActionToolBase< G4TrackCounter >::makeAndFillAction
virtual std::unique_ptr< G4TrackCounter > makeAndFillAction(G4AtlasUserActions &actionLists)=0
Make the action and push onto the lists.
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78