ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
JetTagging
FlavorTagInference
src
hash.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
// Common file for a few small hashing helpers to store things in
6
// std::unordered_*
7
8
#ifndef FTAG_HASH_H
9
#define FTAG_HASH_H
10
11
namespace
FlavorTagInference
{
12
13
template
<
typename
T>
14
std::size_t
getHash
(
const
T& obj) {
15
return
std::hash<T>{}(obj);
16
}
17
18
// stolen from https://stackoverflow.com/a/27952689
19
//
20
// it doesn't have to be good, this isn't called much
21
//
22
inline
size_t
combine
(
size_t
lhs,
size_t
rhs ) {
23
lhs ^= rhs + 0x517cc1b727220a95 + (lhs << 6) + (lhs >> 2);
24
return
lhs;
25
}
26
namespace
NNHashing
{
27
struct
NNKey
{
28
std::string
path
;
29
GNNOptions
opts
;
30
bool
operator==
(
const
NNKey
& key)
const
{
31
return
path
== key.path &&
opts
== key.opts;
32
}
33
std::size_t
hash
()
const
{
34
return
combine
(
getHash
(
path
),
getHash
(
opts
));
35
}
36
};
37
38
struct
NNHasher
{
39
std::size_t
operator()
(
const
NNKey
& o)
const
{
40
return
o.
hash
();
41
}
42
};
43
}
44
}
45
46
#endif
FlavorTagInference::NNHashing
Definition
hash.h:26
FlavorTagInference
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition
CaloClusterLoader.h:27
FlavorTagInference::combine
size_t combine(size_t lhs, size_t rhs)
Definition
hash.h:22
FlavorTagInference::getHash
std::size_t getHash(const T &obj)
Definition
hash.h:14
FlavorTagInference::GNNOptions
Definition
GNNOptions.h:15
FlavorTagInference::NNHashing::NNHasher
Definition
hash.h:38
FlavorTagInference::NNHashing::NNHasher::operator()
std::size_t operator()(const NNKey &o) const
Definition
hash.h:39
FlavorTagInference::NNHashing::NNKey
Definition
hash.h:27
FlavorTagInference::NNHashing::NNKey::operator==
bool operator==(const NNKey &key) const
Definition
hash.h:30
FlavorTagInference::NNHashing::NNKey::hash
std::size_t hash() const
Definition
hash.h:33
FlavorTagInference::NNHashing::NNKey::opts
GNNOptions opts
Definition
hash.h:29
FlavorTagInference::NNHashing::NNKey::path
std::string path
Definition
hash.h:28
Generated on
for ATLAS Offline Software by
1.16.1