ATLAS Offline Software
TrackingGeometryCondAlgTest.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "GaudiKernel/ISvcLocator.h"
6 
8 
9 // Trk includes
11 #include "TrkGeometry/Layer.h"
12 
13 
14 Trk::TrackingGeometryCondAlgTest::TrackingGeometryCondAlgTest(const std::string& name, ISvcLocator* pSvcLocator)
15  : AthReentrantAlgorithm(name, pSvcLocator),
16  m_trackingGeometrySvc("AtlasTrackingGeometrySvc", name),
17  m_trackingGeometryProcessors()
18 {
19  declareProperty("GeometryProcessors", m_trackingGeometryProcessors);
20 }
21 
23 {
24  ATH_MSG_DEBUG("initialize " << name());
25 
26  // Read Handle Key
27  ATH_CHECK(m_trackingGeometryReadKey.initialize());
28 
29 
30  ATH_CHECK(m_trackingGeometrySvc.retrieve());
31  ATH_CHECK(m_trackingGeometryProcessors.retrieve());
32  return StatusCode::SUCCESS;
33 }
34 
35 StatusCode Trk::TrackingGeometryCondAlgTest::execute(const EventContext& ctx) const {
36 
37  //Set up read handle
38  SG::ReadCondHandle<Trk::TrackingGeometry> readHandle{m_trackingGeometryReadKey, ctx};
39  if (!readHandle.isValid() || *readHandle == nullptr) {
40  ATH_MSG_WARNING(m_trackingGeometryReadKey.fullKey() << " is not available.");
41  return StatusCode::FAILURE;
42  }
43  const Trk::TrackingGeometry* trkGeom = *readHandle;
44  ATH_MSG_INFO( "eventID: " << ctx.eventID());
45  const TrackingGeometry* trackingGeometry = m_trackingGeometrySvc->trackingGeometry();
46  if( trackingGeometry == nullptr){
47  ATH_MSG_FATAL( "TRACKING GEOMETRY NOT FOUND IN SVC");
48  return StatusCode::FAILURE;
49  }
50 
51  for (const ToolHandle<Trk::IGeometryProcessor>& proc : m_trackingGeometryProcessors) {
52  ATH_MSG_VERBOSE("PRINT SVC TG");
53  StatusCode sc1 = proc->process(const_cast<Trk::TrackingGeometry&>(*trackingGeometry));
54  ATH_CHECK(sc1);
55  ATH_MSG_VERBOSE("PRINT COND TG");
56  StatusCode sc2 = proc->process(const_cast<Trk::TrackingGeometry&>(*trkGeom));
57  ATH_CHECK(sc2);
58  }
59  return StatusCode::SUCCESS;
60 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Layer.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
Trk::TrackingGeometryCondAlgTest::TrackingGeometryCondAlgTest
TrackingGeometryCondAlgTest(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrackingGeometryCondAlgTest.cxx:14
Trk::TrackingGeometry
Definition: TrackingGeometry.h:67
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TrackingGeometryCondAlgTest.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::TrackingGeometryCondAlgTest::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TrackingGeometryCondAlgTest.cxx:35
mc.proc
proc
Definition: mc.PhPy8EG_A14NNPDF23_gg4l_example.py:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Trk::TrackingGeometryCondAlgTest::initialize
virtual StatusCode initialize() override
Definition: TrackingGeometryCondAlgTest.cxx:22
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
IOVSvcDefs.h
defines and typedefs for IOVSvc
Trk::TrackingGeometryCondAlgTest::m_trackingGeometryProcessors
ToolHandleArray< Trk::IGeometryProcessor > m_trackingGeometryProcessors
Tool to write out a Display format for external viewers.
Definition: TrackingGeometryCondAlgTest.h:44