Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

107 reco track direction is not correct #109

Merged
merged 3 commits into from
May 14, 2024
Merged
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
2 changes: 2 additions & 0 deletions config/TMS_Default_Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
TiltAngle = 19.0811366877 #tan(90-3=87)
# Y difference for expectation of reconstruction from UV and from X hit [mm]
YDifference = 300.0
# Distance from start to calculate track direction for [Number of planes]. Track matching done in plane pairs -> do not set to 1
DirectionDistance = 10

[Recon.AStar]
#CostMetric = "Manhattan"
Expand Down
1 change: 1 addition & 0 deletions src/TMS_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ TMS_Manager::TMS_Manager() {
_RECO_TRACKMATCH_YAnchor = toml::find<float>(data, "Recon", "TrackMatch3D", "YAnchor");
_RECO_TRACKMATCH_TiltAngle = toml::find<double>(data, "Recon", "TrackMatch3D", "TiltAngle");
_RECO_TRACKMATCH_YDifference = toml::find<float>(data, "Recon", "TrackMatch3D", "YDifference");
_RECO_TRACKMATCH_DirectionDistance = toml::find<int>(data, "Recon", "TrackMatch3D", "DirectionDistance");

_RECO_ASTAR_IsGreedy = toml::find<bool> (data, "Recon", "AStar", "IsGreedy");
_RECO_ASTAR_CostMetric = toml::find<std::string> (data, "Recon", "AStar", "CostMetric");
Expand Down
2 changes: 2 additions & 0 deletions src/TMS_Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class TMS_Manager {
float Get_Reco_TRACKMATCH_YAnchor() { return _RECO_TRACKMATCH_YAnchor; };
double Get_Reco_TRACKMATCH_TiltAngle() { return _RECO_TRACKMATCH_TiltAngle; };
float Get_Reco_TRACKMATCH_YDifference() { return _RECO_TRACKMATCH_YDifference; };
int Get_Reco_TRACKMATCH_DirectionDistance() { return _RECO_TRACKMATCH_DirectionDistance; };

bool Get_Reco_ASTAR_IsGreedy() { return _RECO_ASTAR_IsGreedy; };
std::string Get_Reco_ASTAR_CostMetric() { return _RECO_ASTAR_CostMetric; };
Expand Down Expand Up @@ -118,6 +119,7 @@ class TMS_Manager {
float _RECO_TRACKMATCH_YAnchor;
double _RECO_TRACKMATCH_TiltAngle;
float _RECO_TRACKMATCH_YDifference;
int _RECO_TRACKMATCH_DirectionDistance;

bool _RECO_ASTAR_IsGreedy;
std::string _RECO_ASTAR_CostMetric;
Expand Down
9 changes: 6 additions & 3 deletions src/TMS_Reco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,9 @@ std::vector<TMS_Track> TMS_TrackFinder::TrackMatching3D() {
#endif
}
}
// Sort track
SpatialPrio(aTrack.Hits);

// Track Length
aTrack.Length = CalculateTrackLength3D(aTrack);
#ifdef DEBUG
Expand All @@ -1258,9 +1261,9 @@ std::vector<TMS_Track> TMS_TrackFinder::TrackMatching3D() {
std::cout << "Added TrackEnergyDeposit: " << aTrack.EnergyDeposit << std::endl;
#endif
// Track Direction
aTrack.Direction[0] = aTrack.End[0] - aTrack.Start[0];
aTrack.Direction[1] = aTrack.End[1] - aTrack.Start[1];
aTrack.Direction[2] = aTrack.End[2] - aTrack.Start[2];
aTrack.Direction[0] = aTrack.Start[0] - aTrack.Hits[TMS_Manager::GetInstance().Get_Reco_TRACKMATCH_DirectionDistance()].GetRecoX(); //aTrack.End[0] - aTrack.Start[0];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will give a seg fault if DirectionDistance >= len(Hits)

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];
#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
Loading