GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Key.h
Go to the documentation of this file.
1 #ifndef _EVTLIB_KEY_H_
2 #define _EVTLIB_KEY_H_
3 
4 #include <ostream>
5 
6 #include <tuple> // for std::make_tuple()
7 
8 namespace genie{
9 namespace evtlib{
10 
11 struct Key
12 {
13  Key(int _nucl_pdg, int _nu_pdg, bool _iscc)
14  : nucl_pdg(_nucl_pdg), nu_pdg(_nu_pdg), iscc(_iscc) {}
15 
16  bool operator<(const Key& k) const
17  {
18  return (std::make_tuple( nucl_pdg, nu_pdg, iscc) <
19  std::make_tuple(k.nucl_pdg, k.nu_pdg, k.iscc));
20  }
21 
22  friend std::ostream& operator<<(std::ostream& os, const Key& k)
23  {
24  os << k.nu_pdg << " on " << k.nucl_pdg << " " << " via " << (k.iscc ? "CC" : "NC");
25  return os;
26  }
27 
28  int nucl_pdg;
29  int nu_pdg;
30  bool iscc;
31 };
32 
33 }} // namespaces
34 
35 #endif
Key(int _nucl_pdg, int _nu_pdg, bool _iscc)
Definition: Key.h:13
bool operator<(const Key &k) const
Definition: Key.h:16
friend std::ostream & operator<<(std::ostream &os, const Key &k)
Definition: Key.h:22
int nucl_pdg
Definition: Key.h:28