ATLAS Offline Software
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
ATH_CHECK
(
JvtSelectionToolBase::initialize
());
20
21
m_jvtAcc
=
SG::ConstAccessor<float>
(
m_jvtMoment
.key());
22
if
(
m_jetContainer
.empty()) {
23
ATH_MSG_WARNING
(
"No JetContainer set. This behaviour is deprecated"
);
24
ATH_CHECK
(
m_jvtMoment
.initialize(
false
));
25
}
26
else
{
27
m_jvtMoment
=
m_jetContainer
+
"."
+
m_jvtMoment
.key();
28
ATH_CHECK
(
m_jvtMoment
.initialize());
29
}
30
31
if
(
m_configFile
.empty()) {
32
auto
itr = workingPoints.find(
m_wp
);
33
if
(itr == workingPoints.end()) {
34
ATH_MSG_ERROR
(
"Unknown NNJvt WP: "
<<
m_wp
.value());
35
return
StatusCode::FAILURE;
36
}
37
m_configFile
= itr->second;
38
}
39
std::string
file
=
40
m_configDir
.empty() ?
m_configFile
.value() : (
m_configDir
+
"/"
+
m_configFile
);
41
std::string resolved =
PathResolverFindCalibFile
(
file
);
42
if
(resolved.empty()) {
43
ATH_MSG_ERROR
(
"File "
<<
file
<<
" not found!"
);
44
return
StatusCode::FAILURE;
45
}
46
std::ifstream fcuts(resolved);
47
if
(!fcuts.is_open()) {
48
ATH_MSG_ERROR
(
"Failed to open "
<< resolved <<
"!"
);
49
return
StatusCode::FAILURE;
50
}
51
52
m_cutMap
=
JetPileupTag::NNJvtCutMap::fromJSON
(fcuts);
53
54
return
StatusCode::SUCCESS;
55
}
56
57
bool
NNJvtSelectionTool::select
(
const
xAOD::IParticle
*
jet
)
const
{
58
return
m_jvtAcc
(*
jet
) >
m_cutMap
(
jet
->pt(),
m_etaAcc
(*
jet
));
59
}
60
}
// namespace CP
CP::NNJvtSelectionTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition:
NNJvtSelectionTool.cxx:18
NNJvtSelectionTool.h
CP::NNJvtSelectionTool::m_configDir
Gaudi::Property< std::string > m_configDir
Definition:
NNJvtSelectionTool.h:29
CP::NNJvtSelectionTool::m_configFile
Gaudi::Property< std::string > m_configFile
Definition:
NNJvtSelectionTool.h:32
SG::ConstAccessor< float >
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:49
JetPileupTag::NNJvtCutMap::fromJSON
static NNJvtCutMap fromJSON(std::istream &is)
Definition:
NNJvtBinning.cxx:90
jet
Definition:
JetCalibTools_PlotJESFactors.cxx:23
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
CP::NNJvtSelectionTool::m_wp
Gaudi::Property< std::string > m_wp
Definition:
NNJvtSelectionTool.h:27
CP::JvtSelectionToolBase::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition:
JvtSelectionToolBase.cxx:9
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
file
TFile * file
Definition:
tile_monitor.h:29
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
PathResolver.h
CP::NNJvtSelectionTool::m_jvtAcc
SG::ConstAccessor< float > m_jvtAcc
Definition:
NNJvtSelectionTool.h:43
CP::NNJvtSelectionTool::m_cutMap
JetPileupTag::NNJvtCutMap m_cutMap
Definition:
NNJvtSelectionTool.h:37
CP::NNJvtSelectionTool::m_jetContainer
Gaudi::Property< std::string > m_jetContainer
Definition:
NNJvtSelectionTool.h:24
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition:
PathResolver.cxx:431
CP::NNJvtSelectionTool::m_jvtMoment
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jvtMoment
Definition:
NNJvtSelectionTool.h:34
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition:
AthMsgStreamMacros.h:32
ReadDecorHandle.h
Handle class for reading a decoration on an object.
CP::NNJvtSelectionTool::select
virtual bool select(const xAOD::IParticle *jet) const override
Definition:
NNJvtSelectionTool.cxx:57
CP::JvtSelectionToolBase::m_etaAcc
SG::ConstAccessor< float > m_etaAcc
Definition:
JvtSelectionToolBase.h:44
Generated on Fri Jan 10 2025 21:15:23 for ATLAS Offline Software by
1.8.18