ATLAS Offline Software
Loading...
Searching...
No Matches
ServiceExtensionTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
5
6#include <GeoModelKernel/GeoPhysVol.h>
8#include "GeoModelXml/GmxInterface.h"
9#include <SGTools/DataProxy.h>
11
12namespace ITk
13{
14
16 const std::string &name,
17 const IInterface *parent)
18 : GeoModelXmlTool(type, name, parent)
19{
20}
21
23{
24 // retrieve the common stuff
26
27 GeoModelExperiment *theExpt = nullptr;
28 ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS"));
30
31 const GeoModelIO::ReadGeoModel* sqlreader = getSqliteReader();
32
33 if(!sqlreader){
34 if (!isAvailable(m_node, m_table)) {
35 ATH_MSG_ERROR("No ServiceExtension geometry found. ServiceExtension can not be built.");
36 return StatusCode::FAILURE;
37 }
38 }
39 ATH_MSG_INFO("Building Service Extension");
40
41 GeoPhysVol *world = &*theExpt->getPhysVol();
42
43 // Load the geometry, create the volume,
44 // node,table are the location in the DB to look for the clob
45 // empty strings are the (optional) containing detector and envelope names
46 // allowed to pass a null sqlreader ptr - it will be used to steer the source of the geometry
47 GmxInterface gmxInterface;
48 const GeoVPhysVol * topVol = createTopVolume(world, gmxInterface, m_node,m_table, m_containingDetectorName, m_envelopeVolumeName,sqlreader);
49 if (!topVol) {
50 ATH_MSG_FATAL("Could not find the Top Volume!!!");
51 return StatusCode::FAILURE;
52 }
53
54 manager->addTreeTop(topVol);
56
57 ATH_CHECK(detStore()->record(m_detManager, m_detManager->getName()));
58 theExpt->addManager(m_detManager);
59
60 return StatusCode::SUCCESS;
61}
62
63
64} // namespace ITk
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
virtual GeoVDetectorManager * manager()
StatusCode createBaseTool()
bool isAvailable(const std::string &versionNode, const std::string &tableNode) const
GeoModelXmlTool(const std::string &type, const std::string &name, const IInterface *parent)
const GeoVPhysVol * createTopVolume(GeoPhysVol *worldVol, GmxInterface &interface, const std::string &versionNode, const std::string &tableNode, const std::string &containingDetector="", const std::string &envelopeName="", const GeoModelIO::ReadGeoModel *sqlreader=nullptr) const
GeoModelIO::ReadGeoModel * getSqliteReader() const
ServiceExtensionTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::string > m_table
const ServiceExtensionManager * m_detManager
Gaudi::Property< std::string > m_envelopeVolumeName
Gaudi::Property< std::string > m_ServiceExtensionManagerName
Gaudi::Property< std::string > m_node
Gaudi::Property< std::string > m_containingDetectorName
virtual StatusCode create() override final