ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
8using Athena::Units::GeV;
9
10namespace JiveXML {
11
18 xAODMissingETRetriever::xAODMissingETRetriever(const std::string& type,const std::string& name,const IInterface* parent):
19 AthAlgTool(type,name,parent){}
20
21
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) {
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
60
61 ATH_MSG_DEBUG( "in getData()" );
62
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
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Wrapper to avoid constant divisions when using units.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
For each MET collection retrieve basic parameters.
xAODMissingETRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
virtual std::string dataTypeName() const
Return the name of the data type that is generated by this retriever.
SG::ReadHandleKeyArray< xAOD::MissingETContainer > m_keys
const DataMap getData(const xAOD::MissingETContainer *)
Puts the variables into a DataMap.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
std::map< std::string, DataVect > DataMap
Definition DataType.h:59
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition DataType.h:58
Extra patterns decribing particle interation process.