ATLAS Offline Software
Loading...
Searching...
No Matches
TrackingGeometryCondAlg.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
7#include "GaudiKernel/EventContext.h"
11
13 ISvcLocator* pSvcLocator)
14 : AthAlgorithm(name, pSvcLocator)
15{
16}
17
19{
20 ATH_MSG_DEBUG("initialize " << name());
21
22 // Write Handle
24 // Retrieve tools
26 if (m_geometryProcessors.retrieve().isFailure()){
27 ATH_MSG_FATAL( "Could not retrieve " << m_geometryProcessors );
28 return StatusCode::FAILURE;
29 }
30 return StatusCode::SUCCESS;
31}
32
34 //Set up write handle
35 const EventContext& ctx = Gaudi::Hive::currentContext();
37 if (writeHandle.isValid()) {
38 ATH_MSG_DEBUG("Found valid write handle");
39 return StatusCode::SUCCESS;
40 }
41
42 // Start with infinite range and let the TG builder narrow it down.
44
45 std::unique_ptr<Trk::TrackingGeometry> trackingGeometry =
46 m_trackingGeometryBuilder->trackingGeometry(ctx, nullptr, writeHandle);
47
48 // loop over the recursive geometry processors
49 auto gpIter = m_geometryProcessors.begin();
50 auto gpIterE = m_geometryProcessors.end();
51 for (; gpIter != gpIterE; ++gpIter) {
52 if ((*gpIter)->process(*trackingGeometry).isFailure()) {
53 ATH_MSG_FATAL("Processing of TrackingGeometry did not succeed. Abort.");
54 return StatusCode::FAILURE;
55 } else {
56 ATH_MSG_VERBOSE("Successfully processed the TrackingGeometry with "
57 << (*gpIter));
58 }
59 }
60 if (m_dumpGeo) trackingGeometry->dump(msgStream(), "TrackingGeometryCondAlg");
61 ATH_CHECK(writeHandle.record(std::move(trackingGeometry)));
62
63 return StatusCode::SUCCESS;
64}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
defines and typedefs for IOVSvc
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
static EventIDRange infiniteMixed()
Produces an mixed EventIDRange that is infinite in Time and RunLumi.
void addDependency(const EventIDRange &range)
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
TrackingGeometryCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute() override final
SG::WriteCondHandleKey< TrackingGeometry > m_trackingGeometryWriteKey
Output conditions object.
ToolHandleArray< Trk::IGeometryProcessor > m_geometryProcessors
ToolHandle< Trk::IGeometryBuilderCond > m_trackingGeometryBuilder
virtual StatusCode initialize() override final