11#include <framework/gearbox/Const.h>
28 inline double sqrt(
double a) {
return std::sqrt(a); }
31 inline double tan(
double a) {
return std::tan(a); }
34 inline double atan(
double a) {
return std::atan(a); }
81 return DualNumber(a / b.x, - a / (b.x * b.x) * b.dx);
88 return DualNumber(a.x / b.x, (a.dx * b.x - a.x * b.dx) / (b.x * b.x));
102 return DualNumber(a.x * b.x, a.x * b.dx + b.x * a.dx);
116 return DualNumber(std::sqrt(a.x), 1. / (2 * std::sqrt(a.x)) * a.dx);
123 return DualNumber(std::atan(a.x), 1. / (1 + a.x * a.x) * a.dx);
130 return DualNumber(std::tan(a.x), (1.0 + std::tan(a.x) * std::tan(a.x)) * a.dx);
157 return GeneralVector<T>(a.el[0] + b.el[0], a.el[1] + b.el[1], a.el[2] + b.el[2]);
165 return (a.el[0] * b.el[0] + a.el[1] * b.el[1] + a.el[2] * b.el[2]);
187 return sqrt((E1 + E2) * (E1 + E2) - (p1 + p2).norm2());
198 return 1. / (E1 + E2) * (p1 + p2);
222 T p =
sqrt(energy * energy -
me *
me);
224 double dir = isHER ? 1 : -1;
226 T pz = dir * p /
sqrt(tan(angleX) * tan(angleX) + tan(angleY) * tan(angleY) + 1.0);
234 double eL,
double thXL,
double thYL)
236 Eigen::MatrixXd grad(6, 6);
239 for (
int j = 0; j < 6; ++j) {
241 std::vector<double> eps(6, 0.0);
254 grad(0, j) = Ecms.
dx;
255 grad(1, j) = boost.
el[0].dx;
256 grad(2, j) = boost.
el[1].dx;
257 grad(3, j) = boost.
el[2].dx;
258 grad(4, j) = angleX.
dx;
259 grad(5, j) = angleY.
dx;
268 double eL,
double thXL,
double thYL)
270 Eigen::VectorXd mu(6);
275 double Ecms = getEcms<double>(pH, pL);
278 double angleX, angleY;
279 std::tie(angleX, angleY) = getAnglesCMS<double>(pH, pL);
293 inline Eigen::MatrixXd
transformCov(
const Eigen::MatrixXd& covHER,
const Eigen::MatrixXd& covLER,
const Eigen::MatrixXd& grad)
296 Eigen::MatrixXd cov = Eigen::MatrixXd::Zero(6, 6);
297 cov.block<3, 3>(0, 0) = covHER;
298 cov.block<3, 3>(3, 3) = covLER;
300 Eigen::MatrixXd covNew = grad * cov * grad.transpose();
double getMass() const
Particle mass.
static const ChargedStable electron
electron particle
B2Vector3< DataType > operator*(DataType a, const B2Vector3< DataType > &p)
non-memberfunction Scaling of 3-vectors with a real number
B2Vector3< DataType > operator-(const TVector3 &a, const B2Vector3< DataType > &b)
non-memberfunction for substracting a TVector3 from a B2Vector3
B2Vector3< DataType > operator+(const TVector3 &a, const B2Vector3< DataType > &b)
non-memberfunction for adding a TVector3 to a B2Vector3
DualNumber operator/(double a, DualNumber b)
division of double and dual number
GeneralVector< T > getBoost(GeneralVector< T > p1, GeneralVector< T > p2)
get boost vector from HER & LER momentum 3-vectors
GeneralVector< T > getFourVector(T energy, T angleX, T angleY, bool isHER)
get 4-momentum from energy and angles of beam
T getEcms(GeneralVector< T > p1, GeneralVector< T > p2)
get CMS energy from HER & LER momentum 3-vectors
Eigen::MatrixXd transformCov(const Eigen::MatrixXd &covHER, const Eigen::MatrixXd &covLER, const Eigen::MatrixXd &grad)
transform covariance matrix to the variables (Ecms, boostX, boostY, boostZ, angleXZ,...
static const double me
electron mass
double atan(double a)
atan for double
Eigen::VectorXd getCentralValues(double eH, double thXH, double thYH, double eL, double thXL, double thYL)
get vector including (Ecms, boostX, boostY, boostZ, angleXZ, angleYZ) from beam energies and angles
double sqrt(double a)
sqrt for double
std::pair< T, T > getAnglesCMS(GeneralVector< T > p1, GeneralVector< T > p2)
get collision axis angles in CM frame from HER & LER momentum 3-vectors
Eigen::MatrixXd getGradientMatrix(double eH, double thXH, double thYH, double eL, double thXL, double thYL)
get gradient matrix of (eH, thXH, thYH, eL, thXL, thYL) -> (eCMS, boostX, boostY, boostY,...
T dot(GeneralVector< T > a, GeneralVector< T > b)
dot product of two general vectors
Abstract base class for different kinds of events.
Simple structure implementing dual numbers which are used for exact evaluation of the derivatives,...
double dx
differential value of dual number, should be 1 if derivative is calculated
DualNumber()
constructor setting values to zero
DualNumber(double X, double dX)
constructor allowing to set the values
double x
nominal value of dual number
3-vector with members of arbitrary type, especially members can be dual numbers
GeneralVector(T x, T y, T z)
constructor allowing to set the components of vector
T norm2() const
L2 norm of the vector squared
T angleY() const
angle in the YZ projection of the vector
T angleX() const
angle in the XZ projection of the vector
T el[3]
elements of the vector