ATLAS Offline Software
Loading...
Searching...
No Matches
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
8
9#include <fstream>
10
11namespace {
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
17namespace CP {
19
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
44
45 return StatusCode::SUCCESS;
46 }
47
49 if(!isInRange(jet)) return true;
51 return jvtHandle(*jet) > m_cutMap(jet->pt(), m_etaAcc(*jet));
52 }
53} // namespace CP
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Handle class for reading a decoration on an object.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
virtual bool isInRange(const xAOD::IParticle *jet) const
SG::ConstAccessor< float > m_etaAcc
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jvtMomentKey
JetPileupTag::NNJvtCutMap m_cutMap
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Gaudi::Property< std::string > m_configDir
Gaudi::Property< std::string > m_wp
Gaudi::Property< std::string > m_configFile
virtual bool select(const xAOD::IParticle *jet) const override
Handle class for reading a decoration on an object.
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
static NNJvtCutMap fromJSON(std::istream &is)
TFile * file