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";
29 ? iConfig.getParameter<
std::
string>(
"vertexPreselection")
32 ? iConfig.getParameter<
std::
string>(
"candidatePreselection")
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;
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) {
112 result =
filter_(*itm, iEvent, iSetup);
114 if (!result->empty()) {
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) {
170 result->push_back(*which);
T getParameter(std::string const &) const
Produces a list containing a single vertex selected by some criteria.
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
Covariance3DMatrix covariance3D() const
return only 3D position covariance matrix
const VtxSel vtxPreselection_
~PATSingleVertexSelector() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool hasMode_(Mode mode) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::EDGetTokenT< std::vector< reco::Vertex > > verticesToken_
math::Error< dimension >::type Error
covariance error matrix (3x3)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< reco::VertexRef > selVtxs_
#define DEFINE_FWK_MODULE(type)
reco::CandidatePtr bestCand_
Mode parseMode(const std::string &name) const
bool isNull() const
Checks for null.
Abs< T >::type abs(const T &t)
const CandSel candPreselection_
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > candidatesToken_
bool filter(edm::Event &iEvent, const edm::EventSetup &iSetup) override
PATSingleVertexSelector(const edm::ParameterSet &iConfig)
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
const Point & position() const
position
std::unique_ptr< std::vector< reco::Vertex > > filter_(Mode mode, const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::vector< Mode > modes_