ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
SensitiveDetectorMasterTool Class Reference

Public tool which manages all the sensitive detector tools. More...

#include <SensitiveDetectorMasterTool.h>

Inheritance diagram for SensitiveDetectorMasterTool:
Collaboration diagram for SensitiveDetectorMasterTool:

Public Member Functions

 SensitiveDetectorMasterTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor. More...
 
virtual ~SensitiveDetectorMasterTool ()
 Empty virtual destructor. More...
 
StatusCode initialize () override final
 Retrieve the SD tools. SD creation is deferred until initializeSDs. More...
 
StatusCode initializeSDs () override final
 Calls initializeSD on each SD tool to create the SDs for the current worker thread. More...
 
StatusCode BeginOfAthenaEvent () override final
 Calls SetupEvent on each SD tool. More...
 
StatusCode EndOfAthenaEvent () override final
 Calls Gather on each SD tool. More...
 

Private Attributes

ToolHandleArray< ISensitiveDetectorm_senDetTools {this, "SensitiveDetectors", {}, "Tool handle array of all sensitive detector tools"}
 Private array of tool handles pointing to all SD tools. More...
 

Detailed Description

Public tool which manages all the sensitive detector tools.

This tool provides functionality to trigger creation of SDs for the current worker thread and to invoke special SD methods at the beginning and end of an Athena event.

This will probably be changed (back) to a service in the near future.

Definition at line 25 of file SensitiveDetectorMasterTool.h.

Constructor & Destructor Documentation

◆ SensitiveDetectorMasterTool()

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

Standard constructor.

Definition at line 8 of file SensitiveDetectorMasterTool.cxx.

11  : base_class(type, name, parent)
12 {
13 }

◆ ~SensitiveDetectorMasterTool()

virtual SensitiveDetectorMasterTool::~SensitiveDetectorMasterTool ( )
inlinevirtual

Empty virtual destructor.

Definition at line 32 of file SensitiveDetectorMasterTool.h.

32 {}

Member Function Documentation

◆ BeginOfAthenaEvent()

StatusCode SensitiveDetectorMasterTool::BeginOfAthenaEvent ( )
finaloverride

Calls SetupEvent on each SD tool.

Definition at line 45 of file SensitiveDetectorMasterTool.cxx.

46 {
47  // Call setup for all sensitive detectors
48  for (auto& isd : m_senDetTools) {
49  CHECK( isd->SetupEvent() );
50  }
51  return StatusCode::SUCCESS;
52 }

◆ EndOfAthenaEvent()

StatusCode SensitiveDetectorMasterTool::EndOfAthenaEvent ( )
finaloverride

Calls Gather on each SD tool.

Definition at line 54 of file SensitiveDetectorMasterTool.cxx.

55 {
56  // Call gather for all sensitive detectors
57  for (auto& isd : m_senDetTools) {
58  CHECK( isd->Gather() );
59  }
60  return StatusCode::SUCCESS;
61 }

◆ initialize()

StatusCode SensitiveDetectorMasterTool::initialize ( )
finaloverride

Retrieve the SD tools. SD creation is deferred until initializeSDs.

Definition at line 15 of file SensitiveDetectorMasterTool.cxx.

16 {
17  ATH_MSG_DEBUG("initialize");
18 
19  // Retrieve all of the sensitive detector tools.
20  // SD creation is deferred until later for multi-threading.
21  CHECK( m_senDetTools.retrieve() );
22  return StatusCode::SUCCESS;
23 }

◆ initializeSDs()

StatusCode SensitiveDetectorMasterTool::initializeSDs ( )
finaloverride

Calls initializeSD on each SD tool to create the SDs for the current worker thread.

Definition at line 25 of file SensitiveDetectorMasterTool.cxx.

26 {
27  // This method will be called concurrently in AthenaMT during initialization.
28  // We thus conservatively lock the entire method to protect things like the
29  // MsgStream usage and downstream clients.
30  static std::mutex sdMutex;
31  std::lock_guard<std::mutex> sdLock(sdMutex);
32 
33  ATH_MSG_VERBOSE( name() << "::initializeSDs()" );
34 
35  // Loop through all the sensitive detector tools and
36  // initialize them for this thread.
37  ATH_MSG_INFO( "Initializing list of " << m_senDetTools.size() <<
38  " sensitive detectors." );
39  for (auto& isd : m_senDetTools) {
40  CHECK( isd->initializeSD() );
41  }
42  return StatusCode::SUCCESS;
43 }

Member Data Documentation

◆ m_senDetTools

ToolHandleArray<ISensitiveDetector> SensitiveDetectorMasterTool::m_senDetTools {this, "SensitiveDetectors", {}, "Tool handle array of all sensitive detector tools"}
private

Private array of tool handles pointing to all SD tools.

Definition at line 46 of file SensitiveDetectorMasterTool.h.


The documentation for this class was generated from the following files:
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
SensitiveDetectorMasterTool::m_senDetTools
ToolHandleArray< ISensitiveDetector > m_senDetTools
Private array of tool handles pointing to all SD tools.
Definition: SensitiveDetectorMasterTool.h:46
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78