ATLAS Offline Software
PFSumFex.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 /******************************************************************************
6  * @package Trigger/TrigAlgorithms/TrigEFMissingET
7  * @file PFSumFex.cxx
8  *
9  * Implementation of the PFlow fex class
10  * @author Jon Burr
11  *****************************************************************************/
12 
13 #include "PFSumFex.h"
15 #include <array>
16 
17 namespace HLT { namespace MET {
18 
19  PFSumFex::PFSumFex(const std::string& name, ISvcLocator* pSvcLocator) :
20  FexBase(name, pSvcLocator)
21  {}
22 
24  {
25  CHECK( m_neutralPFOKey.initialize() );
26  CHECK( m_chargedPFOKey.initialize() );
27  return initializeBase({"NeutralPFOs", "ChargedHSPFOs", "ChargedPUPFOs"});
28  }
29 
32  const EventContext& context,
33  MonGroupBuilder&) const
34  {
35  auto charged = SG::makeHandle(m_chargedPFOKey, context);
36  if (!charged.isValid())
37  {
38  ATH_MSG_ERROR("Failed to retrieve " << m_chargedPFOKey);
39  return StatusCode::FAILURE;
40  }
41  auto neutral = SG::makeHandle(m_neutralPFOKey, context);
42  if (!neutral.isValid())
43  {
44  ATH_MSG_ERROR("Failed to retrieve " << m_neutralPFOKey);
45  return StatusCode::FAILURE;
46  }
47 
48  std::array<METComponent, 3> pfoSums;
49  for (const xAOD::IParticle* ipfo : *neutral)
50  // 0 is the 'NeutralPFOs' component
51  pfoSums.at(0) += *ipfo;
52  const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV");
53  for (const xAOD::IParticle* ipfo : *charged)
54  // 1 is the 'ChargedHSPFOs' component, 2 is the 'ChargedPUPFOs' component
55  (PVMatchedAcc(*ipfo) ? pfoSums.at(1) : pfoSums.at(2) ) += *ipfo;
56 
57  // Sum together the components
58  METComponent total = pfoSums.at(0) + pfoSums.at(1);
59  if (!m_chargedOnlyFromPV)
60  total += pfoSums.at(2);
61  total.fillMET(met);
62  for (std::size_t ii = 0; ii < 3; ++ii)
63  pfoSums.at(ii).fillMETComponent(ii, met);
64  return StatusCode::SUCCESS;
65  }
66 } } //> end namespace HLT::MET
METComponent.h
initialize
void initialize()
Definition: run_EoverP.cxx:894
HLT::MET::METComponent::fillMET
void fillMET(xAOD::TrigMissingET &met) const
Fill the main component of the MET with this.
Definition: METComponent.cxx:91
PFSumFex.h
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:54
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
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
HLT::MET::PFSumFex::PFSumFex
PFSumFex(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: PFSumFex.cxx:31
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TCS::MET
@ MET
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Types.h:16
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
CP::neutral
@ neutral
Definition: Reconstruction/PFlow/PFlowUtils/PFlowUtils/PFODefs.h:11
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:195
HLT::MET::MonGroupBuilder
Definition: MonGroupBuilder.h:45
xAOD::TrigMissingET_v1
Class holding the Missing ET trigger fex results.
Definition: TrigMissingET_v1.h:32
met::fillMET
StatusCode fillMET(xAOD::MissingET *&met, xAOD::MissingETContainer *metCont, const std::string &metKey, const MissingETBase::Types::bitmask_t metSource)
Definition: METHelpers.cxx:123
CP::charged
@ charged
Definition: Reconstruction/PFlow/PFlowUtils/PFlowUtils/PFODefs.h:11