15 if (mode ==
"firstVertex") {
17 }
else if (mode ==
"nearestToCandidate") {
19 }
else if (mode ==
"fromCandidate") {
21 }
else if (mode ==
"beamSpot") {
24 throw cms::Exception(
"Configuration") <<
"PATSingleVertexSelector: Mode '" << mode <<
"' not recognized or not supported.\n";
30 : doFilterEvents_(
false)
35 if (iConfig.
exists(
"fallbacks")) {
36 vector<string> modes = iConfig.
getParameter<vector<string> >(
"fallbacks");
37 for (vector<string>::const_iterator it = modes.begin(), ed = modes.end(); it != ed; ++it) {
43 if (iConfig.
existsAs<
string>(
"vertexPreselection")) {
44 string presel = iConfig.
getParameter<
string>(
"vertexPreselection");
50 if (iConfig.
existsAs<
string>(
"candidatePreselection")) {
51 string presel = iConfig.
getParameter<
string>(
"candidatePreselection");
59 if ( iConfig.exists(
"filter") )
doFilterEvents_ = iConfig.getParameter<
bool>(
"filter");
61 produces<vector<reco::Vertex> >();
86 for (vector<reco::Vertex>::const_iterator itv = vertices->begin(), edv = vertices->end(); itv != edv; ++itv) {
93 vector<pair<double, const reco::Candidate *> > cands;
99 cands.push_back( pair<double, const reco::Candidate *>(-itc->pt(), &*itc) );
102 if (!cands.empty())
bestCand_ = cands.front().second;
106 auto_ptr<vector<reco::Vertex> >
result;
108 for (std::vector<Mode>::const_iterator itm =
modes_.begin(), endm =
modes_.end(); itm != endm; ++itm) {
123 std::auto_ptr<std::vector<reco::Vertex> >
127 std::auto_ptr<std::vector<reco::Vertex> >
result(
128 new std::vector<reco::Vertex>());
131 if (
selVtxs_.empty())
return result;
132 result->push_back(*
selVtxs_.front());
144 result->push_back(vtx);
150 float dzmin = 9999.0;
151 for (vector<const reco::Vertex *>::const_iterator itv =
selVtxs_.begin(), edv =
selVtxs_.end(); itv != edv; ++itv) {
153 if (dz < dzmin) { dzmin = dz; which = *itv; }
156 result->push_back(*which);
162 reco::Vertex bs(beamSpot->position(), beamSpot->covariance3D(), 0, 0, 0);
163 result->push_back(bs);
T getParameter(std::string const &) const
Produces a list containing a single vertex selected by some criteria.
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
std::auto_ptr< VtxSel > vtxPreselection_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#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
edm::EDGetTokenT< std::vector< reco::Vertex > > verticesToken_
math::Error< dimension >::type Error
covariance error matrix (3x3)
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 >
std::auto_ptr< CandSel > candPreselection_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
~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
Abs< T >::type abs(const T &t)
virtual const Point & vertex() const =0
vertex position
std::vector< edm::EDGetTokenT< edm::View< reco::Candidate > > > candidatesToken_
virtual bool filter(edm::Event &iEvent, const edm::EventSetup &iSetup) override
PATSingleVertexSelector(const edm::ParameterSet &iConfig)
StringCutObjectSelector< reco::Vertex > VtxSel
StringCutObjectSelector< reco::Candidate > CandSel
virtual double vz() const =0
z coordinate of vertex position
volatile std::atomic< bool > shutdown_flag false
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