ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisEventDisplay
xAODJiveXML
src
xAODMissingETRetriever.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
xAODJiveXML/xAODMissingETRetriever.h
"
6
7
#include "
AthenaKernel/Units.h
"
8
using
Athena::Units::GeV;
9
10
namespace
JiveXML
{
11
18
xAODMissingETRetriever::xAODMissingETRetriever
(
const
std::string&
type
,
const
std::string& name,
const
IInterface* parent):
19
AthAlgTool
(
type
,name,parent){}
20
21
22
StatusCode
xAODMissingETRetriever::initialize
(){
23
ATH_CHECK
(
m_keys
.initialize());
24
return
StatusCode::SUCCESS;
25
}
26
27
32
StatusCode
xAODMissingETRetriever::retrieve
(ToolHandle<IFormatTool> &FormatTool) {
33
34
ATH_MSG_DEBUG
(
"in retrieve()"
);
35
36
// Loop through the keys and retrieve the corresponding data
37
for
(
const
auto
& key :
m_keys
) {
38
SG::ReadHandle<xAOD::MissingETContainer>
cont(key);
39
if
(cont.
isValid
()) {
40
DataMap
data =
getData
(&(*cont));
41
if
(FormatTool->AddToEvent(
dataTypeName
(), key.key() +
"_xAOD"
, &data).isFailure()) {
42
ATH_MSG_WARNING
(
"Failed to add collection "
<< key.key());
43
}
else
{
44
ATH_MSG_DEBUG
(
" ("
<< key.key() <<
") retrieved"
);
45
}
46
}
else
{
47
ATH_MSG_WARNING
(
"Collection "
<< key.key() <<
" not found in SG"
);
48
}
49
}
50
51
return
StatusCode::SUCCESS;
52
}
53
54
59
const
DataMap
xAODMissingETRetriever::getData
(
const
xAOD::MissingETContainer
* metCont) {
60
61
ATH_MSG_DEBUG
(
"in getData()"
);
62
63
DataMap
DataMap
;
64
65
DataVect
etx; etx.reserve(metCont->
size
());
66
DataVect
ety; ety.reserve(metCont->
size
());
67
DataVect
et
;
et
.reserve(metCont->
size
());
68
69
float
mpx = 0.;
70
float
mpy = 0.;
71
float
sumet = 0.;
72
73
xAOD::MissingETContainer::const_iterator
metItr = metCont->
begin
();
74
xAOD::MissingETContainer::const_iterator
metItrE = metCont->
end
();
75
76
// current understanding is that we only need the final value
77
// out of the ~9 values within each MET container ('final')
78
79
for
(; metItr != metItrE; ++metItr) {
80
sumet = (*metItr)->sumet()/
GeV
;
81
mpx = (*metItr)->mpx()/
GeV
;
82
mpy = (*metItr)->mpy()/
GeV
;
83
84
ATH_MSG_DEBUG
(
" Components: MissingET [GeV] mpx= "
<< mpx
85
<<
", mpy= "
<< mpy
86
<<
", sumet= "
<< sumet );
87
88
}
// end MissingETIterator
89
90
ATH_MSG_DEBUG
(
" FINAL: MissingET [GeV] mpx= "
<< mpx
91
<<
", mpy= "
<< mpy <<
", sumet= "
<< sumet );
92
93
etx.emplace_back(
DataType
( mpx ));
94
ety.emplace_back(
DataType
( mpy ));
95
et
.emplace_back(
DataType
( sumet ));
96
97
// four-vectors
98
const
auto
n =
et
.size();
99
DataMap
[
"et"
] = std::move(
et
);
100
DataMap
[
"etx"
] = std::move(etx);
101
DataMap
[
"ety"
] = std::move(ety);
102
103
ATH_MSG_DEBUG
(
dataTypeName
() <<
" retrieved with "
<< n <<
" entries"
);
104
105
//All collections retrieved okay
106
return
DataMap
;
107
}
108
109
110
}
// JiveXML namespace
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
DataType
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
Definition
CTPResultByteStreamTool.cxx:22
GeV
#define GeV
Definition
PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
Units.h
Wrapper to avoid constant divisions when using units.
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
DataVector< MissingET_v1 >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
JiveXML::xAODMissingETRetriever::initialize
virtual StatusCode initialize()
Definition
xAODMissingETRetriever.cxx:22
JiveXML::xAODMissingETRetriever::retrieve
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
For each MET collection retrieve basic parameters.
Definition
xAODMissingETRetriever.cxx:32
JiveXML::xAODMissingETRetriever::xAODMissingETRetriever
xAODMissingETRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
Definition
xAODMissingETRetriever.cxx:18
JiveXML::xAODMissingETRetriever::dataTypeName
virtual std::string dataTypeName() const
Return the name of the data type that is generated by this retriever.
Definition
xAODMissingETRetriever.h:42
JiveXML::xAODMissingETRetriever::m_keys
SG::ReadHandleKeyArray< xAOD::MissingETContainer > m_keys
Definition
xAODMissingETRetriever.h:49
JiveXML::xAODMissingETRetriever::getData
const DataMap getData(const xAOD::MissingETContainer *)
Puts the variables into a DataMap.
Definition
xAODMissingETRetriever.cxx:59
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
JiveXML
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
Definition
BadLArRetriever.cxx:22
JiveXML::DataMap
std::map< std::string, DataVect > DataMap
Definition
DataType.h:59
JiveXML::DataVect
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition
DataType.h:58
xAOD::MissingETContainer
MissingETContainer_v1 MissingETContainer
Definition
Event/xAOD/xAODMissingET/xAODMissingET/MissingETContainer.h:16
type
et
Extra patterns decribing particle interation process.
xAODMissingETRetriever.h
Generated on
for ATLAS Offline Software by
1.17.0