ATLAS Offline Software
SensitiveDetectorMasterTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include <mutex>
7 
9  const std::string& name,
10  const IInterface* parent)
11  : base_class(type, name, parent)
12 {
13 }
14 
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 }
24 
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 }
44 
46 {
47  // Call setup for all sensitive detectors
48  for (auto& isd : m_senDetTools) {
49  CHECK( isd->SetupEvent() );
50  }
51  return StatusCode::SUCCESS;
52 }
53 
55 {
56  // Call gather for all sensitive detectors
57  for (auto& isd : m_senDetTools) {
58  CHECK( isd->Gather() );
59  }
60  return StatusCode::SUCCESS;
61 }
SensitiveDetectorMasterTool::initialize
StatusCode initialize() override final
Retrieve the SD tools. SD creation is deferred until initializeSDs.
Definition: SensitiveDetectorMasterTool.cxx:15
SensitiveDetectorMasterTool::SensitiveDetectorMasterTool
SensitiveDetectorMasterTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: SensitiveDetectorMasterTool.cxx:8
SensitiveDetectorMasterTool::EndOfAthenaEvent
StatusCode EndOfAthenaEvent() override final
Calls Gather on each SD tool.
Definition: SensitiveDetectorMasterTool.cxx:54
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
SensitiveDetectorMasterTool.h
SensitiveDetectorMasterTool::BeginOfAthenaEvent
StatusCode BeginOfAthenaEvent() override final
Calls SetupEvent on each SD tool.
Definition: SensitiveDetectorMasterTool.cxx:45
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
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:195
SensitiveDetectorMasterTool::initializeSDs
StatusCode initializeSDs() override final
Calls initializeSD on each SD tool to create the SDs for the current worker thread.
Definition: SensitiveDetectorMasterTool.cxx:25
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78