13 if (mode ==
"firstVertex") {
15 }
else if (mode ==
"nearestToCandidate") {
17 }
else if (mode ==
"fromCandidate") {
19 }
else if (mode ==
"beamSpot") {
22 throw cms::Exception(
"Configuration") <<
"PATSingleVertexSelector: Mode '" << mode <<
"' not recognized or not supported.\n";
28 : doFilterEvents_(
false)
33 if (iConfig.
exists(
"fallbacks")) {
34 vector<string> modes = iConfig.
getParameter<vector<string> >(
"fallbacks");
35 for (vector<string>::const_iterator it = modes.begin(), ed = modes.end(); it != ed; ++it) {
41 if (iConfig.
existsAs<
string>(
"vertexPreselection")) {
42 string presel = iConfig.
getParameter<
string>(
"vertexPreselection");
48 if (iConfig.
existsAs<
string>(
"candidatePreselection")) {
49 string presel = iConfig.
getParameter<
string>(
"candidatePreselection");
59 produces<vector<reco::Vertex> >();
84 for (vector<reco::Vertex>::const_iterator itv = vertices->begin(), edv = vertices->end(); itv != edv; ++itv) {
91 vector<pair<double, const reco::Candidate *> > cands;
92 for (vector<edm::InputTag>::const_iterator itt =
candidates_.begin(), edt =
candidates_.end(); itt != edt; ++itt) {
97 cands.push_back( pair<double, const reco::Candidate *>(-itc->pt(), &*itc) );
100 if (!cands.empty())
bestCand_ = cands.front().second;
104 auto_ptr<vector<reco::Vertex> >
result;
106 for (std::vector<Mode>::const_iterator itm =
modes_.begin(), endm =
modes_.end(); itm != endm; ++itm) {
121 std::auto_ptr<std::vector<reco::Vertex> >
125 std::auto_ptr<std::vector<reco::Vertex> >
result(
126 new std::vector<reco::Vertex>());
129 if (
selVtxs_.empty())
return result;
130 result->push_back(*
selVtxs_.front());
142 result->push_back(vtx);
148 float dzmin = 9999.0;
149 for (vector<const reco::Vertex *>::const_iterator itv =
selVtxs_.begin(), edv =
selVtxs_.end(); itv != edv; ++itv) {
151 if (dz < dzmin) { dzmin = dz; which = *itv; }
154 result->push_back(*which);
160 reco::Vertex bs(beamSpot->position(), beamSpot->covariance3D(), 0, 0, 0);
161 result->push_back(bs);
T getParameter(std::string const &) const
Produces a list containing a single vertex selected by some criteria.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
std::auto_ptr< VtxSel > vtxPreselection_
#define DEFINE_FWK_MODULE(type)
bool hasMode_(Mode mode) const
std::auto_ptr< std::vector< reco::Vertex > > filter_(Mode mode, const edm::Event &iEvent, const edm::EventSetup &iSetup)
static Mode parseMode(const std::string &name)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
math::Error< dimension >::type Error
covariance error matrix (3x3)
std::auto_ptr< CandSel > candPreselection_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
~PATSingleVertexSelector()
virtual size_type numberOfDaughters() const =0
number of daughters
std::vector< const reco::Vertex * > selVtxs_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual double vertexChi2() const =0
chi-squares
virtual const Point & vertex() const =0
vertex position
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual bool filter(edm::Event &iEvent, const edm::EventSetup &iSetup) override
PATSingleVertexSelector(const edm::ParameterSet &iConfig)
StringCutObjectSelector< reco::Vertex > VtxSel
StringCutObjectSelector< reco::Candidate > CandSel
std::vector< edm::InputTag > candidates_
virtual double vz() const =0
z coordinate of vertex position
virtual double vertexCovariance(int i, int j) const =0
(i, j)-th element of error matrix, i, j = 0, ... 2
const reco::Candidate * bestCand_
std::vector< Mode > modes_
virtual double vertexNdof() const =0