ATLAS Offline Software
TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TrigConfHLTUtils_HLTUtils
6 #define TrigConfHLTUtils_HLTUtils
7 
8 #include <string>
9 #include <inttypes.h>
10 
15 #include "CxxUtils/SimpleUpdater.h"
16 
17 namespace TrigConf {
18 
19  typedef uint32_t HLTHash;
20 
28  struct HashMap {
29  ~HashMap();
30 
31  using Name2HashMap_t = CxxUtils::ConcurrentStrMap<HLTHash, CxxUtils::SimpleUpdater>;
32  using Hash2NameMap_t = CxxUtils::ConcurrentToValMap<HLTHash, const std::string, CxxUtils::SimpleUpdater>;
33 
34  Name2HashMap_t name2hash{Name2HashMap_t::Updater_t()};
35  Hash2NameMap_t hash2name{Hash2NameMap_t::Updater_t()};
36  };
37 
39  struct HashStore {
40  ~HashStore();
41 
44  };
45 
46 
47  class HLTUtils {
48  public:
50  static HLTHash string2hash( const std::string&, const std::string& category="TE" );
52  static const std::string hash2string( HLTHash, const std::string& category="TE" );
54  static void hashes2file( const std::string& fileName="hashes2string.txt" );
56  static void file2hashes( const std::string& fileName="hashes2string.txt" );
57 
58  private:
60  inline static const std::string s_newCategory{"##NewCategory"};
61 
63  inline static HashStore s_hashStore ATLAS_THREAD_SAFE{};
64  };
65 
66 }
67 
68 #endif
TrigConf::HashMap::Hash2NameMap_t
CxxUtils::ConcurrentToValMap< HLTHash, const std::string, CxxUtils::SimpleUpdater > Hash2NameMap_t
Definition: TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:32
TrigConf::HashStore::hashCat
HashMap_t hashCat
one HashMap per category
Definition: TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:43
ConcurrentToValMap.h
Hash map from pointers/integers to arbitrary objects allowing concurrent, lockless reads.
TrigConf::HashMap::Name2HashMap_t
CxxUtils::ConcurrentStrMap< HLTHash, CxxUtils::SimpleUpdater > Name2HashMap_t
Definition: TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:31
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigConf::HashStore::~HashStore
~HashStore()
Definition: TrigConfHLTUtils/Root/HLTUtils.cxx:18
TrigConf::HLTHash
uint32_t HLTHash
Definition: TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:19
TrigConf::HashMap::~HashMap
~HashMap()
Definition: TrigConfHLTUtils/Root/HLTUtils.cxx:21
ConcurrentStrMap.h
Hash map from strings allowing concurrent, lockless reads.
TrigConf::HashMap::hash2name
Hash2NameMap_t hash2name
hash to name map
Definition: TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:35
CxxUtils::ConcurrentStrToValMap< HashMap, CxxUtils::SimpleUpdater >::Updater_t
typename Impl_t::Updater_t Updater_t
Updater object.
Definition: ConcurrentStrToValMap.h:103
TrigConf::HashMap
Two concurrent maps to store name->hash and hash->name mappings.
Definition: TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:28
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
TrigConf::HLTUtils::hashes2file
static void hashes2file(const std::string &fileName="hashes2string.txt")
debugging output of internal dictionary
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
TrigConf::HLTUtils::string2hash
static HLTHash string2hash(const std::string &, const std::string &category="TE")
hash function translating TE names into identifiers
ReweightUtils.category
category
Definition: ReweightUtils.py:15
CxxUtils::ConcurrentStrToValMap< HashMap, CxxUtils::SimpleUpdater >
TrigConf::HLTUtils::hash2string
static const std::string hash2string(HLTHash, const std::string &category="TE")
hash function translating identifiers into names (via internal dictionary)
SimpleUpdater.h
Simple (non-deleting) Updater implementation.
ConcurrentStrToValMap.h
Hash map from strings to arbitrary objects allowing concurrent, lockless reads.
TrigConf::HLTUtils::s_newCategory
static const std::string s_newCategory
In-file identifier.
Definition: TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:60
TrigConf::HLTUtils::file2hashes
static void file2hashes(const std::string &fileName="hashes2string.txt")
debugging output of internal dictionary
checker_macros.h
Define macros for attributes used to control the static checker.
TrigConf::HashStore
Store for hash maps per category.
Definition: TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:39
TrigConf::HashMap::name2hash
Name2HashMap_t name2hash
name to hash map
Definition: TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:34
TrigConf::HLTUtils::ATLAS_THREAD_SAFE
static HashStore s_hashStore ATLAS_THREAD_SAFE
Nested concurrent hash-maps to store (key=hash, value=string) pairs for different hash categories.
Definition: TrigConfHLTUtils/TrigConfHLTUtils/HLTUtils.h:63
HLTUtils
Definition: HLTUtils.py:1