CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/PhysicsTools/PatAlgos/plugins/PATSingleVertexSelector.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_PatAlgos_PATSingleVertexSelector_h
00002 #define PhysicsTools_PatAlgos_PATSingleVertexSelector_h
00003 //
00004 // $Id: PATSingleVertexSelector.h,v 1.4 2011/01/18 13:54:10 veelken 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/Utilities/interface/InputTag.h"
00020 #include "CommonTools/Utils/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       // flag to enable/disable EDFilter functionality:
00056       // if set to false, PATSingleVertexSelector selects the "one" event vertex,
00057       // but does not reject any events
00058       bool doFilterEvents_;
00059   };
00060 
00061 }
00062 
00063 #endif
00064