ATLAS Offline Software
Loading...
Searching...
No Matches
CaloExtensionBuilderAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5/********************************************************************
6NAME: CaloExtensionBuilderAlg
7PACKAGE: offline/Reconstruction/RecoTools/TrackToCalo/CaloExtensionBuilderAlg
8
9AUTHORS: Anastopoulos/Capriles
10PURPOSE: Performs Calo Extension for all selected tracks
11 **********************************************************************/
13//
16#include "VxVertex/RecVertex.h"
21#include "xAODTracking/Vertex.h"
23
24// std includes
25#include <algorithm>
26#include <cmath>
27#include <memory>
28
31{
33 ATH_CHECK(m_ParticleCacheKey.initialize());
34 ATH_CHECK(m_TrkPartContainerKey.initialize());
35 return StatusCode::SUCCESS;
36}
37
38StatusCode
39Trk::CaloExtensionBuilderAlg::execute(const EventContext& ctx) const
40{
41 /*
42 * We want to extrapolate everything bar the the TRT-alone
43 */
45 ctx);
46 if (!tracks.isValid()) {
47 ATH_MSG_FATAL("Failed to retrieve TrackParticle container: "
48 << m_TrkPartContainerKey.key());
49 return StatusCode::FAILURE;
50 }
51 // creating and saving the calo extension collection
53 ATH_CHECK(lastCache.record(std::make_unique<CaloExtensionCollection>()));
54
55 // set everything to false
56 const xAOD::TrackParticleContainer* ptrTracks = tracks.cptr();
57 std::vector<bool> mask(ptrTracks->size(), false);
58 // set to true if 500 MeV and above
59 // or not TRT-alone
60 for (const auto* track : *tracks) {
61 if (track->pt() < 500) {
62 continue;
63 }
64 // Cut out TRT alone, but do it for all else
65 if (track->patternRecoInfo().test(xAOD::TRTStandalone)) {
66 continue;
67 }
68 mask[track->index()] = true;
69 }
70
71 ATH_CHECK(m_particleCaloExtensionTool->caloExtensionCollection(
72 ctx, *ptrTracks, mask, *lastCache));
73
74 return StatusCode::SUCCESS;
75}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrkPartContainerKey
input Track collection and vertex
virtual StatusCode initialize() override final
virtual StatusCode execute(const EventContext &ctx) const override final
ToolHandle< Trk::IParticleCaloExtensionTool > m_particleCaloExtensionTool
the Calo Extension tool
SG::WriteHandleKey< CaloExtensionCollection > m_ParticleCacheKey
output particle calo extension collection
::StatusCode StatusCode
StatusCode definition for legacy code.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
@ TRTStandalone
TRT Standalone.