ATLAS Offline Software
DVMissingETFilterTool.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_metCut(50000.0),
21  m_jetPtCut(50000.0),
22  m_applyDeltaPhiCut(false),
23  m_deltaPhiCut(2.)
24  {
25  declareInterface<DerivationFramework::ISkimmingTool>(this);
26  declareProperty("METCut", m_metCut);
27  declareProperty("JetPtCut", m_jetPtCut);
28  declareProperty("applyDeltaPhiCut", m_applyDeltaPhiCut);
29  declareProperty("DeltaPhiCut", m_deltaPhiCut);
30  }
31 
32 // Destructor
34 }
35 
36 // Athena initialize and finalize
38 {
39  ATH_MSG_VERBOSE("initialize() ...");
40  ATH_CHECK(m_metSGKey.initialize());
41  ATH_CHECK(m_jetSGKey.initialize());
42  return StatusCode::SUCCESS;
43 }
45 {
46  ATH_MSG_VERBOSE("finalize() ...");
47  ATH_MSG_INFO("Processed "<< m_ntot <<" events, "<< m_npass<<" events passed filter ");
48  return StatusCode::SUCCESS;
49 }
50 
51 // The filter itself
53 {
54  ++m_ntot;
55 
56  SG::ReadHandle<xAOD::MissingETContainer> metContainer(m_metSGKey);
57  if( !metContainer.isValid() ) {
58  msg(MSG::WARNING) << "No MET container found, will skip this event" << endmsg;
59  return false;
60  }
62 
63  if (metContainer->size() ==1) {
64 
65  double MET = metContainer->at(0)->met();
66  bool passesEvent= (MET > m_metCut) ;
67 
68 
69 
70  if (m_applyDeltaPhiCut) {
71  double phiMET=metContainer->at(0)->phi();
73  if( !jetContainer.isValid() ) {
74  msg(MSG::WARNING) << "No jet container found, will skip this event" << endmsg;
75  return false;
76  }
77  if ((jetContainer->size() > 0) && (jetContainer->at(0)->pt() > m_jetPtCut)){
78  double phiJet = jetContainer->at(0)->phi();
79  double deltaPhi = std::abs(phiMET-phiJet);
80  if (deltaPhi > M_PI) deltaPhi = 2.0*M_PI - deltaPhi;
81  passesEvent = passesEvent && (deltaPhi > m_deltaPhiCut);
82  }
83  }
84 
85  if (passesEvent) {
86  ++m_npass;
87  }
88  return passesEvent;
89  }
90  return false;
91 
92 }
93 
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::DVMissingETFilterTool::~DVMissingETFilterTool
~DVMissingETFilterTool()
Destructor.
Definition: DVMissingETFilterTool.cxx:33
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
DerivationFramework::DVMissingETFilterTool::initialize
StatusCode initialize()
Definition: DVMissingETFilterTool.cxx:37
M_PI
#define M_PI
Definition: ActiveFraction.h:11
DerivationFramework::DVMissingETFilterTool::m_metCut
double m_metCut
Definition: DVMissingETFilterTool.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::DVMissingETFilterTool::m_jetPtCut
double m_jetPtCut
Definition: DVMissingETFilterTool.h:54
DerivationFramework::DVMissingETFilterTool::m_deltaPhiCut
double m_deltaPhiCut
Definition: DVMissingETFilterTool.h:56
beamspotman.n
n
Definition: beamspotman.py:731
DVMissingETFilterTool.h
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
TCS::MET
@ MET
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/L1TopoCommon/Types.h:16
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework::DVMissingETFilterTool::eventPassesFilter
virtual bool eventPassesFilter() const
Check that the current event passes this filter.
Definition: DVMissingETFilterTool.cxx:52
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::DVMissingETFilterTool::DVMissingETFilterTool
DVMissingETFilterTool(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition: DVMissingETFilterTool.cxx:14
DerivationFramework::DVMissingETFilterTool::finalize
StatusCode finalize()
Definition: DVMissingETFilterTool.cxx:44
DerivationFramework::DVMissingETFilterTool::m_applyDeltaPhiCut
bool m_applyDeltaPhiCut
Definition: DVMissingETFilterTool.h:55
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
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