ATLAS Offline Software
Loading...
Searching...
No Matches
PhysValMET.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5*/
6
7// PhysValMET.cxx
8// Implementation file for class PhysValMET
9// Author: Daniel Buescher <daniel.buescher@cern.ch>, Philipp Mogg <philipp.mogg@cern.ch>
11
12// PhysVal includes
13#include "PhysValMET.h"
14// FrameWork includes
15#include "GaudiKernel/IToolSvc.h"
24
30
31#include "xAODTracking/Vertex.h"
34#include "PATCore/AcceptData.h"
37
38// Root includes
39#include "TH1.h"
40
41// STL includes
42#include <cmath>
43
44
45using namespace xAOD;
46
47namespace MissingEtDQA {
48
50 // Public methods:
52
53 // Constructors
55
56 PhysValMET::PhysValMET( const std::string& type,
57 const std::string& name,
58 const IInterface* parent) :
60 m_metmaker(nullptr)
61 {
62 declareProperty( "InputElectrons", m_eleColl = "Electrons" );
63 declareProperty( "InputPhotons", m_gammaColl = "Photons" );
64 declareProperty( "InputTaus", m_tauColl = "TauJets" );
65 declareProperty( "InputMuons", m_muonColl = "Muons" );
66 declareProperty( "DoTruth", m_doTruth = false );
67 declareProperty( "InputIsDAOD", m_inputIsDAOD = false );
68 declareProperty( "DoMETRefPlots", m_doMETRefPlots = false );
69 declareProperty( "METMapName", m_mapname = "METAssoc" );
70 declareProperty( "METCoreName", m_corename = "MET_Core" );
71 }
72
73 // Destructor
76 {
77 m_names.clear();
78 m_types.clear();
79 m_terms.clear();
80 m_MET_Ref.clear();
81 m_MET_Ref_x.clear();
82 m_MET_Ref_y.clear();
83 m_MET_Ref_phi.clear();
84 m_MET_Ref_sum.clear();
85 m_MET_Diff_Ref.clear();
86 m_MET_Diff_Ref_x.clear();
87 m_MET_Diff_Ref_y.clear();
88 m_MET_Diff_Ref_phi.clear();
89 m_MET_Diff_Ref_sum.clear();
90 m_MET_Cumu_Ref.clear();
93 m_MET_dPhi_Ref.clear();
96 m_MET_Reb.clear();
97 m_MET_Reb_x.clear();
98 m_MET_Reb_y.clear();
99 m_MET_Reb_phi.clear();
100 m_MET_Reb_sum.clear();
101 m_MET_Diff_Reb.clear();
102 m_MET_Diff_Reb_x.clear();
103 m_MET_Diff_Reb_y.clear();
104 m_MET_Diff_Reb_phi.clear();
105 m_MET_Diff_Reb_sum.clear();
106 m_MET_Cumu_Reb.clear();
107 m_MET_Resolution_Reb.clear();
109 m_MET_dPhi_Reb.clear();
112}
113
114 // Athena algtool's Hooks
117 {
118 ATH_MSG_INFO ("Initializing " << name() << "...");
120
121 m_names.clear();
122 m_names["RefEle"] = "Electron term";
123 m_names["RefGamma"] = "Photon term";
124 m_names["RefTau"] = "Tau term";
125 m_names["Muons"] = "Muon term";
126 m_names["RefJet"] = "Jet term";
127 m_names["SoftClus"] = "Cluster-based soft term";
128 m_names["PVSoftTrk"] = "Track-based soft term (PV-matched)";
129 m_names["FinalTrk"] = "Total MET with TST";
130 m_names["FinalClus"] = "Total MET with CST";
131 m_names["Track"] = "Track MET, loose selection";
132 m_names["PVTrack_Nominal"] = "Track MET for highest sum p_{T}^{2} PV";
133 m_names["PVTrack_Pileup"] = "Track MET for each pileup vertex";
134
135 m_types.clear();
136 m_types.emplace_back("AntiKt4EMTopo");
137 m_types.emplace_back("AntiKt4EMPFlow");
138
139 m_terms.clear();
140 m_terms.emplace_back("RefEle");
141 m_terms.emplace_back("RefGamma");
142 m_terms.emplace_back("RefTau");
143 m_terms.emplace_back("Muons");
144 m_terms.emplace_back("RefJet");
145 m_terms.emplace_back("SoftClus");
146 m_terms.emplace_back("PVSoftTrk");
147 m_terms.emplace_back("FinalTrk");
148 m_terms.emplace_back("FinalClus");
149
150 ATH_MSG_INFO("Retrieving tools...");
151
152 ATH_CHECK( m_metmakerTopo.retrieve() );
153 ATH_CHECK( m_metmakerPFlow.retrieve() );
154 ATH_CHECK( m_muonSelTool.retrieve() );
155 ATH_CHECK( m_elecSelLHTool.retrieve() );
156 ATH_CHECK( m_photonSelIsEMTool.retrieve() );
157 ATH_CHECK( m_tauSelTool.retrieve() );
158 ATH_CHECK( m_jvtToolEM.retrieve() );
159 ATH_CHECK( m_jvtToolPFlow.retrieve() );
160 m_MET_Ref.clear();
161 m_MET_Ref_x.clear();
162 m_MET_Ref_y.clear();
163 m_MET_Ref_phi.clear();
164 m_MET_Ref_sum.clear();
165 m_MET_Diff_Ref.clear();
166 m_MET_Diff_Ref_x.clear();
167 m_MET_Diff_Ref_y.clear();
168 m_MET_Diff_Ref_phi.clear();
169 m_MET_Diff_Ref_sum.clear();
170 m_MET_Cumu_Ref.clear();
171 m_MET_Resolution_Ref.clear();
173 m_MET_dPhi_Ref.clear();
176 m_MET_Reb.clear();
177 m_MET_Reb_x.clear();
178 m_MET_Reb_y.clear();
179 m_MET_Reb_phi.clear();
180 m_MET_Reb_sum.clear();
181 m_MET_Diff_Reb.clear();
182 m_MET_Diff_Reb_x.clear();
183 m_MET_Diff_Reb_y.clear();
184 m_MET_Diff_Reb_phi.clear();
185 m_MET_Diff_Reb_sum.clear();
186 m_MET_Cumu_Reb.clear();
187 m_MET_Resolution_Reb.clear();
189 m_MET_dPhi_Reb.clear();
192
193 return StatusCode::SUCCESS;
194 }
195
197 {
198 ATH_MSG_INFO ("Booking hists " << name() << "...");
199
200 // Physics validation plots are level 10
201
202 int nbinp = 100;
203 int nbinpxy = 100;
204 int nbinphi = 63;
205 int nbinE = 100;
206 double suptmi = 500.;
207 double suptmixy = 250.;
208 double binphi = 3.15;
209 double lowET = 0.;
210 double suET = 2500.;
211 //all histograms only booked for level>=10
212 if (m_detailLevel >= 10) {
213
214 for (const auto& type : m_types){
215 std::string name_met;
216 std::string name_sub;
217 std::vector<std::string> corrClus_names;
218 std::vector<std::string> corrTrk_names;
219 std::vector<std::string> sum_names;
220 std::string dir;
221
222 corrClus_names.emplace_back("RefEle");
223 corrClus_names.emplace_back("RefGamma");
224 corrClus_names.emplace_back("RefTau");
225 corrClus_names.emplace_back("Muons");
226 corrClus_names.emplace_back("RefJet");
227 corrClus_names.emplace_back("SoftClus");
228
229 corrTrk_names.emplace_back("RefEle");
230 corrTrk_names.emplace_back("RefGamma");
231 corrTrk_names.emplace_back("RefTau");
232 corrTrk_names.emplace_back("Muons");
233 corrTrk_names.emplace_back("RefJet");
234 corrTrk_names.emplace_back("PVSoftTrk");
235
236 sum_names.emplace_back("RefEle");
237 sum_names.emplace_back("RefGamma");
238 sum_names.emplace_back("RefTau");
239 sum_names.emplace_back("Muons");
240 sum_names.emplace_back("RefJet");
241
242 //-------------------------------------------------------------------------------------
243 // First set-up Reference MET histograms (if we want them)
244 if (m_doMETRefPlots){
245 name_met = "MET_Reference_" + type;
246 m_dir_met.clear();
247 std::vector<TH1D*> v_MET_Ref;
248 std::vector<TH1D*> v_MET_Ref_x;
249 std::vector<TH1D*> v_MET_Ref_y;
250 std::vector<TH1D*> v_MET_Ref_phi;
251 std::vector<TH1D*> v_MET_Ref_sum;
252 std::vector<TH1D*> v_MET_Cumu_Ref;
253 std::vector<TH1D*> v_MET_Resolution_Ref;
254 std::vector<TH1D*> v_MET_Significance_Ref;
255 std::vector<TH1D*> v_MET_dPhi_Ref;
256 std::vector<TH2D*> v_MET_CorrFinalTrk_Ref;
257 std::vector<TH2D*> v_MET_CorrFinalClus_Ref;
258 std::vector<TH1D*> v_MET_Diff_Ref;
259 std::vector<TH1D*> v_MET_Diff_Ref_x;
260 std::vector<TH1D*> v_MET_Diff_Ref_y;
261 std::vector<TH1D*> v_MET_Diff_Ref_phi;
262 std::vector<TH1D*> v_MET_Diff_Ref_sum;
263
264 for(const auto& term : m_terms) {
265 v_MET_Ref.push_back( new TH1D((name_met + "_" + term).c_str(), (name_met + " " + m_names[term] + "; E_{T}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinp, 0., suptmi) );
266 v_MET_Ref_x.push_back( new TH1D((name_met + "_" + term +"_x").c_str(), (name_met + " " + m_names[term] + " x; E_{x}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
267 v_MET_Ref_y.push_back( new TH1D((name_met + "_" + term + "_y").c_str(), (name_met + " " + m_names[term] + " y; E_{y}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
268 v_MET_Ref_phi.push_back( new TH1D((name_met + "_" + term + "_phi").c_str(), (name_met + " " + m_names[term] + " phi; #Phi; Entries / 0.1").c_str(), nbinphi,-binphi,binphi) );
269 v_MET_Ref_sum.push_back( new TH1D((name_met + "_" + term + "_sum").c_str(), (name_met + " " + m_names[term] + " sum; E_{T}^{sum} [GeV]; Entries / 25 GeV").c_str(), nbinE, lowET, suET) );
270 m_dir_met.push_back("MET/" + name_met + "/Terms/" + term + "/");
271 }
272 std::size_t n = v_MET_Ref.size();
273 m_MET_Ref[type] = std::move(v_MET_Ref);
274 m_MET_Ref_x[type] = std::move(v_MET_Ref_x);
275 m_MET_Ref_y[type] = std::move(v_MET_Ref_y);
276 m_MET_Ref_phi[type] = std::move(v_MET_Ref_phi);
277 m_MET_Ref_sum[type] = std::move(v_MET_Ref_sum);
278
279 for(std::size_t i = 0; i < n; ++i) {
285 }
286
287 name_sub = name_met + "/Cumulative";
288 v_MET_Cumu_Ref.push_back( new TH1D((name_met + "_Cumulative_FinalClus").c_str(), (name_met + " CST MET cumulative; E_{T}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinp, 0., suptmi) );
289 v_MET_Cumu_Ref.push_back( new TH1D((name_met + "_Cumulative_FinalTrk").c_str(), (name_met + " TST MET cumulative; E_{T}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinp, 0., suptmi) );
290
291 m_MET_Cumu_Ref[type] = v_MET_Cumu_Ref;
292
293 for(std::vector<TH1D*>::size_type i = 0; i < v_MET_Cumu_Ref.size(); ++i) {
294 ATH_CHECK(regHist(m_MET_Cumu_Ref[type].at(i),"MET/" + name_sub + "/",all));
295 }
296
297 name_sub = name_met + "/Residuals";
298 v_MET_Resolution_Ref.push_back( new TH1D((name_met + "_Resolution_FinalClus_x").c_str(), ("x-Residual of CST MET in " + name_met + "; #Delta(E_{T,CST}^{miss}, E_{T,truth}^{miss})_{x} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
299 v_MET_Resolution_Ref.push_back( new TH1D((name_met + "_Resolution_FinalClus_y").c_str(), ("y-Residual of CST MET in " + name_met + "; #Delta(E_{T,CST}^{miss}, E_{T,truth}^{miss})_{y} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
300 v_MET_Resolution_Ref.push_back( new TH1D((name_met + "_Resolution_FinalTrk_x").c_str(), ("x-Residual of TST MET in " + name_met + "; #Delta(E_{T,TST}^{miss}, E_{T,truth}^{miss})_{x} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
301 v_MET_Resolution_Ref.push_back( new TH1D((name_met + "_Resolution_FinalTrk_y").c_str(), ("y-Residual of TST MET in " + name_met + "; #Delta(E_{T,TST}^{miss}, E_{T,truth}^{miss})_{y} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
302
303 m_MET_Resolution_Ref[type] = v_MET_Resolution_Ref;
304
305 for(std::vector<TH1D*>::size_type i = 0; i < v_MET_Resolution_Ref.size(); ++i) {
306 ATH_CHECK(regHist(m_MET_Resolution_Ref[type].at(i),"MET/" + name_sub + "/",all));
307 }
308
309 name_sub = name_met + "/Significance";
310 v_MET_Significance_Ref.push_back( new TH1D((name_met + "_Significance_FinalClus").c_str(), ("MET / sqrt(sumet) for " + name_met + " CST; MET/#sqrt{SET} [#sqrt{GeV}]; Entries / 0.25 #sqrt{GeV}").c_str(), nbinp, 0., 25.) );
311 v_MET_Significance_Ref.push_back( new TH1D((name_met + "_Significance_FinalTrk").c_str(), ("MET / sqrt(sumet) for " + name_met + " TST; MET/#sqrt{SET} [#sqrt{GeV}]; Entries / 0.25 #sqrt{GeV}").c_str(), nbinp, 0., 25.) );
312
313 m_MET_Significance_Ref[type] = v_MET_Significance_Ref;
314
315 for(std::vector<TH1D*>::size_type i = 0; i < v_MET_Significance_Ref.size(); ++i) {
316 ATH_CHECK(regHist(m_MET_Significance_Ref[type].at(i),"MET/" + name_sub + "/",all));
317 }
318
319 name_sub = name_met + "/dPhi";
320 v_MET_dPhi_Ref.push_back( new TH1D((name_met + "_dPhi_leadJetMET_FinalClus").c_str(), ("MET deltaPhi vs leading jet for " + name_met + " CST; #Delta#Phi(leadJet, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
321 v_MET_dPhi_Ref.push_back( new TH1D((name_met + "_dPhi_subleadJetMET_FinalClus").c_str(), ("MET deltaPhi vs subleading jet for " + name_met + " CST; #Delta#Phi(subleadJet, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
322 v_MET_dPhi_Ref.push_back( new TH1D((name_met + "_dPhi_leadLepMET_FinalClus").c_str(), ("MET deltaPhi vs leading lepton for " + name_met + " CST; #Delta#Phi(leadLep, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
323 v_MET_dPhi_Ref.push_back( new TH1D((name_met + "_dPhi_leadJetMET_FinalTrk").c_str(), ("MET deltaPhi vs leading jet for " + name_met + " TST; #Delta#Phi(leadJet, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
324 v_MET_dPhi_Ref.push_back( new TH1D((name_met + "_dPhi_subleadJetMET_FinalTrk").c_str(), ("MET deltaPhi vs subleading jet for " + name_met + " TST; #Delta#Phi(subleadJet, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
325 v_MET_dPhi_Ref.push_back( new TH1D((name_met + "_dPhi_leadLepMET_FinalTrk").c_str(), ("MET deltaPhi vs leading lepton for " + name_met + " TST; #Delta#Phi(leadLep, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
326
327 m_MET_dPhi_Ref[type] = v_MET_dPhi_Ref;
328
329 for(std::vector<TH1D*>::size_type i = 0; i < v_MET_dPhi_Ref.size(); ++i) {
330 ATH_CHECK(regHist(m_MET_dPhi_Ref[type].at(i),"MET/" + name_sub + "/",all));
331 }
332
333 name_sub = name_met + "/Correlations";
334
335 v_MET_CorrFinalClus_Ref.reserve(corrClus_names.size());
336
337 for(const auto& it : corrClus_names) {
338 v_MET_CorrFinalClus_Ref.push_back( new TH2D((name_met + "_" + it + "_FinalClus").c_str(), (name_met + " " + m_names[it] + " vs. CST MET; E_{T," + it + "}^{miss} [GeV]; E_{T,CST}^{miss} [GeV]; Entries").c_str(), nbinp, 0., suptmi, nbinp, 0., suptmi) );
339 }
340 v_MET_CorrFinalTrk_Ref.reserve(corrTrk_names.size());
341
342 for(const auto& it : corrTrk_names) {
343 v_MET_CorrFinalTrk_Ref.push_back( new TH2D((name_met + "_" + it + "_FinalTrk").c_str(), (name_met + " " + m_names[it] + " vs. TST MET; E_{T," + it + "}^{miss} [GeV]; E_{T,TST}^{miss} [GeV]; Entries").c_str(), nbinp, 0., suptmi, nbinp, 0., suptmi) );
344 }
345
346 m_MET_CorrFinalClus_Ref[type] = v_MET_CorrFinalClus_Ref;
347 m_MET_CorrFinalTrk_Ref[type] = v_MET_CorrFinalTrk_Ref;
348
349 for(std::vector<TH2D*>::size_type i = 0; i < v_MET_CorrFinalTrk_Ref.size(); ++i) {
350 ATH_CHECK(regHist(m_MET_CorrFinalTrk_Ref[type].at(i),"MET/" + name_sub + "/",all));
351 }
352 for(std::vector<TH2D*>::size_type i = 0; i < v_MET_CorrFinalClus_Ref.size(); ++i) {
353 ATH_CHECK(regHist(m_MET_CorrFinalClus_Ref[type].at(i),"MET/" + name_sub + "/",all));
354 }
355
356 m_dir_met.clear();
357
358 for(const auto& it : sum_names) {
359 v_MET_Diff_Ref.push_back( new TH1D((name_met + "_Diff_" + it).c_str(), ("MET_Diff " + m_names[it] + " in " + name_met +"; E_{T}^{miss} - #Sigma p_{T} [GeV]; Entries / 3 GeV").c_str(), nbinpxy, -150, 150));
360 v_MET_Diff_Ref_x.push_back( new TH1D((name_met + "_Diff_" + it +"_x").c_str(), ("MET_Diff x " + m_names[it] + " in " + name_met +"; E_{x}^{miss} - #Sigma p_{x} [GeV]; Entries / 3 GeV").c_str(), nbinpxy, -150, 150) );
361 v_MET_Diff_Ref_y.push_back( new TH1D((name_met + "_Diff_" + it +"_y").c_str(), ("MET_Diff y " + m_names[it] + " in " + name_met +"; E_{y}^{miss} - #Sigma p_{y} [GeV]; Entries / 3 GeV").c_str(), nbinpxy, -150, 150) );
362 v_MET_Diff_Ref_phi.push_back( new TH1D((name_met + "_Diff_" + it +"_phi").c_str(), ("MET_Diff phi " + m_names[it] + " in " + name_met +"; #Delta#Phi(E_{T}^{miss},#Sigma p_{T}); Entries / 0.1").c_str(), nbinphi,-binphi,binphi) );
363 v_MET_Diff_Ref_sum.push_back( new TH1D((name_met + "_Diff_" + it +"_sum").c_str(), ("MET_Diff sumet " + m_names[it] + " in " + name_met +"; E_{T}^{sum} - #Sigma |p_{T}| [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -250, 250) );
364 m_dir_met.push_back("MET/" + name_met + "/Differences/" + it + "/");
365 }
366 n = v_MET_Diff_Ref.size();
367 m_MET_Diff_Ref[type] = std::move(v_MET_Diff_Ref);
368 m_MET_Diff_Ref_x[type] = std::move(v_MET_Diff_Ref_x);
369 m_MET_Diff_Ref_y[type] = std::move(v_MET_Diff_Ref_y);
370 m_MET_Diff_Ref_phi[type] = std::move(v_MET_Diff_Ref_phi);
371 m_MET_Diff_Ref_sum[type] = std::move(v_MET_Diff_Ref_sum);
372
373 for(std::size_t i = 0; i < n; ++i) {
379 }
380 // End of if-statement (m_doMETRefPlots)
381 }
382
383 //-------------------------------------------------------------------------------------
384 // Now the same for Rebuilt MET
385
386 name_met = "MET_Rebuilt_" + type;
387 m_dir_met.clear();
388 std::vector<TH1D*> v_MET_Reb;
389 std::vector<TH1D*> v_MET_Reb_x;
390 std::vector<TH1D*> v_MET_Reb_y;
391 std::vector<TH1D*> v_MET_Reb_phi;
392 std::vector<TH1D*> v_MET_Reb_sum;
393 std::vector<TH1D*> v_MET_Cumu_Reb;
394 std::vector<TH1D*> v_MET_Resolution_Reb;
395 std::vector<TH1D*> v_MET_Significance_Reb;
396 std::vector<TH1D*> v_MET_dPhi_Reb;
397 std::vector<TH2D*> v_MET_CorrFinalTrk_Reb;
398 std::vector<TH2D*> v_MET_CorrFinalClus_Reb;
399 std::vector<TH1D*> v_MET_Diff_Reb;
400 std::vector<TH1D*> v_MET_Diff_Reb_x;
401 std::vector<TH1D*> v_MET_Diff_Reb_y;
402 std::vector<TH1D*> v_MET_Diff_Reb_phi;
403 std::vector<TH1D*> v_MET_Diff_Reb_sum;
404
405 for(const auto& term : m_terms) {
406 v_MET_Reb.push_back( new TH1D((name_met + "_" + term).c_str(), (name_met + " " + m_names[term] + "; E_{T}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinp, 0., suptmi) );
407 v_MET_Reb_x.push_back( new TH1D((name_met + "_" + term + "_x").c_str(), (name_met + " " + m_names[term] + " x; E_{x}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
408 v_MET_Reb_y.push_back( new TH1D((name_met + "_" + term + "_y").c_str(), (name_met + " " + m_names[term] + " y; E_{y}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
409 v_MET_Reb_phi.push_back( new TH1D((name_met + "_" + term + "_phi").c_str(), (name_met + " " + m_names[term] + " phi; #Phi; Entries / 0.1").c_str(), nbinphi,-binphi,binphi) );
410 v_MET_Reb_sum.push_back( new TH1D((name_met + "_" + term + "_sum").c_str(), (name_met + " " + m_names[term] + " sum; E_{T}^{sum} [GeV]; Entries / 25 GeV").c_str(), nbinE, lowET, suET) );
411 m_dir_met.push_back("MET/" + name_met + "/Terms/" + term + "/");
412 }
413 std::size_t n = v_MET_Reb.size();
414 m_MET_Reb[type] = std::move(v_MET_Reb);
415 m_MET_Reb_x[type] = std::move(v_MET_Reb_x);
416 m_MET_Reb_y[type] = std::move(v_MET_Reb_y);
417 m_MET_Reb_phi[type] = std::move(v_MET_Reb_phi);
418 m_MET_Reb_sum[type] = std::move(v_MET_Reb_sum);
419
420 for(std::size_t i = 0; i < n; ++i) {
426 }
427
428 name_sub = name_met + "/Cumulative";
429 v_MET_Cumu_Reb.push_back( new TH1D((name_met + "_Cumulative_FinalClus").c_str(), (name_met + " CST MET cumulative; E_{T}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinp, 0., suptmi) );
430 v_MET_Cumu_Reb.push_back( new TH1D((name_met + "_Cumulative_FinalTrk").c_str(), (name_met + " TST MET cumulative; E_{T}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinp, 0., suptmi) );
431
432 m_MET_Cumu_Reb[type] = v_MET_Cumu_Reb;
433
434 for(std::vector<TH1D*>::size_type i = 0; i < v_MET_Cumu_Reb.size(); ++i) {
435 ATH_CHECK(regHist(m_MET_Cumu_Reb[type].at(i),"MET/" + name_sub + "/",all));
436 }
437
438 name_sub = name_met + "/Residuals";
439 v_MET_Resolution_Reb.push_back( new TH1D((name_met + "_Resolution_FinalClus_x").c_str(), ("x-Residual of CST MET in " + name_met + "; #Delta(E_{T,CST}^{miss}, E_{T,truth}^{miss})_{x} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
440 v_MET_Resolution_Reb.push_back( new TH1D((name_met + "_Resolution_FinalClus_y").c_str(), ("y-Residual of CST MET in " + name_met + "; #Delta(E_{T,CST}^{miss}, E_{T,truth}^{miss})_{y} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
441 v_MET_Resolution_Reb.push_back( new TH1D((name_met + "_Resolution_FinalTrk_x").c_str(), ("x-Residual of TST MET in " + name_met + "; #Delta(E_{T,TST}^{miss}, E_{T,truth}^{miss})_{x} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
442 v_MET_Resolution_Reb.push_back( new TH1D((name_met + "_Resolution_FinalTrk_y").c_str(), ("y-Residual of TST MET in " + name_met + "; #Delta(E_{T,TST}^{miss}, E_{T,truth}^{miss})_{y} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy) );
443 m_MET_Resolution_Reb[type] = v_MET_Resolution_Reb;
444
445 for(std::vector<TH1D*>::size_type i = 0; i < v_MET_Resolution_Reb.size(); ++i) {
446 ATH_CHECK(regHist(m_MET_Resolution_Reb[type].at(i),"MET/" + name_sub + "/",all));
447 }
448
449 name_sub = name_met + "/Significance";
450 v_MET_Significance_Reb.push_back( new TH1D((name_met + "_Significance_FinalClus").c_str(), ("MET / sqrt(sumet) for " + name_met + " CST; MET/#sqrt{SET} [#sqrt{GeV}]; Entries / 0.25 #sqrt{GeV}").c_str(), nbinp, 0., 25.) );
451 v_MET_Significance_Reb.push_back( new TH1D((name_met + "_Significance_FinalTrk").c_str(), ("MET / sqrt(sumet) for " + name_met + " TST; MET/sqrt{SET} [#sqrt{GeV}]; Entries / 0.25 #sqrt{GeV}").c_str(), nbinp, 0., 25.) );
452
453 m_MET_Significance_Reb[type] = v_MET_Significance_Reb;
454
455 for(std::vector<TH1D*>::size_type i = 0; i < v_MET_Significance_Reb.size(); ++i) {
456 ATH_CHECK(regHist(m_MET_Significance_Reb[type].at(i),"MET/" + name_sub + "/",all));
457 }
458
459 name_sub = name_met + "/dPhi";
460 v_MET_dPhi_Reb.push_back( new TH1D((name_met + "_dPhi_leadJetMET_FinalClus").c_str(), ("MET deltaPhi vs leading jet for " + name_met + " CST; #Delta#Phi(leadJet, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
461 v_MET_dPhi_Reb.push_back( new TH1D((name_met + "_dPhi_subleadJetMET_FinalClus").c_str(), ("MET deltaPhi vs subleading jet for " + name_met + " CST; #Delta#Phi(subleadJet, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
462 v_MET_dPhi_Reb.push_back( new TH1D((name_met + "_dPhi_leadLepMET_FinalClus").c_str(), ("MET deltaPhi vs leading lepton for " + name_met + " CST; #Delta#Phi(leadLep, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
463 v_MET_dPhi_Reb.push_back( new TH1D((name_met + "_dPhi_leadJetMET_FinalTrk").c_str(), ("MET deltaPhi vs leading jet for " + name_met + " TST; #Delta#Phi(leadJet, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
464 v_MET_dPhi_Reb.push_back( new TH1D((name_met + "_dPhi_subleadJetMET_FinalTrk").c_str(), ("MET deltaPhi vs subleading jet for " + name_met + " TST; #Delta#Phi(subleadJet, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
465 v_MET_dPhi_Reb.push_back( new TH1D((name_met + "_dPhi_leadLepMET_FinalTrk").c_str(), ("MET deltaPhi vs leading lepton for " + name_met + " TST; #Delta#Phi(leadLep, MET); Entries / 0.05").c_str(), nbinphi, 0., binphi) );
466
467 m_MET_dPhi_Reb[type] = v_MET_dPhi_Reb;
468
469 for(std::vector<TH1D*>::size_type i = 0; i < v_MET_dPhi_Reb.size(); ++i) {
470 ATH_CHECK(regHist(m_MET_dPhi_Reb[type].at(i),"MET/" + name_sub + "/",all));
471 }
472
473 name_sub = name_met + "/Correlations";
474 v_MET_CorrFinalClus_Reb.reserve(corrClus_names.size());
475
476 for(const auto& it : corrClus_names) {
477 v_MET_CorrFinalClus_Reb.push_back( new TH2D((name_met + "_" + it + "_FinalClus").c_str(), (name_met + " " + m_names[it] + " vs. CST MET; E_{T," + it + "}^{miss} [GeV]; E_{T,CST}^{miss} [GeV]; Entries").c_str(), nbinp, 0., suptmi, nbinp, 0., suptmi) );
478 }
479 v_MET_CorrFinalTrk_Reb.reserve(corrTrk_names.size());
480
481 for(const auto& it : corrTrk_names) {
482 v_MET_CorrFinalTrk_Reb.push_back( new TH2D((name_met + "_" + it + "_FinalTrk").c_str(), (name_met + " " + m_names[it] + " vs. TST MET; E_{T," + it + "}^{miss} [GeV]; E_{T,TST}^{miss} [GeV]; Entries").c_str(), nbinp, 0., suptmi, nbinp, 0., suptmi) );
483 }
484
485 m_MET_CorrFinalClus_Reb[type] = v_MET_CorrFinalClus_Reb;
486 m_MET_CorrFinalTrk_Reb[type] = v_MET_CorrFinalTrk_Reb;
487
488 for(std::vector<TH2D*>::size_type i = 0; i < v_MET_CorrFinalTrk_Reb.size(); ++i) {
489 ATH_CHECK(regHist(m_MET_CorrFinalTrk_Reb[type].at(i),"MET/" + name_sub + "/",all));
490 }
491 for(std::vector<TH2D*>::size_type i = 0; i < v_MET_CorrFinalClus_Reb.size(); ++i) {
492 ATH_CHECK(regHist(m_MET_CorrFinalClus_Reb[type].at(i),"MET/" + name_sub + "/",all));
493 }
494
495 m_dir_met.clear();
496
497 for(const auto& it : sum_names) {
498 v_MET_Diff_Reb.push_back( new TH1D((name_met + "_Diff_" + it).c_str(), ("MET_Diff " + m_names[it] + " in " + name_met +"; E_{T}^{miss} - #Sigma p_{T} [GeV]; Entries / 3 GeV").c_str(), nbinpxy, -150, 150));
499 v_MET_Diff_Reb_x.push_back( new TH1D((name_met + "_Diff_" + it + "_x").c_str(), ("MET_Diff x " + m_names[it] + " in " + name_met +"; E_{x}^{miss} - #Sigma p_{x} [GeV]; Entries / 3 GeV").c_str(), nbinpxy, -150, 150) );
500 v_MET_Diff_Reb_y.push_back( new TH1D((name_met + "_Diff_" + it + "_y").c_str(), ("MET_Diff y " + m_names[it] + " in " + name_met +"; E_{y}^{miss} - #Sigma p_{y} [GeV]; Entries / 3 GeV").c_str(), nbinpxy, -150, 150) );
501 v_MET_Diff_Reb_phi.push_back( new TH1D((name_met + "_Diff_" + it + "_phi").c_str(), ("MET_Diff phi " + m_names[it] + " in " + name_met +"; #Delta#Phi(E_{T}^{miss}, #Sigma p_{T}); Entries / 0.1").c_str(), nbinphi,-binphi,binphi) );
502 v_MET_Diff_Reb_sum.push_back( new TH1D((name_met + "_Diff_" + it + "_sum").c_str(), ("MET_Diff sumet " + m_names[it] + " in " + name_met +"; E_{T}^{sum} - #Sigma |p_{T}| [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -250, 250) );
503 m_dir_met.push_back("MET/" + name_met + "/Differences/" + it + "/");
504 }
505 n = v_MET_Diff_Reb.size();
506 m_MET_Diff_Reb[type] = std::move(v_MET_Diff_Reb);
507 m_MET_Diff_Reb_x[type] = std::move(v_MET_Diff_Reb_x);
508 m_MET_Diff_Reb_y[type] = std::move(v_MET_Diff_Reb_y);
509 m_MET_Diff_Reb_phi[type] = std::move(v_MET_Diff_Reb_phi);
510 m_MET_Diff_Reb_sum[type] = std::move(v_MET_Diff_Reb_sum);
511
512 for(std::size_t i = 0; i < n; ++i) {
518 }
519 }
520
521 //-------------------------------------------------------------------------------------
522 // Now MET_Track (only built if METRef is too)
523 if (m_doMETRefPlots){
524 std::string name_met = "MET_Track";
525 std::string dir = "MET/" + name_met + "/";
526 std::string sub_dir;
527
528 sub_dir = dir + "Track/";
529 ATH_CHECK(regHist(m_MET_Track = new TH1D("Track", (name_met + " " + m_names["Track"] + "; E_{T}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinp, 0., suptmi), sub_dir, all));
530 ATH_CHECK(regHist(m_MET_Track_x = new TH1D("Track_x", (name_met + " " + m_names["Track"] + " x; E_{x}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy), sub_dir, all));
531 ATH_CHECK(regHist(m_MET_Track_y = new TH1D("Track_y", (name_met + " " + m_names["Track"] + " y; E_{y}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy), sub_dir, all));
532 ATH_CHECK(regHist(m_MET_Track_phi = new TH1D("Track_phi", (name_met + " " + m_names["Track"] + " phi; #Phi; Entries / 0.1").c_str(), nbinphi,-binphi,binphi), sub_dir, all));
533 ATH_CHECK(regHist(m_MET_Track_sum = new TH1D("Track_sum", (name_met + " " + m_names["Track"] + " sum; E_{T}^{sum} [GeV]; Entries / 25 GeV").c_str(), nbinE, lowET, suET), sub_dir, all));
534
535 sub_dir = dir + "PVTrack_Nominal/";
536 ATH_CHECK(regHist(m_MET_PVTrack_Nominal = new TH1D("PVTrack_Nominal", (name_met + " " + m_names["PVTrack_Nominal"] + " ; E_{T}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinp, 0., suptmi), sub_dir, all));
537 ATH_CHECK(regHist(m_MET_PVTrack_Nominal_x = new TH1D("PVTrack_Nominal_x", (name_met + " " + m_names["PVTrack_Nominal"] + " x; E_{x}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy), sub_dir, all));
538 ATH_CHECK(regHist(m_MET_PVTrack_Nominal_y = new TH1D("PVTrack_Nominal_y", (name_met + " " + m_names["PVTrack_Nominal"] + " y; E_{y}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy), sub_dir, all));
539 ATH_CHECK(regHist(m_MET_PVTrack_Nominal_phi = new TH1D("PVTrack_Nominal_phi", (name_met + " " + m_names["PVTrack_Nominal"] + " phi; #Phi; Entries / 0.1").c_str(), nbinphi,-binphi,binphi), sub_dir, all));
540 ATH_CHECK(regHist(m_MET_PVTrack_Nominal_sum = new TH1D("PVTrack_Nominal_sum", (name_met + " " + m_names["PVTrack_Nominal"] + " sum; E_{T}^{sum} [GeV]; Entries / 25 GeV").c_str(), nbinE, lowET, suET), sub_dir, all));
541
542 sub_dir = dir + "PVTrack_Pileup/";
543 ATH_CHECK(regHist(m_MET_PVTrack_Pileup = new TH1D("PVTrack_Pileup", (name_met + " " + m_names["PVTrack_Pileup"] + "; E_{T}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinp, 0., suptmi), sub_dir, all));
544 ATH_CHECK(regHist(m_MET_PVTrack_Pileup_x = new TH1D("PVTrack_Pileup_x", (name_met + " " + m_names["PVTrack_Pileup"] + " x; E_{x}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy), sub_dir, all));
545 ATH_CHECK(regHist(m_MET_PVTrack_Pileup_y = new TH1D("PVTrack_Pileup_y", (name_met +" " + m_names["PVTrack_Pileup"] + " y; E_{y}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy), sub_dir, all));
546 ATH_CHECK(regHist(m_MET_PVTrack_Pileup_phi = new TH1D("PVTrack_Pileup_phi", (name_met + " " + m_names["PVTrack_Pileup"] + " phi; #Phi; Entries / 0.1").c_str(), nbinphi,-binphi,binphi), sub_dir, all));
547 ATH_CHECK(regHist(m_MET_PVTrack_Pileup_sum = new TH1D("PVTrack_Pileup_sum", (name_met + " " + m_names["PVTrack_Pileup"] + " sum; E_{T}^{sum} [GeV]; Entries / 25 GeV").c_str(), nbinE, lowET, suET), sub_dir, all));
548 }
549
550 //-------------------------------------------------------------------------------------
551 //Now MET_Calo
552
553 std::string name_met = "MET_Calo";
554 std::string dir = "MET/" + name_met + "/";
555
556 ATH_CHECK(regHist(m_MET_Calo = new TH1D("Calo", (name_met + " " + m_names["Calo"] + "; E_{T}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinp, 0., suptmi), dir, all));
557 ATH_CHECK(regHist(m_MET_Calo_x = new TH1D("Calo_x", (name_met + " " + m_names["Calo"] + " x; E_{x}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy), dir, all));
558 ATH_CHECK(regHist(m_MET_Calo_y = new TH1D("Calo_y", (name_met + " " + m_names["Calo"] + " y; E_{y}^{miss} [GeV]; Entries / 5 GeV").c_str(), nbinpxy, -suptmixy, suptmixy), dir, all));
559 ATH_CHECK(regHist(m_MET_Calo_phi = new TH1D("Calo_phi", (name_met + " " + m_names["Calo"] + " phi; #Phi; Entries / 0.1").c_str(), nbinphi,-binphi,binphi), dir, all));
560 ATH_CHECK(regHist(m_MET_Calo_sum = new TH1D("Calo_sum", (name_met + " " + m_names["Calo"] + " sum; E_{T}^{sum} [GeV]; Entries / 25 GeV").c_str(), nbinE, lowET, suET), dir, all));
561
562 }
563
564 return StatusCode::SUCCESS;
565 }
566
567 StatusCode PhysValMET::fillHistograms(const EventContext& /*ctx*/)
568 {
569 //dont fill unbooked histograms!
570 if (m_detailLevel < 10) {
571 return StatusCode::SUCCESS;
572 }
573 ATH_MSG_DEBUG ("Filling hists " << name() << "...");
574 //If we're running over new AODs without MET containers, don't do anything!
576 return StatusCode::SUCCESS;
577
578 //Beamspot weight
579 const xAOD::EventInfo* eventInfo(nullptr);
580 ATH_CHECK(evtStore()->retrieve(eventInfo, "EventInfo"));
581
582 float weight = eventInfo->beamSpotWeight();
583
584 //Retrieve MET Truth
585 const xAOD::MissingETContainer* met_Truth = nullptr;
586 if(m_doTruth) {
587 ATH_CHECK( evtStore()->retrieve(met_Truth,"MET_Truth") );
588 if (!met_Truth) {
589 ATH_MSG_ERROR ( "Failed to retrieve MET_Truth. Exiting." );
590 return StatusCode::FAILURE;
591 }
592 }
593
594 //Physics Objects
595 const xAOD::MuonContainer* muons = nullptr;
596 ATH_CHECK( evtStore()->retrieve(muons,m_muonColl) );
597 if (!muons) {
598 ATH_MSG_ERROR ( "Failed to retrieve Muon container. Exiting." );
599 return StatusCode::FAILURE;
600 }
602 bool is_muon = 0;
603 for(const auto mu : *muons) {
604 if(Accept(mu)) {
605 metMuons.push_back(mu);
606 is_muon = 1;
607 }
608 }
609
610 const xAOD::ElectronContainer* electrons = nullptr;
611 ATH_CHECK( evtStore()->retrieve(electrons,m_eleColl) );
612 if (!electrons) {
613 ATH_MSG_ERROR ( "Failed to retrieve Electron container. Exiting." );
614 return StatusCode::FAILURE;
615 }
617 bool is_electron = 0;
618 for(const auto el : *electrons) {
619 if(Accept(el)) {
620 metElectrons.push_back(el);
621 is_electron = 1;
622 }
623 }
624
625 const xAOD::PhotonContainer* photons = nullptr;
626 ATH_CHECK( evtStore()->retrieve(photons,m_gammaColl) );
627 if (!photons) {
628 ATH_MSG_ERROR ( "Failed to retrieve Photon container. Exiting." );
629 return StatusCode::FAILURE;
630 }
632 for(const auto ph : *photons) {
633 if(Accept(ph)) {
634 metPhotons.push_back(ph);
635 }
636 }
637
638 const TauJetContainer* taus = nullptr;
639 ATH_CHECK( evtStore()->retrieve(taus, m_tauColl) );
640 if(!taus) {
641 ATH_MSG_ERROR("Failed to retrieve TauJet container: " << m_tauColl);
642 return StatusCode::SUCCESS;
643 }
645 for(const auto tau : *taus) {
646 if(Accept(tau)) {
647 metTaus.push_back(tau);
648 }
649 }
650
651 // Overlap removal
652
658
659 //Photons
660 bool is_photon = 0;
662 for(pho_itr = metPhotons.begin(); pho_itr != metPhotons.end(); ++pho_itr ) {
663 TLorentzVector phtlv = (*pho_itr)->p4();
664 bool passOR = 1;
665 for(ele_itr = metElectrons.begin(); ele_itr != metElectrons.end(); ++ele_itr) {
666 if(phtlv.DeltaR((*ele_itr)->p4()) < 0.2) {
667 passOR = 0;
668 break;
669 }
670 }
671 if(passOR){
672 metPhotonsOR.push_back(*pho_itr);
673 is_photon = 1;
674 }
675 }
676
677 //TauJets
679 bool is_tau = 0;
680 for(taujet_itr = metTaus.begin(); taujet_itr != metTaus.end(); ++taujet_itr ) {
681 TLorentzVector tautlv = (*taujet_itr)->p4();
682 bool passOR = 1;
683 for(ele_itr = metElectrons.begin(); ele_itr != metElectrons.end(); ++ele_itr) {
684 if(tautlv.DeltaR((*ele_itr)->p4()) < 0.2) {
685 passOR = 0;
686 break;
687 }
688 }
689 for(pho_itr = metPhotonsOR.begin(); pho_itr != metPhotonsOR.end(); ++pho_itr) {
690 if(tautlv.DeltaR((*pho_itr)->p4()) < 0.2) {
691 passOR = 0;
692 break;
693 }
694 }
695 if(passOR){
696 metTausOR.push_back(*taujet_itr);
697 is_tau = 1;
698 }
699 }
700
701 //Sum up the pT's of the objects
702 TLorentzVector el_tlv;
703 double sum_el = 0;
704 for(ele_itr = metElectrons.begin(); ele_itr != metElectrons.end(); ++ele_itr ) {
705 el_tlv += (*ele_itr)->p4();
706 sum_el += (*ele_itr)->pt();
707 }
708
709 TLorentzVector mu_tlv;
710 double sum_mu = 0;
711 for(mu_itr = metMuons.begin(); mu_itr != metMuons.end(); ++mu_itr ) {
712 mu_tlv += (*mu_itr)->p4();
713 sum_mu += (*mu_itr)->pt();
714 }
715
716 TLorentzVector tau_tlv;
717 double sum_tau = 0;
718 for(taujet_itr = metTausOR.begin(); taujet_itr != metTausOR.end(); ++taujet_itr ) {
719 tau_tlv += (*taujet_itr)->p4();
720 sum_tau += (*taujet_itr)->pt();
721 }
722
723 TLorentzVector photon_tlv;
724 double sum_photon = 0;
725 for(pho_itr = metPhotonsOR.begin(); pho_itr != metPhotonsOR.end(); ++pho_itr ) {
726 photon_tlv += (*pho_itr)->p4();
727 sum_photon += (*pho_itr)->pt();
728 }
729
730 for (const auto& type : m_types){
731 ToolHandle<IJetUpdateJvt>* jvtTool(nullptr);
732 double JvtCut = 0.59;
733 if (type == "AntiKt4EMPFlow"){
734 JvtCut = 0.2;
735 jvtTool = &m_jvtToolPFlow;
736 }
737 else if (type == "AntiKt4EMTopo"){
738 jvtTool = &m_jvtToolEM;
739 }
740
741 if(jvtTool == nullptr){
742 ATH_MSG_ERROR("Unrecognized jet container: " << type << "Jets");
743 return StatusCode::FAILURE;
744 }
745
746 // Retrieve Jets
747 std::string name_jet = type + "Jets";
748 const xAOD::JetContainer* jets = nullptr;
749 ATH_CHECK( evtStore()->retrieve(jets,name_jet) );
750 if (!jets) {
751 ATH_MSG_ERROR ( "Failed to retrieve Jet container: " << name_jet << ". Exiting." );
752 return StatusCode::FAILURE;
753 }
754 SG::Decorator<float> NewJvtDec("NewJvt");
755 for(auto jet : *jets) {
756 float newjvt = (*jvtTool)->updateJvt(*jet);
757 NewJvtDec(*jet) = newjvt;
758 }
760 for(const auto jet : *jets) {
761 metJets.push_back(jet);
762 }
763 //Overlap Removal
765 bool is_jet = 0;
766 for(jetc_itr = metJets.begin(); jetc_itr != metJets.end(); ++jetc_itr ) {
767 TLorentzVector jettlv = (*jetc_itr)->p4();
768 bool passOR = 1;
769 for(ele_itr = metElectrons.begin(); ele_itr != metElectrons.end(); ++ele_itr) {
770 if(jettlv.DeltaR((*ele_itr)->p4()) < 0.2) {
771 passOR = 0;
772 break;
773 }
774 }
775 for(pho_itr = metPhotonsOR.begin(); pho_itr != metPhotonsOR.end(); ++pho_itr) {
776 if(jettlv.DeltaR((*pho_itr)->p4()) < 0.2) {
777 passOR = 0;
778 break;
779 }
780 }
781 for(taujet_itr = metTausOR.begin(); taujet_itr != metTausOR.end(); ++taujet_itr) {
782 if(jettlv.DeltaR((*taujet_itr)->p4()) < 0.2) {
783 passOR = 0;
784 break;
785 }
786 }
787 if(passOR){
788 metJetsOR.push_back(*jetc_itr);
789 is_jet = 1;
790 }
791 }
792
793 TLorentzVector jet_tlv;
794 double sum_jet = 0;
795 for(jetc_itr = metJetsOR.begin(); jetc_itr != metJetsOR.end(); ++jetc_itr ) {
796 jet_tlv += (*jetc_itr)->p4();
797 sum_jet += (*jetc_itr)->pt();
798 }
799
800 // Fill MET_Ref
801 std::string name_met = "MET_Reference_" + type;
802 const xAOD::MissingETContainer* met_Ref = nullptr;
803 // We're not building METReference anymore in derivations
804
805 if(m_doMETRefPlots){
806
807 // Retrieve Reference MET
808 ATH_CHECK( evtStore()->retrieve(met_Ref, name_met) );
809 if (!met_Ref) {
810 ATH_MSG_ERROR ("Couldn't retrieve " << name_met);
811 return StatusCode::FAILURE;
812 }
813
814 ATH_MSG_INFO( " MET_Ref_" << type << ":" );
815 for(const auto it : *met_Ref) {
816 const std::string& name = it->name();
817 if(name == "RefEle"){
818 (m_MET_Ref[type]).at(0)->Fill((*met_Ref)[name.c_str()]->met()/1000., weight);
819 (m_MET_Ref_x[type]).at(0)->Fill((*met_Ref)[name.c_str()]->mpx()/1000., weight);
820 (m_MET_Ref_y[type]).at(0)->Fill((*met_Ref)[name.c_str()]->mpy()/1000., weight);
821 (m_MET_Ref_phi[type]).at(0)->Fill((*met_Ref)[name.c_str()]->phi(), weight);
822 (m_MET_Ref_sum[type]).at(0)->Fill((*met_Ref)[name.c_str()]->sumet()/1000., weight);
823 }
824 if(name == "RefGamma"){
825 (m_MET_Ref[type]).at(1)->Fill((*met_Ref)[name.c_str()]->met()/1000., weight);
826 (m_MET_Ref_x[type]).at(1)->Fill((*met_Ref)[name.c_str()]->mpx()/1000., weight);
827 (m_MET_Ref_y[type]).at(1)->Fill((*met_Ref)[name.c_str()]->mpy()/1000., weight);
828 (m_MET_Ref_phi[type]).at(1)->Fill((*met_Ref)[name.c_str()]->phi(), weight);
829 (m_MET_Ref_sum[type]).at(1)->Fill((*met_Ref)[name.c_str()]->sumet()/1000., weight);
830 }
831 if(name == "RefTau"){
832 (m_MET_Ref[type]).at(2)->Fill((*met_Ref)[name.c_str()]->met()/1000., weight);
833 (m_MET_Ref_x[type]).at(2)->Fill((*met_Ref)[name.c_str()]->mpx()/1000., weight);
834 (m_MET_Ref_y[type]).at(2)->Fill((*met_Ref)[name.c_str()]->mpy()/1000., weight);
835 (m_MET_Ref_phi[type]).at(2)->Fill((*met_Ref)[name.c_str()]->phi(), weight);
836 (m_MET_Ref_sum[type]).at(2)->Fill((*met_Ref)[name.c_str()]->sumet()/1000., weight);
837 }
838 if(name == "Muons"){
839 (m_MET_Ref[type]).at(3)->Fill((*met_Ref)[name.c_str()]->met()/1000., weight);
840 (m_MET_Ref_x[type]).at(3)->Fill((*met_Ref)[name.c_str()]->mpx()/1000., weight);
841 (m_MET_Ref_y[type]).at(3)->Fill((*met_Ref)[name.c_str()]->mpy()/1000., weight);
842 (m_MET_Ref_phi[type]).at(3)->Fill((*met_Ref)[name.c_str()]->phi(), weight);
843 (m_MET_Ref_sum[type]).at(3)->Fill((*met_Ref)[name.c_str()]->sumet()/1000., weight);
844 }
845 if(name == "RefJet"){
846 (m_MET_Ref[type]).at(4)->Fill((*met_Ref)[name.c_str()]->met()/1000., weight);
847 (m_MET_Ref_x[type]).at(4)->Fill((*met_Ref)[name.c_str()]->mpx()/1000., weight);
848 (m_MET_Ref_y[type]).at(4)->Fill((*met_Ref)[name.c_str()]->mpy()/1000., weight);
849 (m_MET_Ref_phi[type]).at(4)->Fill((*met_Ref)[name.c_str()]->phi(), weight);
850 (m_MET_Ref_sum[type]).at(4)->Fill((*met_Ref)[name.c_str()]->sumet()/1000., weight);
851 }
852 if(name == "SoftClus"){
853 (m_MET_Ref[type]).at(5)->Fill((*met_Ref)[name.c_str()]->met()/1000., weight);
854 (m_MET_Ref_x[type]).at(5)->Fill((*met_Ref)[name.c_str()]->mpx()/1000., weight);
855 (m_MET_Ref_y[type]).at(5)->Fill((*met_Ref)[name.c_str()]->mpy()/1000., weight);
856 (m_MET_Ref_phi[type]).at(5)->Fill((*met_Ref)[name.c_str()]->phi(), weight);
857 (m_MET_Ref_sum[type]).at(5)->Fill((*met_Ref)[name.c_str()]->sumet()/1000., weight);
858 }
859 if(name == "PVSoftTrk"){
860 (m_MET_Ref[type]).at(6)->Fill((*met_Ref)[name.c_str()]->met()/1000., weight);
861 (m_MET_Ref_x[type]).at(6)->Fill((*met_Ref)[name.c_str()]->mpx()/1000., weight);
862 (m_MET_Ref_y[type]).at(6)->Fill((*met_Ref)[name.c_str()]->mpy()/1000., weight);
863 (m_MET_Ref_phi[type]).at(6)->Fill((*met_Ref)[name.c_str()]->phi(), weight);
864 (m_MET_Ref_sum[type]).at(6)->Fill((*met_Ref)[name.c_str()]->sumet()/1000., weight);
865 }
866 if(name == "FinalTrk"){
867 (m_MET_Ref[type]).at(7)->Fill((*met_Ref)[name.c_str()]->met()/1000., weight);
868 (m_MET_Ref_x[type]).at(7)->Fill((*met_Ref)[name.c_str()]->mpx()/1000., weight);
869 (m_MET_Ref_y[type]).at(7)->Fill((*met_Ref)[name.c_str()]->mpy()/1000., weight);
870 (m_MET_Ref_phi[type]).at(7)->Fill((*met_Ref)[name.c_str()]->phi(), weight);
871 (m_MET_Ref_sum[type]).at(7)->Fill((*met_Ref)[name.c_str()]->sumet()/1000., weight);
872 }
873 if(name == "FinalClus"){
874 (m_MET_Ref[type]).at(8)->Fill((*met_Ref)[name.c_str()]->met()/1000., weight);
875 (m_MET_Ref_x[type]).at(8)->Fill((*met_Ref)[name.c_str()]->mpx()/1000., weight);
876 (m_MET_Ref_y[type]).at(8)->Fill((*met_Ref)[name.c_str()]->mpy()/1000., weight);
877 (m_MET_Ref_phi[type]).at(8)->Fill((*met_Ref)[name.c_str()]->phi(), weight);
878 (m_MET_Ref_sum[type]).at(8)->Fill((*met_Ref)[name.c_str()]->sumet()/1000., weight);
879 }
880 }
881 }
882
883 //Prepare Rebuilding MET
884 ATH_MSG_INFO( " Rebuilding MET_" << type );
885 MissingETContainer* met_Reb = new MissingETContainer();
886 if( evtStore()->record(met_Reb,("MET_Rebuilt"+type).c_str()).isFailure() ) {
887 ATH_MSG_ERROR("Unable to record MissingETContainer: MET_Rebuilt_" << type);
888 return StatusCode::FAILURE;
889 }
891 if( evtStore()->record(met_RebAux,("MET_Rebuilt"+type+"Aux").c_str()).isFailure() ) {
892 ATH_MSG_ERROR("Unable to record MissingETAuxContainer: MET_Rebuilt" << type);
893 return StatusCode::FAILURE;
894 }
895 met_Reb->setStore(met_RebAux);
896
897 m_mapname = "METAssoc_"+type;
898 m_corename = "MET_Core_"+type;
899 const MissingETAssociationMap* metMap = nullptr;
900 if( evtStore()->retrieve(metMap, m_mapname).isFailure() ) {
901 ATH_MSG_WARNING("Unable to retrieve MissingETAssociationMap: " << m_mapname);
902 return StatusCode::SUCCESS;
903 }
904 MissingETAssociationHelper metHelper(metMap);
905 const MissingETContainer* coreMet(nullptr);
906 if( evtStore()->retrieve(coreMet, m_corename).isFailure() ) {
907 ATH_MSG_WARNING("Unable to retrieve MissingETContainer: " << m_corename);
908 return StatusCode::SUCCESS;
909 }
910
911 ATH_MSG_INFO( " MET_Rebuilt_" << type << ":" );
912 //Select and flag objects for final MET building ***************************
913 if( type.find("PFlow") != std::string::npos) m_metmaker = &m_metmakerPFlow;
915
916 // Electrons
917 if( (*m_metmaker)->rebuildMET("RefEle", xAOD::Type::Electron, met_Reb, metElectrons.asDataVector(), metHelper).isFailure() ) {
918 ATH_MSG_ERROR("Failed to build electron term.");
919 return StatusCode::FAILURE;
920 }
921
922 // Photons
923 if( (*m_metmaker)->rebuildMET("RefGamma", xAOD::Type::Photon, met_Reb, metPhotons.asDataVector(), metHelper).isFailure() ) {
924 ATH_MSG_ERROR("Failed to build photon term.");
925 return StatusCode::FAILURE;
926 }
927
928 // Taus
929 if( (*m_metmaker)->rebuildMET("RefTau", xAOD::Type::Tau, met_Reb,metTaus.asDataVector(),metHelper).isFailure() ){
930 ATH_MSG_ERROR("Failed to build tau term.");
931 return StatusCode::FAILURE;
932 }
933
934 // Muons
935 if( (*m_metmaker)->rebuildMET("Muons", xAOD::Type::Muon, met_Reb, metMuons.asDataVector(), metHelper).isFailure() ) {
936 ATH_MSG_ERROR("Failed to build muon term.");
937 return StatusCode::FAILURE;
938 }
939
940 // Jets
941 if( (*m_metmaker)->rebuildJetMET("RefJet", "SoftClus", "PVSoftTrk", met_Reb, jets, coreMet, metHelper, true).isFailure() ) {
942 ATH_MSG_ERROR("Failed to build jet and soft terms.");
943 return StatusCode::FAILURE;
944 }
946 if((*met_Reb)["PVSoftTrk"]) trksource = (*met_Reb)["PVSoftTrk"]->source();
947 if( met::buildMETSum("FinalTrk", met_Reb, trksource).isFailure() ){
948 ATH_MSG_ERROR("Building MET FinalTrk sum failed.");
949 return StatusCode::FAILURE;
950 }
952 if (type == "AntiKt4EMTopo") clsource = static_cast<MissingETBase::Types::bitmask_t>(MissingETBase::Source::Signal::EMTopo);
954
955 if((*met_Reb)["SoftClus"]) clsource = (*met_Reb)["SoftClus"]->source();
956 if( met::buildMETSum("FinalClus", met_Reb, clsource).isFailure() ) {
957 ATH_MSG_ERROR("Building MET FinalClus sum failed.");
958 return StatusCode::FAILURE;
959 }
960
961 // Fill MET_Reb
962 for(const auto it : *met_Reb) {
963 std::string name = it->name();
964 if(name == "RefEle"){
965 (m_MET_Reb[type]).at(0)->Fill((*met_Reb)[name.c_str()]->met()/1000., weight);
966 (m_MET_Reb_x[type]).at(0)->Fill((*met_Reb)[name.c_str()]->mpx()/1000., weight);
967 (m_MET_Reb_y[type]).at(0)->Fill((*met_Reb)[name.c_str()]->mpy()/1000., weight);
968 (m_MET_Reb_phi[type]).at(0)->Fill((*met_Reb)[name.c_str()]->phi(), weight);
969 (m_MET_Reb_sum[type]).at(0)->Fill((*met_Reb)[name.c_str()]->sumet()/1000., weight);
970 }
971 if(name == "RefGamma"){
972 (m_MET_Reb[type]).at(1)->Fill((*met_Reb)[name.c_str()]->met()/1000., weight);
973 (m_MET_Reb_x[type]).at(1)->Fill((*met_Reb)[name.c_str()]->mpx()/1000., weight);
974 (m_MET_Reb_y[type]).at(1)->Fill((*met_Reb)[name.c_str()]->mpy()/1000., weight);
975 (m_MET_Reb_phi[type]).at(1)->Fill((*met_Reb)[name.c_str()]->phi(), weight);
976 (m_MET_Reb_sum[type]).at(1)->Fill((*met_Reb)[name.c_str()]->sumet()/1000., weight);
977 }
978 if(name == "RefTau"){
979 (m_MET_Reb[type]).at(2)->Fill((*met_Reb)[name.c_str()]->met()/1000., weight);
980 (m_MET_Reb_x[type]).at(2)->Fill((*met_Reb)[name.c_str()]->mpx()/1000., weight);
981 (m_MET_Reb_y[type]).at(2)->Fill((*met_Reb)[name.c_str()]->mpy()/1000., weight);
982 (m_MET_Reb_phi[type]).at(2)->Fill((*met_Reb)[name.c_str()]->phi(), weight);
983 (m_MET_Reb_sum[type]).at(2)->Fill((*met_Reb)[name.c_str()]->sumet()/1000., weight);
984 }
985 if(name == "Muons"){
986 (m_MET_Reb[type]).at(3)->Fill((*met_Reb)[name.c_str()]->met()/1000., weight);
987 (m_MET_Reb_x[type]).at(3)->Fill((*met_Reb)[name.c_str()]->mpx()/1000., weight);
988 (m_MET_Reb_y[type]).at(3)->Fill((*met_Reb)[name.c_str()]->mpy()/1000., weight);
989 (m_MET_Reb_phi[type]).at(3)->Fill((*met_Reb)[name.c_str()]->phi(), weight);
990 (m_MET_Reb_sum[type]).at(3)->Fill((*met_Reb)[name.c_str()]->sumet()/1000., weight);
991 }
992 if(name == "RefJet"){
993 (m_MET_Reb[type]).at(4)->Fill((*met_Reb)[name.c_str()]->met()/1000., weight);
994 (m_MET_Reb_x[type]).at(4)->Fill((*met_Reb)[name.c_str()]->mpx()/1000., weight);
995 (m_MET_Reb_y[type]).at(4)->Fill((*met_Reb)[name.c_str()]->mpy()/1000., weight);
996 (m_MET_Reb_phi[type]).at(4)->Fill((*met_Reb)[name.c_str()]->phi(), weight);
997 (m_MET_Reb_sum[type]).at(4)->Fill((*met_Reb)[name.c_str()]->sumet()/1000., weight);
998 }
999 if(name == "SoftClus"){
1000 (m_MET_Reb[type]).at(5)->Fill((*met_Reb)[name.c_str()]->met()/1000., weight);
1001 (m_MET_Reb_x[type]).at(5)->Fill((*met_Reb)[name.c_str()]->mpx()/1000., weight);
1002 (m_MET_Reb_y[type]).at(5)->Fill((*met_Reb)[name.c_str()]->mpy()/1000., weight);
1003 (m_MET_Reb_phi[type]).at(5)->Fill((*met_Reb)[name.c_str()]->phi(), weight);
1004 (m_MET_Reb_sum[type]).at(5)->Fill((*met_Reb)[name.c_str()]->sumet()/1000., weight);
1005 }
1006 if(name == "PVSoftTrk"){
1007 (m_MET_Reb[type]).at(6)->Fill((*met_Reb)[name.c_str()]->met()/1000., weight);
1008 (m_MET_Reb_x[type]).at(6)->Fill((*met_Reb)[name.c_str()]->mpx()/1000., weight);
1009 (m_MET_Reb_y[type]).at(6)->Fill((*met_Reb)[name.c_str()]->mpy()/1000., weight);
1010 (m_MET_Reb_phi[type]).at(6)->Fill((*met_Reb)[name.c_str()]->phi(), weight);
1011 (m_MET_Reb_sum[type]).at(6)->Fill((*met_Reb)[name.c_str()]->sumet()/1000., weight);
1012 }
1013 if(name == "FinalTrk"){
1014 (m_MET_Reb[type]).at(7)->Fill((*met_Reb)[name.c_str()]->met()/1000., weight);
1015 (m_MET_Reb_x[type]).at(7)->Fill((*met_Reb)[name.c_str()]->mpx()/1000., weight);
1016 (m_MET_Reb_y[type]).at(7)->Fill((*met_Reb)[name.c_str()]->mpy()/1000., weight);
1017 (m_MET_Reb_phi[type]).at(7)->Fill((*met_Reb)[name.c_str()]->phi(), weight);
1018 (m_MET_Reb_sum[type]).at(7)->Fill((*met_Reb)[name.c_str()]->sumet()/1000., weight);
1019 }
1020 if(name == "FinalClus"){
1021 (m_MET_Reb[type]).at(8)->Fill((*met_Reb)[name.c_str()]->met()/1000., weight);
1022 (m_MET_Reb_x[type]).at(8)->Fill((*met_Reb)[name.c_str()]->mpx()/1000., weight);
1023 (m_MET_Reb_y[type]).at(8)->Fill((*met_Reb)[name.c_str()]->mpy()/1000., weight);
1024 (m_MET_Reb_phi[type]).at(8)->Fill((*met_Reb)[name.c_str()]->phi(), weight);
1025 (m_MET_Reb_sum[type]).at(8)->Fill((*met_Reb)[name.c_str()]->sumet()/1000., weight);
1026 }
1027 }
1028
1029 //Fill MET Angles
1030 ATH_MSG_INFO( " MET_Angles :" );
1031
1032 double leadPt = 0., subleadPt = 0., leadPhi = 0., subleadPhi = 0.;
1033
1034 for (auto jet_itr = jets->begin(); jet_itr != jets->end(); ++jet_itr) {
1035 if ((*jet_itr)->pt() > leadPt && Accept(*jet_itr,JvtCut,jvtTool)) {
1036 subleadPt = leadPt;
1037 subleadPhi = leadPhi;
1038 leadPt = (*jet_itr)->pt();
1039 leadPhi = (*jet_itr)->phi();
1040 }
1041 else if ((*jet_itr)->pt() > subleadPt && Accept(*jet_itr,JvtCut,jvtTool)) {
1042 subleadPt = (*jet_itr)->pt();
1043 subleadPhi = (*jet_itr)->phi();
1044 }
1045 }
1046
1047 if(m_doMETRefPlots){
1048 const auto & dPhiRef = m_MET_dPhi_Ref[type];
1049 const auto * pClus = (*met_Ref)["FinalClus"];
1050 const auto * pTrk = (*met_Ref)["FinalTrk"];
1051 if (!pTrk or !pClus){
1052 ATH_MSG_ERROR("Dereference of 'Ref' pClus or pTrk");
1053 return StatusCode::FAILURE;
1054 }
1055
1056 dPhiRef.at(0)->Fill( -remainder( leadPhi - pClus->phi(), 2*M_PI ), weight );
1057 dPhiRef.at(1)->Fill( -remainder( subleadPhi - pClus->phi(), 2*M_PI ), weight );
1058 dPhiRef.at(3)->Fill( -remainder( leadPhi - pTrk->phi(), 2*M_PI ), weight );
1059 dPhiRef.at(4)->Fill( -remainder( subleadPhi - pTrk->phi(), 2*M_PI ), weight );
1060 }
1061 const auto & dPhiReb = m_MET_dPhi_Reb[type];
1062 const auto * pClus = (*met_Reb)["FinalClus"];
1063 const auto * pTrk = (*met_Reb)["FinalTrk"];
1064 if (!pTrk or !pClus){
1065 ATH_MSG_ERROR("Dereference of 'Reb' pClus or pTrk");
1066 return StatusCode::FAILURE;
1067 }
1068 dPhiReb.at(0)->Fill( -remainder( leadPhi - pClus->phi(), 2*M_PI ), weight );
1069 dPhiReb.at(1)->Fill( -remainder( subleadPhi - pClus->phi(), 2*M_PI ), weight );
1070 dPhiReb.at(3)->Fill( -remainder( leadPhi - pTrk->phi(), 2*M_PI ), weight );
1071 dPhiReb.at(4)->Fill( -remainder( subleadPhi - pTrk->phi(), 2*M_PI ), weight );
1072
1073 leadPt = 0.; leadPhi = 0.;
1074
1075 xAOD::MuonContainer::const_iterator muon_itr = muons->begin();
1076 xAOD::MuonContainer::const_iterator muon_end = muons->end();
1077
1078 for( ; muon_itr != muon_end; ++muon_itr ) {
1079 if((*muon_itr)->pt() > leadPt) {
1080 leadPt = (*muon_itr)->pt();
1081 leadPhi = (*muon_itr)->phi();
1082 }
1083 }
1084
1085 xAOD::ElectronContainer::const_iterator electron_itr = electrons->begin();
1086 xAOD::ElectronContainer::const_iterator electron_end = electrons->end();
1087
1088 for( ; electron_itr != electron_end; ++electron_itr ) {
1089 if((*electron_itr)->pt() > leadPt) {
1090 leadPt = (*electron_itr)->pt();
1091 leadPhi = (*electron_itr)->phi();
1092 }
1093 }
1094
1095 (m_MET_dPhi_Reb[type]).at(2)->Fill( -remainder( leadPhi - (*met_Reb)["FinalClus"]->phi(), 2*M_PI ), weight );
1096 (m_MET_dPhi_Reb[type]).at(5)->Fill( -remainder( leadPhi - (*met_Reb)["FinalTrk"]->phi(), 2*M_PI ), weight );
1097
1098 if(m_doMETRefPlots){
1099
1100 (m_MET_dPhi_Ref[type]).at(2)->Fill( -remainder( leadPhi - (*met_Ref)["FinalClus"]->phi(), 2*M_PI ), weight );
1101 (m_MET_dPhi_Ref[type]).at(5)->Fill( -remainder( leadPhi - (*met_Ref)["FinalTrk"]->phi(), 2*M_PI ), weight );
1102
1103 //Fill Correlation Plots
1104 //Reference
1105 for(const auto it : *met_Ref) {
1106 const std::string& name = it->name();
1107 if(name == "RefEle"){
1108 (m_MET_CorrFinalTrk_Ref[type]).at(0)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalTrk"]->met()/1000., weight);
1109 (m_MET_CorrFinalClus_Ref[type]).at(0)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalClus"]->met()/1000., weight);
1110 }
1111 if(name == "RefGamma"){
1112 (m_MET_CorrFinalTrk_Ref[type]).at(1)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalTrk"]->met()/1000., weight);
1113 (m_MET_CorrFinalClus_Ref[type]).at(1)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalClus"]->met()/1000., weight);
1114 }
1115 if(name == "RefTau"){
1116 (m_MET_CorrFinalTrk_Ref[type]).at(2)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalTrk"]->met()/1000., weight);
1117 (m_MET_CorrFinalClus_Ref[type]).at(2)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalClus"]->met()/1000., weight);
1118 }
1119 if(name == "Muons"){
1120 (m_MET_CorrFinalTrk_Ref[type]).at(3)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalTrk"]->met()/1000., weight);
1121 (m_MET_CorrFinalClus_Ref[type]).at(3)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalClus"]->met()/1000., weight);
1122 }
1123 if(name == "RefJet"){
1124 (m_MET_CorrFinalTrk_Ref[type]).at(4)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalTrk"]->met()/1000., weight);
1125 (m_MET_CorrFinalClus_Ref[type]).at(4)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalClus"]->met()/1000., weight);
1126 }
1127 if(name == "PVSoftTrk"){
1128 (m_MET_CorrFinalTrk_Ref[type]).at(5)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalTrk"]->met()/1000., weight);
1129 }
1130 if(name == "SoftClus"){
1131 (m_MET_CorrFinalClus_Ref[type]).at(5)->Fill((*met_Ref)[name.c_str()]->met()/1000.,(*met_Ref)["FinalClus"]->met()/1000., weight);
1132 }
1133 }
1134 }
1135
1136 //Rebuilt
1137
1138 for(const auto it : *met_Reb) {
1139 std::string name = it->name();
1140 if(name == "RefEle"){
1141 (m_MET_CorrFinalTrk_Reb[type]).at(0)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalTrk"]->met()/1000., weight);
1142 (m_MET_CorrFinalClus_Reb[type]).at(0)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalClus"]->met()/1000., weight);
1143 }
1144 if(name == "RefGamma"){
1145 (m_MET_CorrFinalTrk_Reb[type]).at(1)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalTrk"]->met()/1000., weight);
1146 (m_MET_CorrFinalClus_Reb[type]).at(1)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalClus"]->met()/1000., weight);
1147 }
1148 if(name == "RefTau"){
1149 (m_MET_CorrFinalTrk_Reb[type]).at(2)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalTrk"]->met()/1000., weight);
1150 (m_MET_CorrFinalClus_Reb[type]).at(2)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalClus"]->met()/1000., weight);
1151 }
1152 if(name == "Muons"){
1153 (m_MET_CorrFinalTrk_Reb[type]).at(3)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalTrk"]->met()/1000., weight);
1154 (m_MET_CorrFinalClus_Reb[type]).at(3)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalClus"]->met()/1000., weight);
1155 }
1156 if(name == "RefJet"){
1157 (m_MET_CorrFinalTrk_Reb[type]).at(4)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalTrk"]->met()/1000., weight);
1158 (m_MET_CorrFinalClus_Reb[type]).at(4)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalClus"]->met()/1000., weight);
1159 }
1160 if(name == "PVSoftTrk"){
1161 (m_MET_CorrFinalTrk_Reb[type]).at(5)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalTrk"]->met()/1000., weight);
1162 }
1163 if(name == "SoftClus"){
1164 (m_MET_CorrFinalClus_Reb[type]).at(5)->Fill((*met_Reb)[name.c_str()]->met()/1000.,(*met_Reb)["FinalClus"]->met()/1000., weight);
1165 }
1166 }
1167
1168 // Fill Resolution
1169 if(m_doTruth){
1170 ATH_MSG_INFO( " Resolution:" );
1171 if(m_doMETRefPlots){
1172 (m_MET_Resolution_Ref[type]).at(0)->Fill(((*met_Ref)["FinalClus"]->mpx()-(*met_Truth)["NonInt"]->mpx())/1000., weight);
1173 (m_MET_Resolution_Ref[type]).at(1)->Fill(((*met_Ref)["FinalClus"]->mpy()-(*met_Truth)["NonInt"]->mpy())/1000., weight);
1174 (m_MET_Resolution_Ref[type]).at(2)->Fill(((*met_Ref)["FinalTrk"]->mpx()-(*met_Truth)["NonInt"]->mpx())/1000., weight);
1175 (m_MET_Resolution_Ref[type]).at(3)->Fill(((*met_Ref)["FinalTrk"]->mpy()-(*met_Truth)["NonInt"]->mpy())/1000., weight);
1176 }
1177 (m_MET_Resolution_Reb[type]).at(0)->Fill(((*met_Reb)["FinalClus"]->mpx()-(*met_Truth)["NonInt"]->mpx())/1000., weight);
1178 (m_MET_Resolution_Reb[type]).at(1)->Fill(((*met_Reb)["FinalClus"]->mpy()-(*met_Truth)["NonInt"]->mpy())/1000., weight);
1179 (m_MET_Resolution_Reb[type]).at(2)->Fill(((*met_Reb)["FinalTrk"]->mpx()-(*met_Truth)["NonInt"]->mpx())/1000., weight);
1180 (m_MET_Resolution_Reb[type]).at(3)->Fill(((*met_Reb)["FinalTrk"]->mpy()-(*met_Truth)["NonInt"]->mpy())/1000., weight);
1181 }
1182
1183 //Fill MET significance
1184
1185 if(const auto sumet = (*met_Reb)["FinalClus"]->sumet(); sumet > 0){
1186 (m_MET_Significance_Reb[type]).at(0)->Fill((*met_Reb)["FinalClus"]->met()/std::sqrt(sumet * 1000.), weight);
1187 }
1188 if(const auto sumet = (*met_Reb)["FinalTrk"]->sumet(); sumet > 0){
1189 (m_MET_Significance_Reb[type]).at(1)->Fill((*met_Reb)["FinalTrk"]->met()/std::sqrt(sumet * 1000.), weight);
1190 }
1191
1192 TLorentzVector target_tlv;
1193 if(m_doMETRefPlots){
1194 //Fill MET Significance
1195 ATH_MSG_INFO( " MET_significance:" );
1196 if( (*met_Ref)["FinalClus"]->sumet() > 0) (m_MET_Significance_Ref[type]).at(0)->Fill((*met_Ref)["FinalClus"]->met()/sqrt((*met_Ref)["FinalClus"]->sumet()*1000.), weight);
1197 if( (*met_Ref)["FinalTrk"]->sumet() > 0) (m_MET_Significance_Ref[type]).at(1)->Fill((*met_Ref)["FinalTrk"]->met()/sqrt((*met_Ref)["FinalTrk"]->sumet()*1000.), weight);
1198
1199 //Fill Diff histograms
1200 for(const auto it : *met_Ref) {
1201 if(it->name() == "RefEle"){
1202 if(is_electron or (it->sumet() > 0)){
1203 target_tlv.SetPxPyPzE(-it->mpx(), -it->mpy(), 0, it->met());
1204 (m_MET_Diff_Ref[type]).at(0)->Fill((target_tlv.Pt() - el_tlv.Pt())/1000., weight);
1205 (m_MET_Diff_Ref_x[type]).at(0)->Fill((target_tlv.Px() - el_tlv.Px())/1000., weight);
1206 (m_MET_Diff_Ref_y[type]).at(0)->Fill((target_tlv.Py() - el_tlv.Py())/1000., weight);
1207 (m_MET_Diff_Ref_phi[type]).at(0)->Fill(el_tlv.DeltaPhi(target_tlv), weight);
1208 (m_MET_Diff_Ref_sum[type]).at(0)->Fill((it->sumet() - sum_el)/1000., weight);
1209 }
1210 }
1211 if(it->name() == "RefGamma"){
1212 if(is_photon or (it->sumet() > 0)){
1213 target_tlv.SetPxPyPzE(-it->mpx(), -it->mpy(), 0, it->met());
1214 (m_MET_Diff_Ref[type]).at(1)->Fill((target_tlv.Pt() - photon_tlv.Pt())/1000., weight);
1215 (m_MET_Diff_Ref_x[type]).at(1)->Fill((target_tlv.Px() - photon_tlv.Px())/1000., weight);
1216 (m_MET_Diff_Ref_y[type]).at(1)->Fill((target_tlv.Py() - photon_tlv.Py())/1000., weight);
1217 (m_MET_Diff_Ref_phi[type]).at(1)->Fill(photon_tlv.DeltaPhi(target_tlv), weight);
1218 (m_MET_Diff_Ref_sum[type]).at(1)->Fill((it->sumet() - sum_photon)/1000., weight);
1219 }
1220 }
1221 if(it->name() == "RefTau"){
1222 if(is_tau or (it->sumet() > 0)){
1223 target_tlv.SetPxPyPzE(-it->mpx(), -it->mpy(), 0, it->met());
1224 (m_MET_Diff_Ref[type]).at(2)->Fill((target_tlv.Pt() - tau_tlv.Pt())/1000., weight);
1225 (m_MET_Diff_Ref_x[type]).at(2)->Fill((target_tlv.Px() - tau_tlv.Px())/1000., weight);
1226 (m_MET_Diff_Ref_y[type]).at(2)->Fill((target_tlv.Py() - tau_tlv.Py())/1000., weight);
1227 (m_MET_Diff_Ref_phi[type]).at(2)->Fill(tau_tlv.DeltaPhi(target_tlv), weight);
1228 (m_MET_Diff_Ref_sum[type]).at(2)->Fill((it->sumet() - sum_tau)/1000., weight);
1229 }
1230 }
1231 if(it->name() == "Muons"){
1232 if(is_muon or (it->sumet() > 0)){
1233 target_tlv.SetPxPyPzE(-it->mpx(), -it->mpy(), 0, it->met());
1234 (m_MET_Diff_Ref[type]).at(3)->Fill((target_tlv.Pt() - mu_tlv.Pt())/1000., weight);
1235 (m_MET_Diff_Ref_x[type]).at(3)->Fill((target_tlv.Px() - mu_tlv.Px())/1000., weight);
1236 (m_MET_Diff_Ref_y[type]).at(3)->Fill((target_tlv.Py() - mu_tlv.Py())/1000., weight);
1237 (m_MET_Diff_Ref_phi[type]).at(3)->Fill(mu_tlv.DeltaPhi(target_tlv), weight);
1238 (m_MET_Diff_Ref_sum[type]).at(3)->Fill((it->sumet() - sum_mu)/1000., weight);
1239 }
1240 }
1241 if(it->name() == "RefJet"){
1242 if(is_jet or (it->sumet() > 0)){
1243 target_tlv.SetPxPyPzE(-it->mpx(), -it->mpy(), 0, it->met());
1244 (m_MET_Diff_Ref[type]).at(4)->Fill((target_tlv.Pt() - jet_tlv.Pt())/1000., weight);
1245 (m_MET_Diff_Ref_x[type]).at(4)->Fill((target_tlv.Px() - jet_tlv.Px())/1000., weight);
1246 (m_MET_Diff_Ref_y[type]).at(4)->Fill((target_tlv.Py() - jet_tlv.Py())/1000., weight);
1247 (m_MET_Diff_Ref_phi[type]).at(4)->Fill(jet_tlv.DeltaPhi(target_tlv), weight);
1248 (m_MET_Diff_Ref_sum[type]).at(4)->Fill((it->sumet() - sum_jet)/1000., weight);
1249 }
1250 }
1251 }
1252 }
1253
1254 // For rebuilt MET add only jets with pT>20e3 and JVT cut
1255 TLorentzVector jetReb_tlv;
1256 double sum_jetReb = 0;
1257 for(const auto jet : metJetsOR) {
1258 if(Accept(jet, JvtCut, jvtTool)) {
1259 jetReb_tlv += jet->p4();
1260 sum_jetReb += jet->pt();
1261 }
1262 }
1263
1264 for(const auto it : *met_Reb) {
1265 if(it->name() == "RefEle"){
1266 if(is_electron or (it->sumet() > 0)){
1267 target_tlv.SetPxPyPzE(-it->mpx(), -it->mpy(), 0, it->met());
1268 (m_MET_Diff_Reb[type]).at(0)->Fill((target_tlv.Pt() - el_tlv.Pt())/1000., weight);
1269 (m_MET_Diff_Reb_x[type]).at(0)->Fill((target_tlv.Px() - el_tlv.Px())/1000., weight);
1270 (m_MET_Diff_Reb_y[type]).at(0)->Fill((target_tlv.Py() - el_tlv.Py())/1000., weight);
1271 (m_MET_Diff_Reb_phi[type]).at(0)->Fill(el_tlv.DeltaPhi(target_tlv), weight);
1272 (m_MET_Diff_Reb_sum[type]).at(0)->Fill((it->sumet() - sum_el)/1000., weight);
1273 }
1274 }
1275 if(it->name() == "RefGamma"){
1276 if(is_photon or (it->sumet() > 0)){
1277 target_tlv.SetPxPyPzE(-it->mpx(), -it->mpy(), 0, it->met());
1278 (m_MET_Diff_Reb[type]).at(1)->Fill((target_tlv.Pt() - photon_tlv.Pt())/1000., weight);
1279 (m_MET_Diff_Reb_x[type]).at(1)->Fill((target_tlv.Px() - photon_tlv.Px())/1000., weight);
1280 (m_MET_Diff_Reb_y[type]).at(1)->Fill((target_tlv.Py() - photon_tlv.Py())/1000., weight);
1281 (m_MET_Diff_Reb_phi[type]).at(1)->Fill(photon_tlv.DeltaPhi(target_tlv), weight);
1282 (m_MET_Diff_Reb_sum[type]).at(1)->Fill((it->sumet() - sum_photon)/1000., weight);
1283 }
1284 }
1285 if(it->name() == "RefTau"){
1286 if(is_tau or (it->sumet() > 0)){
1287 target_tlv.SetPxPyPzE(-it->mpx(), -it->mpy(), 0, it->met());
1288 (m_MET_Diff_Reb[type]).at(2)->Fill((target_tlv.Pt() - tau_tlv.Pt())/1000., weight);
1289 (m_MET_Diff_Reb_x[type]).at(2)->Fill((target_tlv.Px() - tau_tlv.Px())/1000., weight);
1290 (m_MET_Diff_Reb_y[type]).at(2)->Fill((target_tlv.Py() - tau_tlv.Py())/1000., weight);
1291 (m_MET_Diff_Reb_phi[type]).at(2)->Fill(tau_tlv.DeltaPhi(target_tlv), weight);
1292 (m_MET_Diff_Reb_sum[type]).at(2)->Fill((it->sumet() - sum_tau)/1000., weight);
1293 }
1294 }
1295 if(it->name() == "Muons"){
1296 if(is_muon or (it->sumet() > 0)){
1297 target_tlv.SetPxPyPzE(-it->mpx(), -it->mpy(), 0, it->met());
1298 (m_MET_Diff_Reb[type]).at(3)->Fill((target_tlv.Pt() - mu_tlv.Pt())/1000., weight);
1299 (m_MET_Diff_Reb_x[type]).at(3)->Fill((target_tlv.Px() - mu_tlv.Px())/1000., weight);
1300 (m_MET_Diff_Reb_y[type]).at(3)->Fill((target_tlv.Py() - mu_tlv.Py())/1000., weight);
1301 (m_MET_Diff_Reb_phi[type]).at(3)->Fill(mu_tlv.DeltaPhi(target_tlv), weight);
1302 (m_MET_Diff_Reb_sum[type]).at(3)->Fill((it->sumet() - sum_mu)/1000., weight);
1303 }
1304 }
1305 if(it->name() == "RefJet"){
1306 if(is_jet or (it->sumet() > 0)){
1307 target_tlv.SetPxPyPzE(-it->mpx(), -it->mpy(), 0, it->met());
1308 (m_MET_Diff_Reb[type]).at(4)->Fill((target_tlv.Pt() - jetReb_tlv.Pt())/1000., weight);
1309 (m_MET_Diff_Reb_x[type]).at(4)->Fill((target_tlv.Px() - jetReb_tlv.Px())/1000., weight);
1310 (m_MET_Diff_Reb_y[type]).at(4)->Fill((target_tlv.Py() - jetReb_tlv.Py())/1000., weight);
1311 (m_MET_Diff_Reb_phi[type]).at(4)->Fill(jetReb_tlv.DeltaPhi(target_tlv), weight);
1312 (m_MET_Diff_Reb_sum[type]).at(4)->Fill((it->sumet() - sum_jetReb)/1000., weight);
1313 }
1314 }
1315 }
1316
1317 if(type == "AntiKt4EMTopo") {
1318 //Calo MET
1319 //const xAOD::JetContainer* emptyjets = 0;
1321 MissingETContainer* met_Calo = new MissingETContainer();
1322 if( evtStore()->record(met_Calo,("MET_Calo"+type).c_str()).isFailure() ) {
1323 ATH_MSG_ERROR("Unable to record MissingETContainer: MET_Calo_" << type);
1324 return StatusCode::FAILURE;
1325 }
1326 MissingETAuxContainer* met_CaloAux = new MissingETAuxContainer();
1327 if( evtStore()->record(met_CaloAux,("MET_Calo"+type+"Aux").c_str()).isFailure() ) {
1328 ATH_MSG_ERROR("Unable to record MissingETAuxContainer: MET_Calo" << type);
1329 return StatusCode::FAILURE;
1330 }
1331 met_Calo->setStore(met_CaloAux);
1332 MissingETAssociationHelper metHelper(metMap);
1333 if( (*m_metmaker)->rebuildJetMET("RefJet", "SoftClus", "PVSoftTrk", met_Calo, metJetsEmpty.asDataVector(), coreMet, metHelper, true).isFailure() ) {
1334 ATH_MSG_ERROR("Failed to build jet and soft terms.");
1335 return StatusCode::FAILURE;
1336 }
1337
1338 if((*met_Calo)["SoftClus"]) clsource = (*met_Calo)["SoftClus"]->source();
1339 if( met::buildMETSum("FinalClus", met_Calo, clsource).isFailure() ) {
1340 ATH_MSG_ERROR("Building MET FinalClus sum failed.");
1341 return StatusCode::FAILURE;
1342 }
1343
1344 m_MET_Calo->Fill((*met_Calo)["FinalClus"]->met()/1000., weight);
1345 m_MET_Calo_x->Fill((*met_Calo)["FinalClus"]->mpx()/1000., weight);
1346 m_MET_Calo_y->Fill((*met_Calo)["FinalClus"]->mpy()/1000., weight);
1347 m_MET_Calo_phi->Fill((*met_Calo)["FinalClus"]->phi(), weight);
1348 m_MET_Calo_sum->Fill((*met_Calo)["FinalClus"]->sumet()/1000., weight);
1349
1350 }
1351
1352 }
1353
1354 //Currently we don't store MET_Track in the derivations
1355 //if MET_Ref not present, then we also dont have MET_Track
1356 if(m_doMETRefPlots){
1357
1358 //Retrieve MET Track
1359 const xAOD::MissingETContainer* met_Track = nullptr;
1360 ATH_CHECK( evtStore()->retrieve(met_Track,"MET_Track") );
1361 if (!met_Track) {
1362 ATH_MSG_ERROR ( "Failed to retrieve MET_Track. Exiting." );
1363 return StatusCode::FAILURE;
1364 }
1365
1366 // Fill MET Track
1367 ATH_MSG_INFO( " MET_Track:" );
1368
1369 m_MET_Track->Fill((*met_Track)["Track"]->met()/1000., weight);
1370 m_MET_Track_x->Fill((*met_Track)["Track"]->mpx()/1000., weight);
1371 m_MET_Track_y->Fill((*met_Track)["Track"]->mpy()/1000., weight);
1372 m_MET_Track_phi->Fill((*met_Track)["Track"]->phi(), weight);
1373 m_MET_Track_sum->Fill((*met_Track)["Track"]->sumet()/1000., weight);
1374
1375 const xAOD::VertexContainer *vxCont = nullptr;
1376 ATH_CHECK( evtStore()->retrieve(vxCont, "PrimaryVertices") );
1377 for(const auto vx : *vxCont) {
1378 int N = vx->index();
1379 const std::string name = "PVTrack_vx"+std::to_string(N);
1380 if(vx->vertexType()!=xAOD::VxType::NoVtx) {
1381 if(vx->vertexType()==xAOD::VxType::PriVtx) {
1382 m_MET_PVTrack_Nominal->Fill((*met_Track)[name]->met()/1000., weight);
1383 m_MET_PVTrack_Nominal_x->Fill((*met_Track)[name]->mpx()/1000., weight);
1384 m_MET_PVTrack_Nominal_y->Fill((*met_Track)[name]->mpy()/1000., weight);
1385 m_MET_PVTrack_Nominal_phi->Fill((*met_Track)[name]->phi(), weight);
1386 m_MET_PVTrack_Nominal_sum->Fill((*met_Track)[name]->sumet()/1000., weight);
1387 } else {
1388 m_MET_PVTrack_Pileup->Fill((*met_Track)[name]->met()/1000., weight);
1389 m_MET_PVTrack_Pileup_x->Fill((*met_Track)[name]->mpx()/1000., weight);
1390 m_MET_PVTrack_Pileup_y->Fill((*met_Track)[name]->mpy()/1000., weight);
1391 m_MET_PVTrack_Pileup_phi->Fill((*met_Track)[name]->phi(), weight);
1392 m_MET_PVTrack_Pileup_sum->Fill((*met_Track)[name]->sumet()/1000., weight);
1393 }
1394 }
1395 }
1396 }
1397
1398 return StatusCode::SUCCESS;
1399 }
1400
1402 {
1403 if (m_detailLevel < 10){ //don't do anything if histograms not booked & filled
1404 return StatusCode::SUCCESS;
1405 }
1406 ATH_MSG_INFO ("Finalising hists " << name() << "...");
1407 for (const auto& type : m_types){
1408 for(std::vector<TH1D*>::size_type i = 0; i < (m_MET_Reb[type]).size(); ++i) {
1409 if (m_doMETRefPlots){
1410 (m_MET_Ref[type]).at(i)->Sumw2();
1411 (m_MET_Ref_x[type]).at(i)->Sumw2();
1412 (m_MET_Ref_y[type]).at(i)->Sumw2();
1413 (m_MET_Ref_phi[type]).at(i)->Sumw2();
1414 (m_MET_Ref_sum[type]).at(i)->Sumw2();
1415 }
1416 (m_MET_Reb[type]).at(i)->Sumw2();
1417 (m_MET_Reb_x[type]).at(i)->Sumw2();
1418 (m_MET_Reb_y[type]).at(i)->Sumw2();
1419 (m_MET_Reb_phi[type]).at(i)->Sumw2();
1420 (m_MET_Reb_sum[type]).at(i)->Sumw2();
1421 }
1422
1423 for(std::vector<TH1D*>::size_type i = 0; i < (m_MET_Diff_Reb[type]).size(); ++i) {
1424 if (m_doMETRefPlots){
1425 (m_MET_Diff_Ref[type]).at(i)->Sumw2();
1426 (m_MET_Diff_Ref_x[type]).at(i)->Sumw2();
1427 (m_MET_Diff_Ref_y[type]).at(i)->Sumw2();
1428 (m_MET_Diff_Ref_phi[type]).at(i)->Sumw2();
1429 (m_MET_Diff_Ref_sum[type]).at(i)->Sumw2();
1430 }
1431 (m_MET_Diff_Reb[type]).at(i)->Sumw2();
1432 (m_MET_Diff_Reb_x[type]).at(i)->Sumw2();
1433 (m_MET_Diff_Reb_y[type]).at(i)->Sumw2();
1434 (m_MET_Diff_Reb_phi[type]).at(i)->Sumw2();
1435 (m_MET_Diff_Reb_sum[type]).at(i)->Sumw2();
1436 }
1437
1438 for(std::vector<TH2D*>::size_type i = 0; i < (m_MET_CorrFinalTrk_Reb[type]).size(); ++i) {
1439 if (m_doMETRefPlots){
1440 (m_MET_CorrFinalTrk_Ref[type]).at(i)->Sumw2();
1441 }
1442 (m_MET_CorrFinalTrk_Reb[type]).at(i)->Sumw2();
1443 }
1444
1445 for(std::vector<TH2D*>::size_type i = 0; i < (m_MET_CorrFinalClus_Reb[type]).size(); ++i) {
1446 if (m_doMETRefPlots){
1447 (m_MET_CorrFinalClus_Ref[type]).at(i)->Sumw2();
1448 }
1449 (m_MET_CorrFinalClus_Reb[type]).at(i)->Sumw2();
1450 }
1451
1452 for(std::vector<TH1D*>::size_type i = 0; i < (m_MET_Significance_Reb[type]).size(); ++i) {
1453 if (m_doMETRefPlots){
1454 (m_MET_Significance_Ref[type]).at(i)->Sumw2();
1455 }
1456 (m_MET_Significance_Reb[type]).at(i)->Sumw2();
1457 }
1458
1459 for(std::vector<TH1D*>::size_type i = 0; i < (m_MET_Resolution_Reb[type]).size(); ++i) {
1460 if (m_doMETRefPlots){
1461 (m_MET_Resolution_Ref[type]).at(i)->Sumw2();
1462 }
1463 (m_MET_Resolution_Reb[type]).at(i)->Sumw2();
1464 }
1465
1466 for(std::vector<TH1D*>::size_type i = 0; i < (m_MET_dPhi_Ref[type]).size(); ++i) {
1467 if (m_doMETRefPlots){
1468 (m_MET_dPhi_Ref[type]).at(i)->Sumw2();
1469 }
1470 (m_MET_dPhi_Reb[type]).at(i)->Sumw2();
1471 }
1472
1473 int nBins = (m_MET_Reb[type]).at(7)->GetNbinsX();
1474 for(int i=1;i<=nBins;i++){
1475 double err;
1476 if (m_doMETRefPlots){
1477 (m_MET_Cumu_Ref[type]).at(0)->SetBinContent(i, (m_MET_Ref[type]).at(8)->IntegralAndError(i,nBins+1,err));
1478 (m_MET_Cumu_Ref[type]).at(0)->SetBinError(i, err);
1479 (m_MET_Cumu_Ref[type]).at(1)->SetBinContent(i, (m_MET_Ref[type]).at(7)->IntegralAndError(i,nBins+1,err));
1480 (m_MET_Cumu_Ref[type]).at(1)->SetBinError(i, err);
1481 }
1482 (m_MET_Cumu_Reb[type]).at(0)->SetBinContent(i, (m_MET_Reb[type]).at(8)->IntegralAndError(i,nBins+1,err));
1483 (m_MET_Cumu_Reb[type]).at(0)->SetBinError(i, err);
1484 (m_MET_Cumu_Reb[type]).at(1)->SetBinContent(i, (m_MET_Reb[type]).at(7)->IntegralAndError(i,nBins+1,err));
1485 (m_MET_Cumu_Reb[type]).at(1)->SetBinError(i, err);
1486 }
1487 for(std::vector<TH1D*>::size_type i = 0; i < (m_MET_Cumu_Ref[type]).size(); ++i) {
1488 if (m_doMETRefPlots){
1489 m_MET_Cumu_Ref[type].at(i)->Scale(1./(m_MET_Cumu_Ref[type]).at(i)->GetBinContent(1));
1490 }
1491 m_MET_Cumu_Reb[type].at(i)->Scale(1./(m_MET_Cumu_Reb[type]).at(i)->GetBinContent(1));
1492 }
1493
1494 }
1495
1496 if (m_doMETRefPlots){
1497 m_MET_Track->Sumw2();
1498 m_MET_Track_x->Sumw2();
1499 m_MET_Track_y->Sumw2();
1500 m_MET_Track_phi->Sumw2();
1501 m_MET_Track_sum->Sumw2();
1502 m_MET_PVTrack_Nominal->Sumw2();
1503 m_MET_PVTrack_Nominal_x->Sumw2();
1504 m_MET_PVTrack_Nominal_y->Sumw2();
1507 m_MET_PVTrack_Pileup->Sumw2();
1508 m_MET_PVTrack_Pileup_x->Sumw2();
1509 m_MET_PVTrack_Pileup_y->Sumw2();
1510 m_MET_PVTrack_Pileup_phi->Sumw2();
1511 m_MET_PVTrack_Pileup_sum->Sumw2();
1512 }
1513
1514 m_MET_Calo->Sumw2();
1515 m_MET_Calo_x->Sumw2();
1516 m_MET_Calo_y->Sumw2();
1517 m_MET_Calo_phi->Sumw2();
1518 m_MET_Calo_sum->Sumw2();
1519
1520 return StatusCode::SUCCESS;
1521 }
1522
1524 // Const methods:
1526
1528 // Non-const methods:
1531 {
1532 if( mu->pt()<2.5e3 || mu->pt()/cosh(mu->eta())<4e3 ) return false;
1533 return static_cast<bool> (m_muonSelTool->accept(*mu));
1534 }
1535
1537 {
1538 if( fabs(el->eta())>2.47 || el->pt()<10e3 ) return false;
1539 return static_cast<bool> (m_elecSelLHTool->accept(el));
1540 }
1541
1543 {
1544 if( !(ph->author()&20) || fabs(ph->eta())>2.47 || ph->pt()<10e3 ) return false;
1545 return static_cast<bool>(m_photonSelIsEMTool->accept(ph));
1546 }
1547
1549 { return static_cast<bool> (m_tauSelTool->accept( *tau )); }
1550
1551 bool PhysValMET::Accept(const xAOD::Jet* jet, double JvtCut, ToolHandle<IJetUpdateJvt>* jvtTool)
1552 {
1553 if( jet->pt()<20e3 || jvtTool == nullptr) return false;
1554 return (fabs(jet->eta()) > 2.4 || jet->pt() > 60e3 || (*jvtTool)->updateJvt(*jet) > JvtCut);
1555 }
1556
1557
1558
1559}
1560
1561// LocalWords: str
#define M_PI
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_INFO(x,...)
Helper class to provide type-safe access to aux data.
static Double_t taus
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
DataVector adapter that acts like it holds const pointers.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
iterator begin() noexcept
Return an iterator pointing at the beginning of the collection.
iterator end() noexcept
Return an iterator pointing past the end of the collection.
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
DataModel_detail::iterator< ConstDataVector > iterator
The iterator for this type.
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:861
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.
virtual StatusCode regHist(TH1 *h, const std::string &system, Interval_t interval, MgmtAttr_t histo_mgmt=ATTRIB_MANAGED, const std::string &chain="", const std::string &merge="")
Registers a TH1 (including TH2, TH3, and TProfile) to be included in the output stream using logical ...
ManagedMonitorToolBase(const std::string &type, const std::string &name, const IInterface *parent)
std::map< std::string, std::vector< TH1D * > > m_MET_Reb
Definition PhysValMET.h:137
std::map< std::string, std::vector< TH1D * > > m_MET_Ref
Definition PhysValMET.h:121
ToolHandle< CP::IMuonSelectionTool > m_muonSelTool
Definition PhysValMET.h:156
std::map< std::string, std::vector< TH1D * > > m_MET_Diff_Ref
Definition PhysValMET.h:126
std::vector< std::string > m_terms
Definition PhysValMET.h:109
std::map< std::string, std::vector< TH1D * > > m_MET_Diff_Reb_y
Definition PhysValMET.h:144
std::map< std::string, std::vector< TH1D * > > m_MET_Diff_Ref_x
Definition PhysValMET.h:127
std::map< std::string, std::vector< TH1D * > > m_MET_Reb_phi
Definition PhysValMET.h:140
ToolHandle< IMETMaker > * m_metmaker
Definition PhysValMET.h:164
std::map< std::string, std::vector< TH1D * > > m_MET_Cumu_Ref
Definition PhysValMET.h:131
std::map< std::string, std::vector< TH1D * > > m_MET_Reb_x
Definition PhysValMET.h:138
std::map< std::string, std::vector< TH1D * > > m_MET_Significance_Reb
Definition PhysValMET.h:149
std::map< std::string, std::vector< TH1D * > > m_MET_Diff_Ref_y
Definition PhysValMET.h:128
ToolHandle< IMETMaker > m_metmakerPFlow
Definition PhysValMET.h:162
std::map< std::string, std::vector< TH1D * > > m_MET_Reb_y
Definition PhysValMET.h:139
virtual StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
std::vector< std::string > m_types
Definition PhysValMET.h:106
virtual ~PhysValMET()
Destructor:
std::map< std::string, std::vector< TH1D * > > m_MET_Resolution_Reb
Definition PhysValMET.h:148
ToolHandle< TauAnalysisTools::ITauSelectionTool > m_tauSelTool
Definition PhysValMET.h:163
std::map< std::string, std::vector< TH1D * > > m_MET_Reb_sum
Definition PhysValMET.h:141
std::map< std::string, std::vector< TH1D * > > m_MET_Diff_Reb_x
Definition PhysValMET.h:143
std::map< std::string, std::vector< TH1D * > > m_MET_Ref_y
Definition PhysValMET.h:123
std::map< std::string, std::string > m_names
Definition PhysValMET.h:112
std::map< std::string, std::vector< TH2D * > > m_MET_CorrFinalClus_Reb
Definition PhysValMET.h:152
std::map< std::string, std::vector< TH1D * > > m_MET_Ref_x
Definition PhysValMET.h:122
std::map< std::string, std::vector< TH1D * > > m_MET_Diff_Reb_phi
Definition PhysValMET.h:145
ToolHandle< IJetUpdateJvt > m_jvtToolEM
Definition PhysValMET.h:159
std::map< std::string, std::vector< TH1D * > > m_MET_Significance_Ref
Definition PhysValMET.h:133
virtual StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
std::vector< std::string > m_dir_met
Definition PhysValMET.h:154
std::map< std::string, std::vector< TH1D * > > m_MET_Diff_Ref_phi
Definition PhysValMET.h:129
std::map< std::string, std::vector< TH2D * > > m_MET_CorrFinalTrk_Reb
Definition PhysValMET.h:151
std::map< std::string, std::vector< TH1D * > > m_MET_Ref_sum
Definition PhysValMET.h:125
ToolHandle< IJetUpdateJvt > m_jvtToolPFlow
Definition PhysValMET.h:160
ToolHandle< IMETMaker > m_metmakerTopo
Definition PhysValMET.h:161
std::map< std::string, std::vector< TH1D * > > m_MET_Cumu_Reb
Definition PhysValMET.h:147
std::map< std::string, std::vector< TH1D * > > m_MET_Diff_Reb_sum
Definition PhysValMET.h:146
virtual StatusCode initialize()
std::map< std::string, std::vector< TH1D * > > m_MET_dPhi_Reb
Definition PhysValMET.h:150
PhysValMET()
Default constructor:
std::map< std::string, std::vector< TH1D * > > m_MET_Resolution_Ref
Definition PhysValMET.h:132
ToolHandle< IAsgElectronLikelihoodTool > m_elecSelLHTool
Definition PhysValMET.h:157
std::map< std::string, std::vector< TH2D * > > m_MET_CorrFinalClus_Ref
Definition PhysValMET.h:136
virtual StatusCode fillHistograms(const EventContext &ctx)
An inheriting class should either override this function or fillHists().
std::map< std::string, std::vector< TH1D * > > m_MET_Ref_phi
Definition PhysValMET.h:124
std::map< std::string, std::vector< TH1D * > > m_MET_Diff_Reb
Definition PhysValMET.h:142
bool Accept(const xAOD::Electron *el)
ToolHandle< IAsgPhotonIsEMSelector > m_photonSelIsEMTool
Definition PhysValMET.h:158
std::map< std::string, std::vector< TH1D * > > m_MET_Diff_Ref_sum
Definition PhysValMET.h:130
std::map< std::string, std::vector< TH2D * > > m_MET_CorrFinalTrk_Ref
Definition PhysValMET.h:135
std::map< std::string, std::vector< TH1D * > > m_MET_dPhi_Ref
Definition PhysValMET.h:134
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition Egamma_v1.cxx:66
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition Egamma_v1.cxx:71
uint16_t author(uint16_t bitmask=EgammaParameters::AuthorALL) const
Get author.
float beamSpotWeight() const
Weight for beam spot size reweighting.
std::vector< std::string > remainder(const std::vector< std::string > &v1, const std::vector< std::string > &v2)
uint64_t bitmask_t
Type for status word bit mask.
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition AuxElement.h:576
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
@ Photon
The object is a photon.
Definition ObjectType.h:47
@ Muon
The object is a muon.
Definition ObjectType.h:48
@ Electron
The object is an electron.
Definition ObjectType.h:46
@ Tau
The object is a tau (jet).
Definition ObjectType.h:49
@ PriVtx
Primary vertex.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Jet_v1 Jet
Definition of the current "jet version".
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
TauJet_v3 TauJet
Definition of the current "tau version".
Definition TauJet.h:17
MissingETContainer_v1 MissingETContainer
Muon_v1 Muon
Reference the current persistent version:
Definition Muon.h:13
Photon_v1 Photon
Definition of the current "egamma version".
Definition Photon.h:17
MissingETAuxContainer_v1 MissingETAuxContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
MissingETAssociationMap_v1 MissingETAssociationMap
Version control by type defintion.
Electron_v1 Electron
Definition of the current "egamma version".
Definition Electron.h:17
@ Track
Indicator for MET contribution from reconstructed charged particle tracks.
@ EMTopo
Indicator for MET contribution from TopoClusters with EM (basic signal) calibration applied.
@ UnknownSignal
Unknown signal contribution.