diff --git a/include/HEJ/Weights.hh b/include/HEJ/Parameters.hh similarity index 100% copy from include/HEJ/Weights.hh copy to include/HEJ/Parameters.hh diff --git a/include/HEJ/Weights.hh b/include/HEJ/Weights.hh index 8de138e..ca82f1f 100644 --- a/include/HEJ/Weights.hh +++ b/include/HEJ/Weights.hh @@ -1,97 +1,11 @@ /** \file - * \brief Container for event Weights + * \brief Legacy Header for Weights + * \note This Header was moved to "HEJ/Parameters.hh" * * \authors Jeppe Andersen, Tuomas Hapola, Marian Heil, Andreas Maier, Jennifer Smillie * \date 2019 * \copyright GPLv2 or later */ #pragma once -#include "HEJ/exceptions.hh" - -#include - -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 - struct Parameters { - T central; - std::vector variations; - - template - Parameters& operator*=(Parameters const & other); - Parameters& operator*=(double factor); - template - Parameters& operator/=(Parameters const & other); - Parameters& operator/=(double factor); - }; - - template inline - Parameters operator*(Parameters a, Parameters const & b) { - return a*=b; - } - template inline - Parameters operator*(Parameters a, double b) { - return a*=b; - } - template inline - Parameters operator*(double b, Parameters a) { - return a*=b; - } - template inline - Parameters operator/(Parameters a, Parameters const & b) { - return a/=b; - } - template inline - Parameters operator/(Parameters a, double b) { - return a/=b; - } - - //! Shortcut for Weights, e.g. used by the MatrixElement - using Weights = Parameters; - - template - template - Parameters& Parameters::operator*=(Parameters 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 - Parameters& Parameters::operator*=(double factor) { - central *= factor; - for(auto & wt: variations) wt *= factor; - return *this; - }; - - template - template - Parameters& Parameters::operator/=(Parameters 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 - Parameters& Parameters::operator/=(double factor) { - central /= factor; - for(auto & wt: variations) wt /= factor; - return *this; - }; -} +#include "HEJ/Parameters.hh"