ATLAS Offline Software
Loading...
Searching...
No Matches
ToroidDetectorTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
6#include <GeoModelKernel/GeoVolumeCursor.h>
8
9namespace MuonGMR4{
11
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 }
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
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
Simple detector manager that just holds the tree tops to the components representing the passive muon...
Gaudi::Property< std::string > m_mgrName
Under what name the detector manager can be found in store gate.
Gaudi::Property< std::vector< std::string > > m_treeTops
Name of the tree tops.
virtual ~ToroidDetectorTool() override final
virtual StatusCode create() override final
virtual StatusCode clear() override final
ToroidDetectorManager * m_manager
Reference to the detector manger.
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...