19 #include "GaudiKernel/ISvcLocator.h"
20 #include "GaudiKernel/MsgStream.h"
24 #ifdef TRKDETDESCR_MEMUSAGE
31 , m_geometryProcessors(this)
46 "!!! Initialization of TrackingGeometrySvc !!! The Service it to be "
47 "deprecated in favour of the relevant Condition Algorithm. !!!");
48 m_autoRetrieveTools =
false;
49 m_checkToolDeps =
false;
51 if (m_geometryProcessors.retrieve().isFailure()) {
53 return StatusCode::FAILURE;
56 if (m_buildGeometryFromTagInfo) {
61 tagInfoMgr->addListener(
this);
63 ATH_MSG_INFO(
"Building Geometry at initialisation time.");
65 if (trackingGeometryInit(
false).isFailure()) {
67 return StatusCode::FAILURE;
71 return StatusCode::SUCCESS;
78 trackingGeometryInit().ignore();
84 ATH_MSG_INFO(
"Trk::TrackingGeometrySvc::trackingGeometryInit");
86 SmartIF<StoreGateSvc>
detStore{service(
"DetectorStore")};
91 if (!m_trackingGeometryBuilder.empty() && m_trackingGeometryBuilder.retrieve().isFailure()) {
92 ATH_MSG_FATAL(
"Failed to retrieve tool '" << m_trackingGeometryBuilder <<
"'. Aborting.");
93 return StatusCode::FAILURE;
94 }
else if (m_trackingGeometryBuilder.empty()) {
96 <<
" not properly configured. No GeometryBuilder defined. Aborting.");
97 return StatusCode::FAILURE;
99 ATH_MSG_DEBUG(
"Retrieved tool " << m_trackingGeometryBuilder);
104 return StatusCode::SUCCESS;
110 ATH_MSG_INFO(
"trackingGeometryInit - initialize on TagInfoMgr callback");
113 m_trackingGeometry =
nullptr;
115 #ifdef TRKDETDESCR_MEMUSAGE
117 ATH_MSG_INFO(
"[ memory usage ] Start to monitor memory usage of PID: " << getpid());
119 m_memoryLogger.refresh(getpid());
122 m_changeVsize = (-1.) * m_memoryLogger.vmSize();
123 m_changeRss = (-1.) * m_memoryLogger.vmRss();
127 m_trackingGeometry = m_trackingGeometryBuilder->trackingGeometry().release();
129 #ifdef TRKDETDESCR_MEMUSAGE
130 ATH_MSG_INFO(
"[ memory usage ] TrackingGeometry retrieved: ");
131 m_memoryLogger.refresh(getpid());
143 if (
detStore->retrieve(oldTrackingGeometry, m_trackingGeometryName).isFailure())
144 ATH_MSG_WARNING(
"Callback evoked remove of '" << m_trackingGeometryName <<
"'. But retrieve did not succeed! ");
146 ATH_MSG_WARNING(
"Callback evoked remove of '" << m_trackingGeometryName <<
"'. But it did not succeed!");
148 delete oldTrackingGeometry;
154 for (; gpIter != gpIterE; ++gpIter) {
155 if ((*gpIter)->process(*atlasTrackingGeometry).isFailure()) {
156 ATH_MSG_FATAL(
"Processing of TrackingGeometry did not succeed. Abort.");
157 return StatusCode::FAILURE;
159 ATH_MSG_VERBOSE(
"Successfully processed the TrackingGeometry with " << (*gpIter));
160 #ifdef TRKDETDESCR_MEMUSAGE
161 ATH_MSG_INFO(
"[ memory usage ] After processing with " << (*gpIter));
162 m_memoryLogger.refresh(getpid());
168 if (
detStore->record(atlasTrackingGeometry, m_trackingGeometryName,
false).isFailure()) {
171 ATH_MSG_DEBUG(
"initialize() successful: TrackingGeometry '" << m_trackingGeometryName
172 <<
"' built and written to DetectorStore.");
175 return StatusCode::SUCCESS;
181 ATH_MSG_WARNING(
"TrackingGeometry not set ptr=" <<
static_cast<const void*
>(m_trackingGeometry));
188 #ifdef TRKDETDESCR_MEMUSAGE
189 ATH_MSG_INFO(
"[ memory usage ] Change in memory usage -------------------------------- ");
190 ATH_MSG_INFO(
"[ memory usage ] Virtual memory change (vsize) : " << m_changeVsize);
191 ATH_MSG_INFO(
"[ memory usage ] Real memory change (rss) : " << m_changeRss);
192 ATH_MSG_INFO(
"[ memory usage ] ---------------------------------------------------------");
195 return StatusCode::SUCCESS;