ATLAS Offline Software
MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/MuonDetectorTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 
7 #include <GeoModelKernel/GeoPerfUtils.h>
8 #include <GeoModelKernel/GeoPhysVol.h>
9 #include <GeoModelKernel/GeoVolumeCursor.h>
10 #include <GeoModelRead/ReadGeoModel.h>
13 
14 
15 namespace MuonGMR4 {
17  const std::string &name,
18  const IInterface *parent)
20  declareInterface<IGeoModelTool>(this);
21 }
22 
28 
29  ATH_CHECK(m_idHelperSvc.retrieve());
30  ATH_CHECK(m_detTechTools.retrieve());
31  ATH_CHECK(m_geoDbTagSvc.retrieve());
32 
34 
35  GeoModelExperiment *theExpt = nullptr;
36  ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS"));
37  GeoPhysVol *world = theExpt->getPhysVol();
38 
39  for (auto &readOutTool : m_detTechTools) {
40  const unsigned memBefore = GeoPerfUtils::getMem();
41  ATH_CHECK(readOutTool->buildReadOutElements(*m_manager));
42  const unsigned memAfter = GeoPerfUtils::getMem();
43  ATH_MSG_INFO("Building of "<<readOutTool->name()<<" consumed "<<(memAfter - memBefore) / 1024<<" MB memory");
44  }
45  GeoVolumeCursor cursor(world);
46  while (!cursor.atEnd()) {
47  std::string volName = cursor.getName();
48  ATH_MSG_VERBOSE("Check whether "<<volName<<" belongs to the muon world. ");
49  if (std::find(m_treeTopNodes.value().begin(),
50  m_treeTopNodes.value().end(),volName) != m_treeTopNodes.value().end()) {
51  m_manager->addTreeTop(cursor.getVolume());
52  }
53  cursor.next();
54  }
55  ATH_CHECK(detStore()->record(m_manager, m_manager->getName()));
56  ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS"));
57  theExpt->addManager(m_manager);
58 
59  return StatusCode::SUCCESS;
60 }
61 
63  SG::DataProxy *proxy = detStore()->proxy(
65  if (proxy) {
66  proxy->reset();
67  m_manager = nullptr;
68  }
69  return StatusCode::SUCCESS;
70 }
71 
72 } // namespace MuonGMR4
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
GeoModelExperiment::getPhysVol
GeoPhysVol * getPhysVol()
Destructor.
Definition: GeoModelExperiment.cxx:21
MuonGMR4::MuonDetectorTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MuonDetectorTool.h:38
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
MuonGMR4::MuonDetectorTool::m_geoDbTagSvc
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MuonDetectorTool.h:47
MuonGMR4::MuonDetectorTool::MuonDetectorTool
MuonDetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/MuonDetectorTool.cxx:16
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
MuonGMR4::MuonDetectorTool::m_manager
MuonDetectorManager * m_manager
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MuonDetectorTool.h:49
MuonGMR4::MuonDetectorManager
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonDetectorManager.h:61
MuonGMR4::MuonDetectorTool::m_detTechTools
ToolHandleArray< IMuonReadoutGeomTool > m_detTechTools
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MuonDetectorTool.h:41
GeoModelExperiment
Definition: GeoModelExperiment.h:32
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
GeoModelExperiment.h
MuonGMR4
A muon chamber is a collection of readout elements belonging to the same station.
Definition: ChamberAssembleTool.h:16
MuonGMR4::MuonDetectorTool::~MuonDetectorTool
virtual ~MuonDetectorTool() override final
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
MuonDetectorManager.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
GeoModelTool
Definition: GeoModelTool.h:17
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonGMR4::MuonDetectorTool::create
virtual StatusCode create() override final
Create the Detector Node corresponding to this tool.
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/MuonDetectorTool.cxx:27
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuonDetectorTool.h
MuonGMR4::MuonDetectorManager::addTreeTop
void addTreeTop(PVConstLink pv)
Adds a new GeoModelTree node indicating the entrance to a muon system description.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonDetectorManager.cxx:129
GeoModelExperiment::addManager
void addManager(const GeoVDetectorManager *)
Definition: GeoModelExperiment.cxx:40
query_example.cursor
cursor
Definition: query_example.py:21
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
MuonGMR4::MuonDetectorTool::m_treeTopNodes
Gaudi::Property< std::vector< std::string > > m_treeTopNodes
List of GeoGraphnodes in the tree, that belong to the Muon system.
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelR4/MuonGeoModelR4/MuonDetectorTool.h:36
IGeoModelSvc.h
SG::DataProxy
Definition: DataProxy.h:44
MuonGMR4::MuonDetectorTool::clear
virtual StatusCode clear() override final
Definition: MuonPhaseII/MuonDetDescr/MuonGeoModelR4/src/MuonDetectorTool.cxx:62