16 #include <boost/functional/hash.hpp>
22 std::vector<PdgId>
flipSigns(
const std::vector<PdgId>& list) {
23 PID& pdg = PID::instance();
24 vector<PdgId> res = list;
25 for (
auto& elem : res) {
27 if( pdg.
isMeson(elem) == pdg.
isMeson(-elem) && elem != PID::PHOTON ){
36 PID& pdg = PID::instance();
44 std::vector<PdgId>
combineDaughters(
const std::vector<PdgId>& daughters,
const std::vector<PdgId>& subDaughters) {
45 vector<PdgId> res = daughters;
47 if (subDaughters.size() > 0) {
48 vector<PdgId> tmp = subDaughters;
50 res.insert(res.end(), tmp.begin(), tmp.end());
57 boost::hash_combine(seed, static_cast<int>(parent));
58 for (
auto elem : allDaughters) {
59 boost::hash_combine(seed, static_cast<int>(elem));
66 for(
auto elem: allIds) {
67 boost::hash_combine(seed, elem);
74 if (abs(static_cast<int>(a)) != abs(static_cast<int>(b))) {
75 return (abs(static_cast<int>(a)) > abs(static_cast<int>(b)));
82 PdgId aId = pdgGetter(a);
83 PdgId bId = pdgGetter(b);
PDG codes to UID functions.
bool isMeson(PdgId id) const
check whether a PDG code corresponds to a meson
std::vector< PdgId > combineDaughters(const std::vector< PdgId > &daughters, const std::vector< PdgId > &subDaughters)
combine list of codes of daughters and grandaughters (for processes which parameterise two subsequent...
bool particlesByPdg(const std::function< PdgId(const Particle &)> &pdgGetter, const Particle &a, const Particle &b)
checks whether two particles are ordered according to the PDG code ordering used in computing hashes ...
bool pdgSorter(PdgId a, PdgId b)
sorting function for PDG ids for computing hashes.
std::vector< PdgId > flipSigns(const std::vector< PdgId > &list)
return the PDG codes of the conjugate particles (itself if self-conjugate) for all the PDG codes in a...
HashId combineProcessIDs(const std::set< HashId > &allIds)
PdgId flipSign(const PdgId &id)
return the PDG code of the conjugate particle (itself if self-conjugate)
Hammer class for dealing with particle data.
Hammer particle data class.
HashId processID(PdgId parent, const std::vector< PdgId > &allDaughters)
compute a unique ID for a given process based on the PDG codes of the parent particle and the ordered...