ATLAS Offline Software
Loading...
Searching...
No Matches
TrackingGeometryTest.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6// TrackingGeometryTest.cxx, (c) ATLAS Detector software
8
9// Trk includes
12#include "TrkGeometry/Layer.h"
15
16// monitor memory usage
17#ifdef TRKDETDESCR_MEMUSAGE
18#include <unistd.h>
19#endif
20
21
23{
24 #ifdef TRKDETDESCR_MEMUSAGE
25 m_memoryLogger.refresh(getpid());
26 ATH_MSG_INFO( "[ memory usage ] Memory monitoring activated through TRKDETDESCR_MEMUSAGE " );
27 ATH_MSG_INFO( "[ memory usage ] initialize (start) : " );
28 ATH_MSG_INFO( m_memoryLogger );
29 #endif
30
31 // Get the TrackingGeometry from StoreGate
32 // initialize the TrackingGeometrySvc
33 if (m_trackingGeometrySvc.retrieve().isFailure()) {
34 ATH_MSG_FATAL( "Cannot retrieve TrackingGeometrySvc. Abort job. " );
35 return StatusCode::FAILURE;
36 }
37 m_trackingGeometryName = m_trackingGeometrySvc->trackingGeometryName();
38
39 // The Processors -------------------------------------------------------------
40 if ( m_trackingGeometryProcessors.retrieve().isFailure())
41 {
42 ATH_MSG_FATAL( "Failed to retrieve tool(s) in " << m_trackingGeometryProcessors );
43 return StatusCode::FAILURE;
44 } else
45 ATH_MSG_INFO( "Retrieved tools : " << m_trackingGeometryProcessors );
46
47 #ifdef TRKDETDESCR_MEMUSAGE
48 m_memoryLogger.refresh(getpid());
49 ATH_MSG_INFO( "[ memory usage ] initialize (end) : " );
50 ATH_MSG_INFO( m_memoryLogger );
51 #endif
52
53 return StatusCode::SUCCESS;
54}
55
56
58{
59 ATH_MSG_VERBOSE("Running the TrackingGeometryTest Test");
60
61 // ------------------------------- get the trackingGeometry at first place
62 if (!m_trackingGeometry) {
63 if ((detStore()->retrieve(m_trackingGeometry, m_trackingGeometryName)).isFailure())
64 ATH_MSG_FATAL( "Could not retrieve TrackingGeometry '" << m_trackingGeometryName << "' from DetectorStore." );
65 else
66 ATH_MSG_INFO( "TrackingGeometry '" << m_trackingGeometryName << "' successfully retrieved from DetectorStore." );
67 }
68 // only run if it didn't already run before
70 // push the geometry through the different processors
71 for (ToolHandle<Trk::IGeometryProcessor> proc : m_trackingGeometryProcessors) {
72 ATH_MSG_INFO("Parse geometry with processor " << proc->name() );
73 //test so const_cast prb fine
74 if ((proc->process(const_cast<Trk::TrackingGeometry&>(*m_trackingGeometry))).isFailure()){
75 ATH_MSG_FATAL("Could not process the TrackingGeometry with '" << proc->name() <<"'. Aborting test.");
76 return StatusCode::FAILURE;
77 }
78 }
79 m_executed = true;
80 }
81 return StatusCode::SUCCESS;
82
83}
84
85
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(x,...)
const ServiceHandle< StoreGateSvc > & detStore() const
const TrackingGeometry * m_trackingGeometry
The TrackingGeometry to be retrieved.
ToolHandleArray< Trk::IGeometryProcessor > m_trackingGeometryProcessors
ServiceHandle< Trk::ITrackingGeometrySvc > m_trackingGeometrySvc
bool m_executed
Make sure it only runs once.
The TrackingGeometry class is the owner of the constructed TrackingVolumes.