Bug #7050
Bug #6394: Verify that association query objects are created outside tight loops
FindManyP() usage in Track3DKalmanSPS, Track3Dreco and TrackAna modules
100%
Description
Track3DKalmanSPS
, Track3Dreco
and TrackAna
modules show non-optimal usage of associations:
larreco/TrackFinder/Track3DKalmanSPS_module.cc
larreco/TrackFinder/Track3Dreco_module.cc
larreco/TrackFinder/TrackAna_module.cc
I notice dubious practise in Track3DKalmanSPS::produce()
, Track3Dreco::produce()
and TrackAna::anaStitch()
.
The action I recommend:
- since you use it, #include "art/Framework/Core/FindManyP.h"
- bring the queries FindManyP()
out of the loops
- use const std::vector<art::Ptr<T>>&
to store the result of FindManyP::at()
,
that returns a constant reference
- I am not sure about the purpose of using temporaries (pcoll
, sppt
) to
initialize FindManyP()
Contact person: Eric Church (echurch@fnal.gov).
History
#1 Updated by Eric Church over 6 years ago
- Status changed from Assigned to Resolved
Setting this issue to Resolved.
Per Gianluca's recommendations, FindManyP() pulled out of loops where possible, left as-is when in try{} blocks. Include FindManyP.h, const ref& used where possible, auto temporaries removed.
#2 Updated by Gianluca Petrillo about 6 years ago
- % Done changed from 0 to 100
#3 Updated by Gianluca Petrillo about 6 years ago
- Status changed from Resolved to Closed