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