CbmRoot
Loading...
Searching...
No Matches
CaToolsLinkKey.h
Go to the documentation of this file.
1/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
10#ifndef CaToolsLinkKey_h
11#define CaToolsLinkKey_h 1
12
13#include "CaToolsDef.h"
14
15#include <boost/functional/hash.hpp>
16
17namespace cbm::ca::tools
18{
19 struct LinkKey {
24 LinkKey(int index, int event, int file) : fIndex(index), fEvent(event), fFile(file) {}
25
27 friend bool operator==(const LinkKey& lhs, const LinkKey& rhs)
28 {
29 return lhs.fFile == rhs.fFile && lhs.fEvent == rhs.fEvent && lhs.fIndex == rhs.fIndex;
30 }
31
35 };
36} // namespace cbm::ca::tools
37
38namespace std
39{
41 template<>
42 struct hash<cbm::ca::tools::LinkKey> {
43 std::size_t operator()(const cbm::ca::tools::LinkKey& key) const
44 {
45 std::size_t res = 0;
46 boost::hash_combine(res, key.fFile);
47 boost::hash_combine(res, key.fEvent);
48 boost::hash_combine(res, key.fIndex);
49 return res;
50 }
51 };
52} // namespace std
53
54#endif // CaToolsLinkKey_h
Definitions for ca::tools namespace.
constexpr int Undef< int >
Definition CaDefs.h:113
Hash for CbmL1LinkKey.
int fEvent
Index of MC event.
LinkKey(int index, int event, int file)
int fFile
Index of MC file.
int fIndex
Index of MC point/track in external data structures.
friend bool operator==(const LinkKey &lhs, const LinkKey &rhs)
Comparison operator.
std::size_t operator()(const cbm::ca::tools::LinkKey &key) const