ATLAS Offline Software
NNSharingSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef NN_SHARING_SVC_H
6 #define NN_SHARING_SVC_H
7 
10 
13 
14 namespace FlavorTagDiscriminants
15 {
16 
17  namespace detail {
18  struct NNKey {
19  std::string path;
21  bool operator==(const NNKey&) const;
22  std::size_t hash() const;
23  };
24  struct NNHasher {
25  std::size_t operator()(const NNKey& o) const {
26  return o.hash();
27  }
28  };
29  }
30 
31  class NNSharingSvc: public extends<asg::AsgService, INNSharingSvc>
32  {
33  public:
34  using extends::extends; // base class constructor
35 
36  virtual std::shared_ptr<const GNN> get(
37  const std::string& nn_name,
38  const GNNOptions& opts) override;
39  private:
40  using val_t = std::shared_ptr<const GNN>;
41  std::unordered_map<detail::NNKey, val_t, detail::NNHasher> m_gnns;
42  std::unordered_map<std::string, val_t> m_base_gnns;
43  };
44 
45 }
46 
47 #endif
FlavorTagDiscriminants::detail::NNKey::hash
std::size_t hash() const
Definition: NNSharingSvc.cxx:12
FlavorTagDiscriminants::detail::NNHasher
Definition: NNSharingSvc.h:24
FlavorTagDiscriminants::detail::NNKey::opts
FlavorTagDiscriminants::GNNOptions opts
Definition: NNSharingSvc.h:20
AsgService.h
FlavorTagDiscriminants
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition: AssociationEnums.h:11
FlavorTagDiscriminants::GNNOptions
Definition: GNNOptions.h:16
detail
Definition: extract_histogram_tag.cxx:14
FlavorTagDiscriminants::NNSharingSvc::val_t
std::shared_ptr< const GNN > val_t
Definition: NNSharingSvc.h:40
FlavorTagDiscriminants::detail::NNKey
Definition: NNSharingSvc.h:18
GNNOptions.h
FlavorTagDiscriminants::detail::NNKey::operator==
bool operator==(const NNKey &) const
Definition: NNSharingSvc.cxx:17
FlavorTagDiscriminants::NNSharingSvc::get
virtual std::shared_ptr< const GNN > get(const std::string &nn_name, const GNNOptions &opts) override
Definition: NNSharingSvc.cxx:22
FlavorTagDiscriminants::NNSharingSvc
Definition: NNSharingSvc.h:32
FlavorTagDiscriminants::detail::NNHasher::operator()
std::size_t operator()(const NNKey &o) const
Definition: NNSharingSvc.h:25
FlavorTagDiscriminants::NNSharingSvc::m_gnns
std::unordered_map< detail::NNKey, val_t, detail::NNHasher > m_gnns
Definition: NNSharingSvc.h:41
INNSharingSvc.h
FlavorTagDiscriminants::detail::NNKey::path
std::string path
Definition: NNSharingSvc.h:19
GNN.h
FlavorTagDiscriminants::NNSharingSvc::m_base_gnns
std::unordered_map< std::string, val_t > m_base_gnns
Definition: NNSharingSvc.h:42
athena.opts
opts
Definition: athena.py:88