ATLAS Offline Software
Loading...
Searching...
No Matches
HGTD_DetectorTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// includes
6#include "HGTD_DetectorTool.h"
15
17#include "SGTools/DataProxy.h"
18
20 const std::string &name,
21 const IInterface *parent) :
22 GeoModelTool(type, name, parent)
23{
24}
25
27
28 ATH_CHECK(m_geoDbTagSvc.retrieve());
29 ATH_CHECK(m_rdbAccessSvc.retrieve());
30
31 // Get their interfaces to pass to the DetectorFactory
32 m_athenaComps.setDetStore(detStore().operator->());
33 m_athenaComps.setGeoDbTagSvc(&*m_geoDbTagSvc);
34 m_athenaComps.setRDBAccessSvc(&*m_rdbAccessSvc);
35 const HGTD_ID* idHelper{nullptr};
36 ATH_CHECK(detStore()->retrieve(idHelper, "HGTD_ID"));
37 m_athenaComps.setIdHelper(idHelper);
38
39 GeoModelExperiment *theExpt = nullptr;
40 ATH_CHECK(detStore()->retrieve(theExpt, "ATLAS"));
41
42 // The * converts a ConstPVLink to a ref to a GeoVPhysVol, the & takes the address of the GeoVPhysVol
43 GeoPhysVol *world = &*theExpt->getPhysVol();
44
45 HGTD_DetectorFactory theHGTDFactory(&m_athenaComps);
47 theHGTDFactory.create(world);
48
49 // Get the manager from the factory and store it in the detector store.
50 m_detectorManager = theHGTDFactory.getDetectorManager();
51 if (!m_detectorManager) {
52 ATH_MSG_ERROR( "HGTD_DetectorManager not found; not created in HGTD_DetectorFactory?" );
53 return(StatusCode::FAILURE);
54 }
55
56 ATH_MSG_DEBUG("Registering HGTD_DetectorManager as " << m_detectorManager->getName() );
57 ATH_CHECK( detStore()->record(m_detectorManager, m_detectorManager->getName()) );
58
60 return StatusCode::SUCCESS;
61}
62
64
65 // Release manager from the detector store
66 SG::DataProxy* proxy = detStore()->proxy(ClassID_traits< HGTD_DetectorManager >::ID(),m_detectorManager->getName());
67 if (proxy) {
68 proxy->reset();
69 m_detectorManager = nullptr;
70 }
71
72 return StatusCode::SUCCESS;
73}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
GeoPhysVol * getPhysVol()
Destructor.
void addManager(const GeoVDetectorManager *)
virtual void create(GeoPhysVol *world) override
virtual const HGTD_DetectorManager * getDetectorManager() const override
const HGTD_DetectorManager * m_detectorManager
HGTD_GeoModelAthenaComps m_athenaComps
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
ServiceHandle< IRDBAccessSvc > m_rdbAccessSvc
virtual StatusCode create() override final
HGTD_DetectorTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode clear() override final
BooleanProperty m_printIDdict
This is an Identifier helper class for the HGTD subdetector.
Definition HGTD_ID.h:47