ATLAS Offline Software
TCFex.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 TCFex.cxx
8  *
9  * Implementation of the topocluster fex class
10  * @author Jon Burr
11  *****************************************************************************/
12 
13 #include "TCFex.h"
15 #include <array>
16 
17 namespace {
18  bool isBarrel(const xAOD::CaloCluster* iclus,
20  return fabs(iclus->eta(state) ) < 1.5;
21  }
22 }
23 
24 namespace HLT { namespace MET {
25  TCFex::TCFex(const std::string& name, ISvcLocator* pSvcLocator) :
26  FexBase(name, pSvcLocator)
27  {}
28 
30  {
32  return initializeBase({"TCB1", "TCB2", "TCE1", "TCE2"});
33  }
34 
37  const EventContext& context,
38  MonGroupBuilder&) const
39  {
40  // Retrieve the inputs
41  auto clusters = SG::makeHandle(m_clusterKey, context);
42  if (!clusters.isValid())
43  {
44  ATH_MSG_ERROR("Failed to retrieve " << m_clusterKey);
45  return StatusCode::FAILURE;
46  }
47 
48  auto state = m_useUncalibrated ?
51 
52  // Prepare the output values
53  std::array<METComponent, 4> tcSums;
54  for (const xAOD::CaloCluster* iclus : *clusters) {
55  // Pick the right component
56  std::size_t componentIdx = 0;
57  if (iclus->eta() < 0)
58  ++componentIdx;
59  if (!isBarrel(iclus, state) )
60  componentIdx += 2;
61  tcSums.at(componentIdx) += SignedKinematics::fromEnergyEtaPhiM(
62  iclus->e(state), iclus->eta(state), iclus->phi(state),
63  m_useUncalibrated ? iclus->rawM() : iclus->calM() );
64  }
65  // Save the total
66  std::accumulate(tcSums.begin(), tcSums.end(), METComponent{}).fillMET(met);
67 
68  // Save each component
69  for (std::size_t ii = 0; ii < 4; ++ii)
70  tcSums.at(ii).fillMETComponent(ii, met);
71 
72  return StatusCode::SUCCESS;
73  }
74 } } //> end namespace HLT::MET
METComponent.h
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
xAOD::CaloCluster_v1::State
State
enum of possible signal states.
Definition: CaloCluster_v1.h:304
HLT::MET::TCFex::m_clusterKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clusterKey
Input clusters.
Definition: TCFex.h:65
HLT::MET::FexBase
Definition: FexBase.h:47
TCFex.h
HLT::MET::TCFex::fillMET
virtual StatusCode fillMET(xAOD::TrigMissingET &met, const EventContext &context, MonGroupBuilder &monitors) const override
Calculate and fill the output MET value.
Definition: TCFex.cxx:35
HLT::MET::TCFex::TCFex
TCFex(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: TCFex.cxx:25
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
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
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
xAOD::CaloCluster_v1::CALIBRATED
@ CALIBRATED
Definition: CaloCluster_v1.h:307
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
HLT::MET::FexBase::initializeBase
StatusCode initializeBase(const std::vector< std::string > &componentNames)
Initialize the base class.
Definition: FexBase.cxx:48
HLT::MET::TCFex::initialize
virtual StatusCode initialize() override
Initialize the fex.
Definition: TCFex.cxx:29
xAOD::CaloCluster_v1::UNCALIBRATED
@ UNCALIBRATED
Definition: CaloCluster_v1.h:306
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:221
MET
Definition: MET.py:1
HLT::MET::MonGroupBuilder
Definition: MonGroupBuilder.h:45
xAOD::TrigMissingET_v1
Class holding the Missing ET trigger fex results.
Definition: TrigMissingET_v1.h:32
HLT::MET::SignedKinematics::fromEnergyEtaPhiM
static SignedKinematics fromEnergyEtaPhiM(double energy, double eta, double phi, double mass)
Factory function to construct from energy eta, phi and m.
Definition: SignedKinematics.cxx:32
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
python.LArCondContChannels.isBarrel
isBarrel
Definition: LArCondContChannels.py:659
HLT::MET::TCFex::m_useUncalibrated
Gaudi::Property< bool > m_useUncalibrated
Whether to use the uncalibrated clusters or not.
Definition: TCFex.h:74