13 if (
mode ==
"firstVertex") {
15 }
else if (
mode ==
"nearestToCandidate") {
17 }
else if (
mode ==
"fromCandidate") {
19 }
else if (
mode ==
"beamSpot") {
23 <<
"PATSingleVertexSelector: Mode '" <<
mode <<
"' not recognized or not supported.\n";
28 : vtxPreselection_(iConfig.existsAs<
std::
string>(
"vertexPreselection")
29 ? iConfig.getParameter<
std::
string>(
"vertexPreselection")
31 candPreselection_(iConfig.existsAs<
std::
string>(
"candidatePreselection")
32 ? iConfig.getParameter<
std::
string>(
"candidatePreselection")
34 doFilterEvents_(
false) {
38 if (iConfig.
exists(
"fallbacks")) {
39 vector<string> modes = iConfig.
getParameter<vector<string>>(
"fallbacks");
40 for (vector<string>::const_iterator it = modes.begin(), ed = modes.end(); it != ed; ++it) {
50 [
this](
edm::InputTag const &
tag) { return consumes<edm::View<reco::Candidate>>(tag); });
56 if (iConfig.
exists(
"filter"))
59 produces<vector<reco::Vertex>>();
81 for (vector<reco::Vertex>::const_iterator itv =
vertices->begin(), edv =
vertices->end(); itv != edv; ++itv) {
89 vector<pair<double, reco::CandidatePtr>>
cands;
95 iEvent.getByToken(*itt, theseCands);
100 cands.push_back(pair<double, reco::CandidatePtr>(
109 std::unique_ptr<vector<reco::Vertex>>
result;
111 for (std::vector<Mode>::const_iterator itm =
modes_.begin(), endm =
modes_.end(); itm != endm; ++itm) {
132 auto result = std::make_unique<std::vector<reco::Vertex>>();
161 float dzmin = 9999.0;
162 for (
auto itv =
selVtxs_.begin(), edv =
selVtxs_.end(); itv != edv; ++itv) {
169 if (
which.isNonnull())