ATLAS Offline Software
DVMeffFilterTool.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 // DVMissingETFilterTool.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_MeffCut(1000000.),
21  m_METoverMeffCutMin(0.3),
22  m_METoverMeffCutMax(0.7),
23  m_jetPtCut(40000.),
24  m_jetEtaCut(2.7),
25  m_METCut(80000.)
26  {
27  declareInterface<DerivationFramework::ISkimmingTool>(this);
28  declareProperty("MeffCut", m_MeffCut);
29  declareProperty("jetPtCut", m_jetPtCut);
30  declareProperty("jetEtaCut", m_jetEtaCut);
31  declareProperty("METoverMeffCutMin", m_METoverMeffCutMin);
32  declareProperty("METoverMeffCutMax", m_METoverMeffCutMax);
33  declareProperty("METCut",m_METCut);
34  }
35 
36 // Destructor
38 }
39 
40 // Athena initialize and finalize
42 {
43  ATH_MSG_VERBOSE("initialize() ...");
44  ATH_CHECK(m_metSGKey.initialize());
45  ATH_CHECK(m_jetSGKey.initialize());
46  return StatusCode::SUCCESS;
47 }
49 {
50  ATH_MSG_VERBOSE("finalize() ...");
51  ATH_MSG_INFO("Processed "<< m_ntot <<" events, "<< m_npass<<" events passed filter ");
52  return StatusCode::SUCCESS;
53 }
54 
55 // The filter itself
57 {
58  ++m_ntot;
59 
60  double Meff=0.;
61  double MET=0.;
62  double totalJetPT = 0.;
63  bool passesEvent=false;
64 
65  SG::ReadHandle<xAOD::MissingETContainer> metContainer(m_metSGKey);
66  if( !metContainer.isValid() ) {
67  msg(MSG::WARNING) << "No MET container found, will skip this event" << endmsg;
68  return false;
69  }
71 
72  if (metContainer->size() >= 1) {
73  MET = metContainer->at(0)->met();
74  }
75 
77  if( !jetContainer.isValid() ) {
78  msg(MSG::WARNING) << "No jet container found, will skip this event" << endmsg;
79  return false;
80  }
81  for (unsigned int i=0; i< jetContainer->size(); ++i) {
82  const xAOD::Jet* jet = jetContainer->at(i);
83  if (( jet->pt() < m_jetPtCut) || (std::abs(jet->eta())>m_jetEtaCut)) continue;
84  totalJetPT += jet->pt();
85  }
86 
87  Meff += MET;
88  Meff += totalJetPT;
89 
90 
91  if ((Meff > m_MeffCut) || ((MET > m_METCut) && (MET/Meff > m_METoverMeffCutMin ) && (MET/Meff < m_METoverMeffCutMax))) {
92  passesEvent=true;
93  ++m_npass;
94  }
96 
97 
98 
99  return passesEvent;
100 
101 
102 }
103 
DVMeffFilterTool.h
DerivationFramework::DVMeffFilterTool::eventPassesFilter
virtual bool eventPassesFilter() const
Check that the current event passes this filter.
Definition: DVMeffFilterTool.cxx:56
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::DVMeffFilterTool::m_jetPtCut
double m_jetPtCut
Definition: DVMeffFilterTool.h:55
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
DerivationFramework::DVMeffFilterTool::initialize
StatusCode initialize()
Definition: DVMeffFilterTool.cxx:41
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
DerivationFramework::DVMeffFilterTool::m_METCut
double m_METCut
Definition: DVMeffFilterTool.h:57
DerivationFramework::DVMeffFilterTool::m_jetEtaCut
double m_jetEtaCut
Definition: DVMeffFilterTool.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
DerivationFramework::DVMeffFilterTool::DVMeffFilterTool
DVMeffFilterTool(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition: DVMeffFilterTool.cxx:14
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
lumiFormat.i
int i
Definition: lumiFormat.py:92
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
DerivationFramework::DVMeffFilterTool::m_METoverMeffCutMax
double m_METoverMeffCutMax
Definition: DVMeffFilterTool.h:54
TCS::MET
@ MET
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Types.h:16
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
JetAnalysisAlgorithmsTest_EMTopo_eljob.jetContainer
string jetContainer
Definition: JetAnalysisAlgorithmsTest_EMTopo_eljob.py:36
DerivationFramework::DVMeffFilterTool::~DVMeffFilterTool
~DVMeffFilterTool()
Destructor.
Definition: DVMeffFilterTool.cxx:37
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
DerivationFramework::DVMeffFilterTool::m_METoverMeffCutMin
double m_METoverMeffCutMin
Definition: DVMeffFilterTool.h:53
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
AthAlgTool
Definition: AthAlgTool.h:26
DerivationFramework::DVMeffFilterTool::finalize
StatusCode finalize()
Definition: DVMeffFilterTool.cxx:48
DerivationFramework::DVMeffFilterTool::m_MeffCut
double m_MeffCut
Definition: DVMeffFilterTool.h:52
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7