68 if (
mode ==
"firstVertex") {
70 }
else if (
mode ==
"nearestToCandidate") {
72 }
else if (
mode ==
"fromCandidate") {
74 }
else if (
mode ==
"beamSpot") {
78 <<
"PATSingleVertexSelector: Mode '" <<
mode <<
"' not recognized or not supported.\n";
83 : vtxPreselection_(iConfig.existsAs<
std::
string>(
"vertexPreselection")
84 ? iConfig.getParameter<
std::
string>(
"vertexPreselection")
86 candPreselection_(iConfig.existsAs<
std::
string>(
"candidatePreselection")
87 ? iConfig.getParameter<
std::
string>(
"candidatePreselection")
89 doFilterEvents_(
false) {
93 if (iConfig.
exists(
"fallbacks")) {
94 vector<string> modes = iConfig.
getParameter<vector<string>>(
"fallbacks");
95 for (vector<string>::const_iterator it = modes.begin(), ed = modes.end(); it != ed; ++it) {
105 [
this](
edm::InputTag const &
tag) { return consumes<edm::View<reco::Candidate>>(tag); });
111 if (iConfig.
exists(
"filter"))
114 produces<vector<reco::Vertex>>();
136 for (vector<reco::Vertex>::const_iterator itv =
vertices->begin(), edv =
vertices->end(); itv != edv; ++itv) {
144 vector<pair<double, reco::CandidatePtr>>
cands;
150 iEvent.getByToken(*itt, theseCands);
155 cands.push_back(pair<double, reco::CandidatePtr>(
164 std::unique_ptr<vector<reco::Vertex>>
result;
166 for (std::vector<Mode>::const_iterator itm =
modes_.begin(), endm =
modes_.end(); itm != endm; ++itm) {
187 auto result = std::make_unique<std::vector<reco::Vertex>>();
216 float dzmin = 9999.0;
217 for (
auto itv =
selVtxs_.begin(), edv =
selVtxs_.end(); itv != edv; ++itv) {
224 if (
which.isNonnull())