Skip to content

Only make vector of DetectorElements if needed (i.e. for Run 4)

Stewart Martin-Haugh requested to merge smh/athena:DetElement_opt into master

The spacePointsToClusters method creates a std::vector<const InDetDD::SiDetectorElement*> but this is only needed for ITk reconstruction (see !44886 (merged). Make it optional and save some reserves and push_backs.

Appears in heaptrack profiling as a temporary allocation:

2211351 temporary allocations of 2211356 allocations in total (100.00%) from
__gnu_cxx::new_allocator<>::allocate(unsigned long, void const*)
  at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/ext/new_allocator.h:127
  in /cvmfs/atlas-nightlies.cern.ch/repo/sw/23.0_Athena_x86_64-centos7-gcc11-opt/2023-06-02T2101/Athena/23.0.32/InstallArea/x86_64-centos7-gcc11-opt/lib/libSiCombinatorialTrack
FinderTool_xk.so
std::allocator_traits<>::allocate(std::allocator<>&, unsigned long)
  at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/alloc_traits.h:460
std::_Vector_base<>::_M_allocate(unsigned long)
  at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/stl_vector.h:346
std::vector<>::reserve(unsigned long)
  at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/vector.tcc:78
InDet::SiCombinatorialTrackFinder_xk::spacePointsToClusters(std::vector<> const&, std::vector<>&, std::vector<>&)
  at /build/atnight/localbuilds/nightlies/Athena/23.0/athena/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx:955
2206087 temporary allocations of 2206092 allocations in total (100.00%) from: 
    InDet::SiCombinatorialTrackFinder_xk::spacePointsToClusters(std::vector<> const&, std::vector<>&)
      at /build/atnight/localbuilds/nightlies/Athena/23.0/athena/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx:917
      in /cvmfs/atlas-nightlies.cern.ch/repo/sw/23.0_Athena_x86_64-centos7-gcc11-opt/2023-06-02T2101/Athena/23.0.32/InstallArea/x86_64-centos7-gcc11-opt/lib/libSiCombinatorialTrackFinderTool_xk.so
    InDet::SiCombinatorialTrackFinder_xk::findTrack(InDet::SiCombinatorialTrackFinderData_xk&, Trk::ParametersBase<> const&, std::vector<> const&, std::vector<> const&, std::vector<>&, std::multimap<>&, EventContext const&) const
      at /build/atnight/localbuilds/nightlies/Athena/23.0/athena/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx:628
      in /cvmfs/atlas-nightlies.cern.ch/repo/sw/23.0_Athena_x86_64-centos7-gcc11-opt/2023-06-02T2101/Athena/23.0.32/InstallArea/x86_64-centos7-gcc11-opt/lib/libSiCombinatorialT
rackFinderTool_xk.so
    InDet::SiCombinatorialTrackFinder_xk::getTracks[abi:cxx11](InDet::SiCombinatorialTrackFinderData_xk&, Trk::ParametersBase<> const&, std::vector<> const&, std::vector<> const&, std::vector<>&, std::multimap<>&, EventContext const&) const
      at /build/atnight/localbuilds/nightlies/Athena/23.0/athena/InnerDetector/InDetRecTools/SiCombinatorialTrackFinderTool_xk/src/SiCombinatorialTrackFinder_xk.cxx:411
      in /cvmfs/atlas-nightlies.cern.ch/repo/sw/23.0_Athena_x86_64-centos7-gcc11-opt/2023-06-02T2101/Athena/23.0.32/InstallArea/x86_64-centos7-gcc11-opt/lib/libSiCombinatorialTrackFinderTool_xk.so
    InDet::SiTrackMaker_xk::getTracks[abi:cxx11](EventContext const&, InDet::SiTrackMakerEventData_xk&, std::vector<> const&) const
      at /build/atnight/localbuilds/nightlies/Athena/23.0/athena/InnerDetector/InDetRecTools/SiTrackMakerTool_xk/src/SiTrackMaker_xk.cxx:723
      in /cvmfs/atlas-nightlies.cern.ch/repo/sw/23.0_Athena_x86_64-centos7-gcc11-opt/2023-06-02T2101/Athena/23.0.32/InstallArea/x86_64-centos7-gcc11-opt/lib/libSiTrackMakerTool_xk.so
    TrigFastTrackFinder::findTracks(InDet::SiTrackMakerEventData_xk&, TrigRoiDescriptor const&, DataVector<> const*, DataVector<>&, EventContext const&) const
      at /build/atnight/localbuilds/nightlies/Athena/23.0/athena/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx:679
      in /cvmfs/atlas-nightlies.cern.ch/repo/sw/23.0_Athena_x86_64-centos7-gcc11-opt/2023-06-02T2101/Athena/23.0.32/InstallArea/x86_64-centos7-gcc11-opt/lib/libTrigFastTrackFinder.so
    TrigFastTrackFinder::execute(EventContext const&) const
      at /build/atnight/localbuilds/nightlies/Athena/23.0/athena/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx:443
      in /cvmfs/atlas-nightlies.cern.ch/repo/sw/23.0_Athena_x86_64-centos7-gcc11-opt/2023-06-02T2101/Athena/23.0.32/InstallArea/x86_64-centos7-gcc11-opt/lib/libTrigFastTrackFinder.so

Average fullscan trigger track finding time (on ttbar) goes down from 297 ms to 289 ms, about a 2-3% improvement.

Edited by Stewart Martin-Haugh

Merge request reports