rivet is hosted by Hepforge, IPPP Durham
Rivet  2.7.0
BeamConstraint.hh
1 // -*- C++ -*-
2 #ifndef RIVET_BeamConstraint_HH
3 #define RIVET_BeamConstraint_HH
4 
5 #include "Rivet/Particle.hh"
6 
7 namespace 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
Definition: ALICE_2010_I880049.cc:13
set< PdgIdPair > intersection(const set< PdgIdPair > &a, const set< PdgIdPair > &b)
Return the intersection of two sets of {PdgIdPair}s.
Definition: BeamConstraint.hh:52
bool compatible(PdgId p, PdgId allowed)
Definition: BeamConstraint.hh:13