Currently we are reading the vertex collection once per jet.
While CMSSW is smart about caching such access, it is a bad code example.
These two lines should move into the produce method
edm::Handle < std::vector<reco::Vertex> > primaryVertices;
iEvent.getByToken(vtxInputTag_, primaryVertices);
and the current fillVertexVariables method should take the vertex handle (const reference) instead of iEvent as paramter.
Currently we are reading the vertex collection once per jet.
While CMSSW is smart about caching such access, it is a bad code example.
These two lines should move into the
producemethodand the current
fillVertexVariablesmethod should take the vertex handle (const reference) instead ofiEventas paramter.