ATLAS Offline Software
Loading...
Searching...
No Matches
TrackSystematicsAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "GaudiKernel/ServiceHandle.h"
6
9
10namespace InDet {
11 TrackSystematicsAlg::TrackSystematicsAlg( const std::string& name, ISvcLocator* pSvcLocator ) :
12 AthReentrantAlgorithm( name, pSvcLocator ){}
13
15
16 ATH_CHECK(m_inTrackKey.initialize());
17 ATH_CHECK(m_outTrackKey.initialize());
19
20 // Retrieve the tools:
23
24 CP::SystematicSet systSetLRT = {
25 CP::SystematicVariation("TRK_EFF_LARGED0_GLOBAL")
26 };
27 CP::SystematicSet systSetSTD = {
28 CP::SystematicVariation("TRK_EFF_LOOSE_COMBINED"),
29 };
30
31 ATH_CHECK(m_trackFilterToolLRT->applySystematicVariation(systSetLRT));
32 ATH_CHECK(m_trackFilterToolSTD->applySystematicVariation(systSetSTD));
33
34 return StatusCode::SUCCESS;
35 }
36
37 StatusCode TrackSystematicsAlg::execute(const EventContext& ctx) const {
38
39 //Retrieve the tracks:
41
42 auto selectedTracks = std::make_unique<ConstDataVector<xAOD::TrackParticleContainer> >( SG::VIEW_ELEMENTS );
43
44 for(const xAOD::TrackParticle* track : *inTracks) {
45
46 const std::bitset<xAOD::NumberOfTrackRecoInfo> patternReco = track->patternRecoInfo();
47 bool passFilter = false;
48
49 // LRT track
50 if(patternReco.test(xAOD::SiSpacePointsSeedMaker_LargeD0)) {
51 passFilter = m_trackFilterToolLRT->accept(track);
52 }
53 // standard track
54 else {
55 passFilter = m_trackFilterToolSTD->accept(track);
56 }
57 if (passFilter) {
58 ATH_MSG_DEBUG("Track accepted!");
59 selectedTracks->push_back( track );
60 }
61 else {
62 ATH_MSG_DEBUG("Track rejected!");
63 }
64 }
65
66 std::unique_ptr<const xAOD::TrackParticleContainer> outTracks(selectedTracks.release()->asDataVector());
68
69 ATH_MSG_DEBUG( "Initial number of tracks: " << inTracks->size() );
70 ATH_MSG_DEBUG( "Selected number of tracks: " << outTracks->size() );
71
72 if(not outTrackHandle.put(std::move(outTracks))){
73 ATH_MSG_ERROR("Failed to record " << m_outTrackKey.key() << " as const xAOD::TrackParticleContainer!");
74 return StatusCode::FAILURE;
75 }
76 ATH_CHECK(m_decorDeps.linkDecors (m_inTrackKey, ctx));
77
78
79 return StatusCode::SUCCESS;
80 }
81}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
An algorithm that can be simultaneously executed in multiple threads.
Class to wrap a set of SystematicVariations.
StatusCode initialize() override
TrackSystematicsAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_outTrackKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inTrackKey
StatusCode execute(const EventContext &ctx) const override
ToolHandle< InDet::InclusiveTrackFilterTool > m_trackFilterToolLRT
SG::ShallowCopyDecorDeps< xAOD::TrackParticleContainer > m_decorDeps
ToolHandle< InDet::InDetTrackTruthFilterTool > m_trackFilterToolSTD
const_pointer_type put(std::unique_ptr< T > data, bool returnExisting=false) const
Record an object to the store.
Primary Vertex Finder.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
TrackParticle_v1 TrackParticle
Reference the current persistent version:
@ SiSpacePointsSeedMaker_LargeD0