Page MenuHomeHEPForge

No OneTemporary

diff --git a/include/HEJ/Event.hh b/include/HEJ/Event.hh
index 6b549e0..28b3e7a 100644
--- a/include/HEJ/Event.hh
+++ b/include/HEJ/Event.hh
@@ -1,306 +1,307 @@
/** \file
* \brief Declares the Event class and helpers
*
* \authors Jeppe Andersen, Tuomas Hapola, Marian Heil, Andreas Maier, Jennifer Smillie
* \date 2019
* \copyright GPLv2 or later
*/
#pragma once
#include <array>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "HEJ/event_types.hh"
#include "HEJ/Particle.hh"
#include "fastjet/ClusterSequence.hh"
namespace LHEF{
class HEPEUP;
class HEPRUP;
}
namespace fastjet{
class JetDefinition;
}
namespace HEJ{
struct ParameterDescription;
//! Event parameters
struct EventParameters{
double mur; /**< Value of the Renormalisation Scale */
double muf; /**< Value of the Factorisation Scale */
double weight; /**< Event Weight */
//! Optional description
std::shared_ptr<ParameterDescription> description = nullptr;
};
//! Description of event parameters
struct ParameterDescription {
//! Name of central scale choice (e.g. "H_T/2")
std::string scale_name;
//! Actual renormalisation scale divided by central scale
double mur_factor;
//! Actual factorisation scale divided by central scale
double muf_factor;
ParameterDescription() = default;
ParameterDescription(
std::string scale_name, double mur_factor, double muf_factor
):
scale_name{scale_name}, mur_factor{mur_factor}, muf_factor{muf_factor}
{};
};
//! Class to store general Event setup, i.e. Phase space and weights
class EventData{
public:
//! Default Constructor
EventData() = default;
//! Constructor from LesHouches event information
EventData(LHEF::HEPEUP const & hepeup);
//! Constructor with all values given
EventData(
std::array<Particle, 2> const & incoming,
std::vector<Particle> const & outgoing,
std::unordered_map<size_t, std::vector<Particle>> const & decays,
EventParameters const & central,
std::vector<EventParameters> const & variations
):
- incoming_(incoming), outgoing_(outgoing), decays_(decays),
- central_(central), variations_(variations)
+ incoming_(std::move(incoming)), outgoing_(std::move(outgoing)),
+ decays_(std::move(decays)),
+ central_(std::move(central)), variations_(std::move(variations))
{};
//! Move Constructor with all values given
EventData(
std::array<Particle, 2> && incoming,
std::vector<Particle> && outgoing,
std::unordered_map<size_t, std::vector<Particle>> && decays,
EventParameters && central,
std::vector<EventParameters> && variations
):
- incoming_(incoming), outgoing_(outgoing), decays_(decays),
- central_(central), variations_(variations)
+ incoming_(std::move(incoming)), outgoing_(std::move(outgoing)),
+ decays_(std::move(decays)),
+ central_(std::move(central)), variations_(std::move(variations))
{};
//! Incoming Particles
std::array<Particle, 2> const & incoming() const{
return incoming_;
}
//! Incoming Particles
std::array<Particle, 2> & incoming(){
return incoming_;
}
//! Outgoing Particles
std::vector<Particle> const & outgoing() const{
return outgoing_;
}
//! Outgoing Particles
std::vector<Particle> & outgoing(){
return outgoing_;
}
//! Particle decays in the format {outgoing index, decay products}
std::unordered_map<size_t, std::vector<Particle>> const & decays() const{
return decays_;
}
//! Particle decays in the format {outgoing index, decay products}
std::unordered_map<size_t, std::vector<Particle>> & decays(){
return decays_;
}
//! Central parameter (e.g. scale) choice
EventParameters const & central() const{
return central_;
}
//! Central parameter (e.g. scale) choice
EventParameters & central(){
return central_;
}
//! For parameter variation
std::vector<EventParameters> const & variations() const{
return variations_;
}
//! For parameter variation
std::vector<EventParameters> & variations(){
return variations_;
}
private:
std::array<Particle, 2> incoming_;
std::vector<Particle> outgoing_;
std::unordered_map<size_t, std::vector<Particle>> decays_;
//! @TODO replace this by "ParameterVariations"
EventParameters central_;
//! @TODO replace this by "ParameterVariations"
std::vector<EventParameters> variations_;
};
//! An event before jet clustering
//! @TODO remove in HEJ 2.3.0
- struct UnclusteredEvent{
- [[deprecated("Use EventData instead")]]
+ struct [[deprecated("Use EventData instead")]] UnclusteredEvent{
//! Default Constructor
UnclusteredEvent() = default;
//! Constructor from LesHouches event information
UnclusteredEvent(LHEF::HEPEUP const & hepeup):
UnclusteredEvent(EventData(hepeup)){}
//! Constructor from EventData
UnclusteredEvent(EventData const & evData);
std::array<Particle, 2> incoming; /**< Incoming Particles */
std::vector<Particle> outgoing; /**< Outgoing Particles */
//! Particle decays in the format {outgoing index, decay products}
std::unordered_map<size_t, std::vector<Particle>> decays;
//! Central parameter (e.g. scale) choice
EventParameters central;
std::vector<EventParameters> variations; /**< For parameter variation */
};
/** An event with clustered jets
*
* This is the main HEJ 2 event class.
* It contains kinematic information including jet clustering,
* parameter (e.g. scale) settings and the event weight.
*/
class Event{
public:
//! Default Event Constructor
Event() = default;
//! Event Constructor adding jet clustering to an bare, unclustered event
Event(
EventData ev,
fastjet::JetDefinition const & jet_def, double min_jet_pt
);
//! Event Constructor adding jet clustering to an unclustered event
//! @TODO remove in HEJ 2.3.0
[[deprecated("Use constructor with EventData instead")]]
Event(
UnclusteredEvent ev,
fastjet::JetDefinition const & jet_def, double min_jet_pt
):Event(
EventData{ev.incoming,ev.outgoing,ev.decays,ev.central,ev.variations},
jet_def, min_jet_pt
){};
//! The jets formed by the outgoing partons
std::vector<fastjet::PseudoJet> jets() const;
//! The corresponding event before jet clustering
//! @TODO remove in HEJ 2.3.0
- [[deprecated("Use bare() instead")]]
+ [[deprecated("Use data() instead")]]
UnclusteredEvent unclustered() const {
return UnclusteredEvent(ev_);
}
//! The corresponding bare event before jet clustering
- EventData const & bare() const {
+ EventData const & data() const {
return ev_;
}
//! Central parameter choice
EventParameters const & central() const{
return ev_.central();
}
//! Central parameter choice
EventParameters & central(){
return ev_.central();
}
//! Incoming particles
std::array<Particle, 2> const & incoming() const{
return ev_.incoming();
}
//! Outgoing particles
std::vector<Particle> const & outgoing() const{
return ev_.outgoing();
}
//! Particle decays
/**
* The key in the returned map corresponds to the index in the
* vector returned by outgoing()
*/
std::unordered_map<size_t, std::vector<Particle>> const & decays() const{
return ev_.decays();
}
//! Parameter (scale) variations
std::vector<EventParameters> const & variations() const{
return ev_.variations();
}
//! Parameter (scale) variations
std::vector<EventParameters> & variations(){
return ev_.variations();
}
//! Parameter (scale) variation
/**
* @param i Index of the requested variation
*/
EventParameters const & variations(size_t i) const{
return ev_.variations()[i];
}
//! Parameter (scale) variation
/**
* @param i Index of the requested variation
*/
EventParameters & variations(size_t i){
return ev_.variations()[i];
}
//! Indices of the jets the outgoing partons belong to
/**
* @param jets Jets to be tested
* @returns A vector containing, for each outgoing parton,
* the index in the vector of jets the considered parton
* belongs to. If the parton is not inside any of the
* passed jets, the corresponding index is set to -1.
*/
std::vector<int> particle_jet_indices(
std::vector<fastjet::PseudoJet> const & jets
) const{
return cs_.particle_jet_indices(jets);
}
//! Jet definition used for clustering
fastjet::JetDefinition const & jet_def() const{
return cs_.jet_def();
}
//! Minimum jet transverse momentum
double min_jet_pt() const{
return min_jet_pt_;
}
//! Event type
event_type::EventType type() const{
return type_;
}
private:
EventData ev_;
fastjet::ClusterSequence cs_;
double min_jet_pt_;
event_type::EventType type_;
};
//! Square of the partonic centre-of-mass energy \f$\hat{s}\f$
double shat(Event const & ev);
//! Convert an event to a LHEF::HEPEUP
LHEF::HEPEUP to_HEPEUP(Event const & event, LHEF::HEPRUP *);
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Jan 20, 11:33 PM (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4242903
Default Alt Text
(9 KB)

Event Timeline