ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigGepPerf
src
GepMETAlg.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
./GepMETAlg.h
"
6
#include <
xAODTrigger/EnergySumRoIAuxInfo.h
>
7
8
GepMETAlg::GepMETAlg
(
const
std::string& name, ISvcLocator* pSvcLocator ) :
9
AthReentrantAlgorithm
( name, pSvcLocator ){
10
}
11
12
13
GepMETAlg::~GepMETAlg
() {}
14
15
16
StatusCode
GepMETAlg::initialize
() {
17
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
18
CHECK
(
m_caloClustersKey
.initialize());
19
CHECK
(
m_outputMETKey
.initialize());
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
GepMETAlg::finalize
() {
25
ATH_MSG_INFO
(
"Finalizing "
<< name() <<
"..."
);
26
return
StatusCode::SUCCESS;
27
}
28
29
StatusCode
GepMETAlg::execute
(
const
EventContext& context)
const
{
30
ATH_MSG_DEBUG
(
"Executing "
<< name() <<
"..."
);
31
setFilterPassed
(
false
, context);
32
33
34
// read in clusters
35
auto
h_caloClusters =
SG::makeHandle
(
m_caloClustersKey
, context);
36
CHECK
(h_caloClusters.isValid());
37
ATH_MSG_DEBUG
(
"Read in "
<< h_caloClusters->size() <<
" clusters"
);
38
39
const
auto
& caloClusters = *h_caloClusters;
40
41
float
Ex = 0.;
42
float
Ey = 0.;
43
float
totalEt =0.;
44
45
for
(
const
auto
cluster : caloClusters ) {
46
float
et
= cluster->et();
47
float
phi
= cluster->phi();
48
49
Ex -=
et
* TMath::Cos(
phi
);
50
Ey -=
et
* TMath::Sin(
phi
);
51
totalEt +=
et
;
52
}
53
54
ATH_MSG_DEBUG
(
"Calculated MET Ex,Ey: "
<< Ex <<
","
<< Ey);
55
56
// write out the MET object
57
auto
h_outputMET =
SG::makeHandle
(
m_outputMETKey
, context);
58
59
auto
METObj = std::make_unique<xAOD::EnergySumRoI>();
60
METObj->setStore(
new
xAOD::EnergySumRoIAuxInfo
());
61
METObj->setEnergyX(Ex);
62
METObj->setEnergyY(Ey);
63
METObj->setEnergyT(totalEt);
64
65
h_outputMET = std::move(METObj);
66
67
setFilterPassed
(
true
, context);
68
ATH_MSG_DEBUG
(
"No of MET objects: 1"
);
69
70
return
StatusCode::SUCCESS;
71
}
72
73
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
EnergySumRoIAuxInfo.h
GepMETAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Definition
AthCommonAlgorithm.h:99
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
GepMETAlg::m_caloClustersKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_caloClustersKey
Definition
GepMETAlg.h:22
GepMETAlg::finalize
virtual StatusCode finalize()
Definition
GepMETAlg.cxx:24
GepMETAlg::m_outputMETKey
SG::WriteHandleKey< xAOD::EnergySumRoI > m_outputMETKey
Definition
GepMETAlg.h:25
GepMETAlg::execute
virtual StatusCode execute(const EventContext &) const
Definition
GepMETAlg.cxx:29
GepMETAlg::initialize
virtual StatusCode initialize()
Definition
GepMETAlg.cxx:16
GepMETAlg::~GepMETAlg
virtual ~GepMETAlg()
Definition
GepMETAlg.cxx:13
GepMETAlg::GepMETAlg
GepMETAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
GepMETAlg.cxx:8
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
xAOD::EnergySumRoIAuxInfo
EnergySumRoIAuxInfo_v2 EnergySumRoIAuxInfo
Declare the most recent version of the energy-sum auxiliary info.
Definition
EnergySumRoIAuxInfo.h:17
et
Extra patterns decribing particle interation process.
Generated on
for ATLAS Offline Software by
1.17.0