ATLAS Offline Software
HVJetMETFilterTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // HVJetMETFilterTool.cxx, (c) ATLAS Detector software
8 
10 #include <vector>
11 #include <string>
12 
13 // Constructor
15  const std::string& n,
16  const IInterface* p ) :
17  AthAlgTool(t,n,p),
18  m_ntot(0),
19  m_npass(0),
20  m_metTerm("Final"),
21  m_metCut(50000.0)
22  {
23  declareInterface<DerivationFramework::ISkimmingTool>(this);
24  declareProperty("METTerm", m_metTerm);
25  declareProperty("METCut", m_metCut);
26  }
27 
28 // Destructor
30 }
31 
32 // Athena initialize and finalize
34 {
35  ATH_MSG_VERBOSE("initialize() ...");
36  ATH_CHECK(m_metSGKey.initialize());
37  return StatusCode::SUCCESS;
38 }
40 {
41  ATH_MSG_VERBOSE("finalize() ...");
42  ATH_MSG_INFO("Processed "<< m_ntot <<" events, "<< m_npass<<" events passed filter ");
43  return StatusCode::SUCCESS;
44 }
45 
46 // The filter itself
48 {
49  ++m_ntot;
50 
51  const xAOD::MissingET* met(0);
52  SG::ReadHandle<xAOD::MissingETContainer> metContainer(m_metSGKey);
53  if( !metContainer.isValid() ) {
54  msg(MSG::WARNING) << "No MET container found, will skip this event" << endmsg;
55  return false;
56  }
57  msg(MSG::DEBUG)<<"size of MET container is "<<metContainer->size()<<endmsg;
58 
59  if (metContainer->size() !=0) {
60 
61  met = (*metContainer)[m_metTerm];
62  if (!met) {
63  msg(MSG::WARNING) << "Cannot retrieve MissingET term " << m_metTerm << " in " << m_metSGKey << endmsg;
64  return false;
65  }
66 
67  // double MET = metContainer->at(0)->met();
68 
69  // msg(MSG::DEBUG) << "MET and phi are " << met->met() << " " << met->phi() <<endmsg;
70 
71  bool passesEvent= (met->met() > m_metCut) ;
72 
73  if (passesEvent) {
74  ++m_npass;
75  }
76  return passesEvent;
77  }
78  return false;
79 
80 }
81 
DerivationFramework::HVJetMETFilterTool::HVJetMETFilterTool
HVJetMETFilterTool(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition: HVJetMETFilterTool.cxx:14
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::HVJetMETFilterTool::m_metTerm
std::string m_metTerm
Definition: HVJetMETFilterTool.h:52
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
DerivationFramework::HVJetMETFilterTool::m_metCut
double m_metCut
Definition: HVJetMETFilterTool.h:53
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
DerivationFramework::HVJetMETFilterTool::eventPassesFilter
virtual bool eventPassesFilter() const
Check that the current event passes this filter.
Definition: HVJetMETFilterTool.cxx:47
met
Definition: IMETSignificance.h:24
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::MissingET_v1
Principal data object for Missing ET.
Definition: MissingET_v1.h:25
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
DerivationFramework::HVJetMETFilterTool::~HVJetMETFilterTool
~HVJetMETFilterTool()
Destructor.
Definition: HVJetMETFilterTool.cxx:29
DerivationFramework::HVJetMETFilterTool::initialize
StatusCode initialize()
Definition: HVJetMETFilterTool.cxx:33
DerivationFramework::HVJetMETFilterTool::finalize
StatusCode finalize()
Definition: HVJetMETFilterTool.cxx:39
DEBUG
#define DEBUG
Definition: page_access.h:11
HVJetMETFilterTool.h
AthAlgTool
Definition: AthAlgTool.h:26
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7