17#include "AthLinks/ElementLink.h"
19#include <unordered_set>
24 return fabs(ijet->
eta() ) < 2.4;
28namespace HLT {
namespace MET {
42 if (
m_jvtKey.key().find(
".") == std::string::npos)
47 return StatusCode::FAILURE;
53 {
"JETB1",
"JETB2",
"JETE1",
"JETE2",
"TrackSoftTerm"});
58 const EventContext& context,
66 return StatusCode::FAILURE;
69 if (!tracks.isValid())
72 return StatusCode::FAILURE;
75 if (!vertices.isValid())
78 return StatusCode::FAILURE;
96 std::array<METComponent, 4> mhtSums;
102 std::vector<const xAOD::TrackParticle*> tstTracks;
103 tstTracks.reserve(tracks->size() );
105 if (tva->associatedVertex(itrk) == priVtx &&
108 tstTracks.push_back(itrk);
110 std::unordered_set<std::size_t> jetTrackIndices;
113 if (isCentral(ijet) ) {
128 std::size_t componentIdx = 0;
131 if (!isCentral(ijet) )
134 mhtSums.at(componentIdx) += ijet->p4();
136 for (
const auto& link : trackLinksAcc(*ijet) ) {
137 if (link.getDataPtr() != tracks.ptr() ) {
139 <<
"' do not match tracks retrieved with '"
141 return StatusCode::FAILURE;
143 jetTrackIndices.insert(link.index() );
148 if (jetTrackIndices.count(itrk->index() ) == 0)
150 tstSum += itrk->p4();
153 std::accumulate(mhtSums.begin(), mhtSums.end(), tstSum).
fillMET(
met);
155 for (std::size_t ii = 0; ii < 4; ++ii)
156 mhtSums.at(ii).fillMETComponent(ii,
met);
162 << std::accumulate(mhtSums.begin(), mhtSums.end(),
METComponent{}) );
164 return StatusCode::SUCCESS;
#define CHECK(...)
Evaluate an expression and check for errors.
Some common helper functions used by decoration handles.
Handle class for reading a decoration on an object.
FexBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
StatusCode initializeBase(const std::vector< std::string > &componentNames)
Initialize the base class.
Helper struct to build up MET values before moving them into the EDM.
void fillMETComponent(std::size_t idx, xAOD::TrigMissingET &met) const
Fill a component of the MET with this.
void fillMET(xAOD::TrigMissingET &met) const
Fill the main component of the MET with this.
ToolHandle< InDet::IInDetTrackSelectionTool > m_trackSelTool
The track selection tool.
TrkMHTFex(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
virtual StatusCode fillMET(xAOD::TrigMissingET &met, const EventContext &context, MonGroupBuilder &monitors) const override
Calculate and fill the output MET value.
Gaudi::Property< float > m_tstPtCeil
The maximum pT for tracks in the soft term.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jvtKey
The Jvt selection name.
SG::ReadHandleKey< jet::TrackVertexAssociation > m_tvaKey
The track-vertex assocation name.
SG::ReadHandleKey< xAOD::JetContainer > m_jetKey
Input jets and jvt.
deferred_t< SG::AuxElement::ConstAccessor< std::vector< ElementLink< xAOD::IParticleContainer > > > > m_trackGA
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackKey
Input tracks.
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexKey
Input vertices.
virtual StatusCode initialize() override
Initialise the fex.
Gaudi::Property< std::string > m_trackGAName
The ghost-association aux element name.
Gaudi::Property< float > m_minJvtJetPt
Minimum pt selection for JVT on central jets.
Gaudi::Property< float > m_forwardJetPt
Pt selection on forward jets.
Gaudi::Property< float > m_maxJvtJetPt
Maximum pt selection for JVT on central jets.
Gaudi::Property< float > m_jvtSelection
The JVT selection.
virtual double eta() const
The pseudorapidity ( ) of the particle.
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
std::string contKeyFromKey(const std::string &key)
Extract the container part of key.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Jet_v1 Jet
Definition of the current "jet version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrigMissingET_v1 TrigMissingET
Define the most recent version of the TrigMissingET class.