9#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
11#include <genfit/TrackCand.h>
13#include <TMatrixDSym.h>
15#include <gtest/gtest.h>
19using namespace TrackFindingCDC;
21TEST(TrackFindingCDCTest, eventdata_trajectories_CDCTrajectory3D_constructorPosMomCharge)
26 ESign newChargeSign = ESign::c_Plus;
29 CDCTrajectory3D trajectory(newPos3D, newTime, newMom3D, newChargeSign, bZ);;
31 Vector3D mom3D = trajectory.getMom3DAtSupport(bZ);
32 Vector3D pos3D = trajectory.getSupport();
33 ESign chargeSign = trajectory.getChargeSign();
36 EXPECT_NEAR(newMom3D.x(), mom3D.
x(), 10e-7);
37 EXPECT_NEAR(newMom3D.y(), mom3D.
y(), 10e-7);
38 EXPECT_NEAR(newMom3D.z(), mom3D.
z(), 10e-7);
40 EXPECT_NEAR(newPos3D.x(), pos3D.
x(), 10e-7);
41 EXPECT_NEAR(newPos3D.y(), pos3D.
y(), 10e-7);
42 EXPECT_NEAR(newPos3D.z(), pos3D.
z(), 10e-7);
44 EXPECT_NEAR(newChargeSign, chargeSign, 10e-7);
49TEST(TrackFindingCDCTest, CDCTrajectory3D_clear)
54 ESign newChargeSign = ESign::c_Plus;
56 CDCTrajectory3D trajectory3D(newPos3D, newTime, newMom3D, newChargeSign);
58 Helix helix = uncertainHelix;
61 SZLine szLine = helix.szLine();
64 EXPECT_TRUE(trajectory3D.isInvalid());
65 EXPECT_FALSE(trajectory3D.isFitted());
67 uncertainHelix.invalidate();
68 EXPECT_TRUE(uncertainHelix->isInvalid());
71 EXPECT_TRUE(helix.isInvalid());
81TEST(TrackFindingCDCTest, CDCTrajectory3D_GFTrackRoundTrip)
83 Vector3D expectedMomentum(1.0, 0.0, 0.0);
84 Vector3D expectedPosition(0.0, 1.0, 0.0);
85 ESign expectedCharge = ESign::c_Plus;
88 genfit::TrackCand expectedGFTrackCand;
89 expectedGFTrackCand.setPosMomSeed(expectedPosition,
93 TMatrixDSym expectedCov6(6);
95 expectedCov6(0, 0) = 0;
96 expectedCov6(1, 1) = 2;
97 expectedCov6(2, 2) = 3;
98 expectedCov6(3, 3) = 4;
99 expectedCov6(4, 4) = 5;
100 expectedCov6(5, 5) = 6;
101 expectedGFTrackCand.setCovSeed(expectedCov6);
106 genfit::TrackCand gfTrackCand;
107 trajectory3D.fillInto(gfTrackCand, bZ);
109 Vector3D position(gfTrackCand.getPosSeed());
110 Vector3D momentum(gfTrackCand.getMomSeed());
112 TMatrixDSym cov6 = gfTrackCand.getCovSeed();
115 EXPECT_NEAR(expectedPosition.x(), position.x(), 10e-7);
116 EXPECT_NEAR(expectedPosition.y(), position.y(), 10e-7);
117 EXPECT_NEAR(expectedPosition.z(), position.z(), 10e-7);
119 EXPECT_NEAR(expectedMomentum.x(), momentum.x(), 10e-7);
120 EXPECT_NEAR(expectedMomentum.y(), momentum.y(), 10e-7);
121 EXPECT_NEAR(expectedMomentum.z(), momentum.z(), 10e-7);
123 EXPECT_EQ(expectedCharge, charge);
124 for (
int i = 0; i < 6; ++i) {
125 for (
int j = 0; j < 6; ++j) {
126 EXPECT_NEAR(expectedCov6(i, j), cov6(i, j), 10e-7);
Particle full three dimensional trajectory.
Extension of the generalized circle also caching the perigee coordinates.
bool isInvalid() const
Indicates if all circle parameters are zero.
void invalidate()
Sets all circle parameters to zero.
bool isInvalid() const
Indicates if the line parameters do not represent a valid line.
void invalidate()
Sets the parameters to a invalid representation.
A three dimensional vector.
double x() const
Getter for the x coordinate.
double y() const
Getter for the y coordinate.
double z() const
Getter for the z coordinate.
This class represents an ideal helix in perigee parameterization including the covariance matrix of t...
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
ESign
Enumeration for the distinct sign values of floating point variables.
Abstract base class for different kinds of events.