Page MenuHomeHEPForge

No OneTemporary

diff --git a/FixedOrderGen/src/config.cc b/FixedOrderGen/src/config.cc
index 9030ab7..5c367f7 100644
--- a/FixedOrderGen/src/config.cc
+++ b/FixedOrderGen/src/config.cc
@@ -1,439 +1,439 @@
/**
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019-2020
* \copyright GPLv2 or later
*/
#include "config.hh"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <stdexcept>
#include "HEJ/exceptions.hh"
#include "HEJ/PDG_codes.hh"
#include "HEJ/YAMLreader.hh"
#include "Subleading.hh"
namespace HEJFOG{
using HEJ::set_from_yaml;
using HEJ::set_from_yaml_if_defined;
using HEJ::pid::ParticleID;
namespace{
//! Get YAML tree of supported options
/**
* The configuration file is checked against this tree of options
* in assert_all_options_known.
*/
YAML::Node const & get_supported_options(){
const static YAML::Node supported = [](){
YAML::Node supported;
static const auto opts = {
"process", "events", "subleading fraction","subleading channels",
"scales", "scale factors", "max scale ratio", "pdf", "vev",
"event output", "analyses", "analysis", "import scales"
};
// add subnodes to "supported" - the assigned value is irrelevant
for(auto && opt: opts) supported[opt] = "";
for(auto && jet_opt: {"min pt", "peak pt", "algorithm", "R", "max rapidity"}){
supported["jets"][jet_opt] = "";
}
for(auto && particle_type: {"Higgs", "W", "Z"}){
for(auto && particle_opt: {"mass", "width"}){
supported["particle properties"][particle_type][particle_opt] = "";
}
}
for(auto && particle_type: {"Higgs", "Wp", "W+", "Wm", "W-", "Z"}){
for(auto && particle_opt: {"into", "branching ratio"}){
supported["decays"][particle_type][particle_opt] = "";
}
}
for(auto && opt: {"mt", "use impact factors", "include bottom", "mb"}){
supported["Higgs coupling"][opt] = "";
}
for(auto && beam_opt: {"energy", "particles"}){
supported["beam"][beam_opt] = "";
}
for(auto && unweight_opt: {"sample size", "max deviation"}){
supported["unweight"][unweight_opt] = "";
}
for(auto && opt: {"name", "seed"}){
supported["random generator"][opt] = "";
}
return supported;
}();
return supported;
}
JetParameters get_jet_parameters(
YAML::Node const & node, std::string const & entry
){
const auto p = HEJ::get_jet_parameters(node, entry);
JetParameters result;
result.def = p.def;
result.min_pt = p.min_pt;
set_from_yaml(result.max_y, node, entry, "max rapidity");
set_from_yaml_if_defined(result.peak_pt, node, entry, "peak pt");
if(result.peak_pt && *result.peak_pt <= result.min_pt)
throw std::invalid_argument{
"Value of option 'peak pt' has to be larger than 'min pt'."
};
return result;
}
Beam get_Beam(
YAML::Node const & node, std::string const & entry
){
Beam beam;
std::vector<HEJ::ParticleID> particles;
set_from_yaml(beam.energy, node, entry, "energy");
set_from_yaml_if_defined(particles, node, entry, "particles");
if(! particles.empty()){
for(HEJ::ParticleID particle: particles){
if(particle != HEJ::pid::p && particle != HEJ::pid::p_bar){
throw std::invalid_argument{
"Unsupported value in option " + entry + ": particles:"
" only proton ('p') and antiproton ('p_bar') beams are supported"
};
}
}
if(particles.size() != 2){
throw std::invalid_argument{"Not exactly two beam particles"};
}
beam.particles.front() = particles.front();
beam.particles.back() = particles.back();
}
return beam;
}
std::vector<std::string> split(
std::string const & str, std::string const & delims
){
std::vector<std::string> result;
for(size_t begin, end = 0; end != str.npos;){
begin = str.find_first_not_of(delims, end);
if(begin == str.npos) break;
end = str.find_first_of(delims, begin + 1);
result.emplace_back(str.substr(begin, end - begin));
}
return result;
}
std::invalid_argument invalid_incoming(std::string const & what){
return std::invalid_argument{
"Incoming particle type " + what + " not supported,"
" incoming particles have to be 'p', 'p_bar' or partons"
};
}
std::invalid_argument invalid_outgoing(std::string const & what){
return std::invalid_argument{
"Outgoing particle type " + what + " not supported,"
" outgoing particles have to be 'j', 'photon', 'H', 'Wm', 'Wp', 'e-', 'e+', 'nu_e', 'nu_e_bar'"
};
}
HEJ::ParticleID reconstruct_boson_id(
std::vector<HEJ::ParticleID> const & ids
){
assert(ids.size()==2);
const int pidsum = ids[0] + ids[1];
if(pidsum == +1) {
assert(HEJ::is_antilepton(ids[0]));
if(HEJ::is_antineutrino(ids[0])) {
throw HEJ::not_implemented{"lepton-flavour violating final state"};
}
assert(HEJ::is_neutrino(ids[1]));
// charged antilepton + neutrino means we had a W+
return HEJ::pid::Wp;
}
if(pidsum == -1) {
assert(HEJ::is_antilepton(ids[0]));
if(HEJ::is_neutrino(ids[1])) {
throw HEJ::not_implemented{"lepton-flavour violating final state"};
}
assert(HEJ::is_antineutrino(ids[0]));
// charged lepton + antineutrino means we had a W-
return HEJ::pid::Wm;
}
throw HEJ::not_implemented{
- "final state with leptons "+HEJ::name(ids[0])+" and "+HEJ::name(ids[1])
+ "final state with leptons "+name(ids[0])+" and "+name(ids[1])
+" not supported"
};
}
Process get_process(
YAML::Node const & node, std::string const & entry
){
Process result;
std::string process_string;
set_from_yaml(process_string, node, entry);
assert(! process_string.empty());
const auto particles = split(process_string, " \n\t\v=>");
if(particles.size() < 3){
throw std::invalid_argument{
"Bad format in option process: '" + process_string
+ "', expected format is 'in1 in2 => out1 ...'"
};
}
result.incoming.front() = HEJ::to_ParticleID(particles[0]);
result.incoming.back() = HEJ::to_ParticleID(particles[1]);
for(size_t i = 0; i < result.incoming.size(); ++i){
const HEJ::ParticleID in = result.incoming[i];
if(
in != HEJ::pid::proton && in != HEJ::pid::p_bar
&& !HEJ::is_parton(in)
){
throw invalid_incoming(particles[i]);
}
}
result.njets = 0;
for(size_t i = result.incoming.size(); i < particles.size(); ++i){
assert(! particles[i].empty());
if(particles[i] == "j") ++result.njets;
else if(std::isdigit(particles[i].front())
&& particles[i].back() == 'j')
result.njets += std::stoi(particles[i]);
else{
const auto pid = HEJ::to_ParticleID(particles[i]);
if(pid==HEJ::pid::Higgs || pid==HEJ::pid::Wp || pid==HEJ::pid::Wm){
if(result.boson)
throw std::invalid_argument{
"More than one outgoing boson is not supported"
};
if(!result.boson_decay.empty())
throw std::invalid_argument{
"Production of a boson together with a lepton is not supported"
};
result.boson = pid;
} else if (HEJ::is_anylepton(pid)){
// Do not accept more leptons, if two leptons are already mentioned
if( result.boson_decay.size()>=2 )
throw std::invalid_argument{"Too many leptons provided"};
if(result.boson)
throw std::invalid_argument{
"Production of a lepton together with a boson is not supported"
};
result.boson_decay.emplace_back(pid);
} else {
throw invalid_outgoing(particles[i]);
}
}
}
if(result.njets < 2){
throw std::invalid_argument{
"Process has to include at least two jets ('j')"
};
}
if(!result.boson_decay.empty()){
std::sort(begin(result.boson_decay),end(result.boson_decay));
assert(!result.boson);
result.boson = reconstruct_boson_id(result.boson_decay);
}
return result;
}
HEJFOG::Subleading to_subleading_channel(YAML::Node const & yaml){
std::string name;
using namespace HEJFOG::channels;
set_from_yaml(name, yaml);
if(name == "none")
return none;
if(name == "all")
return all;
if(name == "unordered" || name == "uno")
return uno;
if(name == "qqx")
return qqx;
throw HEJ::unknown_option("Unknown subleading channel '"+name+"'");
}
unsigned int get_subleading_channels(YAML::Node const & node){
using YAML::NodeType;
using namespace HEJFOG::channels;
// all channels allowed by default
if(!node) return all;
switch(node.Type()){
case NodeType::Undefined:
return all;
case NodeType::Null:
return none;
case NodeType::Scalar:
return to_subleading_channel(node);
case NodeType::Map:
throw HEJ::invalid_type{"map is not a valid option for subleading channels"};
case NodeType::Sequence:
unsigned int channels = HEJFOG::Subleading::none;
for(auto && channel_node: node){
channels |= get_subleading_channels(channel_node);
}
return channels;
}
throw std::logic_error{"unreachable"};
}
Decay get_decay(YAML::Node const & node,
std::string const & entry, std::string const & boson
){
Decay decay;
set_from_yaml(decay.products, node, entry, boson, "into");
decay.branching_ratio=1;
set_from_yaml_if_defined(decay.branching_ratio, node, entry, boson,
"branching ratio");
return decay;
}
std::vector<Decay> get_decays(YAML::Node const & node,
std::string const & entry, std::string const & boson
){
using YAML::NodeType;
if(!node[entry][boson]) return {};
switch(node[entry][boson].Type()){
case NodeType::Null:
case NodeType::Undefined:
return {};
case NodeType::Scalar:
throw HEJ::invalid_type{"value is not a list of decays"};
case NodeType::Map:
return {get_decay(node, entry, boson)};
case NodeType::Sequence:
std::vector<Decay> result;
for(auto && decay_str: node[entry][boson]){
result.emplace_back(get_decay(decay_str, entry, boson));
}
return result;
}
throw std::logic_error{"unreachable"};
}
ParticlesDecayMap get_all_decays(YAML::Node const & node,
std::string const & entry
){
if(!node[entry]) return {};
if(!node[entry].IsMap())
throw HEJ::invalid_type{entry + " have to be a map"};
ParticlesDecayMap result;
for(auto const & sub_node: node[entry]) {
const auto boson = sub_node.first.as<std::string>();
const auto id = HEJ::to_ParticleID(boson);
result.emplace(id, get_decays(node, entry, boson));
}
return result;
}
HEJ::ParticleProperties get_particle_properties(
YAML::Node const & node, std::string const & entry,
std::string const & boson
){
HEJ::ParticleProperties result;
set_from_yaml(result.mass, node, entry, boson, "mass");
set_from_yaml(result.width, node, entry, boson, "width");
return result;
}
HEJ::EWConstants get_ew_parameters(YAML::Node const & node){
HEJ::EWConstants result;
double vev;
set_from_yaml(vev, node, "vev");
result.set_vevWZH(vev,
get_particle_properties(node, "particle properties", "W"),
get_particle_properties(node, "particle properties", "Z"),
get_particle_properties(node, "particle properties", "Higgs")
);
return result;
}
UnweightSettings get_unweight(
YAML::Node const & node, std::string const & entry
){
UnweightSettings result;
set_from_yaml(result.sample_size, node, entry, "sample size");
if(result.sample_size <= 0){
throw std::invalid_argument{
"negative sample size " + std::to_string(result.sample_size)
};
}
set_from_yaml(result.max_dev, node, entry, "max deviation");
return result;
}
Config to_Config(YAML::Node const & yaml){
try{
HEJ::assert_all_options_known(yaml, get_supported_options());
}
catch(HEJ::unknown_option const & ex){
throw HEJ::unknown_option{std::string{"Unknown option '"} + ex.what() + "'"};
}
Config config;
config.process = get_process(yaml, "process");
set_from_yaml(config.events, yaml, "events");
config.jets = get_jet_parameters(yaml, "jets");
config.beam = get_Beam(yaml, "beam");
for(size_t i = 0; i < config.process.incoming.size(); ++i){
const auto & in = config.process.incoming[i];
using namespace HEJ::pid;
if( (in == p || in == p_bar) && in != config.beam.particles[i]){
throw std::invalid_argument{
"Particle type of beam " + std::to_string(i+1) + " incompatible"
+ " with type of incoming particle " + std::to_string(i+1)
};
}
}
set_from_yaml(config.pdf_id, yaml, "pdf");
set_from_yaml(config.subleading_fraction, yaml, "subleading fraction");
if(config.subleading_fraction == 0)
config.subleading_channels = Subleading::none;
else
config.subleading_channels = get_subleading_channels(yaml["subleading channels"]);
config.ew_parameters = get_ew_parameters(yaml);
config.particle_decays = get_all_decays(yaml, "decays");
if(config.process.boson // check that Ws always decay
&& std::abs(*config.process.boson) == HEJ::ParticleID::Wp
&& config.process.boson_decay.empty()
){
auto const & decay = config.particle_decays.find(*config.process.boson);
if(decay == config.particle_decays.end() || decay->second.empty())
throw std::invalid_argument{
- "Decay for "+HEJ::name(*config.process.boson)+" is required"};
+ "Decay for "+name(*config.process.boson)+" is required"};
}
set_from_yaml_if_defined(config.analyses_parameters, yaml, "analyses");
if(yaml["analysis"]){
std::cerr <<
"WARNING: Configuration entry 'analysis' is deprecated. "
" Use 'analyses' instead.\n";
YAML::Node ana;
set_from_yaml(ana, yaml, "analysis");
if(!ana.IsNull()){
config.analyses_parameters.push_back(ana);
}
}
config.scales = HEJ::to_ScaleConfig(yaml);
set_from_yaml_if_defined(config.output, yaml, "event output");
config.rng = HEJ::to_RNGConfig(yaml, "random generator");
config.Higgs_coupling = HEJ::get_Higgs_coupling(yaml, "Higgs coupling");
if(yaml["unweight"]) config.unweight = get_unweight(yaml, "unweight");
return config;
}
} // namespace anonymous
Config load_config(std::string const & config_file){
try{
return to_Config(YAML::LoadFile(config_file));
}
catch(...){
std::cerr << "Error reading " << config_file << ":\n ";
throw;
}
}
}
diff --git a/include/HEJ/PDG_codes.hh b/include/HEJ/PDG_codes.hh
index 8725a6a..198f4af 100644
--- a/include/HEJ/PDG_codes.hh
+++ b/include/HEJ/PDG_codes.hh
@@ -1,217 +1,218 @@
/** \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.
*
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019-2020
* \copyright GPLv2 or later
*/
#pragma once
#include <string>
#include <cstdlib>
namespace HEJ {
//! particle ids according to PDG
namespace pid {
//! The possible particle identities. We use PDG IDs as standard.
enum ParticleID: int{
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 */
antidown = d_bar, /*!< Anti-Down Quark */
u_bar = -u, /*!< Anti-Up quark */
antiup = -u, /*!< Anti-Up quark */
s_bar = -s, /*!< Anti-Strange Quark */
antistrange = -s, /*!< Anti-Strange Quark */
c_bar = -c, /*!< Anti-Charm Quark */
anticharm = -c, /*!< Anti-Charm Quark */
b_bar = -b, /*!< Anti-Bottom Quark */
antibottom = -b, /*!< Anti-Bottom Quark */
t_bar = -t, /*!< Anti-Top Quark */
antitop = -t, /*!< Anti-Top Quark */
e_bar = -e, /*!< Positron */
positron = e_bar, /*!< Positron */
antielectron = positron, /*!< Positron */
nu_e_bar = -nu_e, /*!< Electron Anti-Neutrino */
electron_antineutrino = nu_e_bar,/*!< Electron Anti-Neutrino */
mu_bar = -mu, /*!< Anti-Muon */
antimuon = -mu, /*!< Anti-Muon */
nu_mu_bar = -nu_mu, /*!< Muon Anti-Neutrino */
muon_antineutrino = nu_mu_bar, /*!< Muon Anti-Neutrino */
tau_bar = -tau, /*!< Anti-Tau */
antitau = tau_bar, /*!< Anti-Tau */
nu_tau_bar = -nu_tau, /*!< Tau Anti-Neutrino */
tau_antineutrino = nu_tau_bar, /*!< Tau Anti-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 */
antiproton = p_bar, /*!< Anti-Proton */
};
+ //! Get the of the particle with the given PDG ID
+ std::string name(ParticleID id);
+
} // namespace pid
using ParticleID = pid::ParticleID;
//! Convert a particle name to the corresponding PDG particle ID
ParticleID to_ParticleID(std::string const & name);
- //! Get the of the particle with the given PDG ID
- std::string name(ParticleID id);
/**
* \brief Function to determine if particle is a parton
* @param id PDG ID of particle
* @returns true if the particle is a parton, false otherwise
*/
inline
constexpr bool is_parton(ParticleID id){
return id == pid::gluon || std::abs(id) <= pid::top;
}
/**
* \brief Function to determine if particle is a quark
* @param id PDG ID of particle
* @returns true if the particle is a quark, false otherwise
*/
inline
constexpr bool is_quark(ParticleID id){
return (id >= pid::down && id <= pid::top);
}
/**
* \brief Function to determine if particle is an antiquark
* @param id PDG ID of particle
* @returns true if the particle is an antiquark, false otherwise
*/
inline
constexpr bool is_antiquark(ParticleID id){
return (id <= pid::d_bar && id >= pid::t_bar);
}
/**
* \brief Function to determine if particle is an (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, Z, or Higgs boson
* @param id PDG ID of particle
* @returns true if the partice is an 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 the particle is a photon, W or Z
* @param id PDG ID of particle
* @returns true if the partice is an 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);
}
/**
* \brief Function to determine if particle is a lepton
* @param id PDG ID of particle
* @returns true if the particle is a lepton, false otherwise
*/
inline
constexpr bool is_lepton(ParticleID id){
return (id >= pid::electron && id <= pid::tau_neutrino);
}
/**
* \brief Function to determine if particle is an antilepton
* @param id PDG ID of particle
* @returns true if the particle is an antilepton, false otherwise
*/
inline
constexpr bool is_antilepton(ParticleID id){
return (id <= pid::positron && id >= pid::nu_tau_bar);
}
/**
* \brief Function to determine if particle is an (anti-)lepton
* @param id PDG ID of particle
* @returns true if the particle is a lepton or antilepton, false otherwise
*/
inline
constexpr bool is_anylepton(ParticleID id){
return ( is_lepton(id) || is_antilepton(id));
}
/**
* \brief Function to determine if particle is a neutrino
* @param id PDG ID of particle
* @returns true if the particle is a neutrino, false otherwise
*/
inline
constexpr bool is_neutrino(ParticleID id){
return (id == pid::nu_e || id == pid::tau_neutrino || id == pid::muon_neutrino);
}
/**
* \brief Function to determine if particle is an antineutrino
* @param id PDG ID of particle
* @returns true if the particle is an antineutrino, false otherwise
*/
inline
constexpr bool is_antineutrino(ParticleID id){
return (id == pid::nu_e_bar || id == pid::nu_tau_bar || id == pid::nu_mu_bar);
}
/**
* \brief Function to determine if particle is an (anti-)neutrino
* @param id PDG ID of particle
* @returns true if the particle is a neutrino or antineutrino, false otherwise
*/
inline
constexpr bool is_anyneutrino(ParticleID id){
return ( is_neutrino(id)||is_antineutrino(id));
}
} // namespace HEJ
diff --git a/src/PDG_codes.cc b/src/PDG_codes.cc
index ba0314e..29dd079 100644
--- a/src/PDG_codes.cc
+++ b/src/PDG_codes.cc
@@ -1,102 +1,104 @@
/**
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*/
#include "HEJ/PDG_codes.hh"
#include <map>
#include "HEJ/exceptions.hh"
-namespace HEJ{
+namespace HEJ {
ParticleID to_ParticleID(std::string const & name){
using namespace HEJ::pid;
static const std::map<std::string, ParticleID> known = {
{"d", d}, {"down", down}, {"1",static_cast<ParticleID>(1)},
{"u", u}, {"up", up}, {"2",static_cast<ParticleID>(2)},
{"s", s}, {"strange", strange}, {"3",static_cast<ParticleID>(3)},
{"c", c}, {"charm", charm}, {"4",static_cast<ParticleID>(4)},
{"b", b}, {"bottom", bottom}, {"5",static_cast<ParticleID>(5)},
{"t", t}, {"top", top}, {"6",static_cast<ParticleID>(6)},
{"e", e}, {"electron", electron}, {"e-", e}, {"11",static_cast<ParticleID>(11)},
{"nu_e", nu_e}, {"electron_neutrino", electron_neutrino},
{"12",static_cast<ParticleID>(12)},
{"mu", mu}, {"muon", muon}, {"mu-", mu}, {"13",static_cast<ParticleID>(13)},
{"nu_mu", nu_mu}, {"muon_neutrino", muon_neutrino}, {"14",static_cast<ParticleID>(14)},
{"tau", tau}, {"tau-", tau}, {"15",static_cast<ParticleID>(15)},
{"nu_tau", nu_tau}, {"tau_neutrino", tau_neutrino}, {"16",static_cast<ParticleID>(16)},
{"d_bar", d_bar}, {"antidown", antidown}, {"-1",static_cast<ParticleID>(-1)},
{"u_bar", u_bar}, {"antiup", antiup}, {"-2",static_cast<ParticleID>(-2)},
{"s_bar", s_bar}, {"antistrange", antistrange}, {"-3",static_cast<ParticleID>(-3)},
{"c_bar", c_bar}, {"anticharm", anticharm}, {"-4",static_cast<ParticleID>(-4)},
{"b_bar", b_bar}, {"antibottom", antibottom}, {"-5",static_cast<ParticleID>(-5)},
{"t_bar", t_bar}, {"antitop", antitop}, {"-6",static_cast<ParticleID>(-6)},
{"e_bar", e_bar}, {"antielectron", antielectron}, {"positron", positron},
{"e+", e_bar}, {"-11",static_cast<ParticleID>(-11)},
{"nu_e_bar", nu_e_bar}, {"electron-antineutrino", electron_antineutrino},
{"-12",static_cast<ParticleID>(-12)},
{"mu_bar", mu_bar}, {"mu+", mu_bar}, {"antimuon", antimuon},
{"-13",static_cast<ParticleID>(-13)},
{"nu_mu_bar", nu_mu_bar}, {"muon-antineutrino", muon_antineutrino},
{"-14",static_cast<ParticleID>(-14)},
{"tau_bar", tau_bar}, {"tau+", tau_bar}, {"antitau", antitau},
{"-15",static_cast<ParticleID>(-15)},
{"nu_tau_bar", nu_tau_bar}, {"tau-antineutrino", tau_antineutrino},
{"-16",static_cast<ParticleID>(-16)},
{"gluon", gluon}, {"g", g}, {"21",static_cast<ParticleID>(21)},
{"photon", photon}, {"gamma", gamma}, {"22",static_cast<ParticleID>(22)},
{"Z", Z}, {"23",static_cast<ParticleID>(23)},
{"Wp", Wp}, {"W+", Wp}, {"24",static_cast<ParticleID>(24)},
{"Wm", Wm}, {"W-", Wm}, {"-24",static_cast<ParticleID>(-24)},
{"h", h}, {"H", h}, {"Higgs", Higgs}, {"higgs", higgs},
{"25",static_cast<ParticleID>(25)},
{"p", p}, {"proton", proton}, {"2212",static_cast<ParticleID>(2212)},
{"p_bar", p_bar}, {"antiproton", antiproton}, {"-2212",static_cast<ParticleID>(-2212)}
};
const auto res = known.find(name);
if(res == known.end()){
throw std::invalid_argument("Unknown particle " + name);
}
return res->second;
}
+namespace pid {
std::string name(ParticleID id) {
using namespace HEJ::pid;
switch (id) {
case down: return "down";
case up: return "up";
case strange: return "strange";
case charm: return "charm";
case bottom: return "bottom";
case top: return "top";
case electron: return "electron";
case muon: return "muon";
case tau: return "tau";
case electron_neutrino: return "electron-neutrino";
case muon_neutrino: return "muon-neutrino";
case tau_neutrino: return "tau-neutrino";
case antidown: return "antidown";
case antiup: return "antiup";
case antistrange: return "antistrange";
case anticharm: return "anticharm";
case antibottom: return "antibottom";
case antitop: return "antitop";
case positron: return "positron";
case antimuon: return "antimuon";
case antitau: return "antitau";
case electron_antineutrino: return "electron-antineutrino";
case muon_antineutrino: return "muon-antineutrino";
case tau_antineutrino: return "tau-antineutrino";
case gluon: return "gluon";
case photon: return "photon";
case Z: return "Z";
case Wp: return "W+";
case Wm: return "W-";
case Higgs: return "Higgs";
case proton: return "proton";
case antiproton: return "antiproton";
}
throw std::logic_error{"unreachable"};
}
-}
+} // namespace pid
+} // namespace HEJ

File Metadata

Mime Type
text/x-diff
Expires
Sat, Dec 21, 12:42 PM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4022805
Default Alt Text
(29 KB)

Event Timeline