00001 #ifndef PhysicsTools_PatAlgos_PATSingleVertexSelector_h 00002 #define PhysicsTools_PatAlgos_PATSingleVertexSelector_h 00003 // 00004 // $Id: PATSingleVertexSelector.h,v 1.1 2008/07/22 12:47:02 gpetrucc Exp $ 00005 // 00006 00016 #include "FWCore/Framework/interface/EDFilter.h" 00017 #include "FWCore/Framework/interface/Event.h" 00018 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00019 #include "FWCore/ParameterSet/interface/InputTag.h" 00020 #include "PhysicsTools/Utilities/interface/StringCutObjectSelector.h" 00021 00022 #include "DataFormats/VertexReco/interface/Vertex.h" 00023 #include "DataFormats/Candidate/interface/Candidate.h" 00024 00025 namespace pat { 00026 00027 class PATSingleVertexSelector : public edm::EDFilter { 00028 00029 public: 00030 00031 explicit PATSingleVertexSelector(const edm::ParameterSet & iConfig); 00032 ~PATSingleVertexSelector(); 00033 00034 virtual bool filter(edm::Event & iEvent, const edm::EventSetup & iSetup); 00035 00036 private: 00037 enum Mode { First, NearestToCand, FromCand, FromBeamSpot }; 00038 typedef StringCutObjectSelector<reco::Vertex> VtxSel; 00039 typedef StringCutObjectSelector<reco::Candidate> CandSel; 00040 00041 static Mode parseMode(const std::string &name) ; 00042 bool filter_(Mode mode, edm::Event & iEvent, const edm::EventSetup & iSetup) ; 00043 bool hasMode_(Mode mode) const ; 00044 // configurables 00045 std::vector<Mode> modes_; // mode + optional fallbacks 00046 edm::InputTag vertices_; 00047 std::vector<edm::InputTag> candidates_; 00048 std::auto_ptr<VtxSel > vtxPreselection_; 00049 std::auto_ptr<CandSel> candPreselection_; 00050 edm::InputTag beamSpot_; 00051 // transient data. meaningful while 'filter()' is on the stack 00052 std::vector<const reco::Vertex *> selVtxs_; 00053 const reco::Candidate * bestCand_; 00054 00055 }; 00056 00057 } 00058 00059 #endif 00060