Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Geometry releases will be tagged as `Descriptive_tag_v_X.Y.Z`.
## [MAIN] - Unreleased
- Changed MergeTracks default to True.
- Hits trailing the end of a Hough Track can now be added to the track they 'should' correspond to. ON by default, switchable in config.
- Prevent 3D track matching from looping indefinitely when the last hit in a required view lies outside the detector bounds.

## [Version 0.2] - 2023-12-13
- Areal density calculation fixed, affected Muon KE reconstruction
Expand Down
35 changes: 28 additions & 7 deletions src/TMS_Reco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,21 +1320,32 @@ std::vector<TMS_Track> TMS_TrackFinder::TrackMatching3D() {
// if (Xrun) std::cout <<"itX:"<<itX<<" ,Y: " << XTracks[itX].GetNotZ() << ", Z: " << XTracks[itX].GetZ() <<", PlaneNumber: " << XTracks[itX].GetPlaneNumber()<< std::endl;
// Sanity check for hits being in the detector volume (x and z)
bool hit_outside = false;
bool view_exhausted = false;
if (std::abs(UTracks[itU].GetNotZ()) > 4000.0 || UTracks[itU].GetZ() < 11000 || UTracks[itU].GetZ() > 20000) {
--itU;
if (itU == 0) view_exhausted = true;
else --itU;
hit_outside = true;
}
if (std::abs(VTracks[itV].GetNotZ()) > 4000.0 || VTracks[itV].GetZ() < 11000 || VTracks[itV].GetZ() > 20000) {
--itV;
if (itV == 0) view_exhausted = true;
else --itV;
hit_outside = true;
}
if (Xrun && Xback_match && Xfront_match) {
if (XTracks[itX].GetNotZ() > 400. || XTracks[itX].GetNotZ() < -4000. || XTracks[itX].GetZ() < 11000 || XTracks[itX].GetZ() > 20000) {
--itX;
if (itX == 0) view_exhausted = true;
else --itX;
hit_outside = true;
}
}
if (hit_outside) continue;
// There is no valid hit left in at least one required view. Continuing
// would decrement its index below zero and read outside the vector.
if (view_exhausted) break;
if (hit_outside) {
sane = (itU > 0 || itV > 0);
if (Xrun && Xback_match && Xfront_match) sane = sane || itX > 0;
continue;
}

// Stereo check
bool stereo_view = true;
Expand Down Expand Up @@ -2137,17 +2148,27 @@ std::vector<TMS_Track> TMS_TrackFinder::TrackMatching3D_XY() {
// std::cout <<"itX:"<<itX<<" ,Y: " << XTracks[itX].GetNotZ() << ", Z: " << XTracks[itX].GetZ() <<", PlaneNumber: " << XTracks[itX].GetPlaneNumber()<< std::endl;
// Sanity check for hits being in the detector volume (x and z)
bool hit_outside = false;
bool view_exhausted = false;
if (XTracks[itX].GetNotZ() > 500.0 || XTracks[itX].GetNotZ() == 0. || XTracks[itX].GetNotZ() < -4000.0
|| XTracks[itX].GetZ() < 11000 || XTracks[itX].GetZ() > 20000) {
--itX;
if (itX == 0) view_exhausted = true;
else --itX;
hit_outside = true;
}
if (std::abs(YTracks[itY].GetNotZ()) > 4000.0 or YTracks[itY].GetNotZ() == 0.
|| YTracks[itY].GetZ() < 11000 || YTracks[itY].GetZ() > 20000) {
--itY;
if (itY == 0) view_exhausted = true;
else --itY;
hit_outside = true;
}
if (hit_outside) continue;
// There is no valid hit left in at least one required view.
// Continuing would decrement its index below zero, skip the
// loop-condition update, and repeatedly read outside the vector.
if (view_exhausted) break;
if (hit_outside) {
sane = (itX > 0 || itY > 0);
continue;
}

// Stereo check
bool stereo_view = true;
Expand Down
Loading