Skip to content

Commit

Permalink
Fix typo, bool vs string
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkio committed Oct 18, 2024
1 parent a1d9539 commit fb58f56
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
4 changes: 4 additions & 0 deletions config/TMS_Default_Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
# 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.TrackSmoothing]
UseTrackSmoothing = true
TrackSmoothingStrategy = "simple"

[Recon.AStar]
#CostMetric = "Manhattan"
CostMetric = "Euclidean"
Expand Down
3 changes: 3 additions & 0 deletions src/TMS_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ TMS_Manager::TMS_Manager() {
_RECO_TIME_TimeSlicerMinimumSliceWidthInUnits = toml::find<int>(data, "Recon", "Time", "TimeSlicerMinimumSliceWidthInUnits");
_RECO_TIME_TimeSlicerMaxTime = toml::find<double>(data, "Recon", "Time", "TimeSlicerMaxTime");

_RECO_TRACKSMOOTHING_UseTrackSmoothing = toml::find<bool>(data, "Recon", "TrackSmoothing", "UseTrackSmoothing");
_RECO_TRACKSMOOTHING_TrackSmoothingStrategy = toml::find<std::string>(data, "Recon", "TrackSmoothing", "TrackSmoothingStrategy");

_RECO_DBSCAN_MinPoints = toml::find<int>(data, "Recon", "DBSCAN", "MinPoints");
_RECO_DBSCAN_Epsilon = toml::find<double>(data, "Recon", "DBSCAN", "Epsilon");
_RECO_DBSCAN_PreDBNeighbours = toml::find<int>(data, "Recon", "DBSCAN", "PreDBNeighbours");
Expand Down
6 changes: 6 additions & 0 deletions src/TMS_Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class TMS_Manager {
bool Get_Reco_Kalman_Run() { return _RECO_KALMAN_RUN; };

bool Get_LightWeight_Truth() { return _TRUTH_LIGHTWEIGHT; };

bool Get_Reco_TRACKSMOOTHING_UseTrackSmoothing() { return _RECO_TRACKSMOOTHING_UseTrackSmoothing; };
std::string Get_Reco_TRACKSMOOTHING_TrackSmoothingStrategy() { return _RECO_TRACKSMOOTHING_TrackSmoothingStrategy; };

bool Get_Reco_TIME_RunTimeSlicer() { return _RECO_TIME_RunTimeSlicer; };
bool Get_Reco_TIME_RunSimpleTimeSlicer() { return _RECO_TIME_RunSimpleTimeSlicer; };
Expand Down Expand Up @@ -143,6 +146,9 @@ class TMS_Manager {
float _RECO_TRACKMATCH_YDifference;
int _RECO_TRACKMATCH_DirectionDistance;

bool _RECO_TRACKSMOOTHING_UseTrackSmoothing;
std::string _RECO_TRACKSMOOTHING_TrackSmoothingStrategy;

bool _RECO_ASTAR_IsGreedy;
std::string _RECO_ASTAR_CostMetric;

Expand Down
8 changes: 4 additions & 4 deletions src/TMS_Reco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1623,12 +1623,12 @@ std::vector<TMS_Track> TMS_TrackFinder::TrackMatching3D() {
// Sort track
SpatialPrio(aTrack.Hits);

// TODO check if we have track smoothing turned on via TMS_Manager::GetInstance()
aTrack.ApplyTrackSmoothing();
if (TMS_Manager::GetInstance().Get_Reco_TRACKSMOOTHING_UseTrackSmoothing())
aTrack.ApplyTrackSmoothing();

// Smoothing of start and end of track in case of too much 'flailing around' in the y direction
// end
bool SameSign = true;
/*bool SameSign = true;
if ((aTrack.End[1] > 0 && aTrack.Hits[aTrack.Hits.size() - 3].GetRecoY() < 0) || (aTrack.End[1] < 0 && aTrack.Hits[aTrack.Hits.size() - 3].GetRecoY() > 0)) SameSign = false;
if ((SameSign &&std::abs(aTrack.End[1] - aTrack.Hits[aTrack.Hits.size() - 3].GetRecoY()) >= 676.6) || (!SameSign && std::abs(aTrack.End[1]) + std::abs(aTrack.Hits[aTrack.Hits.size() - 3].GetRecoY()) >= 674.6)) {
aTrack.End[1] = (aTrack.End[1] + aTrack.Hits[aTrack.Hits.size() - 3].GetRecoY()) / 2;
Expand All @@ -1644,7 +1644,7 @@ std::vector<TMS_Track> TMS_TrackFinder::TrackMatching3D() {
if (aTrack.Start[1] > 244.0) aTrack.Start[1] = 244.0;
else if (aTrack.Start[1] < -2949.0) aTrack.Start[1] = -2949.0;
aTrack.Hits[0].SetRecoY(aTrack.Start[1]);
}
}*/
#ifdef DEBUG
for (auto hits: aTrack.Hits) {
std::cout << "Match: " << hits.GetRecoX() << "," << hits.GetRecoY() << "," << hits.GetZ() << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion src/TMS_Track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void TMS_Track::ApplyTrackSmoothing() {
//double initial_track_smoothness = CalculateTrackSmoothnessY();
// Ideally this would be done in reco somewhere but idk where
setDefaultUncertainty();
std::string strategy = "simple";
std::string strategy = TMS_Manager::GetInstance().Get_Reco_TRACKSMOOTHING_TrackSmoothingStrategy();
if (strategy == "simple") simpleTrackSmoothing();
// The next level would be to do a minimization that minimizes curvature + chi2,
// where chi2 takes into account the uncertainty of each point. Basically almost kalman filter
Expand Down

0 comments on commit fb58f56

Please sign in to comment.