Loading [MathJax]/extensions/tex2jax.js
hej is hosted by Hepforge, IPPP Durham
HEJ  2.3.0
High energy resummation for hadron colliders
Particle.hh
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include <optional>
12 #include <utility>
13 #include <vector>
14 
15 #include "boost/rational.hpp"
16 #include "fastjet/PseudoJet.hh"
17 
18 #include "HEJ/PDG_codes.hh"
19 
20 namespace HEJ {
21 
22  using Colour = std::pair<int,int>;
23 
25  struct Particle {
29  fastjet::PseudoJet p;
31  std::optional<Colour> colour;
32 
34  double rapidity() const{
35  return p.rapidity();
36  }
38  double perp() const{
39  return p.perp();
40  }
42  double pt() const{
43  return perp();
44  }
46  double px() const{
47  return p.px();
48  }
50  double py() const{
51  return p.py();
52  }
54  double pz() const{
55  return p.pz();
56  }
58  double E() const{
59  return p.E();
60  }
62  double m() const{
63  return p.m();
64  }
65  };
66 
68 
74  struct rapidity_less{
75  template<class FourVector>
76  bool operator()(FourVector const & p1, FourVector const & p2){
77  return p1.rapidity() < p2.rapidity();
78  }
79  };
80 
82 
88  struct pz_less{
89  template<class FourVector>
90  bool operator()(FourVector const & p1, FourVector const & p2){
91  return p1.pz() < p2.pz();
92  }
93  };
94 
96  inline
97  std::vector<fastjet::PseudoJet> to_PseudoJet(
98  std::vector<Particle> const & v
99  ){
100  std::vector<fastjet::PseudoJet> result;
101  result.reserve(v.size());
102  for(auto && sp: v) result.emplace_back(sp.p);
103  return result;
104  }
105 
107 
111  struct type_less{
112  template<class Particle>
113  bool operator()(Particle const & p1, Particle const & p2){
114  return p1.type < p2.type;
115  }
116  };
117 
119  inline
120  constexpr bool is_antiparticle(Particle const & p){
121  return is_antiparticle(p.type);
122  }
123 
125  inline
126  constexpr bool is_parton(Particle const & p){
127  return is_parton(p.type);
128  }
129 
131  inline
132  constexpr bool is_quark(Particle const & p){
133  return is_quark(p.type);
134  }
135 
137  inline
138  constexpr bool is_antiquark(Particle const & p){
139  return is_antiquark(p.type);
140  }
141 
143  inline
144  constexpr bool is_anyquark(Particle const & p){
145  return is_anyquark(p.type);
146  }
147 
153  inline
154  constexpr bool is_lepton(Particle const & p){
155  return is_lepton(p.type);
156  }
157 
163  inline
164  constexpr bool is_antilepton(Particle const & p){
165  return is_antilepton(p.type);
166  }
167 
173  inline
174  constexpr bool is_anylepton(Particle const & p){
175  return is_anylepton(p.type);
176  }
177 
183  inline
184  constexpr bool is_neutrino(Particle const & p){
185  return is_neutrino(p.type);
186  }
187 
193  inline
194  constexpr bool is_antineutrino(Particle const & p){
195  return is_antineutrino(p.type);
196  }
197 
203  inline
204  constexpr bool is_anyneutrino(Particle const & p){
205  return is_anyneutrino(p.type);
206  }
207 
209  inline
210  constexpr bool is_massless(Particle const & p){
211  return is_massless(p.type);
212  }
213 
215  inline
216  constexpr bool is_massive(Particle const & p){
217  return is_massive(p.type);
218  }
219 
225  inline
226  constexpr bool is_charged_lepton(Particle const & p){
227  return is_charged_lepton(p.type);
228  }
229 
235  inline
236  constexpr bool is_charged_antilepton(Particle const & p){
237  return is_charged_antilepton(p.type);
238  }
239 
245  inline
246  constexpr bool is_charged_anylepton(Particle const & p){
247  return is_charged_anylepton(p.type);
248  }
249 
251  inline
252  constexpr bool is_AWZ_boson(Particle const & particle){
253  return is_AWZ_boson(particle.type);
254  }
255 
257  inline
258  constexpr bool is_AWZH_boson(Particle const & particle){
259  return is_AWZH_boson(particle.type);
260  }
261 
263  inline
264  std::vector<Particle> filter_partons(
265  std::vector<Particle> const & v
266  ){
267  std::vector<Particle> result;
268  result.reserve(v.size());
269  std::copy_if(
270  begin(v), end(v), std::back_inserter(result),
271  [](Particle const & p){ return is_parton(p); }
272  );
273  return result;
274  }
275 
277  inline
278  std::vector<Particle> filter_AWZH_bosons(
279  std::vector<Particle> const & v
280  ){
281  std::vector<Particle> result;
282  std::copy_if(
283  begin(v), end(v), std::back_inserter(result),
284  [](Particle const & p){ return is_AWZH_boson(p); }
285  );
286  return result;
287  }
288 
290  boost::rational<int> charge(Particle const & p);
291 
292 } // namespace HEJ
Contains the Particle IDs of all relevant SM particles.
ParticleID
The possible particle identities. We use PDG IDs as standard.
Definition: PDG_codes.hh:25
@ unspecified
Unspecified type, should never be used!, debug only.
Definition: PDG_codes.hh:27
@ p
Definition: PDG_codes.hh:88
Main HEJ 2 Namespace.
Definition: mainpage.dox:1
constexpr bool is_antiparticle(Particle const &p)
Check if the argument is an antiparticle.
Definition: Particle.hh:120
constexpr bool is_antineutrino(Particle const &p)
Function to determine if particle is an antineutrino.
Definition: Particle.hh:194
constexpr bool is_parton(Particle const &p)
Check if a particle is a parton, i.e. quark, antiquark, or gluon.
Definition: Particle.hh:126
constexpr bool is_antiquark(Particle const &p)
Check if a particle is an anti-quark.
Definition: Particle.hh:138
std::pair< int, int > Colour
Definition: Particle.hh:22
constexpr bool is_lepton(Particle const &p)
Function to determine if particle is a lepton.
Definition: Particle.hh:154
constexpr bool is_quark(Particle const &p)
Check if a particle is a quark.
Definition: Particle.hh:132
constexpr bool is_anylepton(Particle const &p)
Function to determine if particle is an (anti-)lepton.
Definition: Particle.hh:174
fastjet::PseudoJet to_PseudoJet(CLHEP::HepLorentzVector const &mom)
Definition: LorentzVector.hh:88
constexpr bool is_anyneutrino(Particle const &p)
Function to determine if particle is an (anti-)neutrino.
Definition: Particle.hh:204
boost::rational< int > charge(Particle const &p)
Particle electric charge.
constexpr bool is_charged_antilepton(Particle const &p)
Function to determine if particle is a charged lepton.
Definition: Particle.hh:236
constexpr bool is_AWZH_boson(Particle const &particle)
Check if a particle is a photon, W, Z, or Higgs boson.
Definition: Particle.hh:258
std::vector< Particle > filter_partons(std::vector< Particle > const &v)
Extract all partons from a vector of particles.
Definition: Particle.hh:264
constexpr bool is_charged_anylepton(Particle const &p)
Function to determine if particle is a charged lepton or charged antilepton.
Definition: Particle.hh:246
constexpr bool is_massless(Particle const &p)
Check if a particle is massless.
Definition: Particle.hh:210
constexpr bool is_antilepton(Particle const &p)
Function to determine if particle is an antilepton.
Definition: Particle.hh:164
constexpr bool is_charged_lepton(Particle const &p)
Function to determine if particle is a charged lepton.
Definition: Particle.hh:226
constexpr bool is_neutrino(Particle const &p)
Function to determine if particle is a neutrino.
Definition: Particle.hh:184
constexpr bool is_massive(Particle const &p)
Check if a particle is massive.
Definition: Particle.hh:216
std::vector< Particle > filter_AWZH_bosons(std::vector< Particle > const &v)
Extract all AWZH bosons from a vector of particles.
Definition: Particle.hh:278
constexpr bool is_anyquark(Particle const &p)
Check if a particle is a quark or anit-quark.
Definition: Particle.hh:144
constexpr bool is_AWZ_boson(Particle const &particle)
Check if a particle is a photon, W or Z boson.
Definition: Particle.hh:252
Class representing a particle.
Definition: Particle.hh:25
double rapidity() const
get rapidity
Definition: Particle.hh:34
double py() const
get momentum in y direction
Definition: Particle.hh:50
fastjet::PseudoJet p
particle momentum
Definition: Particle.hh:29
double px() const
get momentum in x direction
Definition: Particle.hh:46
std::optional< Colour > colour
(optional) colour & anti-colour
Definition: Particle.hh:31
double E() const
get energy
Definition: Particle.hh:58
ParticleID type
particle type
Definition: Particle.hh:27
double pz() const
get momentum in z direction
Definition: Particle.hh:54
double m() const
get mass
Definition: Particle.hh:62
double perp() const
get transverse momentum
Definition: Particle.hh:38
double pt() const
get transverse momentum
Definition: Particle.hh:42
Functor to compare momenta in z direction.
Definition: Particle.hh:88
bool operator()(FourVector const &p1, FourVector const &p2)
Definition: Particle.hh:90
Functor to compare rapidities.
Definition: Particle.hh:74
bool operator()(FourVector const &p1, FourVector const &p2)
Definition: Particle.hh:76
Functor to compare particle type (PDG)
Definition: Particle.hh:111
bool operator()(Particle const &p1, Particle const &p2)
Definition: Particle.hh:113