Page MenuHomeHEPForge

No OneTemporary

diff --git a/Changes-API.md b/Changes-API.md
index 8bc5826..e9882f1 100644
--- a/Changes-API.md
+++ b/Changes-API.md
@@ -1,73 +1,75 @@
# Changelog for HEJ API
This log lists only changes on the HEJ API. These are primarily code changes
relevant for calling HEJ as an API. This file should only be read as an addition
to `Changes.md`, where the main features are documented.
## Version 2.X
### 2.X.0
* Made `MatrixElement.tree_kin(...)` and `MatrixElement.tree_param(...)` public
* New class `CrossSectionAccumulator` to keep track of Cross Section of the
different subproccess
* New template struct `Parameters` similar to old `Weights`
- `Weights` are now an alias for `Parameters<double>`. Calling `Weights` did
not change
- `Weights.hh` was replaced by `Parameters.hh`. The old `Weights.hh` header
will be removed in HEJ Version 2.2.0
* Function to multiplication and division of `EventParameters.weight` by double
- This can be combined with `Parameters`, e.g.
`Parameters<EventParameters>*Weights`, see also `Events.parameters()`
- Moved `EventParameters` to `Parameters.hh` header
* Restructured `Event` class
- `Event` can now only be build from a (new) `Event::EventData` class
- Removed default constructor for `Event`
- `Event::EventData` replaces the old `UnclusteredEvent` struct.
- `UnclusteredEvent` is now deprecated, and will be removed in HEJ Version
2.3.0
- Removed `Event.unclustered()` function
- Added new member function `Events.parameters()`, to directly access
(underlying) `Parameters<EventParameters>`
- New member functions `begin_partons`, `end_partons` with aliases
`cbegin_partons`, `cend_partons` for constant iterators over
outgoing partons.
* New function `Event::EventData.reconstruct_intermediate()` to reconstruct
bosons from decays, e.g. `positron + nu_e => Wp`
* Added optional Colour charges to particles (`Particle.colour`)
- Colour connection in the HEJ limit can be generated via
`Event.generate_colours` (automatically done in the resummation)
* New abstact `EventReader` class, as base for reading events from files
- Moved LHE file reader to `HEJ::LesHouchesReader`
- New `HEJ::HDF5Reader` to read `hdf5` files
* New function `Analysis.initialise(LHEF::HEPRUP const &)` to pass `HEPRUP` to
the analysis.
* Renamed `EventType::nonHEJ` to `EventType::non_resummable` and `is_HEJ()`
to `is_resummable()` such that Run card is consistent with internal workings
* new class `EWConstants` replaces previously hardcoded `vev`
- `EWConstants` have to be set in the general `config` and the
`MatrixElementConfig`
* Replaced `HepMCInterface` and `HepMCWriter` by `HepMCInterfaceX` and
`HepMCWriterX` respectivly, with `X` being the major version of HepMC (2 or 3)
+* Added an auxiliary function to obtain a `std::string` from and
+ `EventDescription`
## Version 2.0
### 2.0.5
* no further changes to API
### 2.0.4
* Fixed wrong path of `HEJ_INCLUDE_DIR` in `hej-config.cmake`
### 2.0.3
* no further changes to API
### 2.0.2
* no further changes to API
### 2.0.1
* no further changes to API
diff --git a/include/HEJ/Parameters.hh b/include/HEJ/Parameters.hh
index 840d2e4..146b4ac 100644
--- a/include/HEJ/Parameters.hh
+++ b/include/HEJ/Parameters.hh
@@ -1,155 +1,158 @@
/** \file
* \brief Containers for Parameter variations, e.g. different Weights
*
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*/
#pragma once
#include <memory>
#include <vector>
+#include <string>
#include "HEJ/exceptions.hh"
namespace HEJ{
//! Collection of parameters, e.g. Weights, assigned to a single event
/**
* A number of member functions of the MatrixElement class return Parameters
* objects containing the squares of the matrix elements for the various
* scale choices.
*/
template<class T>
struct Parameters {
T central;
std::vector<T> variations;
template<class T_ext>
Parameters<T>& operator*=(Parameters<T_ext> const & other);
Parameters<T>& operator*=(double factor);
template<class T_ext>
Parameters<T>& operator/=(Parameters<T_ext> const & other);
Parameters<T>& operator/=(double factor);
};
template<class T1, class T2> inline
Parameters<T1> operator*(Parameters<T1> a, Parameters<T2> const & b) {
a*=b;
return a;
}
template<class T> inline
Parameters<T> operator*(Parameters<T> a, double b) {
a*=b;
return a;
}
template<class T> inline
Parameters<T> operator*(double b, Parameters<T> a) {
a*=b;
return a;
}
template<class T1, class T2> inline
Parameters<T1> operator/(Parameters<T1> a, Parameters<T2> const & b) {
a/=b;
return a;
}
template<class T> inline
Parameters<T> operator/(Parameters<T> a, double b) {
a/=b;
return a;
}
//! Alias for weight container, e.g. used by the MatrixElement
using Weights = Parameters<double>;
//! Description of event parameters, see also EventParameters
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}
{};
};
+ std::string to_string(ParameterDescription const & p);
+
//! 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;
//! multiply weight by factor
EventParameters& operator*=(double factor){
weight*=factor;
return *this;
};
//! divide weight by factor
EventParameters& operator/=(double factor){
weight/=factor;
return *this;
};
};
inline EventParameters operator*(EventParameters a, double b){
a*=b;
return a;
}
inline EventParameters operator*(double b, EventParameters a){
a*=b;
return a;
}
inline EventParameters operator/(EventParameters a, double b){
a/=b;
return a;
}
//! @{
//! @internal Implementation of template functions
template<class T>
template<class T_ext>
Parameters<T>& Parameters<T>::operator*=(Parameters<T_ext> const & other) {
if(other.variations.size() != variations.size()) {
throw std::invalid_argument{"Wrong number of Parameters"};
}
central *= other.central;
for(std::size_t i = 0; i < variations.size(); ++i) {
variations[i] *= other.variations[i];
}
return *this;
};
template<class T>
Parameters<T>& Parameters<T>::operator*=(double factor) {
central *= factor;
for(auto & wt: variations) wt *= factor;
return *this;
};
template<class T>
template<class T_ext>
Parameters<T>& Parameters<T>::operator/=(Parameters<T_ext> const & other) {
if(other.variations.size() != variations.size()) {
throw std::invalid_argument{"Wrong number of Parameters"};
}
central /= other.central;
for(std::size_t i = 0; i < variations.size(); ++i) {
variations[i] /= other.variations[i];
}
return *this;
};
template<class T>
Parameters<T>& Parameters<T>::operator/=(double factor) {
central /= factor;
for(auto & wt: variations) wt /= factor;
return *this;
};
//! @}
}
diff --git a/src/Parameters.cc b/src/Parameters.cc
new file mode 100644
index 0000000..cab2e24
--- /dev/null
+++ b/src/Parameters.cc
@@ -0,0 +1,25 @@
+/**
+ * \authors The HEJ collaboration (see AUTHORS for details)
+ * \date 2019
+ * \copyright GPLv2 or later
+ */
+#include "HEJ/Parameters.hh"
+
+#include <sstream>
+#include <iostream>
+
+namespace HEJ {
+
+ std::string to_string(ParameterDescription const & p) {
+ // use ostringstream over std::to_string to remove trailing 0s
+ std::ostringstream stream;
+ stream << "\\mu_r = ";
+ if(p.mur_factor != 1.) stream << p.mur_factor << '*';
+ stream << p.scale_name << ", "
+ "\\mu_f = ";
+ if(p.muf_factor != 1.) stream << p.muf_factor << '*';
+ stream << p.scale_name;
+ return stream.str();
+ }
+
+}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 7:39 PM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3804371
Default Alt Text
(8 KB)

Event Timeline