ATLAS Offline Software
Loading...
Searching...
No Matches
TrackSmearingAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "TrackSmearingAlg.h"
9
10namespace InDet {
12{
13 ATH_CHECK(m_smearingTool.retrieve());
14 if (!m_biasingTool.empty())
15 ATH_CHECK(m_biasingTool.retrieve());
16
17 if (!m_systematicVariation.value().empty())
19
20 // Pre-register the systematic set in each tool's cache so the
21 // reentrant applyCorrection(track, syst) overload can look it up.
22 ATH_CHECK(m_smearingTool->applySystematicVariation(m_systSet));
23 if (!m_biasingTool.empty())
24 ATH_CHECK(m_biasingTool->applySystematicVariation(m_systSet));
25
26 ATH_CHECK(m_inTrackKey.initialize());
27 ATH_CHECK(m_outTrackKey.initialize());
28 return StatusCode::SUCCESS;
29}
30
31StatusCode TrackSmearingAlg::execute(const EventContext& ctx) const
32{
34 ATH_CHECK(inTracks.isValid());
35
36 auto [outTracks, outAux] =
37 xAOD::shallowCopyContainer(*inTracks, ctx);
38
39 for (xAOD::TrackParticle* trk : *outTracks) {
40 if (m_smearingTool->applyCorrection(*trk, m_systSet)
42 ATH_MSG_ERROR("Could not apply InDetTrackSmearingTool.");
43 return StatusCode::FAILURE;
44 }
45 if (!m_biasingTool.empty()) {
46 if (m_biasingTool->applyCorrection(*trk, m_systSet)
48 ATH_MSG_ERROR("Could not apply InDetTrackBiasingTool.");
49 return StatusCode::FAILURE;
50 }
51 }
52 }
53
55 ATH_CHECK(outHandle.record(std::move(outTracks), std::move(outAux)));
56 return StatusCode::SUCCESS;
57}
58
59} // namespace InDet
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
@ Error
Some error happened during the object correction.
Class to wrap a set of SystematicVariations.
CP::SystematicSet m_systSet
Gaudi::Property< std::string > m_systematicVariation
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inTrackKey
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_outTrackKey
PublicToolHandle< IInDetTrackSmearingTool > m_smearingTool
StatusCode execute(const EventContext &ctx) const override
PublicToolHandle< IInDetTrackBiasingTool > m_biasingTool
StatusCode initialize() override
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Primary Vertex Finder.
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, const EventContext &ctx)
Function making a shallow copy of a constant container.
TrackParticle_v1 TrackParticle
Reference the current persistent version: