ATLAS Offline Software
Loading...
Searching...
No Matches
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
9NumJetVarTool::NumJetVarTool(const std::string & type, const std::string & name ,const IInterface* parent):
10 AthAlgTool( type, name, parent )
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
26float NumJetVarTool::value(const xAOD::JetContainer & jets) const {
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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
NumJetVarTool(const std::string &type, const std::string &name, const IInterface *parent)
virtual float value(const xAOD::JetContainer &) const
the value of the variable for a given Event
Gaudi::Property< float > m_etaMax
bool m_failureOnMissingContainer
virtual StatusCode initialize()
Gaudi::Property< float > m_etCut
Gaudi::Property< float > m_ptCut
Gaudi::Property< float > m_etaMin
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".