Skip to content

Commit

Permalink
Merge pull request #111 from DUNE/107-reco-track-direction-is-not-cor…
Browse files Browse the repository at this point in the history
…rect

Preventing a seg fault with the new direction calculation for short t…
  • Loading branch information
LiamOS authored May 15, 2024
2 parents 2465ae2 + c0b8490 commit d9ee0c6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/TMS_Reco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1275,9 +1275,15 @@ std::vector<TMS_Track> TMS_TrackFinder::TrackMatching3D() {
std::cout << "Added TrackEnergyDeposit: " << aTrack.EnergyDeposit << std::endl;
#endif
// Track Direction
aTrack.Direction[0] = aTrack.Start[0] - aTrack.Hits[TMS_Manager::GetInstance().Get_Reco_TRACKMATCH_DirectionDistance()].GetRecoX(); //aTrack.End[0] - aTrack.Start[0];
aTrack.Direction[1] = aTrack.Start[1] - aTrack.Hits[TMS_Manager::GetInstance().Get_Reco_TRACKMATCH_DirectionDistance()].GetRecoY(); //aTrack.End[1] - aTrack.Start[1];
aTrack.Direction[2] = aTrack.Start[2] - aTrack.Hits[TMS_Manager::GetInstance().Get_Reco_TRACKMATCH_DirectionDistance()].GetZ(); //aTrack.End[2] - aTrack.Start[2];
if (TMS_Manager::GetInstance().Get_Reco_TRACKMATCH_DirectionDistance() >= aTrack.Hits.size()) {
aTrack.Direction[0] = aTrack.Start[0] - aTrack.End[0];
aTrack.Direction[1] = aTrack.Start[1] - aTrack.End[1];
aTrack.Direction[2] = aTrack.Start[2] - aTrack.End[2];
} else {
aTrack.Direction[0] = aTrack.Start[0] - aTrack.Hits[TMS_Manager::GetInstance().Get_Reco_TRACKMATCH_DirectionDistance()].GetRecoX();
aTrack.Direction[1] = aTrack.Start[1] - aTrack.Hits[TMS_Manager::GetInstance().Get_Reco_TRACKMATCH_DirectionDistance()].GetRecoY();
aTrack.Direction[2] = aTrack.Start[2] - aTrack.Hits[TMS_Manager::GetInstance().Get_Reco_TRACKMATCH_DirectionDistance()].GetZ();
}
#ifdef DEBUG
std::cout << "Start: " << aTrack.Start[0] << " | " << aTrack.Start[1] << " | " << aTrack.Start[2] << std::endl;
std::cout << "End: " << aTrack.End[0] << " | " << aTrack.End[1] << " | " << aTrack.End[2] << std::endl;
Expand Down

0 comments on commit d9ee0c6

Please sign in to comment.