ATLAS Offline Software
Loading...
Searching...
No Matches
TrackingGeometryTest.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 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
22Trk::TrackingGeometryTest::TrackingGeometryTest(const std::string& name, ISvcLocator* pSvcLocator) :
23 Trk::TrkDetDescrUnitTestBase(name, pSvcLocator),
24#ifdef TRKDETDESCR_MEMUSAGE
25 m_memoryLogger(),
26#endif
27 m_executed(false),
28 m_trackingGeometrySvc("TrackingGeometrySvc","AtlasTrackingGeometrySvc"),
29 m_trackingGeometry(nullptr),
30 m_trackingGeometryName("AtlasTrackingGeometry"),
32 {
33 // get the service handle for the TrackingGeometry
34 declareProperty("TrackingGeometrySvc" , m_trackingGeometrySvc);
35 // get the tools for display and recording
36 declareProperty("TrackingGeometryProcessors" , m_trackingGeometryProcessors);
37 }
38
40{
41 #ifdef TRKDETDESCR_MEMUSAGE
42 m_memoryLogger.refresh(getpid());
43 ATH_MSG_INFO( "[ memory usage ] Memory monitoring activated through TRKDETDESCR_MEMUSAGE " );
44 ATH_MSG_INFO( "[ memory usage ] initialize (start) : " );
45 ATH_MSG_INFO( m_memoryLogger );
46 #endif
47
48 // Get the TrackingGeometry from StoreGate
49 // initialize the TrackingGeometrySvc
50 if (m_trackingGeometrySvc.retrieve().isFailure()) {
51 ATH_MSG_FATAL( "Cannot retrieve TrackingGeometrySvc. Abort job. " );
52 return StatusCode::FAILURE;
53 }
54 m_trackingGeometryName = m_trackingGeometrySvc->trackingGeometryName();
55
56 // The Processors -------------------------------------------------------------
57 if ( m_trackingGeometryProcessors.retrieve().isFailure())
58 {
59 ATH_MSG_FATAL( "Failed to retrieve tool(s) in " << m_trackingGeometryProcessors );
60 return StatusCode::FAILURE;
61 } else
62 ATH_MSG_INFO( "Retrieved tools : " << m_trackingGeometryProcessors );
63
64 #ifdef TRKDETDESCR_MEMUSAGE
65 m_memoryLogger.refresh(getpid());
66 ATH_MSG_INFO( "[ memory usage ] initialize (end) : " );
67 ATH_MSG_INFO( m_memoryLogger );
68 #endif
69
70 return StatusCode::SUCCESS;
71}
72
73
75{
76 ATH_MSG_VERBOSE("Running the TrackingGeometryTest Test");
77
78 // ------------------------------- get the trackingGeometry at first place
79 if (!m_trackingGeometry) {
80 if ((detStore()->retrieve(m_trackingGeometry, m_trackingGeometryName)).isFailure())
81 ATH_MSG_FATAL( "Could not retrieve TrackingGeometry '" << m_trackingGeometryName << "' from DetectorStore." );
82 else
83 ATH_MSG_INFO( "TrackingGeometry '" << m_trackingGeometryName << "' successfully retrieved from DetectorStore." );
84 }
85 // only run if it didn't already run before
87 // push the geometry through the different processors
88 for (ToolHandle<Trk::IGeometryProcessor> proc : m_trackingGeometryProcessors) {
89 ATH_MSG_INFO("Parse geometry with processor " << proc->name() );
90 //test so const_cast prb fine
91 if ((proc->process(const_cast<Trk::TrackingGeometry&>(*m_trackingGeometry))).isFailure()){
92 ATH_MSG_FATAL("Could not process the TrackingGeometry with '" << proc->name() <<"'. Aborting test.");
93 return StatusCode::FAILURE;
94 }
95 }
96 m_executed = true;
97 }
98 return StatusCode::SUCCESS;
99
100}
101
102
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
const TrackingGeometry * m_trackingGeometry
The TrackingGeometry to be retrieved.
ToolHandleArray< Trk::IGeometryProcessor > m_trackingGeometryProcessors
Tool to write out a Display format for external viewers.
TrackingGeometryTest(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
ServiceHandle< Trk::ITrackingGeometrySvc > m_trackingGeometrySvc
Service handle for retrieving the TrackingGeometry.
std::string m_trackingGeometryName
The Name of the TrackingGeometry.
bool m_executed
Make sure it only runs once.
The TrackingGeometry class is the owner of the constructed TrackingVolumes.
TrkDetDescrUnitTestBase(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Ensure that the ATLAS eigen extensions are properly loaded.