ATLAS Offline Software
Loading...
Searching...
No Matches
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 HitCollectionMap& hitCollections) {
47 // Call setup for all sensitive detectors
48 for (auto& isd : m_senDetTools) {
49 CHECK(isd->SetupEvent(hitCollections));
50 }
51 return StatusCode::SUCCESS;
52}
53
55 HitCollectionMap& hitCollections) {
56 // Call gather for all sensitive detectors
57 for (auto& isd : m_senDetTools) {
58 CHECK(isd->Gather(hitCollections));
59 }
60 return StatusCode::SUCCESS;
61}
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Small wrapper around hit collection map to facilitate accessing the hit collection.
StatusCode initialize() override final
Retrieve the SD tools. SD creation is deferred until initializeSDs.
StatusCode initializeSDs() override final
Calls initializeSD on each SD tool to create the SDs for the current worker thread.
StatusCode EndOfAthenaEvent(HitCollectionMap &) override final
Calls Gather on each SD tool.
ToolHandleArray< ISensitiveDetector > m_senDetTools
Private array of tool handles pointing to all SD tools.
StatusCode BeginOfAthenaEvent(HitCollectionMap &) override final
Calls SetupEvent on each SD tool.
SensitiveDetectorMasterTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.