Skip to content
Snippets Groups Projects

ATLASRECTS-5057: Avoid holes search in GSF

Merged Roger Naranjo requested to merge ATLAS-EGamma/athena:avoid_holes_search_in_gsf into master

This MR is intended to save some CPU time during GSF. The holes search is a bit time consuming and we can estimated by hand looking at the number of holes in the original track and change in the number of silicon hits between the original track and the GSF tracks.

Mentioning @christos and @amorley

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
  • This merge request affects 3 packages:

    • InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool
    • Reconstruction/egamma/egammaAlgs
    • Tracking/TrkTools/TrkTrackSummaryTool
    • Resolved by Roger Naranjo

      Hi better to put it here over the many small comments.

      I would I have gone with adding in the summaryTool

      +updateTrackNoHoleSearch(Track& track) const
      +{
      +  // first check if track has summary already.
      +  if (track.m_trackSummary!=nullptr) {
      +    delete track.m_trackSummary;
      +    track.m_trackSummary = nullptr;
      +  }
      +  track.m_trackSummary=summaryNoHoleSearch(track).release();
      +  return;
      +}
      + 

      and then in the code call this and pick Trk::TrackSummary* summary = Info.Track->trackSummary();

      or doing something equivalent given the track is non const inside the EMBremCollectionBuilder so no need to add to the tool

      Trk::TrackSummary* summary = Info.Track->trackSummary();
      if(summary != nullptr){
        delete summary;
        summary = nullptr;
      } 
      summary = summaryNoHoleSearch(*(Info.Track)).release();

      And then update that one. Now

      • you call createTrackSummaryNoHoleSearch, which calls summaryNoHoleSearch .
      • then you go via the path of const_cast although you have non-const track
      • then you get a const summary (although you could have avoided it)
      • which leads to another allocation via make_unique to get a non-const copy ...

      So 2 allocations + 1 const_cast when you need just 1 allocation ...

      Edited by Christos Anastopoulos
  • :white_check_mark: CI Result SUCCESS

    Athena AthSimulation
    externals :white_check_mark: :white_check_mark:
    cmake :white_check_mark: :white_check_mark:
    make :white_check_mark: :white_check_mark:
    required tests :white_check_mark: :white_check_mark:
    optional tests :white_check_mark: :white_check_mark:

    Full details available at NICOS MR-26513-2019-09-12-00-52
    :white_check_mark: Athena: number of compilation errors 0, warnings 0
    :white_check_mark: AthSimulation: number of compilation errors 0, warnings 0
    :pencil: For experts only: Jenkins output [CI-MERGE-REQUEST-CC7 3201]

    • Resolved by Roger Naranjo

      On another note since

      std::unique_ptr<Trk::TrackSummary>
      Trk::TrackSummaryTool::createSummary( const Track& track,
                                            bool doHolesInDet,
                                            bool doHolesMuon) const
      {
        // first check if track has summary already and then return a clone
        // (remember the TrackSummaryTool is a factory!)
        if (track.trackSummary()!=nullptr) {
          ATH_MSG_DEBUG ("Return cached summary for author : "<<track.info().dumpInfo());
          return std::make_unique<Trk::TrackSummary>(*(track.trackSummary()));
        }

      is always called . e.g. (even after the removal you did)

       Trk::TrackSummary* ts= createSummary(track,m_doHolesInDet, m_doHolesMuon ).release();
        Trk::Track& nonConstTrack = const_cast<Trk::Track&>(track);
        if (onlyUpdateTrack) {
          // not returning summary. Add it directly the track
          nonConstTrack.m_trackSummary = ts;
          ts=nullptr; // returning nullptr
        } else {
          // need to return summary too. So add a copy to the track
          nonConstTrack.m_trackSummary = new Trk::TrackSummary(*ts);
        }
        return ts;
      1. not sure why you removed the comment on the "clone".

      2. I am bit scheptical on the changes you did there as you now create a clone and you can overwrite what was there without delete ...

      before if something was there you were getting just clone. Now you create a clone for it anyhow, and then you go on also to do nonConstTrack.m_trackSummary = new Trk::TrackSummary(*ts); overriding what was there with a clone of itself without deleting it , so mem leak alert ...

      Edited by Christos Anastopoulos
  • added 1 commit

    • c207883b - Implement fixes on my comments in the MR

    Compare with previous version

  • This merge request affects 4 packages:

    • InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool
    • Reconstruction/egamma/egammaAlgs
    • Tracking/TrkTools/TrkToolInterfaces
    • Tracking/TrkTools/TrkTrackSummaryTool
  • added 1 commit

    • cd2f1480 - Implement fixes on my comments in the MR

    Compare with previous version

  • This merge request affects 4 packages:

    • InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool
    • Reconstruction/egamma/egammaAlgs
    • Tracking/TrkTools/TrkToolInterfaces
    • Tracking/TrkTools/TrkTrackSummaryTool
  • :white_check_mark: CI Result SUCCESS

    Athena AthSimulation
    externals :white_check_mark: :white_check_mark:
    cmake :white_check_mark: :white_check_mark:
    make :white_check_mark: :white_check_mark:
    required tests :white_check_mark: :white_check_mark:
    optional tests :white_check_mark: :white_check_mark:

    Full details available at NICOS MR-26513-2019-09-12-05-18
    :white_check_mark: Athena: number of compilation errors 0, warnings 0
    :white_check_mark: AthSimulation: number of compilation errors 0, warnings 0
    :pencil: For experts only: Jenkins output [CI-MERGE-REQUEST-CC7 3204]

  • :white_check_mark: CI Result SUCCESS

    Athena AthSimulation
    externals :white_check_mark: :white_check_mark:
    cmake :white_check_mark: :white_check_mark:
    make :white_check_mark: :white_check_mark:
    required tests :white_check_mark: :white_check_mark:
    optional tests :white_check_mark: :white_check_mark:

    Full details available at NICOS MR-26513-2019-09-12-05-28
    :white_check_mark: Athena: number of compilation errors 0, warnings 0
    :white_check_mark: AthSimulation: number of compilation errors 0, warnings 0
    :pencil: For experts only: Jenkins output [CI-MERGE-REQUEST-CC7 3203]

  • Roger Naranjo resolved all threads

    resolved all threads

  • I'll approve this, but I would like to bring up a point of concern for me. I personally think that the memory management as per discussion above is fairly confusing. It would be nice to clean it all up and consistently use smart pointer throughout instead of release() it to a raw pointer, which hard to keep track. However, that part has already been discussed quite a bit, and they look ok for now.--MR L1

  • Hey to do it throughout one needs to change also the Trk::Track class (if we discuss this after my changes). As this hold a plain Trk::TrackSummary* which it owns. So the release is used to tranfer the summary to the Trk::Track.

    This design can indeed become a bit tricky as you manually remove the old and add the new so perhaps it worths to change it at the Trk::Track level, but is another level down in the code ...

    if the Trk::Track was holding a unique_ptr rather than plain then the release would be move or reset and would not need the manual delete of the existing . So yes there is scope if we touch the EDM class.

    Edited by Christos Anastopoulos
  • mentioned in commit cd876e27

  • mentioned in merge request !26586 (merged)

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading