ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkDetDescr
TrkDetDescrUnitTests
src
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
10
#include "
TrkDetDescrUnitTests/TrackingGeometryTest.h
"
11
#include "
TrkDetDescrInterfaces/IGeometryProcessor.h
"
12
#include "
TrkGeometry/Layer.h
"
13
#include "
TrkGeometry/TrackingGeometry.h
"
14
#include "
TrkGeometry/TrackingVolume.h
"
15
16
// monitor memory usage
17
#ifdef TRKDETDESCR_MEMUSAGE
18
#include <unistd.h>
19
#endif
20
21
22
Trk::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"
),
31
m_trackingGeometryProcessors
()
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
39
StatusCode
Trk::TrackingGeometryTest::initializeTest
()
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
74
StatusCode
Trk::TrackingGeometryTest::runTest
()
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
86
if
(!
m_executed
&&
m_trackingGeometry
){
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
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
IGeometryProcessor.h
Layer.h
TrackingGeometryTest.h
TrackingGeometry.h
TrackingVolume.h
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
Trk::TrackingGeometryTest::m_trackingGeometry
const TrackingGeometry * m_trackingGeometry
The TrackingGeometry to be retrieved.
Definition
TrackingGeometryTest.h:57
Trk::TrackingGeometryTest::m_trackingGeometryProcessors
ToolHandleArray< Trk::IGeometryProcessor > m_trackingGeometryProcessors
Tool to write out a Display format for external viewers.
Definition
TrackingGeometryTest.h:59
Trk::TrackingGeometryTest::TrackingGeometryTest
TrackingGeometryTest(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition
TrackingGeometryTest.cxx:22
Trk::TrackingGeometryTest::initializeTest
StatusCode initializeTest()
Definition
TrackingGeometryTest.cxx:39
Trk::TrackingGeometryTest::m_trackingGeometrySvc
ServiceHandle< Trk::ITrackingGeometrySvc > m_trackingGeometrySvc
Service handle for retrieving the TrackingGeometry.
Definition
TrackingGeometryTest.h:56
Trk::TrackingGeometryTest::runTest
StatusCode runTest()
Definition
TrackingGeometryTest.cxx:74
Trk::TrackingGeometryTest::m_trackingGeometryName
std::string m_trackingGeometryName
The Name of the TrackingGeometry.
Definition
TrackingGeometryTest.h:58
Trk::TrackingGeometryTest::m_executed
bool m_executed
Make sure it only runs once.
Definition
TrackingGeometryTest.h:54
Trk::TrackingGeometry
The TrackingGeometry class is the owner of the constructed TrackingVolumes.
Definition
TrackingGeometry.h:68
Trk::TrkDetDescrUnitTestBase::TrkDetDescrUnitTestBase
TrkDetDescrUnitTestBase(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition
TrkDetDescrUnitTestBase.cxx:12
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Generated on
for ATLAS Offline Software by
1.17.0