ATLAS Offline Software
Loading...
Searching...
No Matches
RingerSelector.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef RingerSelectorTools_tools_onnx_RingerSelector_h
5#define RingerSelectorTools_tools_onnx_RingerSelector_h
6
7
8
9#include "GaudiKernel/StatusCode.h"
10#include "GaudiKernel/ServiceHandle.h"
15#include <onnxruntime_cxx_api.h>
19#include "GaudiKernel/SystemOfUnits.h"
20#include <memory>
21#include "TEnv.h"
22
23namespace Ringer {
24
25 namespace onnx{
26
28
29 {
30 public:
31
33 RingerSelector( const std::string& name );
34
36 ~RingerSelector()=default;
37
38
42 StatusCode read_from( const std::string&, AthOnnx::IOnnxRuntimeSvc *);
43
44
48 std::vector<std::vector<float>> prepare_inputs( unsigned barcode, const xAOD::TrigRingerRings *, const xAOD::TrigElectron *) const;
49
50
54 float predict(const xAOD::TrigRingerRings *, const xAOD::TrigElectron * ) const;
55
56
60 bool accept(const xAOD::TrigRingerRings *, float discr, float mu ) const;
61
62
63 private:
64
66 std::vector< Ringer::onnx::Model > m_models;
68 std::vector< Ringer::onnx::Threshold > m_thresholds;
69
71 template <typename T> bool strtof(const std::string& input, T& f);
73 template <typename T> std::vector<T> GetValues (const std::string& input, TEnv& env);
75 std::vector<std::string> GetPaths(const std::string& input, TEnv& env);
77 std::string GetBasePath(const std::string &path) const;
78
79 };
80
81 } // namespace onnx
82} //namespace Ringer
83
84#endif
Service used for managing global objects used by Onnx Runtime.
std::vector< T > GetValues(const std::string &input, TEnv &env)
Get the list of values inside of tenv.
StatusCode read_from(const std::string &, AthOnnx::IOnnxRuntimeSvc *)
read tunings from configuration file
bool accept(const xAOD::TrigRingerRings *, float discr, float mu) const
Accept method.
float predict(const xAOD::TrigRingerRings *, const xAOD::TrigElectron *) const
Calculation of model output.
RingerSelector(const std::string &name)
Standard constructor.
std::vector< std::string > GetPaths(const std::string &input, TEnv &env)
Get the list of paths inside of tenv.
std::vector< Ringer::onnx::Model > m_models
hold all onnx sessions
std::vector< Ringer::onnx::Threshold > m_thresholds
hold all thresholds definitions
bool strtof(const std::string &input, T &f)
parse tenv string into list with type T
std::vector< std::vector< float > > prepare_inputs(unsigned barcode, const xAOD::TrigRingerRings *, const xAOD::TrigElectron *) const
prepare all inputs
std::string GetBasePath(const std::string &path) const
Get basepath from calib path.
~RingerSelector()=default
Standard destructor.
Class mimicking the AthMessaging class from the offline software.
Namespace dedicated for Ringer utilities.
TrigRingerRings_v2 TrigRingerRings
Define the latest version of the TrigRingerRings class.
TrigElectron_v1 TrigElectron
Declare the latest version of the class.