Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F8724072
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Subscribers
None
View Options
diff --git a/include/RHEJ/PDG_codes.hh b/include/RHEJ/PDG_codes.hh
index b01c690..3c153e2 100644
--- a/include/RHEJ/PDG_codes.hh
+++ b/include/RHEJ/PDG_codes.hh
@@ -1,124 +1,133 @@
/** \file PDG_codes.hh
* \brief Contains the Particle IDs of all relevant SM particles.
*
* Large enumeration included which has multiple entries for potential
* alternative names of different particles. There are also functions
* which can be used to determine if a particle is a parton or if
* it is a non-gluon boson.
*/
#pragma once
namespace RHEJ {
//! particle ids according to PDG
namespace pid {
//! The possible particle identities. We use PDG IDs as standard.
enum ParticleID{
d = 1, /*!< Down Quark */
down = d, /*!< Down Quark */
u = 2, /*!< Up Quark */
up = u, /*!< Up Quark */
s = 3, /*!< Strange Quark */
strange = s, /*!< Strange Quark */
c = 4, /*!< Charm Quark */
charm = c, /*!< Charm Quark */
b = 5, /*!< Bottom Quark */
bottom = b, /*!< Bottom Quark */
t = 6, /*!< Top Quark */
top = t, /*!< Top Quark */
e = 11, /*!< Electron */
electron = e, /*!< Electron */
nu_e = 12, /*!< Electron Neutrino */
electron_neutrino = nu_e, /*!< Electron neutrino */
mu = 13, /*!< Muon */
muon = mu, /*!< Muon */
nu_mu = 14, /*!< Muon Neutrino */
muon_neutrino = nu_mu, /*!< Muon Neutrino */
tau = 15, /*!< Tau */
nu_tau = 16, /*!< Tau Neutrino */
tau_neutrino = nu_tau, /*!< Tau Neutrino */
d_bar = -d, /*!< Anti-Down Quark */
u_bar = -u, /*!< Anti-Up quark */
s_bar = -s, /*!< Anti-Strange Quark */
c_bar = -c, /*!< Anti-Charm Quark */
b_bar = -b, /*!< Anti-Bottom Quark */
t_bar = -t, /*!< Anti-Top Quark */
e_bar = -e, /*!< Positron */
nu_e_bar = -nu_e, /*!< Anti-Electron Neutrino */
mu_bar = -mu, /*!< Anti-Muon */
nu_mu_bar = -nu_mu, /*!< Anti-Muon Neutrino */
tau_bar = -tau, /*!< Anti-Tau */
nu_tau_bar = -nu_tau, /*!< Anti-Tau Neutrino */
gluon = 21, /*!< Gluon */
g = gluon, /*!< Gluon */
photon = 22, /*!< Photon */
gamma = photon, /*!< Photon */
Z = 23, /*!< Z Boson */
Wp = 24, /*!< W- Boson */
Wm = -Wp, /*!< W+ Boson */
h = 25, /*!< Higgs Boson */
Higgs = h, /*!< Higgs Boson */
higgs = h, /*!< Higgs Boson */
p = 2212, /*!< Proton */
proton = p, /*!< Proton */
p_bar = -p, /*!< Anti-Proton */
};
}
using ParticleID = pid::ParticleID;
/**
* \brief Function to determine if particle is a parton
* @param p PDG ID of particle
* @returns true if the particle is a parton, false otherwise
*/
inline
constexpr bool is_parton(ParticleID p){
return p == pid::gluon || std::abs(p) <= pid::top;
}
/**
* \brief function to determine if the particle is a photon, W, Z, or Higgs boson
* @param id PDG ID of particle
* @returns true if the partice is a A,W,Z, or H, false otherwise
*/
inline
constexpr bool is_AWZH_boson(ParticleID id){
return id == pid::Wm || (id >= pid::photon && id <= pid::Higgs);
}
/**
- * \brief Function to determine if particle is a parton
- * @param p PDG ID of particle
+ * \brief Function to determine if particle is a quark
+ * @param id PDG ID of particle
* @returns true if the particle is a qaurk, false otherwise
*/
inline
- constexpr bool is_quark(ParticleID p){
- return (p >= pid::down && p <= pid::top);
+ constexpr bool is_quark(ParticleID id){
+ return (id >= pid::down && id <= pid::top);
}
/**
- * \brief Function to determine if particle is a parton
- * @param p PDG ID of particle
+ * \brief Function to determine if particle is a antiquark
+ * @param id PDG ID of particle
* @returns true if the particle is an antiquark, false otherwise
*/
inline
- constexpr bool is_antiquark(ParticleID p){
- return (p <= pid::d_bar && p >= pid::t_bar);
+ constexpr bool is_antiquark(ParticleID id){
+ return (id <= pid::d_bar && id >= pid::t_bar);
}
+ /**
+ * \brief Function to determine if particle is a (anti-)quark
+ * @param id PDG ID of particle
+ * @returns true if the particle is a quark or antiquark, false otherwise
+ */
+ inline
+ constexpr bool is_anyquark(ParticleID id){
+ return (id && id >= pid::t_bar && id <= pid::t);
+ }
/**
* \brief function to determine if the particle is a photon, W or Z
* @param id PDG ID of particle
* @returns true if the partice is a A,W,Z, or H, false otherwise
*/
inline
constexpr bool is_AWZ_boson(ParticleID id){
return id == pid::Wm || (id >= pid::photon && id <= pid::Wp);
}
}
diff --git a/include/RHEJ/utility.hh b/include/RHEJ/utility.hh
index 4e44556..440af2f 100644
--- a/include/RHEJ/utility.hh
+++ b/include/RHEJ/utility.hh
@@ -1,215 +1,221 @@
/**
* \file
* \brief Contains various utilities
*/
#pragma once
#include <algorithm>
#include <cassert>
#include <boost/core/demangle.hpp>
// FastJet Includes
#include "fastjet/PseudoJet.hh"
#include "fastjet/ClusterSequence.hh"
#include "RHEJ/PDG_codes.hh"
namespace RHEJ{
//! Class representing a particle
struct Particle {
//! particle type
ParticleID type;
//! particle momentum
fastjet::PseudoJet p;
//! get rapidity
double rapidity() const{
return p.rapidity();
}
//! get transverse momentum
double perp() const{
return p.perp();
}
//! get momentum in x direction
double px() const{
return p.px();
}
//! get momentum in y direction
double py() const{
return p.py();
}
//! get momentum in z direction
double pz() const{
return p.pz();
}
//! get energy
double E() const{
return p.E();
}
//! get mass
double m() const{
return p.m();
}
};
//! Functor to compare rapidities
/**
* This can be used whenever a rapidity comparison function is needed,
* for example in many standard library functions.
*
* @see pz_less
*/
struct rapidity_less{
template<class FourVector>
bool operator()(FourVector const & p1, FourVector const & p2){
return p1.rapidity() < p2.rapidity();
}
};
//! Functor to compare momenta in z direction
/**
* This can be used whenever a pz comparison function is needed,
* for example in many standard library functions.
*
* @see rapidity_less
*/
struct pz_less{
template<class FourVector>
bool operator()(FourVector const & p1, FourVector const & p2){
return p1.pz() < p2.pz();
}
};
//! Convert a vector of Particles to a vector of particle momenta
inline
std::vector<fastjet::PseudoJet> to_PseudoJet(
std::vector<Particle> const & v
){
std::vector<fastjet::PseudoJet> result;
for(auto && sp: v) result.emplace_back(sp.p);
return result;
}
//! Check if a particle is a parton, i.e. quark, antiquark, or gluon
inline
bool is_parton(Particle const & p){
return is_parton(p.type);
}
//! Check if a particle is a quark
inline
bool is_quark(Particle const & p){
return is_quark(p.type);
}
//! Check if a particle is an anti-quark
inline
bool is_antiquark(Particle const & p){
return is_antiquark(p.type);
}
+ //! Check if a particle is a quark or anit-quark
+ inline
+ bool is_anyquark(Particle const & p){
+ return is_anyquark(p.type);
+ }
+
//! Check if a particle is a photon, W or Z boson
inline bool is_AWZ_boson(Particle const & particle){
return is_AWZ_boson(particle.type);
}
//! Check if a particle is a photon, W, Z, or Higgs boson
inline bool is_AWZH_boson(Particle const & particle){
return is_AWZH_boson(particle.type);
}
//! Extract all partons from a vector of particles
inline
std::vector<Particle> filter_partons(
std::vector<Particle> const & v
){
std::vector<Particle> result;
result.reserve(v.size());
std::copy_if(
begin(v), end(v), std::back_inserter(result),
[](Particle const & p){ return is_parton(p); }
);
return result;
}
//! Create a std::unique_ptr to a T object
/**
* For non-array types this works like std::make_unique,
* which is not available under C++11
*/
template<class T, class... Args>
std::unique_ptr<T> make_unique(Args&&... a){
return std::unique_ptr<T>{new T{std::forward<Args>(a)...}};
}
//! Create an array containing the passed arguments
template<typename T, typename... U>
constexpr
std::array<T, 1 + sizeof...(U)> make_array(T t, U&&... rest){
return {{t, std::forward<U>(rest)...}};
}
inline
std::string join(
std::string const & /* delim */, std::string const & str
){
return str;
}
//! Join strings with a delimiter
/**
* @param delim Delimiter to be put between consecutive strings
* @param first First string
* @param second Second string
* @param rest Remaining strings
*/
template<typename... Strings>
std::string join(
std::string const & delim,
std::string const & first, std::string const & second,
Strings&&... rest
){
return join(delim, first + delim + second, std::forward<Strings>(rest)...);
}
//! Return the name of the argument's type
template<typename T>
std::string type_string(T&&){
return boost::core::demangle(typeid(T).name());
}
//! Eliminate compiler warnings for unused variables
template<typename... T>
constexpr void ignore(T&&...) {}
//! Check whether two doubles are closer than ep > 0 to each other
inline
bool nearby_ep(double a, double b, double ep){
assert(ep > 0);
return std::abs(a-b) < ep;
}
//! Check whether all components of two PseudoJets are closer than ep to each other
inline
bool nearby_ep(
fastjet::PseudoJet const & pa, fastjet::PseudoJet const & pb,
double ep
){
assert(ep > 0);
for(size_t i = 0; i < 4; ++i){
if(!nearby_ep(pa[i], pb[i], ep)) return false;
}
return true;
}
inline
bool nearby(
fastjet::PseudoJet const & pa, fastjet::PseudoJet const & pb, double const norm = 1.
){
return nearby_ep(pa, pb, 1e-7*norm);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Jan 20, 10:26 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4242644
Default Alt Text
(11 KB)
Attached To
rHEJ HEJ
Event Timeline
Log In to Comment