Performs the actual test.
189 auto expectedTracksHandle
190 =
event.getValidHandle<std::vector<recob::Track>>(
tracksTag);
191 auto const& expectedTracks = *expectedTracksHandle;
194 <<
"Starting test on " << expectedTracks.size() <<
" tracks from '" 197 art::FindManyP<recob::Hit> hitsPerTrack
200 art::FindOneP<recob::TrackTrajectory> trajectoryPerTrack
203 auto const& expectedTrackFitHitInfo
204 = *(
event.getValidHandle<std::vector<std::vector<recob::TrackFitHitInfo>>>
208 , proxy::withAssociatedAs<recob::Hit, tag::SpecialHits>()
217 "Track proxy does NOT have space points available!!!");
221 "recob::TrackFitHitInfo not found!!!" 225 BOOST_TEST(
tracks.empty() == expectedTracks.empty());
226 BOOST_TEST(
tracks.size() == expectedTracks.size());
228 BOOST_TEST(
tracks.size() == expectedTrackFitHitInfo.size());
229 decltype(
auto) allFitHitInfo =
tracks.
get<
recob::TrackFitHitInfo>();
231 std::is_lvalue_reference<decltype(allFitHitInfo)>(),
232 "Copy of parallel
data!"
235 (allFitHitInfo.data() ==
std::addressof(expectedTrackFitHitInfo));
239 BOOST_TEST(fitHitInfoSize == expectedTrackFitHitInfo.
size());
241 std::
size_t iExpectedTrack = 0;
243 BOOST_TEST_CHECKPOINT(
"Track #" << trackProxy.index());
245 auto const& expectedTrack = expectedTracks[iExpectedTrack];
246 auto const& expectedHits = hitsPerTrack.at(iExpectedTrack);
247 auto const& expectedFitHitInfo = expectedTrackFitHitInfo[iExpectedTrack];
248 auto const& expectedTrajPtr = trajectoryPerTrack.at(iExpectedTrack);
250 = expectedTrajPtr.isNull()?
nullptr: expectedTrajPtr.get();
255 (std::addressof(trackRef) == std::addressof(expectedTrack));
257 (std::addressof(trackProxy.track()) == std::addressof(expectedTrack));
258 BOOST_TEST(trackProxy.nHits() == expectedHits.size());
259 BOOST_TEST(trackProxy.index() == iExpectedTrack);
261 decltype(
auto) fitHitInfo = trackProxy.
get<
recob::TrackFitHitInfo>();
263 std::is_lvalue_reference<decltype(fitHitInfo)>(),
264 "Copy of parallel data element!"
267 (
std::addressof(fitHitInfo),
std::addressof(expectedFitHitInfo));
268 BOOST_TEST(fitHitInfo.size() == expectedFitHitInfo.size());
271 (trackProxy.
get<
tag::SpecialHits>().size(), expectedHits.size());
275 (trackProxy.hasOriginalTrajectory() == !expectedTrajPtr.isNull());
276 if (expectedTrajCPtr) {
277 BOOST_TEST(trackProxy.originalTrajectoryPtr() == expectedTrajPtr);
278 BOOST_TEST(&trackProxy.originalTrajectory() == expectedTrajPtr.get());
281 BOOST_TEST(!(trackProxy.originalTrajectoryPtr()));
286 std::addressof(expectedTrack.Trajectory())
292 BOOST_TEST(trackProxy->NPoints() == expectedTrack.NPoints());
295 std::array<unsigned int, recob::TrajectoryPointFlagTraits::maxFlags()>
298 std::size_t iPoint = 0;
299 for (
auto const& pointInfo: trackProxy.points()) {
300 BOOST_TEST_CHECKPOINT(
" point #" << pointInfo.index());
302 decltype(
auto) expectedPointFlags = expectedTrack.FlagsAtPoint(iPoint);
304 BOOST_TEST(pointInfo.
index() == iPoint);
307 expectedTrack.Trajectory().LocationAtPoint(iPoint)
310 (pointInfo.
momentum() == expectedTrack.MomentumVectorAtPoint(iPoint));
311 BOOST_TEST(pointInfo.flags() == expectedPointFlags);
312 if (expectedPointFlags.hasOriginalHitIndex()) {
314 (pointInfo.hitPtr().key() == expectedPointFlags.fromHit());
317 BOOST_TEST(!pointInfo.hitPtr());
328 if (!expectedPointFlags.isDefined(flag))
continue;
329 if (expectedPointFlags.isSet(flag)) ++flagCounts[flag.index()];
333 (fitHitInfo[iPoint].WireId() == expectedFitHitInfo[iPoint].WireId());
335 (pointInfo.fitInfoPtr() == std::addressof(expectedFitHitInfo[iPoint]));
337 std::addressof(fitHitInfo[iPoint]) ==
338 std::addressof(expectedFitHitInfo[iPoint])
343 BOOST_TEST(iPoint == expectedTrack.NPoints());
353 BOOST_TEST_CHECKPOINT(
" flag: " << flag);
354 unsigned int flagCount = 0U;
355 for (
auto const& pointInfo: trackProxy.pointsWithFlags(flag)) {
357 BOOST_TEST_CHECKPOINT(
" point #" << pointInfo.index());
358 BOOST_TEST(pointInfo.flags().isDefined(flag));
359 BOOST_TEST(pointInfo.flags().isSet(flag));
363 BOOST_TEST(flagCount == flagCounts[flag.index()]);
368 BOOST_TEST(iExpectedTrack == expectedTracks.size());
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
auto withOriginalTrajectory(art::InputTag const &inputTag)
Adds recob::TrackTrajectory information to the proxy.
static constexpr Flag_t Suspicious
The point reconstruction is somehow questionable.
Reconstruction base classes.
static constexpr Flag_t NoPoint
The trajectory point is not defined.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
A trajectory in space reconstructed from hits.
Object storing per-hit information from a track fit.
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
static constexpr Flag_t HitIgnored
Hit was not included for the computation of the trajectory.
for(std::string line;std::getline(inFile, line);)
Represents a track trajectory before the final fit.
art::InputTag tracksTag
Tag for the input tracks.
static constexpr Flag_t DetectorIssue
The hit is associated to a problematic channel.
auto withFitHitInfo(art::InputTag const &inputTag)
Adds recob::TrackFitHitInfo information to the proxy.
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Represents a track trajectory from the final fit.
auto const & get(AssnsNode< L, R, D > const &r)
def momentum(x1, x2, x3, scale=1.)
Number of supported track types.
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a "fitted" track:
Event finding and building.