ATLAS Offline Software
Loading...
Searching...
No Matches
TrigL1FexJetMonitorTool.cxx
Go to the documentation of this file.
1// -*- C++ -*-
2
3/*
4 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5*/
6
10
11#include "./JTMContainers.h"
12#include "./L1MonitorAdaptors.h"
13#include "./DataStructs.h"
14#include <memory>
15
17
18template<typename T>
20 const std::string& name,
21 const IInterface* parent)
22 : base_class( type, name, parent )
23{
24 declareProperty("l1container", m_l1jetContainerkey);
25
26}
27
28
29
30template<typename T>
32{
33 ATH_CHECK(m_l1jetContainerkey.initialize());
34
35 if (m_doMatching) {
38
41
44
47
50
53
56
59
62
63 ATH_CHECK(m_offmatchedKey.initialize() );
64 ATH_CHECK(m_offptdiffKey.initialize() );
65 ATH_CHECK(m_offenergydiffKey.initialize() );
66 ATH_CHECK(m_offmassdiffKey.initialize() );
67 ATH_CHECK(m_offptrespKey.initialize() );
68 ATH_CHECK(m_offenergyrespKey.initialize() );
69 ATH_CHECK(m_offmassrespKey.initialize() );
70 ATH_CHECK(m_offptrefKey.initialize() );
71 ATH_CHECK(m_offetarefKey.initialize() );
72
75
78
80 m_l1jetContainerkey.key() + ".energydiff_" + m_HLTJetContainerToMatch;
81
83 m_l1jetContainerkey.key() + ".massdiff_" + m_HLTJetContainerToMatch;
84
87
89 m_l1jetContainerkey.key() + ".energyresp_" + m_HLTJetContainerToMatch;
90
92 m_l1jetContainerkey.key() + ".massresp_" + m_HLTJetContainerToMatch;
93
96
99
100 ATH_CHECK(m_hltmatchedKey.initialize());
101 ATH_CHECK(m_hltptdiffKey.initialize());
102 ATH_CHECK(m_hltenergydiffKey.initialize());
103 ATH_CHECK(m_hltmassdiffKey.initialize());
104 ATH_CHECK(m_hltptrespKey.initialize());
105 ATH_CHECK(m_hltenergyrespKey.initialize());
106 ATH_CHECK(m_hltmassrespKey.initialize());
107 ATH_CHECK(m_hltptrefKey.initialize());
108 ATH_CHECK(m_hltetarefKey.initialize());
109
110 } else {
111 // declare the keys unused if no matching is configured
112
113 // offline container matching
114 ATH_CHECK(m_offmatchedKey.initialize(false));
115 ATH_CHECK(m_offptdiffKey.initialize(false));
116 ATH_CHECK(m_offenergydiffKey.initialize(false));
117 ATH_CHECK(m_offmassdiffKey.initialize(false));
118 ATH_CHECK(m_offptrespKey.initialize(false));
119 ATH_CHECK(m_offenergyrespKey.initialize(false));
120 ATH_CHECK(m_offmassrespKey.initialize(false));
121 ATH_CHECK(m_offptrefKey.initialize(false));
122 ATH_CHECK(m_offetarefKey.initialize(false));
123
124 // trigger container matching
125 ATH_CHECK(m_hltmatchedKey.initialize(false));
126 ATH_CHECK(m_hltptdiffKey.initialize(false));
127 ATH_CHECK(m_hltenergydiffKey.initialize(false));
128 ATH_CHECK(m_hltmassdiffKey.initialize(false));
129 ATH_CHECK(m_hltptrespKey.initialize(false));
130 ATH_CHECK(m_hltenergyrespKey.initialize(false));
131 ATH_CHECK(m_hltmassrespKey.initialize(false));
132 ATH_CHECK(m_hltptrefKey.initialize(false));
133 ATH_CHECK(m_hltetarefKey.initialize(false));
134 }
135
136 return StatusCode::SUCCESS;
137}
138
139
140
141template<typename T>
142StatusCode
144 std::vector<JetData>& jetData
145 ) const{
146
147
148 // Retrieve the L1 jet container
150 if( !jets.isValid() ){
151 // the L1 containers should _always_ be present, although may be empty.
152 ATH_MSG_WARNING("evtStore() does not contain the L1 jet collection with name "
154 return StatusCode::SUCCESS;
155 }
156
157 // find variables associated with jets in the input container.
158 for(const auto jet : *jets){
159 /*
160 Ensure that the the et is above a hardware threshold:
161 From Sergi Rodriguez 23/02/2022
162 in the bitwise simulation we also have an energy threshold,
163 which is taken from the trigger menu.
164 If the Et is below the threshold the TOB word is set to 0
165 */
166
167 if (vetoJet(jet)) {continue;} // see L1MonitoredAdaptors
168
169 jetData.emplace_back(et(jet)*0.001, // see L1MonitoredAdaptors
170 jet->eta(),
171 jet->phi(),
172 et_label(jet));
173
174 }
175 return StatusCode::SUCCESS;
176}
177
178
179
180template<typename T>
181StatusCode
183 MatchToEnum matchTo,
184 std::vector<JetMatchData>& jetMatchData
185 ) const {
186 if (!m_doMatching) {
187 // otherwise will attempt to use uniniatialied Keys
188 return StatusCode::SUCCESS;
189 }
190
191 std::unique_ptr<SG::ReadDecorHandle<JetContainer, char>> matchedHandle;
192 std::unique_ptr<SG::ReadDecorHandle<JetContainer, double>> ptdiffHandle;
193 std::unique_ptr<SG::ReadDecorHandle<JetContainer, double>> energydiffHandle;
194 std::unique_ptr<SG::ReadDecorHandle<JetContainer, double>> massdiffHandle;
195 std::unique_ptr<SG::ReadDecorHandle<JetContainer, double>> ptrespHandle;
196 std::unique_ptr<SG::ReadDecorHandle<JetContainer, double>> energyrespHandle;
197 std::unique_ptr<SG::ReadDecorHandle<JetContainer, double>> massrespHandle;
198 std::unique_ptr<SG::ReadDecorHandle<JetContainer, double>> ptrefHandle;
199 std::unique_ptr<SG::ReadDecorHandle<JetContainer, double>> etarefHandle;
200
201 if (matchTo == MatchToEnum::hlt) {
202
203 matchedHandle.reset(new SG::ReadDecorHandle<JetContainer, char> (m_hltmatchedKey, ctx));
204 ptdiffHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_hltptdiffKey, ctx));
205 energydiffHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_hltenergydiffKey, ctx));
206 massdiffHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_hltmassdiffKey, ctx));
207 ptrespHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_hltptrespKey, ctx));
208 energyrespHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_hltenergyrespKey, ctx));
209 massrespHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_hltmassrespKey, ctx));
210 ptrefHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_hltptrefKey, ctx));
211 etarefHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_hltetarefKey, ctx));
212 } else if (matchTo == MatchToEnum::offline) {
213 matchedHandle.reset(new SG::ReadDecorHandle<JetContainer, char> (m_offmatchedKey, ctx));
214 ptdiffHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_offptdiffKey, ctx));
215 energydiffHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_offenergydiffKey, ctx));
216 massdiffHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_offmassdiffKey, ctx));
217 ptrespHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_offptrespKey, ctx));
218 energyrespHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_offenergyrespKey, ctx));
219 massrespHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_offmassrespKey, ctx));
220 ptrefHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_offptrefKey, ctx));
221 etarefHandle.reset(new SG::ReadDecorHandle<JetContainer, double> (m_offetarefKey, ctx));
222 } else {
223 ATH_MSG_ERROR ("unsupported MatchTo value");
224 return StatusCode::FAILURE;
225 }
226
227 ATH_CHECK((*matchedHandle).initialize());
228 ATH_CHECK((*ptdiffHandle).initialize());
229 ATH_CHECK((*energydiffHandle).initialize());
230 ATH_CHECK((*massdiffHandle).initialize());
231 ATH_CHECK((*ptrespHandle).initialize());
232 ATH_CHECK((*energyrespHandle).initialize());
233 ATH_CHECK((*massrespHandle).initialize());
234 ATH_CHECK((*ptrefHandle).initialize());
235 ATH_CHECK((*etarefHandle).initialize());
236
237
238 // Loop over L1 jets and fill pt, energy, mass differences and responses
239 // between matched jets, plus reference pT and eta
240
241 // Retrieve the L1 jet container
243 if(!jets.isValid()){
244 // the L1 containers should _always_ be present, although may be empty.
245 ATH_MSG_WARNING("evtStore() does not contain the L1 jet collection with name "
247 return StatusCode::SUCCESS;
248 }
249
250 for(const auto jet : *jets){
251 bool matched = (*matchedHandle)(*jet);
252
253 if(matched){
254 jetMatchData.emplace_back((*ptdiffHandle)(*jet),
255 (*energydiffHandle)(*jet),
256 (*massdiffHandle)(*jet),
257 (*ptrespHandle)(*jet),
258 (*energyrespHandle)(*jet),
259 (*massrespHandle)(*jet),
260 (*ptrefHandle)(*jet),
261 (*etarefHandle)(*jet));
262 }
263 }
264
265 return StatusCode::SUCCESS;
266}
267
272
273
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
Handle class for reading a decoration on an object.
std::string et_label(const xAOD::jFexSRJetRoI *)
float et(const xAOD::jFexSRJetRoI *j)
bool vetoJet(const xAOD::jFexSRJetRoI *j)
Handle class for reading a decoration on an object.
Gaudi::Property< std::string > m_offlineJetContainerToMatch
SG::ReadDecorHandleKey< JetContainer > m_hltmassrespKey
SG::ReadDecorHandleKey< JetContainer > m_offmatchedKey
SG::ReadDecorHandleKey< JetContainer > m_offptrefKey
Gaudi::Property< std::string > m_HLTJetContainerToMatch
SG::ReadDecorHandleKey< JetContainer > m_offetarefKey
SG::ReadDecorHandleKey< JetContainer > m_hltptdiffKey
SG::ReadDecorHandleKey< JetContainer > m_hltmassdiffKey
SG::ReadDecorHandleKey< JetContainer > m_hltptrespKey
virtual StatusCode getData(const EventContext &ctx, std::vector< JetData > &jetData) const override
SG::ReadDecorHandleKey< JetContainer > m_hltenergyrespKey
SG::ReadDecorHandleKey< JetContainer > m_hltenergydiffKey
SG::ReadDecorHandleKey< JetContainer > m_offptrespKey
virtual StatusCode initialize() override
SG::ReadDecorHandleKey< JetContainer > m_offmassdiffKey
SG::ReadDecorHandleKey< JetContainer > m_hltmatchedKey
SG::ReadDecorHandleKey< JetContainer > m_hltetarefKey
virtual StatusCode getMatchData(const EventContext &ctx, MatchToEnum, std::vector< JetMatchData > &jetData) const override
TrigL1FexJetMonitorTool(const std::string &, const std::string &, const IInterface *)
SG::ReadDecorHandleKey< JetContainer > m_offenergyrespKey
SG::ReadDecorHandleKey< JetContainer > m_offmassrespKey
SG::ReadDecorHandleKey< JetContainer > m_offenergydiffKey
SG::ReadDecorHandleKey< JetContainer > m_offptdiffKey
SG::ReadDecorHandleKey< JetContainer > m_hltptrefKey
SG::ReadHandleKey< JetContainer > m_l1jetContainerkey
Gaudi::Property< bool > m_doMatching