ATLAS Offline Software
METMonTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // **********************************************************************
6 // METMonTool.cxx
7 // AUTHORS: Michele Consonni
8 // 20110202: Jet cleaning added by Isabel Pedraza and Michele Consonni
9 // 20180118: Major cleaning for release 22 (AthenaMT) Tomasz Bold
10 // **********************************************************************
11 
12 
14 
15 #include "GaudiKernel/IInterface.h"
16 #include "GaudiKernel/StatusCode.h"
17 
19 
20 #include "xAODMissingET/MissingET.h"
22 
23 #include "xAODJet/Jet.h"
24 
25 #include "xAODEgamma/Electron.h"
26 #include "xAODMuon/Muon.h"
27 
28 #include "CLHEP/Units/SystemOfUnits.h"
29 
30 #include "TH1D.h"
31 #include "TH2D.h"
32 #include "TH1F.h"
33 #include "TH2F.h"
34 #include "TProfile.h"
35 #include "TProfile2D.h"
36 #include "TAxis.h"
37 
38 #include <cmath>
39 #include <sstream>
40 
41 
42 // *********************************************************************
43 // Public Methods
44 // *********************************************************************
45 static const std::map<std::string, std::pair<std::string, std::string> > key2SubSkeyMap( {
46  { "MET_RefFinal", { "MET_Reference_AntiKt4LCTopo", "FinalClus" } },// add track
47  { "MET_RefEle", { "MET_Reference_AntiKt4LCTopo", "RefEle" } },
48  { "MET_RefGamma", { "MET_Reference_AntiKt4LCTopo", "RefGamma" } } ,
49  { "MET_RefTau", { "MET_Reference_AntiKt4LCTopo", "RefTau" } },
50  { "MET_SoftClus", { "MET_Reference_AntiKt4LCTopo", "SoftClus" } },
51  { "MET_SoftTrk", { "MET_Reference_AntiKt4LCTopo", "FinalTrk" } },
52  { "MET_PVSoftTrk", { "MET_Reference_AntiKt4LCTopo", "PVSoftTrk" } },
53  { "MET_RefJet_JVFCut", { "MET_Reference_AntiKt4LCTopo", "RefJet" } }, // RefJet_JVFCut}
54  { "MET_RefJet", { "MET_Reference_AntiKt4LCTopo", "RefJet" } },
55  { "MET_Muon", { "MET_Reference_AntiKt4LCTopo", "Muons" } },
56  { "MET_PFlow_RefFinal", { "MET_Reference_AntiKt4EMPFlow", "FinalClus" } }, // add track
57  { "MET_PFlow_RefEle", { "MET_Reference_AntiKt4EMPFlow", "RefEle" } },
58  { "MET_PFlow_RefGamma", { "MET_Reference_AntiKt4EMPFlow", "RefGamma" } },
59  { "MET_PFlow_RefTau", { "MET_Reference_AntiKt4EMPFlow", "RefTau" } },
60  { "MET_PFlow_SoftClus", { "MET_Reference_AntiKt4EMPFlow", "SoftClus" } },
61  { "MET_PFlow_SoftTrk", { "MET_Reference_AntiKt4EMPFlow", "FinalTrk" } },
62  { "MET_PFlow_PVSoftTrk", { "MET_Reference_AntiKt4EMPFlow", "PVSoftTrk" } },
63  { "MET_PFlow_RefJet_JVFCut", { "MET_Reference_AntiKt4EMPFlow", "RefJet" } }, // RefJet_JVFCut
64  { "MET_PFlow_RefJet", { "MET_Reference_AntiKt4EMPFlow", "RefJet" } },
65  { "MET_PFlow_Muon", { "MET_Reference_AntiKt4EMPFlow", "Muons" } },
66  { "MET_LocalHadTopo", { "MET_LocHadTopo", "LocHadTopo" } },
67  { "MET_LocHadTopo", { "MET_LocHadTopo", "LocHadTopo" } }, // same as above
68  { "MET_Topo", { "MET_EMTopo", "EMTopo" } },
69  { "MET_Track", { "MET_Track", "Track" } },
70  { "MET_PFlow", { "MET_Reference_AntiKt4EMPFlow", "FinalClus" } }
71  } );
72 
73 
74 METMonTool::METMonTool(const std::string& type, const std::string& name, const IInterface* parent)
76 {}
77 
78 
80 {
81  // If m_metFinKey is not empty then append it to m_metKeys
82  if (m_metFinKey != "")
83  {
85  // Remove m_metFinKey from m_metKeys if it already exists
86  for (; it != m_metKeys.end();)
87  {
88  if ((*it) == m_metFinKey) it = m_metKeys.erase(it);
89  else ++it;
90  }
91  m_metKeys.value().push_back(m_metFinKey);
92  }
93 
94  m_ContainerWarnings_metKeys.resize(m_metKeys.size(), 0);
95 
96  // ...and debug
97 
98  ATH_MSG_DEBUG("Using the following keys:");
99  ATH_MSG_DEBUG("metCalKey = " << m_metCalKey);
100  ATH_MSG_DEBUG("metRegKey = " << m_metRegKey);
101  ATH_MSG_DEBUG("metKeys = ");
103  for (; it != m_metKeys.end(); ++it)
104  {
105  ATH_MSG_DEBUG((*it));
106  }
107  ATH_MSG_DEBUG("");
108 
109  // what are the actual storegate keys?
110  std::unordered_set<std::string> realSGKeys;
111  for (const auto& k : m_metKeys) {
112  const auto itr = key2SubSkeyMap.find(k);
113  if (itr != key2SubSkeyMap.end()) {
114  realSGKeys.insert(itr->second.first);
115  }
116  }
117  for (const auto& k : std::vector<std::string>{ m_metCalKey, m_metRegKey }) {
118  const auto itr = key2SubSkeyMap.find(k);
119  if (itr != key2SubSkeyMap.end()) {
120  realSGKeys.insert(itr->second.first);
121  }
122  }
123  for (const auto& k : realSGKeys) {
124  m_metKeysFull.push_back(k);
125  }
126 
127  ATH_CHECK(m_metKeysFull.initialize());
128  ATH_CHECK(m_metForCut.initialize());
130  ATH_CHECK(m_jetColKey.initialize(!m_jetColKey.empty()));
132  ATH_CHECK(m_muoColKey.initialize(!m_muoColKey.empty()));
133  //resize vector with number of WARNINGs already displayed for retrieval of a certain container
134  m_ContainerWarnings_metKeys.resize(m_metKeys.size(), 0);
135 
136  if (!service("THistSvc", m_thistSvc).isSuccess()) {
137  // m_log << MSG::ERROR << "Unable to locate THistSvc" << endmsg;
138  return StatusCode::FAILURE;
139  }
140 
141  if (m_badJets || m_doJetcleaning) {
142  CHECK(m_selTool.retrieve());
143  } else {
144  // if the tool is not required it shoudl be configured as non-retrievable
145  if ( m_selTool.isEnabled() ){
146  ATH_MSG_ERROR("JetSelTool is configured even if is not required");
147  return StatusCode::FAILURE;
148  }
149  }
151 }
152 
154 {}
155 
156 
157 // *********************************************************************
158 // Book Histograms
159 // *********************************************************************
161 {
162  ATH_MSG_DEBUG("in bookHistograms()");
163 
164 
165  // Check consistency between m_etrangeCalFactors and m_calIndices
166  if (m_etrangeCalFactors.size() < m_calIndices)
167  {
168  ATH_MSG_DEBUG("Vector of Et ranges for calorimeter subsystems is incomplete: filling with 1's");
169  std::vector<float> temp = m_etrangeCalFactors;
170  temp.resize( m_calIndices, 1.);
171  m_etrangeCalFactors = temp;
172  }
173 
174  // Check consistency between m_etrangeRegFactors and m_regIndices
175  if (m_etrangeRegFactors.size() < m_regIndices)
176  {
177  std::vector<float> temp = m_etrangeRegFactors;
178  temp.resize( m_regIndices, 1.);
179  m_etrangeRegFactors = temp;
180  ATH_MSG_DEBUG("Vector of Et ranges for regions is incomplete: filling with 1's");
181  }
182 
183  std::string suffix = "";
184  if (m_suffix != "")
185  {
186  suffix += "_" + m_suffix;
187  }
188 
189  //MonGroup met_sources(this, "MET/Sources" + suffix, run, ATTRIB_MANAGED);
190  MonGroup met_sources(this, "MET/Sources" + suffix, (m_environment == AthenaMonManager::online) ? run : lumiBlock);
191  MonGroup met_calos(this, "MET/Calos" + suffix, (m_environment == AthenaMonManager::online) ? run : lumiBlock);//, run, ATTRIB_MANAGED);
192  MonGroup met_regions(this, "MET/Regions" + suffix, (m_environment == AthenaMonManager::online) ? run : lumiBlock);//, run, ATTRIB_MANAGED);
193  MonGroup met_jets(this, "MET/Jets" + suffix, (m_environment == AthenaMonManager::online) ? run : lumiBlock);//, run, ATTRIB_MANAGED);
194  MonGroup met_electrons(this, "MET/Electrons" + suffix, (m_environment == AthenaMonManager::online) ? run : lumiBlock);//, run, ATTRIB_MANAGED);
195  MonGroup met_muons(this, "MET/Muons" + suffix, (m_environment == AthenaMonManager::online) ? run : lumiBlock);//, run, ATTRIB_MANAGED);
196  MonGroup met_summary(this, "MET/Summary" + suffix, (m_environment == AthenaMonManager::online) ? run : lumiBlock);//, run, ATTRIB_MANAGED);
197 
198  // Book histograms
199 
201  {
202  // book histograms that are only made in the online environment...
203  }
205  {
206  // book histograms that are only relevant for cosmics data...
207  }
208 
209  unsigned int nSources = m_metKeys.size();
210  for (unsigned int i = 0; i < nSources; i++)
211  {
212  if (m_metFinKey != "" && i == nSources - 1)
213  {
214  bookSourcesHistograms(m_metKeys[i], met_summary, true).ignore();
215  if (!m_jetColKey.empty()) bookProfileHistograms(m_metKeys[i], "Jet", met_jets, &m_iJet).ignore();
216  if (!m_eleColKey.empty()) bookProfileHistograms(m_metKeys[i], "Ele", met_electrons, &m_iEle).ignore();
217  if (!m_muoColKey.empty()) bookProfileHistograms(m_metKeys[i], "Muo", met_muons, &m_iMuo).ignore();
218  }
219  else bookSourcesHistograms(m_metKeys[i], met_sources, false).ignore();
220  }
221 
222  if (m_metCalKey != "") bookCalosHistograms(met_calos).ignore();
223  if (m_metRegKey != "") bookRegionsHistograms(met_regions).ignore();
224 
225  bookSummaryHistograms(met_summary).ignore();
226 
227  ATH_MSG_DEBUG("bookHistograms() ended");
228 
229  return StatusCode::SUCCESS;
230 }
231 
232 
234 {
235 
236  ATH_MSG_DEBUG("in clearHistograms()");
237 
238  // Sources
239  m_et.clear();
240  m_ex.clear();
241  m_ey.clear();
242  m_phi.clear();
243  m_sumet.clear();
244 
245  // Profiles
246  m_metVsEta.clear();
247  m_dphiVsEta.clear();
248  m_metVsPhi.clear();
249  m_dphiVsPhi.clear();
250  m_metVsEtaPhi.clear();
251 
252  // Calorimeters
253  m_etCal.clear();
254  m_exCal.clear();
255  m_eyCal.clear();
256  m_phiCal.clear();
257  m_sumetCal.clear();
258 
259  // Regions
260  m_etReg.clear();
261  m_exReg.clear();
262  m_eyReg.clear();
263  m_phiReg.clear();
264  m_sumetReg.clear();
265 
266  return StatusCode::SUCCESS;
267 }
268 
269 
270 StatusCode METMonTool::bookSourcesHistograms(std::string& metName, MonGroup& met_mongroup, bool doProfiles)
271 {
272 
273  ATH_MSG_DEBUG("in bookSourcesHistograms(" << metName.c_str() << ")");
274 
275  // std::ostringstream hName; //forward comment: even if do not manage the move to Generic tool the strigstream can be now fully replaced by c++11 string helper functions
276  std::string hName;
277  std::ostringstream hTitle;
278  std::ostringstream hxTitle;
279  std::ostringstream hyTitle;
280  TH1* h = 0;
281 
282  // ***************************** //
283  // Missing ET Sources Monitoring //
284  // ***************************** //
285 
286  // Set histogram ranges
287  float etmin = 0., etmax = m_etrange;
288  float sumetmin = 0., sumetmax = m_etrange*m_etrangeSumFactor;
289  if (m_doFillNegativeSumEt) sumetmin = -sumetmax;
290 
291  if ((m_suffix.value().find("EF_xe20_noMu") != std::string::npos))
292  {
293  etmax = m_etrange*0.5;
294  sumetmax = m_etrange*0.5*m_etrangeSumFactor;
296  }
297  // Et Distributions
298  hName = "et_" + metName;
299  hTitle << "Et Distribution (" << metName << ")";
300  hxTitle << "MET Et (GeV)";
301  hyTitle << "Events";
302  h = new TH1F( hName.c_str(), hTitle.str().c_str(), m_etbin, etmin, etmax);
303  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
304  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
305  met_mongroup.regHist(h).ignore();
306  m_et.push_back(h);
307 
308  hTitle.str("");
309  hxTitle.str(""); hyTitle.str("");
310  // Ex Distributions
311  hName = "ex_" + metName;
312  hTitle << "Ex Distribution (" << metName << ")";
313  hxTitle << "MET Etx (GeV)";
314  hyTitle << "Events";
315  h = new TH1F( hName.c_str(), hTitle.str().c_str(), m_etbin, -etmax, etmax);
316  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
317  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
318  met_mongroup.regHist(h).ignore();
319  m_ex.push_back(h);
320 
321  hTitle.str("");
322  hxTitle.str(""); hyTitle.str("");
323  // Ey Distributions
324  hName = "ey_" + metName;
325  hTitle << "Ey Distribution (" << metName << ")";
326  hxTitle << "MET Ety (GeV)";
327  hyTitle << "Events";
328  h = new TH1F( hName.c_str(), hTitle.str().c_str(), m_etbin, -etmax, etmax);
329  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
330  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
331  met_mongroup.regHist(h).ignore();
332  m_ey.push_back(h);
333 
334  hTitle.str("");
335  hxTitle.str(""); hyTitle.str("");
336  // Phi Distributions
337  hName = "phi_" + metName;
338  hTitle << "Phi Distribution (" << metName << ")";
339  hxTitle << "MET Phi (radian)";
340  hyTitle << "Events";
341  h = new TH1F(hName.c_str(), hTitle.str().c_str(), m_phibin, -M_PI, +M_PI);
342  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
343  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
344  met_mongroup.regHist(h).ignore();
345  m_phi.push_back(h);
346 
347  hTitle.str("");
348  hxTitle.str(""); hyTitle.str("");
349  // SumEt Distributions
350  hName = "sumet_" + metName;
351  hTitle << "SumEt Distribution (" << metName << ")";
352  hxTitle << "SumEt (GeV)";
353  hyTitle << "Events";
354  if (metName == "MET_Cryo" || metName == "MET_MuonBoy" || metName == "MET_CellOut_em")
355  sumetmax = m_etrange*m_etrangeSumFactor*0.25;
356  h = new TH1F(hName.c_str(), hTitle.str().c_str(), m_etbin, sumetmin, sumetmax);
357  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
358  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
359  met_mongroup.regHist(h).ignore();
360  m_sumet.push_back(h);
361 
362  hTitle.str("");
363  hxTitle.str(""); hyTitle.str("");
364 
365  if (doProfiles)
366  {
367  // MissingET Vs SumEt
368  hName = "metVsSumEt_" + metName;
369  hTitle << "MET Vs SumEt Distribution (" << metName << ")";
370  hxTitle << "SumEt (GeV)";
371  hyTitle << "MET Et (GeV)";
372  m_metVsSumEt = new TProfile(hName.c_str(), hTitle.str().c_str(), m_etbin, sumetmin, sumetmax);
373  m_metVsSumEt->GetXaxis()->SetTitle(hxTitle.str().c_str());
374  m_metVsSumEt->GetYaxis()->SetTitle(hyTitle.str().c_str()); m_metVsSumEt->GetYaxis()->SetTitleOffset(m_tos);
375  met_mongroup.regHist(m_metVsSumEt).ignore();
376 
377  hTitle.str("");
378  hxTitle.str(""); hyTitle.str("");
379 
380  // MissingET Vs Phi
381  hName = "metVsMetPhi_" + metName;
382  hTitle << "MET Vs MetPhi Distribution (" << metName << ")";
383  hxTitle << "MET Phi (radian)";
384  hyTitle << "MET Et (GeV)";
385  m_metVsMetPhi = new TProfile(hName.c_str(), hTitle.str().c_str(), m_phibin, -M_PI, +M_PI);
386  m_metVsMetPhi->GetXaxis()->SetTitle(hxTitle.str().c_str());
387  m_metVsMetPhi->GetYaxis()->SetTitle(hyTitle.str().c_str()); m_metVsMetPhi->GetYaxis()->SetTitleOffset(m_tos);
388  met_mongroup.regHist(m_metVsMetPhi).ignore();
389 
390  hTitle.str("");
391  hxTitle.str(""); hyTitle.str("");
392  }
393 
394  return StatusCode::SUCCESS;
395 }
396 
397 
399 {
400  ATH_MSG_DEBUG("in bookCalosHistograms()");
401 
402  std::ostringstream hName;
403  std::ostringstream hTitle;
404  std::ostringstream hxTitle;
405  std::ostringstream hyTitle;
406  TH1* h = 0;
407 
408  // ********************************** //
409  // Missing ET Calorimeters Monitoring //
410  // ********************************** //
411 
412  for (unsigned int i = 0; i < m_calIndices; i++)
413  {
414  // Set histogram ranges
415  float etmin = 0., etmax = m_etrange*m_etrangeCalFactors[i];
416  float sumetmin = 0., sumetmax = m_etrange*m_etrangeSumFactor*m_etrangeCalFactors[i];
417  if (m_doFillNegativeSumEt) sumetmin = -1.*sumetmax;
418 
419  // Et Distributions
420  hName << "et_" << m_calStrings[i];
421  hTitle << "Et Distribution (" << m_calStrings[i] << ")";
422  hxTitle << "MET Et (GeV)";
423  hyTitle << "Events";
424  h = new TH1F(hName.str().c_str(), hTitle.str().c_str(), m_etbin, etmin, etmax);
425  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
426  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
427  met_calos.regHist(h).ignore();
428  m_etCal.push_back(h);
429  hName.str("");
430  hTitle.str("");
431  hxTitle.str(""); hyTitle.str("");
432  // Ex Distributions
433  hName << "ex_" << m_calStrings[i];
434  hTitle << "Ex Distribution (" << m_calStrings[i] << ")";
435  hxTitle << "MET Etx (GeV)";
436  hyTitle << "Events";
437  h = new TH1F(hName.str().c_str(), hTitle.str().c_str(), m_etbin, -etmax, etmax);
438  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
439  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
440  met_calos.regHist(h).ignore();
441  m_exCal.push_back(h);
442  hName.str("");
443  hTitle.str("");
444  hxTitle.str(""); hyTitle.str("");
445  // Ey Distributions
446  hName << "ey_" << m_calStrings[i];
447  hTitle << "Ey Distribution (" << m_calStrings[i] << ")";
448  hxTitle << "MET Ety (GeV)";
449  hyTitle << "Events";
450  h = new TH1F(hName.str().c_str(), hTitle.str().c_str(), m_etbin, -etmax, etmax);
451  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
452  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
453  met_calos.regHist(h).ignore();
454  m_eyCal.push_back(h);
455  hName.str("");
456  hTitle.str("");
457  hxTitle.str(""); hyTitle.str("");
458  // Phi Distributions
459  hName << "phi_" << m_calStrings[i];
460  hTitle << "Phi Distribution (" << m_calStrings[i] << ")";
461  hxTitle << "MET Phi (radian)";
462  hyTitle << "Events";
463  h = new TH1F(hName.str().c_str(), hTitle.str().c_str(), m_phibin, -M_PI, +M_PI);
464  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
465  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
466  met_calos.regHist(h).ignore();
467  m_phiCal.push_back(h);
468  hName.str("");
469  hTitle.str("");
470  hxTitle.str(""); hyTitle.str("");
471  // SumEt Distributions
472  hName << "sumet_" << m_calStrings[i];
473  hTitle << "SumEt Distribution (" << m_calStrings[i] << ")";
474  hxTitle << "SumEt (GeV)";
475  hyTitle << "Events";
476  h = new TH1F(hName.str().c_str(), hTitle.str().c_str(), m_etbin, sumetmin, sumetmax);
477  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
478  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
479  met_calos.regHist(h).ignore();
480  m_sumetCal.push_back(h);
481  hName.str("");
482  hTitle.str("");
483  hxTitle.str(""); hyTitle.str("");
484  }
485 
486  return StatusCode::SUCCESS;
487 }
488 
489 
491 {
492 
493  ATH_MSG_DEBUG("in bookRegionsHistograms()");
494 
495  std::ostringstream hName;
496  std::ostringstream hTitle;
497  std::ostringstream hxTitle;
498  std::ostringstream hyTitle;
499  TH1* h = 0;
500 
501  // ***************************** //
502  // Missing ET Regions Monitoring //
503  // ***************************** //
504 
505  for (unsigned int i = 0; i < m_regIndices; i++)
506  {
507  // Set histogram ranges
508  float etmin = 0., etmax = m_etrange*m_etrangeRegFactors[i];
509  float sumetmin = 0., sumetmax = m_etrange*m_etrangeSumFactor*m_etrangeRegFactors[i];
510  if (m_doFillNegativeSumEt) sumetmin = -1.*sumetmax;
511 
512  // Ex Distributions
513  hName << "et_" << m_regStrings[i];
514  hTitle << "Et Distribution (" << m_regStrings[i] << ")";
515  hxTitle << "MET Et (GeV)";
516  hyTitle << "Events";
517  h = new TH1F(hName.str().c_str(), hTitle.str().c_str(), m_etbin, etmin, etmax);
518  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
519  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
520  met_regions.regHist(h).ignore();
521  m_etReg.push_back(h);
522  hName.str("");
523  hTitle.str("");
524  hxTitle.str(""); hyTitle.str("");
525  // Ex Distributions
526  hName << "ex_" << m_regStrings[i];
527  hTitle << "Ex Distribution (" << m_regStrings[i] << ")";
528  hxTitle << "MET Etx (GeV)";
529  hyTitle << "Events";
530  h = new TH1F(hName.str().c_str(), hTitle.str().c_str(), m_etbin, -etmax, etmax);
531  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
532  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
533  met_regions.regHist(h).ignore();
534  m_exReg.push_back(h);
535  hName.str("");
536  hTitle.str("");
537  hxTitle.str(""); hyTitle.str("");
538  // Ey Distributions
539  hName << "ey_" << m_regStrings[i];
540  hTitle << "Ey Distribution (" << m_regStrings[i] << ")";
541  hxTitle << "MET Ety (GeV)";
542  hyTitle << "Events";
543  h = new TH1F(hName.str().c_str(), hTitle.str().c_str(), m_etbin, -etmax, etmax);
544  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
545  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
546  met_regions.regHist(h).ignore();
547  m_eyReg.push_back(h);
548  hName.str("");
549  hTitle.str("");
550  hxTitle.str(""); hyTitle.str("");
551  // Phi Distributions
552  hName << "phi_" << m_regStrings[i];
553  hTitle << "Phi Distribution (" << m_regStrings[i] << ")";
554  hxTitle << "MET Phi (radian)";
555  hyTitle << "Events";
556  h = new TH1F(hName.str().c_str(), hTitle.str().c_str(), m_phibin, -M_PI, +M_PI);
557  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
558  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
559  met_regions.regHist(h).ignore();
560  m_phiReg.push_back(h);
561  hName.str("");
562  hTitle.str("");
563  hxTitle.str(""); hyTitle.str("");
564  // SumEt Distributions
565  hName << "sumet_" << m_regStrings[i];
566  hTitle << "SumEt Distribution (" << m_regStrings[i] << ")";
567  hxTitle << "SumEt (GeV)";
568  hyTitle << "Events";
569  h = new TH1F(hName.str().c_str(), hTitle.str().c_str(), m_etbin, sumetmin, sumetmax);
570  h->GetXaxis()->SetTitle(hxTitle.str().c_str());
571  h->GetYaxis()->SetTitle(hyTitle.str().c_str()); h->GetYaxis()->SetTitleOffset(m_tos);
572  met_regions.regHist(h).ignore();
573  m_sumetReg.push_back(h);
574  hName.str("");
575  hTitle.str("");
576  hxTitle.str(""); hyTitle.str("");
577  }
578 
579  return StatusCode::SUCCESS;
580 }
581 
582 
584 {
585 
586  ATH_MSG_DEBUG("in bookSummaryHistograms()");
587 
588  std::ostringstream exTitle;
589  std::ostringstream eyTitle;
590  std::ostringstream phiTitle;
591 
592  exTitle << "MET <etx> (GeV)";
593  eyTitle << "MET <ety> (GeV)";
594  phiTitle << "MET <phi> (radian)";
595 
596  // ************************************ //
597  // Missing Ex, Ey, Phi Means Monitoring //
598  // ************************************ //
599 
600  unsigned int nSources = m_metKeys.size();
601  unsigned int nCalos = m_calIndices;
602  unsigned int nRegions = m_regIndices;
603 
604  if (nSources > 1)
605  {
606  m_exMean = new TProfile("exMean", "Means of the Ex Sources", nSources, 0., nSources);
607  m_eyMean = new TProfile("eyMean", "Means of the Ey Sources", nSources, 0., nSources);
608  m_phiMean = new TProfile("phiMean", "Means of the Phi Sources", nSources, 0., nSources);
609  m_exMean->GetYaxis()->SetTitle(exTitle.str().c_str()); m_exMean->GetYaxis()->SetTitleOffset(m_tos);
610  m_eyMean->GetYaxis()->SetTitle(eyTitle.str().c_str()); m_eyMean->GetYaxis()->SetTitleOffset(m_tos);
611  m_phiMean->GetYaxis()->SetTitle(phiTitle.str().c_str()); m_phiMean->GetYaxis()->SetTitleOffset(m_tos);
612  for (unsigned int i = 0; i < nSources; i++)
613  {
614  m_exMean->GetXaxis()->SetBinLabel(i + 1, m_metKeys[i].c_str());
615  m_eyMean->GetXaxis()->SetBinLabel(i + 1, m_metKeys[i].c_str());
616  m_phiMean->GetXaxis()->SetBinLabel(i + 1, m_metKeys[i].c_str());
617  }
618  met_summary.regHist(m_exMean).ignore();
619  met_summary.regHist(m_eyMean).ignore();
620  met_summary.regHist(m_phiMean).ignore();
621  }
622 
623  if (m_metCalKey != "" && nCalos > 1)
624  {
625  m_exCalMean = new TProfile("exCalMean", "Means of the Ex Calorimeters", nCalos, 0., nCalos);
626  m_eyCalMean = new TProfile("eyCalMean", "Means of the Ey Calorimeters", nCalos, 0., nCalos);
627  m_phiCalMean = new TProfile("phiCalMean", "Means of the Phi Calorimeters", nCalos, 0., nCalos);
628  m_exCalMean->GetYaxis()->SetTitle(exTitle.str().c_str()); m_exCalMean->GetYaxis()->SetTitleOffset(m_tos);
629  m_eyCalMean->GetYaxis()->SetTitle(eyTitle.str().c_str()); m_eyCalMean->GetYaxis()->SetTitleOffset(m_tos);
630  m_phiCalMean->GetYaxis()->SetTitle(phiTitle.str().c_str()); m_phiCalMean->GetYaxis()->SetTitleOffset(m_tos);
631  for (unsigned int i = 0; i < nCalos; i++)
632  {
633  m_exCalMean->GetXaxis()->SetBinLabel(i + 1, m_calStrings[i].c_str());
634  m_eyCalMean->GetXaxis()->SetBinLabel(i + 1, m_calStrings[i].c_str());
635  m_phiCalMean->GetXaxis()->SetBinLabel(i + 1, m_calStrings[i].c_str());
636  }
637  met_summary.regHist(m_exCalMean).ignore();
638  met_summary.regHist(m_eyCalMean).ignore();
639  met_summary.regHist(m_phiCalMean).ignore();
640  }
641 
642  if (m_metRegKey != "" && nRegions > 1)
643  {
644  m_exRegMean = new TProfile("exRegMean", "Means of the Ex Regions", nRegions, 0., nRegions);
645  m_eyRegMean = new TProfile("eyRegMean", "Means of the Ey Regions", nRegions, 0., nRegions);
646  m_phiRegMean = new TProfile("phiRegMean", "Means of the Phi Regions", nRegions, 0., nRegions);
647  m_exRegMean->GetYaxis()->SetTitle(exTitle.str().c_str()); m_exRegMean->GetYaxis()->SetTitleOffset(m_tos);
648  m_eyRegMean->GetYaxis()->SetTitle(eyTitle.str().c_str()); m_eyRegMean->GetYaxis()->SetTitleOffset(m_tos);
649  m_phiRegMean->GetYaxis()->SetTitle(phiTitle.str().c_str()); m_phiRegMean->GetYaxis()->SetTitleOffset(m_tos);
650  for (unsigned int i = 0; i < nRegions; i++)
651  {
652  m_exRegMean->GetXaxis()->SetBinLabel(i + 1, m_regStrings[i].c_str());
653  m_eyRegMean->GetXaxis()->SetBinLabel(i + 1, m_regStrings[i].c_str());
654  m_phiRegMean->GetXaxis()->SetBinLabel(i + 1, m_regStrings[i].c_str());
655  }
656  met_summary.regHist(m_exRegMean).ignore();
657  met_summary.regHist(m_eyRegMean).ignore();
658  met_summary.regHist(m_phiRegMean).ignore();
659  }
660 
661  return StatusCode::SUCCESS;
662 }
663 
664 
665 StatusCode METMonTool::bookProfileHistograms(std::string& metName, const char* objName, MonGroup& met_mongroup, int* index)
666 {
667  ATH_MSG_DEBUG("in bookProfileHistograms(" << metName.c_str() << ", " << objName << ")");
668 
669  // ************************************ //
670  // Missing Et Correlations to Particles //
671  // ************************************ //
672 
673  std::ostringstream hName;
674  std::ostringstream hTitle;
675  std::ostringstream hxTitle;
676  std::ostringstream hyTitle;
677  TProfile* hp = 0;
678  TProfile2D* hp2 = 0;
679 
680  // MissingET Vs Eta
681  hName << "metVs" << objName << "Eta_" << metName;
682  hTitle << "MET Vs " << objName << " Eta Distribution (" << metName << ")";
683  hxTitle << objName << " Eta";
684  hyTitle << "MET Et (GeV)";
685  hp = new TProfile(hName.str().c_str(), hTitle.str().c_str(), m_etabin, -5., +5.);
686  hp->GetXaxis()->SetTitle(hxTitle.str().c_str());
687  hp->GetYaxis()->SetTitle(hyTitle.str().c_str()); hp->GetYaxis()->SetTitleOffset(m_tos);
688  met_mongroup.regHist(hp).ignore();
689  m_metVsEta.push_back(hp);
690  hName.str("");
691  hTitle.str("");
692  hxTitle.str(""); hyTitle.str("");
693  // DeltaPhi Vs Eta
694  hName << "dphiVs" << objName << "Eta_" << metName;
695  hTitle << "DeltaPhi Vs " << objName << " Eta Distribution (" << metName << ")";
696  hxTitle << objName << " Eta";
697  hyTitle << "deltaPhi (MET, " << objName << ")";
698  hp = new TProfile(hName.str().c_str(), hTitle.str().c_str(), m_etabin, -5., +5.);
699  hp->GetXaxis()->SetTitle(hxTitle.str().c_str());
700  hp->GetYaxis()->SetTitle(hyTitle.str().c_str()); hp->GetYaxis()->SetTitleOffset(m_tos);
701  met_mongroup.regHist(hp).ignore();
702  m_dphiVsEta.push_back(hp);
703  hName.str("");
704  hTitle.str("");
705  hxTitle.str(""); hyTitle.str("");
706  // MissingET Vs Phi
707  hName << "metVs" << objName << "Phi_" << metName;
708  hTitle << "MET Vs " << objName << " Phi Distribution (" << metName << ")";
709  hxTitle << objName << " Phi (radian)";
710  hyTitle << "MET Et (GeV)";
711  hp = new TProfile(hName.str().c_str(), hTitle.str().c_str(), m_phibin, -M_PI, +M_PI);
712  hp->GetXaxis()->SetTitle(hxTitle.str().c_str());
713  hp->GetYaxis()->SetTitle(hyTitle.str().c_str()); hp->GetYaxis()->SetTitleOffset(m_tos);
714  met_mongroup.regHist(hp).ignore();
715  m_metVsPhi.push_back(hp);
716  hName.str("");
717  hTitle.str("");
718  hxTitle.str(""); hyTitle.str("");
719  /*
720  // MissingET Parallel Vs Phi
721  hName << "metParaVs" << objName << "Phi_" << metName.c_str();
722  hTitle << "MET Parallel Vs " << objName << " Phi Distribution (" << metName.c_str() << ")";
723  hxTitle << objName << " Phi (radian)";
724  hyTitle << "MET Parallel (GeV)";
725  hp = new TProfile( hName.str().c_str(), hTitle.str().c_str(), m_phibin, -m_Pi, +m_Pi );
726  hp->GetXaxis()->SetTitle(hxTitle.str().c_str());
727  hp->GetYaxis()->SetTitle(hyTitle.str().c_str()); hp->GetYaxis()->SetTitleOffset(m_tos);
728  met_mongroup.regHist( hp ).ignore();
729  m_metParaVsPhi.push_back( hp );
730  hName.str("");
731  hTitle.str("");
732  hxTitle.str(""); hyTitle.str("");
733  // MissingET Perpendicular Vs Phi
734  hName << "metPerpVs" << objName << "Phi_" << metName.c_str();
735  hTitle << "MET Perpendicular Vs " << objName << " Phi Distribution (" << metName.c_str() << ")";
736  hxTitle << objName << " Phi (radian)";
737  hyTitle << "MET Perpendicular (GeV)";
738  hp = new TProfile( hName.str().c_str(), hTitle.str().c_str(), m_phibin, -m_Pi, +m_Pi );
739  hp->GetXaxis()->SetTitle(hxTitle.str().c_str());
740  hp->GetYaxis()->SetTitle(hyTitle.str().c_str()); hp->GetYaxis()->SetTitleOffset(m_tos);
741  met_mongroup.regHist( hp ).ignore();
742  m_metPerpVsPhi.push_back( hp );
743  hName.str("");
744  hTitle.str("");
745  hxTitle.str(""); hyTitle.str("");
746  */
747  //DeltaPhi Vs Phi
748  hName << "dphiVs" << objName << "Phi_" << metName;
749  hTitle << "DeltaPhi Vs " << objName << " Phi Distribution (" << metName << ")";
750  hxTitle << objName << " Phi (radian)";
751  hyTitle << "deltaPhi (MET, " << objName << ")";
752  hp = new TProfile(hName.str().c_str(), hTitle.str().c_str(), m_phibin, -M_PI, +M_PI);
753  hp->GetXaxis()->SetTitle(hxTitle.str().c_str());
754  hp->GetYaxis()->SetTitle(hyTitle.str().c_str()); hp->GetYaxis()->SetTitleOffset(m_tos);
755  met_mongroup.regHist(hp).ignore();
756  m_dphiVsPhi.push_back(hp);
757  hName.str("");
758  hTitle.str("");
759  hxTitle.str(""); hyTitle.str("");
760  // MissingET Vs Eta Phi
761  hName << "metVs" << objName << "EtaPhi_" << metName;
762  hTitle << "MET Vs " << objName << " EtaPhi Distribution (" << metName << ")";
763  hxTitle << objName << " Eta";
764  hyTitle << objName << " Phi (radian)";
765  hp2 = new TProfile2D(hName.str().c_str(), hTitle.str().c_str(), m_etabin, -5., +5., m_phibin, -M_PI, +M_PI);
766  hp2->GetXaxis()->SetTitle(hxTitle.str().c_str());
767  hp2->GetYaxis()->SetTitle(hyTitle.str().c_str()); hp2->GetYaxis()->SetTitleOffset(m_tos);
768  met_mongroup.regHist(hp2).ignore();
769  m_metVsEtaPhi.push_back(hp2);
770  hName.str("");
771  hTitle.str("");
772  hxTitle.str(""); hyTitle.str("");
773 
774  (*index) = m_metVsEtaPhi.size() - 1;
775 
776  return StatusCode::SUCCESS;
777 }
778 
779 
780 // *********************************************************************
781 // Fill Histograms
782 // *********************************************************************
783 
785 {
786  ATH_MSG_DEBUG("in fillHistograms()");
787 
789  if (!thisEventInfo.isValid())
790  ATH_MSG_DEBUG("No EventInfo object found! Can't access LAr event info status!");
791  else
792  {
793  if (thisEventInfo->errorState(xAOD::EventInfo::LAr) == xAOD::EventInfo::Error)
794  {
795  return StatusCode::SUCCESS;
796  }
797  }
798 
799 
800  fillSourcesHistograms().ignore();
801  if (m_metCalKey != "") fillCalosHistograms().ignore();
802  if (m_metRegKey != "") fillRegionsHistograms().ignore();
803 
804  ATH_MSG_DEBUG("fillHistograms() ended");
805  return StatusCode::SUCCESS;
806 }
807 
808 
810 {
811 
812  // MET > 80 cut
813  ATH_MSG_DEBUG("in fillSourcesHistograms()");
814 
815  const xAOD::JetContainer* xJetCollection = 0;
816  if (!m_jetColKey.empty())
817  {
819  xJetCollection = xhJetCollection.get();
820  if (!xJetCollection)
821  {
822  ATH_MSG_WARNING("Unable to retrieve JetContainer: " << m_jetColKey.key());
823  }
824  else
825  {
826  // Get Hardest Jet
827  // Assume sorted collection
828  if (!(xJetCollection->size() > 0) && m_badJets)
829  {
830  return StatusCode::SUCCESS;
831  }
832 
833  if (xJetCollection->size() > 0)
834  {
835 
836  if (m_badJets)
837  {
838  int counterbadjets = 0;
839  xAOD::JetContainer::const_iterator jetItr = xJetCollection->begin();
840  xAOD::JetContainer::const_iterator jetItrE = xJetCollection->end();
841 
842  for (; jetItr != jetItrE; ++jetItr)
843  {
844 
845  const xAOD::Jet* xjet = *jetItr;
846  if( m_selTool->keep(*xjet) ) continue; //jetsel tool
847  counterbadjets++;
848 
849  }
850  if (counterbadjets == 0)
851  {
852  return StatusCode::SUCCESS;
853  }
854  }
855  }
856  else
857  {
858  ATH_MSG_DEBUG("Empty jet collection");
859  }
860  }
861  }
862 
863  const xAOD::ElectronContainer* xElectrons = 0;
864  const xAOD::Electron* xhEle = 0;
865 
866  if (!m_eleColKey.empty())
867  {
869  xElectrons = rhElectrons.get();
870  if (!xElectrons)
871  {
872  ATH_MSG_WARNING("Unable to retrieve ElectronContainer: " << m_eleColKey.key());
873  }
874  else
875  {
876  // Get Hardest Electron
877  // Assume sorted collection
878  if (xElectrons->size() > 0)
879  {
880  auto eleItr = xElectrons->begin();
881  xhEle = *eleItr;
882  }
883  else ATH_MSG_DEBUG("Empty electron collection");
884  }
885  }
886 
887  const xAOD::MuonContainer* xMuons = 0;
888  const xAOD::Muon* xhMuon = 0;
889 
890  if (!m_muoColKey.empty())
891  {
893  xMuons = rhMuons.get();
894  if (!xMuons)
895  {
896  ATH_MSG_WARNING("Unable to retrieve muon collection: " << m_muoColKey.key());
898  }
899  else
900  {
901  // Get Hardest Electron
902  // Assume sorted collection
903  if (xMuons->size() > 0)
904  {
905  auto muonItr = xMuons->begin();
906  xhMuon = *muonItr;
907  }
908  else ATH_MSG_DEBUG("Empty muon collection");
909  }
910  }
911 
912  // *************************** //
913  // Retrieve Missing Et Sources //
914  // *************************** //
915 
916  bool doSummary = (m_metKeys.size() > 1);
917 
918  if (m_met_cut_80) {
920  if (xMissEt_forCut.isValid()) {
921  float et_RefFinal = (*xMissEt_forCut)["FinalClus"]->met() / CLHEP::GeV;
922  if (et_RefFinal < m_met_cut) return StatusCode::SUCCESS;
923  }
924  }
925 
926  if (m_doJetcleaning && !m_badJets)
927  {
928  if (xJetCollection->size() > 0){
929  xAOD::JetContainer::const_iterator jetItrE = xJetCollection->end();
930 
931  xAOD::JetContainer::const_iterator jetItr = xJetCollection->begin();
932  for (; jetItr != jetItrE; ++jetItr)
933  {
934 
935  const xAOD::Jet* xjet = *jetItr;
936  bool isgoodjet = m_selTool->keep(*xjet);
937  if(! isgoodjet ) return StatusCode::SUCCESS;
938  }
939  }
940  }
941 
942 
943  for (unsigned int i = 0; i < m_metKeys.size(); i++)
944  {
945 
946  auto foundIterator = key2SubSkeyMap.find( m_metKeys[i] );
947  if ( foundIterator == key2SubSkeyMap.end() ) continue;
948  std::string xaod_key = foundIterator->second.first;
949  std::string xaod_subkey = foundIterator->second.second;
950 
951  const xAOD::MissingETContainer* xMissEt = 0;
952 
953  SG::ReadHandle<xAOD::MissingETContainer> xhMissEt{xaod_key};
954 
955  if (xhMissEt.isValid()) {
956  xMissEt = xhMissEt.get();
957 
958 
959  if (!xMissEt)
960  {
961  ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << xaod_key);
962  }
963  else
964  {
965  ATH_MSG_DEBUG("Filling histograms for term " << m_metKeys[i]);
966 
967  if ((*xMissEt)[xaod_subkey]) {
968  float ex = (*xMissEt)[xaod_subkey]->mpx() / CLHEP::GeV;
969  float ey = (*xMissEt)[xaod_subkey]->mpy() / CLHEP::GeV;
970  float et = (*xMissEt)[xaod_subkey]->met() / CLHEP::GeV;
971  float phi = (*xMissEt)[xaod_subkey]->phi();
972  float sumet = (*xMissEt)[xaod_subkey]->sumet() / CLHEP::GeV;
973 
974 
975 
976 
977 
978  if (et > 0.)
979  {
980  m_et[i]->Fill(et);
981  m_ex[i]->Fill(ex);
982  m_ey[i]->Fill(ey);
983  m_phi[i]->Fill(phi);
984  m_sumet[i]->Fill(sumet);
985 
986  if (m_metFinKey != "" && i == m_metKeys.size() - 1)
987  {
988  // met Vs SumEt
989  m_metVsSumEt->Fill(sumet, et);
991  // Profile Histograms
992 
993 
994  if (TMath::Abs(et) < m_truncatedMean) {
995  if (xJetCollection != 0) {
996  for ( const xAOD::Jet* xjet : *xJetCollection ) {
997  if ( xjet ) {
998  const xAOD::JetFourMom_t& jetP4 = xjet->jetP4();
999  fillProfileHistograms(et, phi, jetP4.eta(), jetP4.phi(), m_iJet).ignore();
1000  }
1001  }
1002  }
1003 
1004  if (xhEle != 0) fillProfileHistograms(et, phi, xhEle->eta(), xhEle->phi(), m_iEle).ignore();
1005  if (xhMuon != 0) fillProfileHistograms(et, phi, xhMuon->eta(), xhMuon->phi(), m_iMuo).ignore();
1006  }
1007  }
1008  // Mean summaries
1009  if (doSummary)
1010  {
1011  m_exMean->Fill(i + 0.5, ex);
1012  m_eyMean->Fill(i + 0.5, ey);
1013  m_phiMean->Fill(i + 0.5, phi);
1014  }
1015  }
1016  }// xaod_subket
1017  }
1018 
1019  }
1020 
1021  else
1022  {
1023  ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << xaod_key);
1024  }
1025  }
1026 
1027  return StatusCode::SUCCESS;
1028 }
1029 
1030 
1032 {
1033 
1034  ATH_MSG_DEBUG("in fillCalosHistograms()");
1035 
1036  // ******************************** //
1037  // Retrieve Missing Et Calorimeters //
1038  // ******************************** //
1039 
1040  bool doSummary = (m_calIndices > 1);
1041 
1042  const xAOD::MissingETContainer* xmetCal = 0;
1044  if (! xhmetCal.isValid()) {
1045  ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << m_metCalKey);
1046  return StatusCode::SUCCESS;
1047  }
1048 
1049  xmetCal = xhmetCal.get();
1050 
1051 
1052  if (m_met_cut_80) {
1054  if (xMissEt_forCut.isValid()) {
1055  float et_RefFinal = (*xMissEt_forCut)["FinalClus"]->met() / CLHEP::GeV;
1056  if (et_RefFinal < m_met_cut) return StatusCode::SUCCESS;
1057  }
1058  }
1059 
1060 
1061  if (m_doJetcleaning && !m_badJets) {
1062  const xAOD::JetContainer* xJetCollection = 0;
1064  xJetCollection = xhJetCollection.get();
1065  if ( xJetCollection == 0 ) {
1066  ATH_MSG_WARNING("Unable to retrieve JetContainer: " << m_jetColKey.key());
1067  //return StatusCode::FAILURE;
1068  } else {
1069 
1070  for ( const xAOD::Jet* xjet: *xJetCollection ) {
1071  if( m_selTool->keep(*xjet) == false ) return StatusCode::SUCCESS;
1072  }
1073  }
1074  }
1075 
1076  for (unsigned int i = 0; i < m_calIndices; i++) {
1077 
1078  float ex = (*xmetCal)[m_calStrings[i]]->mpx() / CLHEP::GeV;
1079  float ey = (*xmetCal)[m_calStrings[i]]->mpy() / CLHEP::GeV;
1080  float et = sqrt(ex*ex + ey*ey);// (*xmetCal)["LocHadTopo"]->met() / CLHEP::GeV;
1081  float phi = atan2(ey, ex);// (*xmetCal)["LocHadTopo"]->phi() / CLHEP::GeV;
1082  float sumet = (*xmetCal)[m_calStrings[i]]->sumet() / CLHEP::GeV;
1083 
1084 
1085  if (et > 0.)
1086  {
1087  m_etCal[i]->Fill(et);
1088  m_exCal[i]->Fill(ex);
1089  m_eyCal[i]->Fill(ey);
1090  m_phiCal[i]->Fill(phi);
1091  m_sumetCal[i]->Fill(sumet);
1092  // Mean summaries
1093  if (doSummary)
1094  {
1095  m_exCalMean->Fill(i + 0.5, ex);
1096  m_eyCalMean->Fill(i + 0.5, ey);
1097  m_phiCalMean->Fill(i + 0.5, phi);
1098  }
1099  }
1100  }
1101 
1102  return StatusCode::SUCCESS;
1103 }
1104 
1106 {
1107 
1108  ATH_MSG_DEBUG("in fillRegionsHistograms()");
1109 
1110  // *************************** //
1111  // Retrieve Missing Et Regions //
1112  // *************************** //
1113 
1114  bool doSummary = (m_regIndices > 1);
1115 
1117  if (xmetReg.isValid()) {
1118  //s// ATH_MSG_DEBUG("Filling histograms per calorimeter region with key " << m_metRegKey);
1119  //s// metReg = missET->getRegions();
1120  for (unsigned int i = 0; i < m_regIndices; i++) {
1121  std::string xaod_truth_region = "";
1122  if (i == 0) xaod_truth_region = "Int_Central";
1123  else if (i == 1) xaod_truth_region = "Int_EndCap";
1124  else if (i == 2) xaod_truth_region = "Int_Forward";
1125  else xaod_truth_region = "Int_Central";
1126 
1127  float ex = (*xmetReg)[xaod_truth_region]->mpx() / CLHEP::GeV;
1128  float ey = (*xmetReg)[xaod_truth_region]->mpy() / CLHEP::GeV;
1129  float et = sqrt(ex*ex + ey*ey);
1130  float phi = atan2(ey, ex);
1131  float sumet = (*xmetReg)[xaod_truth_region]->sumet() / CLHEP::GeV;
1132 
1133  if (et > 0.) {
1134  m_etReg[i]->Fill(et);
1135  m_exReg[i]->Fill(ex);
1136  m_eyReg[i]->Fill(ey);
1137  m_phiReg[i]->Fill(phi);
1138  m_sumetReg[i]->Fill(sumet);
1139  // Mean summaries
1140  if (doSummary) {
1141  m_exRegMean->Fill(i + 0.5, ex);
1142  m_eyRegMean->Fill(i + 0.5, ey);
1143  m_phiRegMean->Fill(i + 0.5, phi);
1144  }
1145  }
1146  }
1147  } else {
1148  ATH_MSG_DEBUG("Unable to retrieve MissingETContainer: " << m_metRegKey);
1149  }
1150 
1151  return StatusCode::SUCCESS;
1152 }
1153 
1154 
1155 StatusCode METMonTool::fillProfileHistograms(float et, float phi, float objEta, float objPhi, int i)
1156 {
1157 
1158  ATH_MSG_DEBUG("in fillProfileHistograms()");
1159 
1160  float dphi = phi - objPhi;
1161  if (dphi > +M_PI) dphi = dphi - 2.*M_PI;
1162  if (dphi < -M_PI) dphi = dphi + 2.*M_PI;
1163  dphi = fabs(dphi);
1164  m_metVsEta[i]->Fill(objEta, et);
1165  //m_metParaVsEta[i]->Fill( objEta, et*cos(dphi) );
1166  //m_metPerpVsEta[i]->Fill( objEta, et*sin(dphi) );
1167  m_dphiVsEta[i]->Fill(objEta, dphi);
1168  m_metVsPhi[i]->Fill(objPhi, et);
1169  //m_metParaVsPhi[i]->Fill( objPhi, et*cos(dphi) );
1170  //m_metPerpVsPhi[i]->Fill( objPhi, et*sin(dphi) );
1171  m_dphiVsPhi[i]->Fill(objPhi, dphi);
1172  m_metVsEtaPhi[i]->Fill(objEta, objPhi, et);
1173  return StatusCode::SUCCESS;
1174 }
1175 
1176 
1177 // *********************************************************************
1178 // Process Histograms
1179 // *********************************************************************
1180 
1181 
1183 {
1184  ATH_MSG_DEBUG("in procHistograms()");
1185 
1186  ATH_MSG_DEBUG("procHistograms() ended");
1187  return StatusCode::SUCCESS;
1188 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
METMonTool::m_regStrings
std::vector< std::string > m_regStrings
Definition: METMonTool.h:97
METMonTool::bookProfileHistograms
StatusCode bookProfileHistograms(std::string &metName, const char *objName, MonGroup &met_mongroup, int *index)
Definition: METMonTool.cxx:665
METMonTool::fillCalosHistograms
StatusCode fillCalosHistograms()
Definition: METMonTool.cxx:1031
METMonTool::m_phiMean
TProfile * m_phiMean
Definition: METMonTool.h:150
METMonTool::m_phiCalMean
TProfile * m_phiCalMean
Definition: METMonTool.h:154
METMonTool::m_iJet
int m_iJet
Definition: METMonTool.h:160
Jet.h
et
Extra patterns decribing particle interation process.
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
METMonTool::m_eyCal
std::vector< TH1 * > m_eyCal
Definition: METMonTool.h:138
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
METMonTool::m_iMuo
int m_iMuo
Definition: METMonTool.h:160
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
METMonTool::m_etCal
std::vector< TH1 * > m_etCal
Definition: METMonTool.h:136
METMonTool::m_truncatedMean
float m_truncatedMean
Definition: METMonTool.h:116
METMonTool::m_exMean
TProfile * m_exMean
Definition: METMonTool.h:148
METMonTool::m_metCalKey
StringProperty m_metCalKey
Definition: METMonTool.h:84
METMonTool::m_metVsSumEt
TProfile * m_metVsSumEt
Definition: METMonTool.h:123
ManagedMonitorToolBase::lumiBlock
@ lumiBlock
Definition: ManagedMonitorToolBase.h:114
ManagedMonitorToolBase
Provides functionality for users to implement and save histograms, ntuples, and summary data,...
Definition: ManagedMonitorToolBase.h:74
Muon.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
index
Definition: index.py:1
METMonTool::m_ContainerWarnings_Muon
int m_ContainerWarnings_Muon
Definition: METMonTool.h:170
METMonTool::m_phiReg
std::vector< TH1 * > m_phiReg
Definition: METMonTool.h:145
METMonTool::clearHistograms
StatusCode clearHistograms()
Definition: METMonTool.cxx:233
METMonTool::m_metFinKey
StringProperty m_metFinKey
Definition: METMonTool.h:83
xAOD::Muon_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
METMonTool::m_phibin
Gaudi::Property< int > m_phibin
Definition: METMonTool.h:102
AthenaMonManager::cosmics
@ cosmics
Definition: AthenaMonManager.h:58
METMonTool::m_eyMean
TProfile * m_eyMean
Definition: METMonTool.h:149
xAOD::Muon_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
skel.it
it
Definition: skel.GENtoEVGEN.py:423
TProfile2D
Definition: rootspy.cxx:531
METMonTool::m_eyReg
std::vector< TH1 * > m_eyReg
Definition: METMonTool.h:144
M_PI
#define M_PI
Definition: ActiveFraction.h:11
METMonTool::m_etrangeCalFactors
Gaudi::Property< std::vector< float > > m_etrangeCalFactors
Definition: METMonTool.h:108
DataVector::get
const T * get(size_type n) const
Access an element, as an rvalue.
METMonTool::m_regIndices
const size_t m_regIndices
Definition: METMonTool.h:94
ManagedMonitorToolBase::m_dataType
AthenaMonManager::DataType_t m_dataType
Definition: ManagedMonitorToolBase.h:901
METMonTool::m_suffix
StringProperty m_suffix
Definition: METMonTool.h:77
METMonTool::fillHistograms
StatusCode fillHistograms()
An inheriting class should either override this function or fillHists().
Definition: METMonTool.cxx:784
METMonTool::m_metVsPhi
std::vector< TProfile * > m_metVsPhi
Definition: METMonTool.h:130
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
METMonTool::m_eyRegMean
TProfile * m_eyRegMean
Definition: METMonTool.h:157
METMonTool::bookSourcesHistograms
StatusCode bookSourcesHistograms(std::string &metName, MonGroup &met_mongroup, bool doProfiles)
Definition: METMonTool.cxx:270
xAOD::EventInfo_v1::LAr
@ LAr
The LAr calorimeter.
Definition: EventInfo_v1.h:335
METMonTool::initialize
StatusCode initialize()
Definition: METMonTool.cxx:79
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
METMonTool::m_dphiVsPhi
std::vector< TProfile * > m_dphiVsPhi
Definition: METMonTool.h:133
METMonTool::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: METMonTool.h:82
METMonTool::bookCalosHistograms
StatusCode bookCalosHistograms(MonGroup &met_calos)
Definition: METMonTool.cxx:398
METMonTool::m_ey
std::vector< TH1 * > m_ey
Definition: METMonTool.h:120
METMonTool::m_phi
std::vector< TH1 * > m_phi
Definition: METMonTool.h:121
METMonTool::fillSourcesHistograms
StatusCode fillSourcesHistograms()
Definition: METMonTool.cxx:809
xAOD::EventInfo_v1::Error
@ Error
The sub-detector issued an error.
Definition: EventInfo_v1.h:349
METMonTool::m_eyCalMean
TProfile * m_eyCalMean
Definition: METMonTool.h:153
METMonTool::m_exReg
std::vector< TH1 * > m_exReg
Definition: METMonTool.h:143
METMonTool::m_metForCut
SG::ReadHandleKey< xAOD::MissingETContainer > m_metForCut
Definition: METMonTool.h:81
METMonTool::m_dphiVsEta
std::vector< TProfile * > m_dphiVsEta
Definition: METMonTool.h:129
ManagedMonitorToolBase::MonGroup
A container of information describing a monitoring object.
Definition: ManagedMonitorToolBase.h:138
METMonTool::m_phiCal
std::vector< TH1 * > m_phiCal
Definition: METMonTool.h:139
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ManagedMonitorToolBase::initialize
virtual StatusCode initialize()
Definition: ManagedMonitorToolBase.cxx:669
METMonTool::m_doFillNegativeSumEt
Gaudi::Property< bool > m_doFillNegativeSumEt
Definition: METMonTool.h:114
METMonTool::m_metRegKey
StringProperty m_metRegKey
Definition: METMonTool.h:85
METMonTool::m_ex
std::vector< TH1 * > m_ex
Definition: METMonTool.h:119
lumiFormat.i
int i
Definition: lumiFormat.py:92
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition: TrigEgammaMonitorHelper.py:81
METMonTool::m_etrangeRegFactors
Gaudi::Property< std::vector< float > > m_etrangeRegFactors
Definition: METMonTool.h:111
METMonTool::m_sumetReg
std::vector< TH1 * > m_sumetReg
Definition: METMonTool.h:146
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthenaMonManager::online
@ online
Definition: AthenaMonManager.h:49
METMonTool::m_calIndices
const size_t m_calIndices
Definition: METMonTool.h:93
METMonTool::m_tos
Gaudi::Property< float > m_tos
Definition: METMonTool.h:115
METMonTool::m_thistSvc
ITHistSvc * m_thistSvc
used only if m_selType == FromTool
Definition: METMonTool.h:175
METMonTool::m_etbin
Gaudi::Property< int > m_etbin
Definition: METMonTool.h:103
test_pyathena.parent
parent
Definition: test_pyathena.py:15
METMonTool::m_doJetcleaning
Gaudi::Property< bool > m_doJetcleaning
Definition: METMonTool.h:164
METMonTool::m_met_cut_80
Gaudi::Property< bool > m_met_cut_80
Definition: METMonTool.h:99
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
METMonTool::m_exCal
std::vector< TH1 * > m_exCal
Definition: METMonTool.h:137
METMonTool::m_etrangeSumFactor
Gaudi::Property< float > m_etrangeSumFactor
Definition: METMonTool.h:106
run
Definition: run.py:1
xAOD::Egamma_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
Definition: Egamma_v1.cxx:75
METMonTool::m_etReg
std::vector< TH1 * > m_etReg
Definition: METMonTool.h:142
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
METMonTool::procHistograms
StatusCode procHistograms()
An inheriting class should either override this function or finalHists().
Definition: METMonTool.cxx:1182
METMonTool::m_jetColKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetColKey
Definition: METMonTool.h:86
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
METMonTool::m_iEle
int m_iEle
Definition: METMonTool.h:160
METMonTool::METMonTool
METMonTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: METMonTool.cxx:74
ManagedMonitorToolBase::MonGroup::regHist
StatusCode regHist(TH1 *h)
Registers a TH1 (including TH2, TH3, and TProfile) to be included in the output stream using logical ...
Definition: ManagedMonitorToolBase.cxx:195
ManagedMonitorToolBase::m_environment
AthenaMonManager::Environment_t m_environment
Definition: ManagedMonitorToolBase.h:902
METMonTool::bookHistograms
StatusCode bookHistograms()
An inheriting class should either override this function or bookHists().
Definition: METMonTool.cxx:160
METMonTool::m_sumet
std::vector< TH1 * > m_sumet
Definition: METMonTool.h:122
xAOD::JetFourMom_t
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.
Definition: JetTypes.h:17
xAOD::MissingETContainer_v1
Container for xAOD::MissingET_v1 objects.
Definition: MissingETContainer_v1.h:21
MissingET.h
METMonTool::fillProfileHistograms
StatusCode fillProfileHistograms(float et, float phi, float objEta, float objPhi, int i)
Definition: METMonTool.cxx:1155
METMonTool::m_exRegMean
TProfile * m_exRegMean
Definition: METMonTool.h:156
METMonTool::m_phiRegMean
TProfile * m_phiRegMean
Definition: METMonTool.h:158
METMonTool::m_eleColKey
SG::ReadHandleKey< xAOD::ElectronContainer > m_eleColKey
Definition: METMonTool.h:87
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
METMonTool::m_metVsEta
std::vector< TProfile * > m_metVsEta
Definition: METMonTool.h:126
TProfile
Definition: rootspy.cxx:515
METMonTool::m_etrange
Gaudi::Property< float > m_etrange
Definition: METMonTool.h:105
xAOD::Electron_v1
Definition: Electron_v1.h:34
METMonTool.h
EventInfo.h
METMonTool::~METMonTool
~METMonTool()
Definition: METMonTool.cxx:153
METMonTool::m_metVsEtaPhi
std::vector< TProfile2D * > m_metVsEtaPhi
Definition: METMonTool.h:134
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
METMonTool::bookSummaryHistograms
StatusCode bookSummaryHistograms(MonGroup &met_summary)
Definition: METMonTool.cxx:583
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
METMonTool::m_etabin
Gaudi::Property< int > m_etabin
Definition: METMonTool.h:101
h
TProfile::Fill
int Fill(double, double)
Definition: rootspy.cxx:523
METMonTool::m_metKeys
StringArrayProperty m_metKeys
Definition: METMonTool.h:79
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
METMonTool::m_sumetCal
std::vector< TH1 * > m_sumetCal
Definition: METMonTool.h:140
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TH1
Definition: rootspy.cxx:268
METMonTool::fillRegionsHistograms
StatusCode fillRegionsHistograms()
Definition: METMonTool.cxx:1105
METMonTool::m_calStrings
const std::vector< std::string > m_calStrings
Definition: METMonTool.h:95
METMonTool::m_met_cut
Gaudi::Property< float > m_met_cut
Definition: METMonTool.h:104
METMonTool::m_et
std::vector< TH1 * > m_et
Definition: METMonTool.h:118
METMonTool::m_exCalMean
TProfile * m_exCalMean
Definition: METMonTool.h:152
xAOD::Egamma_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: Egamma_v1.cxx:70
Electron.h
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
METMonTool::bookRegionsHistograms
StatusCode bookRegionsHistograms(MonGroup &met_regions)
Definition: METMonTool.cxx:490
METMonTool::m_metVsMetPhi
TProfile * m_metVsMetPhi
Definition: METMonTool.h:124
METMonTool::m_ContainerWarnings_metKeys
std::vector< int > m_ContainerWarnings_metKeys
Definition: METMonTool.h:171
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
METMonTool::m_selTool
ToolHandle< IJetSelector > m_selTool
Definition: METMonTool.h:173
METMonTool::m_muoColKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muoColKey
Definition: METMonTool.h:88
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
MissingETComposition.h
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528
METMonTool::m_metKeysFull
SG::ReadHandleKeyArray< xAOD::MissingETContainer > m_metKeysFull
Definition: METMonTool.h:80
METMonTool::m_badJets
Gaudi::Property< bool > m_badJets
Definition: METMonTool.h:165