ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Atlas
G4AtlasTools
src
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>
6
#include "
SensitiveDetectorMasterTool.h
"
7
8
SensitiveDetectorMasterTool::SensitiveDetectorMasterTool
(
const
std::string&
type
,
9
const
std::string& name,
10
const
IInterface* parent)
11
: base_class(
type
, name, parent)
12
{
13
}
14
15
StatusCode
SensitiveDetectorMasterTool::initialize
()
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
25
StatusCode
SensitiveDetectorMasterTool::initializeSDs
()
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
45
StatusCode
SensitiveDetectorMasterTool::BeginOfAthenaEvent
(
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
54
StatusCode
SensitiveDetectorMasterTool::EndOfAthenaEvent
(
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
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x,...)
Definition
AthMsgStreamMacros.h:42
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
SensitiveDetectorMasterTool.h
HitCollectionMap
Small wrapper around hit collection map to facilitate accessing the hit collection.
Definition
HitCollectionMap.h:23
SensitiveDetectorMasterTool::initialize
StatusCode initialize() override final
Retrieve the SD tools. SD creation is deferred until initializeSDs.
Definition
SensitiveDetectorMasterTool.cxx:15
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
SensitiveDetectorMasterTool::EndOfAthenaEvent
StatusCode EndOfAthenaEvent(HitCollectionMap &) override final
Calls Gather on each SD tool.
Definition
SensitiveDetectorMasterTool.cxx:54
SensitiveDetectorMasterTool::m_senDetTools
ToolHandleArray< ISensitiveDetector > m_senDetTools
Private array of tool handles pointing to all SD tools.
Definition
SensitiveDetectorMasterTool.h:46
SensitiveDetectorMasterTool::BeginOfAthenaEvent
StatusCode BeginOfAthenaEvent(HitCollectionMap &) override final
Calls SetupEvent on each SD tool.
Definition
SensitiveDetectorMasterTool.cxx:45
SensitiveDetectorMasterTool::SensitiveDetectorMasterTool
SensitiveDetectorMasterTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition
SensitiveDetectorMasterTool.cxx:8
type
Generated on
for ATLAS Offline Software by
1.17.0