Skip to content

Commit

Permalink
Merge pull request #24744 from slava77/patch-40
Browse files Browse the repository at this point in the history
PhotonIDValueMapProducer use auto const ref to avoid unnecessary object copies
  • Loading branch information
cmsbuild committed Oct 1, 2018
2 parents a5bee72 + 9f51413 commit 74ed5a9
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -416,11 +416,11 @@ void PhotonIDValueMapProducer::getImpactParameters(
const edm::Ptr<reco::Candidate>& candidate, const reco::Vertex& pv, float& dxy, float& dz)
{
if (isAOD_) {
auto theTrack = *static_cast<const edm::Ptr<reco::PFCandidate>>(candidate)->trackRef();
auto const& theTrack = *static_cast<const edm::Ptr<reco::PFCandidate>>(candidate)->trackRef();
dxy = theTrack.dxy(pv.position());
dz = theTrack.dz(pv.position());
} else {
auto aCand = *static_cast<const edm::Ptr<pat::PackedCandidate>>(candidate);
auto const& aCand = *static_cast<const edm::Ptr<pat::PackedCandidate>>(candidate);
dxy = aCand.dxy(pv.position());
dz = aCand.dz(pv.position());
}
Expand Down

0 comments on commit 74ed5a9

Please sign in to comment.