![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
21 #include "lwtnn/generic/FastGraph.hh"
22 #include "lwtnn/parse_json.hh"
23 #include "lwtnn/Stack.hh"
40 ATH_MSG_ERROR(
"JetVertexTaggerTool needs to have its input jet container configured!");
41 return StatusCode::FAILURE;
47 ATH_MSG_INFO(
" resolved in :\n " << configPath <<
"\n\n");
49 std::ifstream fconfig( configPath.c_str() );
50 if ( !fconfig.is_open() ) {
52 ATH_MSG_ERROR(
"Are you sure that the file exists at this path?" );
53 return StatusCode::FAILURE;
56 ATH_MSG_INFO(
"\n Reading JVT likelihood histogram from:\n " << configPath <<
"\n\n");
60 lwt::InputOrder
order;
62 std::vector<std::string>
inputs = {
"Rpt",
"JVFCorr",
"ptbin",
"etabin"};
64 node_order.emplace_back(
cfg.inputs[0].name,
inputs);
65 order.scalar = node_order;
69 m_lwnn = std::make_unique<lwt::generic::FastGraph<double> >(
cfg,
order);
74 std::ifstream fcuts( cutsPath.c_str() );
75 if ( !fcuts.is_open() ) {
77 ATH_MSG_ERROR(
"Are you sure that the file exists at this path?" );
78 return StatusCode::FAILURE;
91 #ifndef XAOD_STANDALONE
111 return StatusCode::SUCCESS;
119 lwt::VectorX<double> inputvals =
lwt::build_vector({rpt,jvfcorr,
static_cast<double>(ptbin),
static_cast<double>(etabin)});
120 std::vector<lwt::VectorX<double> > scalars{inputvals};
137 if (vertices.size()==1) {
140 return vertices.back();
156 ATH_MSG_WARNING(
"Invalid primary vertex found, will not continue decorating with JVT.");
157 return StatusCode::FAILURE;
166 static constexpr
float invalidJvt = -1;
167 static constexpr
float invalidRpt = 0;
168 static constexpr
char invalidPassJvt =
true;
172 float jvt = invalidJvt;
173 float rpt = invalidRpt;
174 char passJvt = invalidPassJvt;
178 float jvfcorr = jvfCorrHandle(*
jet);
179 std::vector<float> sumpttrk = sumPtTrkHandle(*
jet);
180 rpt = sumpttrk[HSvertex->
index() - vertices[0]->index()]/
jet->pt();
182 size_t ptbin, etabin;
185 float jvtCut =
m_cutMap(ptbin, etabin);
186 passJvt = jvt > jvtCut;
190 ATH_MSG_VERBOSE(
" --> inputs: corrJVF " << jvfcorr <<
", rpt " << rpt );
191 ATH_MSG_VERBOSE(
"JVT cut for ptbin " << ptbin <<
", etabin " << etabin <<
" = " << jvtCut);
192 ATH_MSG_VERBOSE(
"Evaluated JVT = " << jvt <<
", jet " << (passJvt ?
"passes" :
"fails") <<
" working point" );
197 jvtHandle(*
jet) = jvt;
198 if (!rptHandle.key().empty())
199 rptHandle(*
jet) = rpt;
200 if (!passJvtHandle.key().empty())
201 passJvtHandle(*
jet) = passJvt;
204 return StatusCode::SUCCESS;
Gaudi::Property< float > m_maxpt_for_cut
float evaluateJvt(float rpt, float jvfcorr, size_t ptbin, size_t etabin) const
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jvtKey
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
JetVertexNNTagger(const std::string &name)
Constructor with a tool name.
const xAOD::Vertex * findHSVertex(const xAOD::VertexContainer &vertices) const
#define ATH_MSG_VERBOSE(x)
VxType::VertexType vertexType() const
The type of the vertex.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
Gaudi::Property< bool > m_suppressOutputDeps
static NNJvtCutMap fromJSON(std::istream &is)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Handle class for reading a decoration on an object.
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
::StatusCode StatusCode
StatusCode definition for legacy code.
SG::WriteDecorHandleKey< xAOD::JetContainer > m_rptKey
Handle class for adding a decoration to an object.
std::vector< std::pair< std::string, std::vector< std::string > > > order_t
~JetVertexNNTagger()
Destructor.
VectorXd build_vector(const std::vector< double > &bias)
size_t index() const
Return the index of this element within its container.
Gaudi::Property< std::string > m_jetContainerName
Gaudi::Property< std::string > m_NNConfigDir
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
GraphConfig parse_json_graph(std::istream &json)
Gaudi::Property< bool > m_suppressInputDeps
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jvfCorrKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_passJvtKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_sumPtTrkKey
Gaudi::Property< std::string > m_NNCutFileName
JetContainer_v1 JetContainer
Definition of the current "jet container version".
virtual StatusCode decorate(const xAOD::JetContainer &jetCont) const override
Decorate a jet collection without otherwise modifying it.
std::unique_ptr< lwt::generic::FastGraph< double > > m_lwnn
Internal members for interpreting jet inputs and NN configuration.
Gaudi::Property< std::string > m_NNParamFileName