8#include <framework/dbobjects/BeamParameters.h>
10#include <gtest/gtest.h>
20 beamparams.
setLER(3.49841, M_PI, 0, std::vector<double>());
21 beamparams.
setHER(7.99638, 0.022, 0, std::vector<double>());
23 const ROOT::Math::PxPyPzEVector upsVec = beamparams.
getHER() + beamparams.
getLER();
24 ROOT::Math::PxPyPzEVector upsVecCMS = beamparams.
getLabToCMS() * upsVec;
26 const double mUpsilon = 10.5794;
27 EXPECT_TRUE(fabs(upsVecCMS.E() - mUpsilon) < 1e-2);
28 EXPECT_TRUE(fabs(upsVecCMS.X()) < 1e-15);
29 EXPECT_TRUE(fabs(upsVecCMS.Y()) < 1e-15);
30 EXPECT_TRUE(fabs(upsVecCMS.Z()) < 2e-15) << fabs(upsVecCMS.Z());
32 EXPECT_TRUE(fabs(beamparams.
getMass() - mUpsilon) < 1e-2);
39 beamparams.
setLER(3.49841, M_PI, 0, std::vector<double>());
40 beamparams.
setHER(7.99638, 0.022, 0, std::vector<double>());
43 ROOT::Math::PxPyPzEVector vec(1, 1, 1, 1);
44 vec = backAndForth * vec;
45 EXPECT_TRUE(fabs(vec.X() - 1) < 1e-15);
46 EXPECT_TRUE(fabs(vec.Y() - 1) < 1e-15);
47 EXPECT_TRUE(fabs(vec.Z() - 1) < 1e-15);
55 TMatrixDSym upper(3), sym(3);
57 for (
int i = 0; i < 3; i++) {
58 for (
int j = 0; j < 3; j++) {
59 upper(i, j) = (j >= i) ? ++n : -1;
60 if (j >= i) sym(i, j) = sym(j, i) = upper(i, j);
71 std::vector<double> cov;
72 TMatrixDSym matrix(3);
73 beamparams.
setHER(0, 0, 0, cov);
74 beamparams.
setVertex(ROOT::Math::XYZVector(0, 0, 0), cov);
75 EXPECT_EQ(matrix, beamparams.
getCovHER());
84 for (
int i = 0; i < 10; ++i) {
85 std::vector<double> cov{1.*i};
86 TMatrixDSym beam(3), vertex(3);
91 beamparams.
setHER(0, 0, 0, cov);
92 beamparams.
setVertex(ROOT::Math::XYZVector(0, 0, 0), cov);
103 std::vector<double> cov{1., 2., 3.};
104 TMatrixDSym matrix(3);
108 beamparams.
setHER(0, 0, 0, cov);
109 beamparams.
setVertex(ROOT::Math::XYZVector(0, 0, 0), cov);
110 EXPECT_EQ(matrix, beamparams.
getCovHER());
118 std::vector<double> cov{1., 2., 3., 4., 5., 6.};
119 TMatrixDSym matrix(3);
121 matrix(0, 1) = matrix(1, 0) = 2;
122 matrix(0, 2) = matrix(2, 0) = 3;
124 matrix(1, 2) = matrix(2, 1) = 5;
126 beamparams.
setHER(0, 0, 0, cov);
127 beamparams.
setVertex(ROOT::Math::XYZVector(0, 0, 0), cov);
128 EXPECT_EQ(matrix, beamparams.
getCovHER());
136 std::vector<double> cov{1., 2., 3., 4., 5., 6., 7., 8., 9.};
137 TMatrixDSym matrix(3);
139 matrix(0, 1) = matrix(1, 0) = 2;
140 matrix(0, 2) = matrix(2, 0) = 3;
142 matrix(1, 2) = matrix(2, 1) = 6;
144 beamparams.
setHER(0, 0, 0, cov);
145 beamparams.
setVertex(ROOT::Math::XYZVector(0, 0, 0), cov);
146 EXPECT_EQ(matrix, beamparams.
getCovHER());
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
void setHER(double energy, double angleX, double angleY, const std::vector< double > &cov)
Set the HER FourVector and error matrix from beam energy, angle and covariance entries.
TMatrixDSym getCovVertex() const
Get the covariance matrix of the vertex position.
void setLER(double energy, double angleX, double angleY, const std::vector< double > &cov)
Set the LER FourVector and error matrix from beam energy, angle and covariance entries.
void setCovHER(const TMatrixDSym &cov)
Set the covariance matrix for HER (E, theta_x, theta_y) where E is the energy, theta_x is the horizon...
TMatrixDSym getCovHER() const
Get the covariance matrix of HER (E, theta_x, theta_y) where E is the energy, theta_x is the horizont...
void setVertex(const ROOT::Math::XYZVector &vertex, const std::vector< double > &cov)
Set the vertex position and error matrix.
const ROOT::Math::PxPyPzEVector & getHER() const
Get 4vector of the high energy beam.
const ROOT::Math::PxPyPzEVector & getLER() const
Get 4vector of the low energy beam.
const ROOT::Math::LorentzRotation & getLabToCMS() const
Return the LorentzRotation to convert from lab to CMS frame.
const ROOT::Math::LorentzRotation & getCMSToLab() const
Return the LorentzRotation to convert from CMS to lab frame.
double getMass() const
Get the invariant mass of the collision (= energy in CMS)
Abstract base class for different kinds of events.