57 useBeamSpot_(
cfg.getParameter<
bool>(
"useBeamSpot")),
58 useLostTracks_(
cfg.getParameter<
bool>(
"useLostTracks")),
59 useEleKfTracks_(
cfg.getParameter<
bool>(
"useEleKfTracks")) {
60 produces<reco::VertexCollection>();
89 auto outputVertices = std::make_unique<reco::VertexCollection>();
90 outputVertices->reserve(1);
93 std::vector<reco::TransientTrack> transTracks;
97 if (
cand.charge() == 0 ||
cand.vertexRef().isNull())
99 if (
cand.bestTrack() ==
nullptr)
101 auto key =
cand.vertexRef().key();
108 transTracks.push_back(transTrackBuilder.
build(
cand.bestTrack()));
113 for (
const auto&
cand : (*lostTrackCands)) {
114 if (
cand.charge() == 0 ||
cand.vertexRef().isNull())
116 if (
cand.bestTrack() ==
nullptr)
118 auto key =
cand.vertexRef().key();
123 transTracks.push_back(transTrackBuilder.
build(
cand.bestTrack()));
129 for (
const auto&
cand : (*eleKfTrackCands)) {
130 if (
cand.charge() == 0 ||
cand.vertexRef().isNull())
132 if (
cand.bestTrack() ==
nullptr)
134 auto key =
cand.vertexRef().key();
139 transTracks.push_back(transTrackBuilder.
build(
cand.bestTrack()));
148 if (transTracks.size() >= 3) {
152 transVtx = avf.
vertex(transTracks);
160 if (!std::isfinite(transVtx.
position().
z()))
169 outputVertices->push_back(refitPV);
183 desc.add<
bool>(
"useBeamSpot",
true)->setComment(
"Refit PV with beam-spot constraint");
184 desc.add<
bool>(
"useLostTracks",
true)
185 ->setComment(
"Use collection of tracks not used by PF-candidates, aka lost-tracks");
186 desc.add<
bool>(
"useEleKfTracks",
true)
187 ->setComment(
"Use collection of electron KF-tracks instead of GSF-tracks of electron PF-candidates");
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void produce(edm::Event &, const edm::EventSetup &) override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
GlobalPoint position() const
~PATRefitVertexProducer() override
edm::EDGetTokenT< reco::BeamSpot > srcBeamSpot_
edm::EDGetTokenT< std::vector< pat::PackedCandidate > > srcLostTracks_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const override
std::vector< Vertex > VertexCollection
reco::TransientTrack build(const reco::Track *p) const
void setWeightThreshold(float w)
Abs< T >::type abs(const T &t)
key
prepare the HTCondor submission files and eventually submit them
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< std::vector< pat::PackedCandidate > > srcCands_
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::EDGetTokenT< reco::VertexCollection > srcVertices_
edm::ESGetToken< TransientTrackBuilder, TransientTrackRecord > transTrackBuilderToken_
edm::EDGetTokenT< std::vector< pat::PackedCandidate > > srcEleKfTracks_
PATRefitVertexProducer(const edm::ParameterSet &)