Skip to content
Snippets Groups Projects

Cleanup of ca::TripletConstructor.

Merged Dominik Smith requested to merge d.smith/cbmroot:TrackingCleanupSquashed2 into master
All threads resolved!

This MR builds upon !1896 (closed). The main achievement is the elimination of several global fields for storage of temporary (doublet and triplet) hit and track objects. All intermediate results are now kept at local scope. The interface of the class was also changed, such that the final Vector<ca::Triplet> output object is now a return value, instead of a class member that has to be retrieved by a getter.

In order to eliminate global objects, several private functions of the class (such as FindRightHit(), FitTriplets(), FindDoublets() etc.) were restructured, renamed in some cases, and streamlined. Local lambda expressions were used in some cases. The class functions now explicitly reveal what their input and output is.

The resulting code is, in my opinion, much more concise and readable for a non-expert.

@se.gorbunov There is one potential conflict with !1898 (merged). A lambda expression called fitTrack now receives a fscal instead of a float, according to its header, but at the function calls the values -1.f and 1.f are passed. This will not produce any logic errors, but the compiler might complain if fscal is globally set to something other than float.

Also: If we could get rid of the debug output checks, i.e. those controlled by

    static constexpr bool fDebugDublets     = false;  // print debug info for dublets
    static constexpr bool fDebugTriplets    = false;  // print debug info for triplets
    static constexpr bool fDebugCollectHits = false;  // print debug info for CollectHits

then this class could be made even cleaner.

@s.zharko The QA test completes and shows no conflicts.

Edited by Dominik Smith

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Dominik Smith changed the description

    changed the description

    • Author Maintainer
      Resolved by Dominik Smith

      @f.uhlig The MacOS pipelines are showing the following compilation error:

      /Users/fairroot/builds/computing/cbmroot/algo/ca/core/tracking/CaTripletConstructor.cxx:346:20: error: reference to local binding 'hitsM_2' declared in enclosing function 'cbm::algo::ca::TripletConstructor::FindTripletHits'
              int indM = hitsM_2[i2];
                         ^
      [CTest: warning matched] /Users/fairroot/builds/computing/cbmroot/algo/ca/core/tracking/CaTripletConstructor.cxx:283:20: note: 'hitsM_2' declared here
        auto& [tracks_2, hitsM_2] = doublets;
                         ^
      1 error generated.

      Do you have an idea what the problem is? Something with the structured bindings? I'm not seeing this on Linux.

  • Dominik Smith added 1 commit

    added 1 commit

    • 5bd0a657 - Cleaned up ca::TripletConstructor.

    Compare with previous version

  • Dominik Smith resolved all threads

    resolved all threads

  • Dominik Smith mentioned in merge request !1900 (closed)

    mentioned in merge request !1900 (closed)

  • Author Maintainer

    Closing. Superceded by !1900 (closed).

  • Please register or sign in to reply
    Loading