ATLAS Offline Software
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
23  ATH_CHECK(m_trackingGeometryWriteKey.initialize());
24  // Retrieve tools
25  ATH_CHECK(m_trackingGeometryBuilder.retrieve());
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();
36  SG::WriteCondHandle<Trk::TrackingGeometry> writeHandle{m_trackingGeometryWriteKey, ctx};
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.
43  writeHandle.addDependency (IOVInfiniteRange::infiniteMixed());
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 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Trk::TrackingGeometry::dump
void dump(MsgStream &out, const std::string &head) const
Definition: TrackingGeometry.cxx:294
IOVInfiniteRange::infiniteMixed
static EventIDRange infiniteMixed()
Produces an mixed EventIDRange that is infinite in Time and RunLumi.
Definition: IOVInfiniteRange.h:55
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
IOVInfiniteRange.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trk::TrackingGeometryCondAlg::TrackingGeometryCondAlg
TrackingGeometryCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrackingGeometryCondAlg.cxx:12
Trk::TrackingGeometryCondAlg::execute
virtual StatusCode execute() override final
Definition: TrackingGeometryCondAlg.cxx:33
Trk::TrackingGeometryCondAlg::initialize
virtual StatusCode initialize() override final
Definition: TrackingGeometryCondAlg.cxx:18
TrackingGeometryCondAlg.h
TrackingGeometry.h
IOVSvcDefs.h
defines and typedefs for IOVSvc
SG::WriteCondHandle
Definition: WriteCondHandle.h:26