8 #include <framework/utilities/TestHelpers.h>
9 #include <framework/dbobjects/BeamParameters.h>
11 #include <gtest/gtest.h>
21 beamparams.
setLER(3.49841, M_PI, 0, std::vector<double>());
22 beamparams.
setHER(7.99638, 0.022, 0, std::vector<double>());
24 const TLorentzVector upsVec = beamparams.
getHER() + beamparams.
getLER();
25 TLorentzVector upsVecCMS = upsVec;
28 const double mUpsilon = 10.5794;
29 EXPECT_TRUE(fabs(upsVecCMS.E() - mUpsilon) < 1e-2);
30 EXPECT_TRUE(fabs(upsVecCMS.X()) < 1e-15);
31 EXPECT_TRUE(fabs(upsVecCMS.Y()) < 1e-15);
32 EXPECT_TRUE(fabs(upsVecCMS.Z()) < 2e-15) << fabs(upsVecCMS.Z());
34 EXPECT_TRUE(fabs(beamparams.
getMass() - mUpsilon) < 1e-2);
41 beamparams.
setLER(3.49841, M_PI, 0, std::vector<double>());
42 beamparams.
setHER(7.99638, 0.022, 0, std::vector<double>());
45 TLorentzVector vec(1, 1, 1, 1);
46 vec.Transform(backAndForth);
47 EXPECT_TRUE(fabs(vec.X() - 1) < 1e-15);
48 EXPECT_TRUE(fabs(vec.Y() - 1) < 1e-15);
49 EXPECT_TRUE(fabs(vec.Z() - 1) < 1e-15);
57 TMatrixDSym upper(3), sym(3);
59 for (
int i = 0; i < 3; i++) {
60 for (
int j = 0; j < 3; j++) {
61 upper(i, j) = (j >= i) ? ++n : -1;
62 if (j >= i) sym(i, j) = sym(j, i) = upper(i, j);
73 std::vector<double> cov;
74 TMatrixDSym matrix(3);
75 beamparams.
setHER(0, 0, 0, cov);
76 beamparams.
setVertex(TVector3(0, 0, 0), cov);
77 EXPECT_EQ(matrix, beamparams.
getCovHER());
86 for (
int i = 0; i < 10; ++i) {
87 std::vector<double> cov{1.*i};
88 TMatrixDSym beam(3), vertex(3);
93 beamparams.
setHER(0, 0, 0, cov);
94 beamparams.
setVertex(TVector3(0, 0, 0), cov);
105 std::vector<double> cov{1., 2., 3.};
106 TMatrixDSym matrix(3);
110 beamparams.
setHER(0, 0, 0, cov);
111 beamparams.
setVertex(TVector3(0, 0, 0), cov);
112 EXPECT_EQ(matrix, beamparams.
getCovHER());
120 std::vector<double> cov{1., 2., 3., 4., 5., 6.};
121 TMatrixDSym matrix(3);
123 matrix(0, 1) = matrix(1, 0) = 2;
124 matrix(0, 2) = matrix(2, 0) = 3;
126 matrix(1, 2) = matrix(2, 1) = 5;
128 beamparams.
setHER(0, 0, 0, cov);
129 beamparams.
setVertex(TVector3(0, 0, 0), cov);
130 EXPECT_EQ(matrix, beamparams.
getCovHER());
138 std::vector<double> cov{1., 2., 3., 4., 5., 6., 7., 8., 9.};
139 TMatrixDSym matrix(3);
141 matrix(0, 1) = matrix(1, 0) = 2;
142 matrix(0, 2) = matrix(2, 0) = 3;
144 matrix(1, 2) = matrix(2, 1) = 6;
146 beamparams.
setHER(0, 0, 0, cov);
147 beamparams.
setVertex(TVector3(0, 0, 0), cov);
148 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 setVertex(const TVector3 &vertex, const std::vector< double > &cov)
Set the vertex position and error matrix.
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...
const TLorentzRotation & getLabToCMS() const
Return the LorentzRotation to convert from lab to CMS frame.
const TLorentzRotation & getCMSToLab() const
Return the LorentzRotation to convert from CMS to lab frame.
const TLorentzVector & getLER() const
Get 4vector of the low energy beam.
const TLorentzVector & getHER() const
Get 4vector of the high energy beam.
double getMass() const
Get the invariant mass of the collision (= energy in CMS)
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Abstract base class for different kinds of events.