ATLAS Offline Software
DVTracklessJetFilterTool.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 // DVTracklessJetFilterTool.cxx, (c) ATLAS Detector software
8 
10 #include <vector>
11 #include <string>
12 
13 
14 // Constructor
16  const std::string& n,
17  const IInterface* p ) :
18  AthAlgTool(t,n,p),
19  m_ntot(0),
20  m_npass(0),
21  m_ptCut(50000.0)
22  {
23  declareInterface<DerivationFramework::ISkimmingTool>(this);
24  declareProperty("JetPtCut", m_ptCut);
25  declareProperty("JetEtaCut", m_etaCut);
26  declareProperty("sumPtTrkCut", m_sumPtTrkCut);
27  declareProperty("nJetsRequired", m_nJetsRequired=1);
28  }
29 
30 // Destructor
32 }
33 
34 // Athena initialize and finalize
36 {
37  ATH_MSG_VERBOSE("initialize() ...");
38  ATH_CHECK(m_jetSGKey.initialize());
39 
40  return StatusCode::SUCCESS;
41 
42 }
44 {
45  ATH_MSG_VERBOSE("finalize() ...");
46  ATH_MSG_INFO("Processed "<< m_ntot <<" events, "<< m_npass<<" events passed filter ");
47  return StatusCode::SUCCESS;
48 }
49 
50 // The filter itself
52 {
53  ++m_ntot;
54  bool passesEvent=false;
55 
56  int nJetsPassed=0;
57 
59  if( !jetContainer.isValid() ) {
60  msg(MSG::WARNING) << "No Jet container found, will skip this event" << endmsg;
61  return false;
62  }
63  msg(MSG::DEBUG)<<"size of Jet container is "<<jetContainer->size()<<endmsg;
64 
65  for (unsigned int i=0; i< jetContainer->size(); ++i) {
66  const xAOD::Jet* jet = jetContainer->at(i);
67  if (( jet->pt() < m_ptCut) || (std::abs(jet->eta())>m_etaCut)) continue;
68 
69  std::vector<float> sumPtTrkvec;
70  jet->getAttribute(xAOD::JetAttribute::SumPtTrkPt500, sumPtTrkvec);
71  if (sumPtTrkvec.size() > 0) {
72  msg(MSG::DEBUG)<<"sumptTrk is "<<sumPtTrkvec.at(0)<<endmsg;
73  if (sumPtTrkvec.at(0) < m_sumPtTrkCut) {
74  nJetsPassed+=1;
75  }
76  }
77  }
78  if (nJetsPassed >=m_nJetsRequired) {
79  ++m_npass;
80  passesEvent=true;
81  }
82 
83  return passesEvent;
84 
85 }
86 
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::DVTracklessJetFilterTool::m_etaCut
double m_etaCut
Definition: DVTracklessJetFilterTool.h:54
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::DVTracklessJetFilterTool::m_nJetsRequired
int m_nJetsRequired
Definition: DVTracklessJetFilterTool.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::DVTracklessJetFilterTool::finalize
StatusCode finalize()
Definition: DVTracklessJetFilterTool.cxx:43
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
lumiFormat.i
int i
Definition: lumiFormat.py:92
DerivationFramework::DVTracklessJetFilterTool::m_sumPtTrkCut
double m_sumPtTrkCut
Definition: DVTracklessJetFilterTool.h:55
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DVTracklessJetFilterTool.h
JetAnalysisAlgorithmsTest_EMTopo_eljob.jetContainer
string jetContainer
Definition: JetAnalysisAlgorithmsTest_EMTopo_eljob.py:36
xAOD::JetAttribute::SumPtTrkPt500
@ SumPtTrkPt500
Definition: JetAttributes.h:108
DerivationFramework::DVTracklessJetFilterTool::DVTracklessJetFilterTool
DVTracklessJetFilterTool(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition: DVTracklessJetFilterTool.cxx:15
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
DEBUG
#define DEBUG
Definition: page_access.h:11
DerivationFramework::DVTracklessJetFilterTool::m_ptCut
double m_ptCut
Definition: DVTracklessJetFilterTool.h:53
AthAlgTool
Definition: AthAlgTool.h:26
DerivationFramework::DVTracklessJetFilterTool::initialize
StatusCode initialize()
Definition: DVTracklessJetFilterTool.cxx:35
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
DerivationFramework::DVTracklessJetFilterTool::eventPassesFilter
virtual bool eventPassesFilter() const
Check that the current event passes this filter.
Definition: DVTracklessJetFilterTool.cxx:51
DerivationFramework::DVTracklessJetFilterTool::~DVTracklessJetFilterTool
~DVTracklessJetFilterTool()
Destructor.
Definition: DVTracklessJetFilterTool.cxx:31