ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetJvtEfficiency
Root
NNJvtSelectionTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
JetJvtEfficiency/NNJvtSelectionTool.h
"
6
#include "
PathResolver/PathResolver.h
"
7
#include "
AsgDataHandles/ReadDecorHandle.h
"
8
9
#include <fstream>
10
11
namespace
{
12
const
static
std::map<std::string, std::string> workingPoints{
13
{
"FixedEffPt"
,
"NNJVT.Cuts.FixedEffPt.Offline.Nonprompt_All_MaxW.json"
},
14
{
"TightFwd"
,
"NNJVT.Cuts.TightFwd.Offline.Nonprompt_All_MaxWeight.json"
}};
15
}
16
17
namespace
CP
{
18
StatusCode
NNJvtSelectionTool::initialize
() {
19
20
ATH_CHECK
(
JvtSelectionToolBase::initialize
());
21
22
if
(
m_configFile
.empty()) {
23
auto
itr = workingPoints.find(
m_wp
);
24
if
(itr == workingPoints.end()) {
25
ATH_MSG_ERROR
(
"Unknown NNJvt WP: "
<<
m_wp
.value());
26
return
StatusCode::FAILURE;
27
}
28
m_configFile
= itr->second;
29
}
30
std::string
file
=
31
m_configDir
.empty() ?
m_configFile
.value() : (
m_configDir
+
"/"
+
m_configFile
);
32
std::string resolved =
PathResolverFindCalibFile
(
file
);
33
if
(resolved.empty()) {
34
ATH_MSG_ERROR
(
"File "
<<
file
<<
" not found!"
);
35
return
StatusCode::FAILURE;
36
}
37
std::ifstream fcuts(resolved);
38
if
(!fcuts.is_open()) {
39
ATH_MSG_ERROR
(
"Failed to open "
<< resolved <<
"!"
);
40
return
StatusCode::FAILURE;
41
}
42
43
m_cutMap
=
JetPileupTag::NNJvtCutMap::fromJSON
(fcuts);
44
45
return
StatusCode::SUCCESS;
46
}
47
48
bool
NNJvtSelectionTool::select
(
const
xAOD::IParticle
*
jet
)
const
{
49
if
(!
isInRange
(
jet
))
return
true
;
50
SG::ReadDecorHandle<xAOD::JetContainer, float>
jvtHandle(
m_jvtMomentKey
);
51
return
jvtHandle(*
jet
) >
m_cutMap
(
jet
->pt(),
m_etaAcc
(*
jet
));
52
}
53
}
// namespace CP
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ReadDecorHandle.h
Handle class for reading a decoration on an object.
NNJvtSelectionTool.h
PathResolver.h
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition
PathResolver.cxx:325
CP::JvtSelectionToolBase::isInRange
virtual bool isInRange(const xAOD::IParticle *jet) const
Definition
JvtSelectionToolBase.cxx:29
CP::JvtSelectionToolBase::m_etaAcc
SG::ConstAccessor< float > m_etaAcc
Definition
JvtSelectionToolBase.h:56
CP::JvtSelectionToolBase::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
JvtSelectionToolBase.cxx:10
CP::JvtSelectionToolBase::m_jvtMomentKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jvtMomentKey
Definition
JvtSelectionToolBase.h:45
CP::NNJvtSelectionTool::m_cutMap
JetPileupTag::NNJvtCutMap m_cutMap
Definition
NNJvtSelectionTool.h:31
CP::NNJvtSelectionTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition
NNJvtSelectionTool.cxx:18
CP::NNJvtSelectionTool::m_configDir
Gaudi::Property< std::string > m_configDir
Definition
NNJvtSelectionTool.h:25
CP::NNJvtSelectionTool::m_wp
Gaudi::Property< std::string > m_wp
Definition
NNJvtSelectionTool.h:23
CP::NNJvtSelectionTool::m_configFile
Gaudi::Property< std::string > m_configFile
Definition
NNJvtSelectionTool.h:28
CP::NNJvtSelectionTool::select
virtual bool select(const xAOD::IParticle *jet) const override
Definition
NNJvtSelectionTool.cxx:48
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition
StoreGate/StoreGate/ReadDecorHandle.h:94
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
JetPileupTag::NNJvtCutMap::fromJSON
static NNJvtCutMap fromJSON(std::istream &is)
Definition
NNJvtBinning.cxx:93
file
TFile * file
Definition
tile_monitor.h:29
Generated on
for ATLAS Offline Software by
1.17.0