ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonPhaseII
MuonDetDescr
MuonGeoModelR4
src
ToroidDetectorTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
ToroidDetectorTool.h
"
5
#include <
MuonReadoutGeometryR4/ToroidDetectorManager.h
>
6
#include <GeoModelKernel/GeoVolumeCursor.h>
7
#include <
GeoModelUtilities/GeoModelExperiment.h
>
8
9
namespace
MuonGMR4
{
10
ToroidDetectorTool::~ToroidDetectorTool
() =
default
;
11
12
StatusCode
ToroidDetectorTool::create
() {
13
GeoModelExperiment
*theExpt =
nullptr
;
14
ATH_CHECK
(detStore()->retrieve(theExpt,
"ATLAS"
));
15
16
const
std::vector<std::string>& nodeNames{
m_treeTops
};
17
if
(nodeNames.empty()) {
18
return
StatusCode::SUCCESS;
19
}
20
std::vector<PVConstLink> treeTops{};
21
22
GeoVolumeCursor cursor{theExpt->
getPhysVol
()};
23
24
while
(!cursor.atEnd()) {
25
std::string volName = cursor.getName();
26
ATH_MSG_VERBOSE
(
"Check whether \""
<<volName<<
"\" belongs to the muon world. "
);
27
if
(std::ranges::find(nodeNames, volName) != nodeNames.end()) {
28
treeTops.push_back(cursor.getVolume());
29
}
30
cursor.next();
31
}
32
ATH_MSG_DEBUG
(
"Include "
<<treeTops.size()<<
"/"
<<nodeNames.size()
33
<<
" nodes into the toroid manager ("
<<
m_mgrName
<<
")."
);
34
if
(treeTops.empty()) {
35
ATH_MSG_ERROR
(
"No top node could be found"
);
36
return
StatusCode::FAILURE;
37
38
}
39
m_manager
=
new
ToroidDetectorManager
(
m_mgrName
);
40
for
(
const
auto
& link : treeTops) {
41
m_manager
->addTreeTop(link);
42
}
43
ATH_CHECK
(detStore()->record(
m_manager
,
m_manager
->getName()));
44
theExpt->
addManager
(
m_manager
);
45
46
return
StatusCode::SUCCESS;
47
}
48
49
StatusCode
ToroidDetectorTool::clear
() {
50
if
(!
m_manager
) {
51
return
StatusCode::SUCCESS;
52
}
53
SG::DataProxy
*proxy = detStore()->proxy(
ClassID_traits<ToroidDetectorManager>::ID
(),
54
m_manager
->getName());
55
if
(proxy) {
56
proxy->reset();
57
m_manager
=
nullptr
;
58
}
59
return
StatusCode::SUCCESS;
60
}
61
62
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
GeoModelExperiment.h
ToroidDetectorManager.h
ToroidDetectorTool.h
GeoModelExperiment
Definition
GeoModelExperiment.h:32
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition
GeoModelExperiment.cxx:21
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition
GeoModelExperiment.cxx:40
MuonGMR4::ToroidDetectorManager
Simple detector manager that just holds the tree tops to the components representing the passive muon...
Definition
ToroidDetectorManager.h:12
MuonGMR4::ToroidDetectorTool::m_mgrName
Gaudi::Property< std::string > m_mgrName
Under what name the detector manager can be found in store gate.
Definition
ToroidDetectorTool.h:27
MuonGMR4::ToroidDetectorTool::m_treeTops
Gaudi::Property< std::vector< std::string > > m_treeTops
Name of the tree tops.
Definition
ToroidDetectorTool.h:29
MuonGMR4::ToroidDetectorTool::~ToroidDetectorTool
virtual ~ToroidDetectorTool() override final
MuonGMR4::ToroidDetectorTool::create
virtual StatusCode create() override final
Definition
ToroidDetectorTool.cxx:12
MuonGMR4::ToroidDetectorTool::clear
virtual StatusCode clear() override final
Definition
ToroidDetectorTool.cxx:49
MuonGMR4::ToroidDetectorTool::m_manager
ToroidDetectorManager * m_manager
Reference to the detector manger.
Definition
ToroidDetectorTool.h:31
SG::DataProxy
Definition
DataProxy.h:45
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition
MdtCalibInput.h:19
ClassID_traits::ID
static constexpr CLID ID()
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:44
Generated on
for ATLAS Offline Software by
1.17.0