ATLAS Offline Software
NumJetVarTool.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 #include "xAODJet/Jet.h"
7 
8 
9 NumJetVarTool::NumJetVarTool(const std::string & type, const std::string & name ,const IInterface* parent):
11  , m_failureOnMissingContainer(false)
12 {
13  declareInterface<IEventHistoVarTool>(this);
14  declareProperty("FailureOnMissingContainer", m_failureOnMissingContainer);
15 
16 }
17 
19 
20  ATH_MSG_INFO("Counting number of jets with PtCut: "<<m_ptCut<<", EtCut: "<<m_etCut<<", EtaMin: "<<m_etaMin<<", EtaMax: "<<m_etaMax);
21 
22  return StatusCode::SUCCESS;
23 
24 }
25 
27 
28  if ( jets.empty() ) {
30  ATH_MSG_ERROR("Input JetContainer could not be found or is empty");
31  return 0.;
32  } else {
33  ATH_MSG_DEBUG("Input JetContainer could not be found or is empty");
34  return 0.;
35  }
36  }
37 
38  float njets = 0.;
39  for (const xAOD::Jet* jet : jets) {
40  if (jet->pt() >= m_ptCut*1000. && jet->p4().Et() >= m_etCut*1000. && fabs(jet->eta()) >= m_etaMin && fabs(jet->eta()) <= m_etaMax ) {
41  njets++;
42  }
43  }
44  return njets;
45 }
NumJetVarTool::value
virtual float value(const xAOD::JetContainer &) const
the value of the variable for a given Event
Definition: NumJetVarTool.cxx:26
Jet.h
NumJetVarTool::initialize
virtual StatusCode initialize()
Definition: NumJetVarTool.cxx:18
NumJetVarTool.h
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
NumJetVarTool::m_etaMin
Gaudi::Property< float > m_etaMin
Definition: NumJetVarTool.h:33
NumJetVarTool::m_etaMax
Gaudi::Property< float > m_etaMax
Definition: NumJetVarTool.h:34
NumJetVarTool::m_etCut
Gaudi::Property< float > m_etCut
Definition: NumJetVarTool.h:32
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
NumJetVarTool::NumJetVarTool
NumJetVarTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: NumJetVarTool.cxx:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
NumJetVarTool::m_ptCut
Gaudi::Property< float > m_ptCut
Definition: NumJetVarTool.h:31
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
NumJetVarTool::m_failureOnMissingContainer
bool m_failureOnMissingContainer
Definition: NumJetVarTool.h:36
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
AthAlgTool
Definition: AthAlgTool.h:26