8#include <gtest/gtest.h>
9#include <framework/utilities/TestHelpers.h>
10#include <tracking/trackFindingCDC/testFixtures/TrackFindingCDCTestWithTopology.h>
12#include <tracking/trackFindingCDC/filters/track/BasicTrackVarSet.h>
13#include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
15#include <cdc/dataobjects/CDCHit.h>
16#include <cdc/dataobjects/WireID.h>
17#include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
18#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
19#include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
20#include <tracking/trackFindingCDC/geometry/Vector3D.h>
25using namespace TrackFindingCDC;
27TEST(BasicTrackVarSetCalculation, test_empty_track)
38 bool returnvalue = trackVarSet.
extract(&emptyTrack);
39 EXPECT_EQ(
false, returnvalue);
43 EXPECT_EQ(0, *trackVarSet.
find(
"size"));
44 EXPECT_EQ(0, *trackVarSet.
find(
"pt"));
46 EXPECT_EQ(0, *trackVarSet.
find(
"drift_length_mean"));
47 EXPECT_EQ(0, *trackVarSet.
find(
"drift_length_sum"));
48 EXPECT_EQ(0, *trackVarSet.
find(
"drift_length_min"));
49 EXPECT_EQ(0, *trackVarSet.
find(
"drift_length_max"));
50 EXPECT_EQ(0, *trackVarSet.
find(
"drift_length_variance"));
52 EXPECT_EQ(0, *trackVarSet.
find(
"adc_mean"));
53 EXPECT_EQ(0, *trackVarSet.
find(
"adc_sum"));
54 EXPECT_EQ(0, *trackVarSet.
find(
"adc_min"));
55 EXPECT_EQ(0, *trackVarSet.
find(
"adc_max"));
56 EXPECT_EQ(0, *trackVarSet.
find(
"adc_variance"));
58 EXPECT_EQ(0, *trackVarSet.
find(
"empty_s_mean"));
59 EXPECT_EQ(0, *trackVarSet.
find(
"empty_s_sum"));
60 EXPECT_EQ(0, *trackVarSet.
find(
"empty_s_min"));
61 EXPECT_EQ(0, *trackVarSet.
find(
"empty_s_max"));
62 EXPECT_EQ(0, *trackVarSet.
find(
"empty_s_variance"));
63 EXPECT_EQ(0, *trackVarSet.
find(
"s_range"));
72 double driftLength = 2.0;
73 unsigned short adcCount = 512.0;
74 double arcLength2D = 0.3;
75 const CDCHit aHit(128, adcCount, aWireID);
77 const CDCRLWireHit aRLWireHit(&aWireHit, ERightLeft::c_Unknown);
78 double some_arbitrary_z_coord = 0.0;
79 const Vector3D aRecoPos(aRLWireHit.getRefPos2D(), some_arbitrary_z_coord);
80 const CDCRecoHit3D aCDCHit(aRLWireHit, aRecoPos, arcLength2D);
81 const std::vector<CDCRecoHit3D> aHitVector{aCDCHit};
89 EXPECT_EQ(1, *trackVarSet.
find(
"size"));
91 EXPECT_EQ(driftLength, *trackVarSet.
find(
"drift_length_mean"));
92 EXPECT_EQ(driftLength, *trackVarSet.
find(
"drift_length_sum"));
93 EXPECT_EQ(driftLength, *trackVarSet.
find(
"drift_length_min"));
94 EXPECT_EQ(driftLength, *trackVarSet.
find(
"drift_length_max"));
96 EXPECT_EQ(-1, *trackVarSet.
find(
"drift_length_variance"));
98 EXPECT_EQ(adcCount, *trackVarSet.
find(
"adc_mean"));
99 EXPECT_EQ(adcCount, *trackVarSet.
find(
"adc_sum"));
100 EXPECT_EQ(adcCount, *trackVarSet.
find(
"adc_min"));
101 EXPECT_EQ(adcCount, *trackVarSet.
find(
"adc_max"));
103 EXPECT_EQ(-1, *trackVarSet.
find(
"adc_variance"));
106 EXPECT_EQ(0, *trackVarSet.
find(
"empty_s_mean"));
107 EXPECT_EQ(0, *trackVarSet.
find(
"empty_s_sum"));
108 EXPECT_EQ(0, *trackVarSet.
find(
"empty_s_min"));
109 EXPECT_EQ(0, *trackVarSet.
find(
"empty_s_max"));
110 EXPECT_EQ(0, *trackVarSet.
find(
"s_range"));
112 EXPECT_EQ(-1, *trackVarSet.
find(
"empty_s_variance"));
123 std::vector<WireID> wireIDs = {aWireID, bWireID};
125 std::vector<double> drift_lengths = {2.0, 3.0};
128 std::vector<unsigned short> adc_counts = {30, 500};
129 std::vector<double> arc_length_2Ds = {2.0, -3.0};
131 std::vector<CDCHit> cdcHits;
132 std::vector<CDCWireHit> cdcWireHits;
133 std::vector<CDCRecoHit3D> cdcRecoHits;
135 for (
size_t i = 0; i < drift_lengths.size(); i++) {
136 cdcHits.emplace_back(128, adc_counts.at(i), wireIDs.at(i));
137 cdcWireHits.emplace_back(&cdcHits.at(i), drift_lengths.at(i));
138 CDCRLWireHit aRLWireHit(&cdcWireHits.at(i), ERightLeft::c_Unknown);
139 Vector3D aRecoPos(aRLWireHit.getRefPos2D(), 0.0);
140 cdcRecoHits.emplace_back(aRLWireHit, aRecoPos, arc_length_2Ds.at(i));
149 EXPECT_EQ(2, *trackVarSet.
find(
"size"));
151 EXPECT_EQ(2.5, *trackVarSet.
find(
"drift_length_mean"));
152 EXPECT_EQ(5.0, *trackVarSet.
find(
"drift_length_sum"));
153 EXPECT_EQ(2.0, *trackVarSet.
find(
"drift_length_min"));
154 EXPECT_EQ(3.0, *trackVarSet.
find(
"drift_length_max"));
156 EXPECT_NEAR(0.7071, *trackVarSet.
find(
"drift_length_variance"), 1e-4);
158 EXPECT_EQ(265, *trackVarSet.
find(
"adc_mean"));
159 EXPECT_EQ(530, *trackVarSet.
find(
"adc_sum"));
160 EXPECT_EQ(30, *trackVarSet.
find(
"adc_min"));
161 EXPECT_EQ(500, *trackVarSet.
find(
"adc_max"));
162 EXPECT_NEAR(332.34, *trackVarSet.
find(
"adc_variance"), 1e-2);
165 double only_empty_s = -5.0;
166 EXPECT_EQ(only_empty_s, *trackVarSet.
find(
"empty_s_mean"));
167 EXPECT_EQ(only_empty_s, *trackVarSet.
find(
"empty_s_sum"));
168 EXPECT_EQ(only_empty_s, *trackVarSet.
find(
"empty_s_min"));
169 EXPECT_EQ(only_empty_s, *trackVarSet.
find(
"empty_s_max"));
170 EXPECT_EQ(only_empty_s, *trackVarSet.
find(
"s_range"));
172 EXPECT_EQ(-1, *trackVarSet.
find(
"empty_s_variance"));
183 std::vector<WireID> wireIDs = {aWireID, bWireID, cWireID};
186 std::vector<double> arc_length_2Ds = { -2.0, 0.0, 3.0};
188 std::vector<CDCHit> cdcHits;
189 cdcHits.reserve(wireIDs.size());
190 std::vector<CDCWireHit> cdcWireHits;
191 cdcWireHits.reserve(wireIDs.size());
192 std::vector<CDCRecoHit3D> cdcRecoHits;
193 cdcRecoHits.reserve(wireIDs.size());
195 for (
const WireID& wireID : wireIDs) {
196 cdcHits.emplace_back(128, 0, wireID);
198 for (
const CDCHit& cdcHit : cdcHits) {
199 cdcWireHits.emplace_back(&cdcHit, 0);
201 for (std::size_t i = 0; i < cdcWireHits.size(); i++) {
202 const CDCRLWireHit aRLWireHit(&cdcWireHits.at(i), ERightLeft::c_Unknown);
203 const Vector3D aRecoPos(aRLWireHit.getRefPos2D(), 0.0);
204 cdcRecoHits.emplace_back(aRLWireHit, aRecoPos, arc_length_2Ds.at(i));
213 EXPECT_EQ(3, *trackVarSet.
find(
"size"));
215 EXPECT_EQ(2.5, *trackVarSet.
find(
"empty_s_mean"));
216 EXPECT_EQ(5.0, *trackVarSet.
find(
"empty_s_sum"));
217 EXPECT_EQ(2.0, *trackVarSet.
find(
"empty_s_min"));
218 EXPECT_EQ(3.0, *trackVarSet.
find(
"empty_s_max"));
219 EXPECT_NEAR(0.7071, *trackVarSet.
find(
"empty_s_variance"), 1e-4);
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Class to compute floating point variables from a track which can be recorded as a flat TNtuple or ser...
bool extract(const CDCTrack *track) override
Generate and assign the contained variables.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Class representing a three dimensional reconstructed hit.
Class representing a sequence of three dimensional reconstructed hits.
Class representing a hit wire in the central drift chamber.
Class representing the sense wire arrangement in the whole of the central drift chamber.
const CDCWire & getWire(const WireID &wireId) const
Getter for wire getter by wireID object.
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
const WireID & getWireID() const
Getter for the wire id.
This class provides the declaration of the common test fixture to all test of the track finding in th...
MayBePtr< Float_t > find(const std::string &varName) override
Pointer to the variable with the given name.
A three dimensional vector.
Class to identify a wire inside the CDC.
Abstract base class for different kinds of events.