ATLAS Offline Software
MHTFex.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 /******************************************************************************
6  * @package Trigger/TrigAlgorithms/TrigEFMissingET
7  * @file MHTFex.cxx
8  *
9  * Implementation of the mht fex class
10  * @author Jon Burr
11  *****************************************************************************/
12 
13 #include "MHTFex.h"
15 #include <array>
16 
17 namespace HLT { namespace MET {
18  MHTFex::MHTFex(const std::string& name, ISvcLocator* pSvcLocator) :
19  FexBase(name, pSvcLocator)
20  {}
21 
23  {
24  CHECK( m_jetKey.initialize() );
25  return initializeBase({"JETB1", "JETB2", "JETE1", "JETE2"});
26  }
27 
30  const EventContext& context,
31  MonGroupBuilder&) const
32  {
33  // Retrieve the inputs
34  auto jets = SG::makeHandle(m_jetKey, context);
35  if (!jets.isValid())
36  {
37  ATH_MSG_ERROR("Failed to retrieve " << m_jetKey);
38  return StatusCode::FAILURE;
39  }
40 
41  // Prepare the output values
42  std::array<METComponent, 4> mhtSums;
43  for (const xAOD::Jet* ijet : *jets) {
44  // Apply the pT selection
45  if (ijet->pt() < (isCentral(ijet) ? m_centralPtCut : m_forwardPtCut) )
46  continue;
47  // Get the right MET component
48  std::size_t componentIdx = 0;
49  if (ijet->eta() < 0)
50  ++componentIdx;
51  if (!isCentral(ijet) )
52  componentIdx += 2;
53  mhtSums.at(componentIdx) += ijet->p4();
54  }
55 
56  // Save the full sum
57  std::accumulate(mhtSums.begin(), mhtSums.end(), METComponent{}).fillMET(met);
58  // Save each component
59  for (std::size_t ii = 0; ii < 4; ++ii)
60  mhtSums.at(ii).fillMETComponent(ii, met);
61 
62  return StatusCode::SUCCESS;
63  }
64 } } //> end class HLT::MET
METComponent.h
initialize
void initialize()
Definition: run_EoverP.cxx:894
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
met
Definition: IMETSignificance.h:24
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
HLT
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Definition: HLTResultReader.h:26
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MHTFex.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
HLT::MET::MHTFex::MHTFex
MHTFex(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: MHTFex.cxx:30
HLT::MET::METComponent
Helper struct to build up MET values before moving them into the EDM.
Definition: METComponent.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
MET
Definition: MET.py:1
HLT::MET::MonGroupBuilder
Definition: MonGroupBuilder.h:45
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
xAOD::TrigMissingET_v1
Class holding the Missing ET trigger fex results.
Definition: TrigMissingET_v1.h:32
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
met::fillMET
StatusCode fillMET(xAOD::MissingET *&met, xAOD::MissingETContainer *metCont, const std::string &metKey, const MissingETBase::Types::bitmask_t metSource)
Definition: METHelpers.cxx:123