|
ATLAS Offline Software
|
Go to the documentation of this file.
9 #include "AthLinks/ElementLink.h"
24 #include "lwtnn/NNLayerConfig.hh"
25 #include "lwtnn/parse_json.hh"
48 if (initNetworkStatus != StatusCode::SUCCESS) {
49 return initNetworkStatus;
53 if (
m_wp ==
"Tight") {
56 else if (
m_wp ==
"Custom") {
60 ATH_MSG_ERROR(
"Invalid TVA working point \"" <<
m_wp <<
"\" - for a custom configuration, please provide \"Custom\" for the \"WorkingPoint\" property.");
61 return StatusCode::FAILURE;
65 if (
m_wp ==
"Custom") {
66 ATH_MSG_INFO(
"TVA working point \"Custom\" provided - tool properties are initialized to default values unless explicitly set by the user.");
69 ATH_MSG_INFO(
"TVA working point \"" <<
m_wp <<
"\" provided - tool properties have been configured accordingly.");
74 return StatusCode::SUCCESS;
78 float mvaOutput = -1.;
79 return isMatch(trk, vx, mvaOutput);
83 const EventContext& ctx = Gaudi::Hive::currentContext();
86 throw std::runtime_error(
"ERROR in CP::MVATrackVertexAssociationTool::isCompatible : could not retrieve xAOD::EventInfo!");
91 throw std::runtime_error(
"ERROR in CP::MVATrackVertexAssociationTool::isCompatible : hardscatter vertex link is not valid!");
93 float mvaOutput = -1.;
94 return isMatch(trk, **vtxLink, mvaOutput,
evt.get());
132 const EventContext& ctx = Gaudi::Hive::currentContext();
144 throw std::runtime_error(
"ERROR in CP::MVATrackVertexAssociationTool::isMatch : could not retrieve xAOD::EventInfo!");
154 return (mvaOutput >=
m_cut);
157 template <
typename T,
typename V>
162 for (
const auto *
vertex : vx_list) {
165 trktovxlist.reserve(trk_list.size());
166 for (
const auto *
track : trk_list) {
168 trktovxlist.push_back(
track);
171 trktovxmap[
vertex] = trktovxlist;
177 template <
typename T>
185 for (
const auto *
vertex : vx_list) {
194 if (!bestMatchVertex) {
195 ATH_MSG_DEBUG(
"Could not find any matched vertex for this track.");
198 return bestMatchVertex;
201 template <
typename T,
typename V>
207 for (
const auto *
vertex : vx_list) {
210 trktovxlist.reserve(trk_list.size());
211 trktovxmap[
vertex] = trktovxlist;
215 for (
const auto *
track : trk_list) {
219 trktovxmap[vx_match].push_back(
track);
231 return StatusCode::FAILURE;
245 return StatusCode::FAILURE;
254 return StatusCode::FAILURE;
260 m_network = std::make_unique<lwt::LightweightNeuralNetwork>(netDef.inputs, netDef.layers, netDef.outputs);
265 if (netDef.inputs.size() != 1) {
267 return StatusCode::FAILURE;
270 m_graph = std::make_unique<lwt::LightweightGraph>(netDef);
273 return StatusCode::SUCCESS;
279 std::map<std::string, double>
input;
283 std::map<std::string, double>
output;
290 std::map<std::string, std::map<std::string, double>> wrappedInput;
#define maxValue(current, test)
bool toContainedElement(BaseConstReference data, ElementType element, IProxyDict *sg=0)
Set from element pointer and a reference to the container (storable)
std::map< const xAOD::Vertex *, xAOD::TrackVertexAssociationList > TrackVertexAssociationMap
const std::string & key() const
Return the StoreGate ID for the referenced object.
Select isolated Photons, Electrons and Muons.
VxType::VertexType vertexType() const
The type of the vertex.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
JSONConfig parse_json(std::istream &json)
bool isValid() const
Test to see if the link can be dereferenced.
Handle class for reading a decoration on an object.
::StatusCode StatusCode
StatusCode definition for legacy code.
const_pointer_type get() const
Dereference the pointer, but don't cache anything.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ElementLink implementation for ROOT usage.
std::vector< const xAOD::TrackParticle * > TrackVertexAssociationList
std::string to_string(const DetectorType &type)
Class describing the basic event information.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
GraphConfig parse_json_graph(std::istream &json)
Class describing a Vertex.
Class describing a TrackParticle.
bool match(std::string s1, std::string s2)
match the individual directories of two strings