Skip to content
Snippets Groups Projects

Fix invalid memory access in ClassifyPhotonElectronAlg

Merged Oleksandr Zenaiev requested to merge fix_ClassifyPhotonElectronAlg into master

The lines

photons.erase( std::remove_if( photons.begin(), photons.end(),
                                   [&]( const auto& hypo ) { return CaloMomentum( hypo ).pt() < m_eTcut; } ),
                   photons.end() );
    electrons.erase( std::remove_if( electrons.begin(), electrons.end(),
                                     [&]( const auto& hypo ) { return CaloMomentum( hypo ).pt() < m_electrEtCut; } ),
                     electrons.end() );

produced invalid memory access in very rare events when corrected calo hypos have pT lower than the same pT cut applied before correction. It seems KeyedContainer does not support remove_if? (cc @sponce) (worth to say that erasing elements happens very rarely, something like 1:1000 events) This was spotted when running (not yet merged) new test from Moore!386 (merged) (one has to run on more than 1000 events to see a crash).

Another small fix is changing m_eTcut -> m_photonEtCut in two places (perhaps a typo? cc @cmarinbe).

Thanks @sstahl for spotting the problem with erasing element in the very first commit.

Should go with Brunel!964 (merged) for references updates

Edited by Rosen Matev

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
  • mentioned in issue Moore#136 (closed)

  • Ross John Hunter assigned to @peilian and unassigned @rjhunter

    assigned to @peilian and unassigned @rjhunter

  • Oleksandr Zenaiev added 83 commits

    added 83 commits

    • 2c90a896...282b0731 - 82 commits from branch master
    • b6ef3ddc - Merge remote-tracking branch 'origin/master' into fix_ClassifyPhotonElectronAlg

    Compare with previous version

  • added 1 commit

    • e9916fe2 - Apply suggestion to CaloFuture/CaloFutureReco/src/ClassifyPhotonElectronAlg.cpp

    Compare with previous version

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