BeamConstraint.hh
// -*- C++ -*-
#ifndef RIVET_BeamConstraint_HH
#define RIVET_BeamConstraint_HH
#include "Rivet/Rivet.hh"
#include "Rivet/ParticleName.hh"
#include "Rivet/Particle.hh"
#include <iostream>
namespace Rivet {
inline bool compatible(PdgId p, PdgId allowed) {
//assert(p != ANY);
return (allowed == ANY || p == allowed);
}
inline bool compatible(const PdgIdPair& pair, const PdgIdPair& allowedpair) {
bool oneToOne = compatible(pair.first, allowedpair.first);
bool twoToTwo = compatible(pair.second, allowedpair.second);
bool oneToTwo = compatible(pair.first, allowedpair.second);
bool twoToOne = compatible(pair.second, allowedpair.first);
return (oneToOne && twoToTwo) || (oneToTwo && twoToOne);
}
inline bool compatible(const ParticlePair& ppair,
const PdgIdPair& allowedpair) {
return compatible(make_pdgid_pair(ppair.first.pdgId(),
ppair.second.pdgId()), allowedpair);
}
inline bool compatible(const PdgIdPair& allowedpair,
const ParticlePair& ppair) {
return compatible(ppair, allowedpair);
}
inline bool compatible(const PdgIdPair& pair, const set<PdgIdPair>& allowedpairs) {
for (set<PdgIdPair>::const_iterator bp = allowedpairs.begin(); bp != allowedpairs.end(); ++bp) {
if (compatible(pair, *bp)) return true;
}
return false;
}
inline set<PdgIdPair> intersection(const set<PdgIdPair>& a, const set<PdgIdPair>& b) {
set<PdgIdPair> ret;
for (set<PdgIdPair>::const_iterator bp = a.begin(); bp != a.end(); ++bp) {
if (compatible(*bp, b)) ret.insert(*bp);
}
return ret;
}
}
#endif
Rivet::PdgId
int PdgId
Typedef for a PDG ID code.
Definition: Particle.fhh:29
Rivet::intersection
set< PdgIdPair > intersection(const set< PdgIdPair > &a, const set< PdgIdPair > &b)
Return the intersection of two sets of {PdgIdPair}s.
Definition: BeamConstraint.hh:56
Rivet::ParticlePair
std::pair< Particle, Particle > ParticlePair
Typedef for a pair of Particle objects.
Definition: Particle.fhh:20
Rivet::PdgIdPair
std::pair< PdgId, PdgId > PdgIdPair
Typedef for a pair of particle names.
Definition: Particle.fhh:32
Rivet::compatible
bool compatible(PdgId p, PdgId allowed)
Definition: BeamConstraint.hh:16
Rivet::make_pdgid_pair
std::pair< PdgId, PdgId > make_pdgid_pair(PdgId a, PdgId b)
Convenience maker of particle ID pairs from PdgIds.
Definition: ParticleName.hh:154