Rivet: /Users/chrisg/software/rivet/include/Rivet/Tools/BeamConstraint.hh Source File

| Rivet 3.1.9

BeamConstraint.hh
1// -*- C++ -*-
2#ifndef RIVET_BeamConstraint_HH
3#define RIVET_BeamConstraint_HH
4
5#include "Rivet/Particle.hh"
6
7namespace Rivet {
8
9
13 inline bool compatible(PdgId p, PdgId allowed) {
14 return (allowed == PID::ANY || p == allowed);
15 }
16
20 inline bool compatible(const PdgIdPair& pair, const PdgIdPair& allowedpair) {
21 bool oneToOne = compatible(pair.first, allowedpair.first);
22 bool twoToTwo = compatible(pair.second, allowedpair.second);
23 bool oneToTwo = compatible(pair.first, allowedpair.second);
24 bool twoToOne = compatible(pair.second, allowedpair.first);
25 return (oneToOne && twoToTwo) || (oneToTwo && twoToOne);
26 }
27
28
30 inline bool compatible(const ParticlePair& ppair,
31 const PdgIdPair& allowedpair) {
32 return compatible(PID::make_pdgid_pair(ppair.first.pid(),
33 ppair.second.pid()), allowedpair);
34 }
36 inline bool compatible(const PdgIdPair& allowedpair,
37 const ParticlePair& ppair) {
38 return compatible(ppair, allowedpair);
39 }
40
41
44 inline bool compatible(const PdgIdPair& pair, const set<PdgIdPair>& allowedpairs) {
45 for (set<PdgIdPair>::const_iterator bp = allowedpairs.begin(); bp != allowedpairs.end(); ++bp) {
46 if (compatible(pair, *bp)) return true;
47 }
48 return false;
49 }
50
52 inline set<PdgIdPair> intersection(const set<PdgIdPair>& a, const set<PdgIdPair>& b) {
53 set<PdgIdPair> ret;
54 for (set<PdgIdPair>::const_iterator bp = a.begin(); bp != a.end(); ++bp) {
55 if (compatible(*bp, b)) ret.insert(*bp);
56 }
57 return ret;
58 }
59
60
61}
62
63#endif
Rivet::Kin::p
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:684
Rivet
Definition MC_Cent_pPb.hh:10
Rivet::ParticlePair
std::pair< Particle, Particle > ParticlePair
Typedef for a pair of Particle objects.
Definition Particle.hh:42
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:52
Rivet::compatible
bool compatible(PdgId p, PdgId allowed)
Definition BeamConstraint.hh:13