ATLAS Offline Software
TrackSlimmer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TrackSlimmer.cxx, (c) ATLAS Detector software
8 
12 
14  ISvcLocator* pSvcLocator)
15  : AthReentrantAlgorithm(name, pSvcLocator)
16  , m_slimTool("Trk::TrkTrackSlimmingTool/TrkTrackSlimmingTool")
17  , m_trackLocation{ "ConvertedMooreTracks" }
18 {
19  declareProperty("TrackSlimmingTool", m_slimTool);
20  declareProperty("TrackLocation", m_trackLocation);
21 }
22 
24 
27 {
28  if (m_slimTool.retrieve().isFailure()) {
29  ATH_MSG_ERROR("Failed to retrieve TrkTrackSlimmingTool tool "
30  << m_slimTool);
31  return StatusCode::FAILURE;
32  }
33  ATH_CHECK(m_trackLocation.initialize());
34  return StatusCode::SUCCESS;
35 }
36 
39 {
40  return StatusCode::SUCCESS;
41 }
42 
44 Trk::TrackSlimmer::execute(const EventContext& ctx) const
45 {
46  auto InputHandles = m_trackLocation.makeHandles(ctx);
47  auto InputIt = InputHandles.begin();
48  auto InputE = InputHandles.end();
49  for (; InputIt != InputE; ++InputIt) {
50  auto& trackLocation = *InputIt;
51  if (trackLocation.isValid()) {
52  // loop through tracks, slimming them as you go.
53  TrackCollection::const_iterator it = trackLocation->begin();
54  TrackCollection::const_iterator itEnd = trackLocation->end();
55  for (; it != itEnd; ++it) {
56  m_slimTool->slimConstTrack(**it);
57  } // Loop over Trk::Track
58  } // is valid
59  } // loop over input collections
60 
61  return StatusCode::SUCCESS;
62 }
Trk::TrackSlimmer::TrackSlimmer
TrackSlimmer(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition: TrackSlimmer.cxx:13
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
Trk::TrackSlimmer::execute
StatusCode execute(const EventContext &ctx) const override
standard Athena-Algorithm method
Definition: TrackSlimmer.cxx:44
skel.it
it
Definition: skel.GENtoEVGEN.py:423
Trk::TrackSlimmer::~TrackSlimmer
~TrackSlimmer()
Default Destructor.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
ITrackSlimmingTool.h
Trk::TrackSlimmer::initialize
StatusCode initialize() override
standard Athena-Algorithm method
Definition: TrackSlimmer.cxx:26
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Trk::TrackSlimmer::finalize
StatusCode finalize() override
standard Athena-Algorithm method
Definition: TrackSlimmer.cxx:38
TrackSlimmer.h
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15