CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/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.5 2011/06/15 11:47:25 friis 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       std::auto_ptr<std::vector<reco::Vertex> >
00043         filter_(Mode mode, const edm::Event & iEvent, const edm::EventSetup & iSetup);
00044       bool hasMode_(Mode mode) const ;
00045       // configurables
00046       std::vector<Mode> modes_; // mode + optional fallbacks
00047       edm::InputTag vertices_;
00048       std::vector<edm::InputTag> candidates_;
00049       std::auto_ptr<VtxSel > vtxPreselection_;
00050       std::auto_ptr<CandSel> candPreselection_;
00051       edm::InputTag beamSpot_;
00052       // transient data. meaningful while 'filter()' is on the stack
00053       std::vector<const reco::Vertex *> selVtxs_;
00054       const reco::Candidate *           bestCand_;
00055 
00056       // flag to enable/disable EDFilter functionality:
00057       // if set to false, PATSingleVertexSelector selects the "one" event vertex,
00058       // but does not reject any events
00059       bool doFilterEvents_;
00060   };
00061 
00062 }
00063 
00064 #endif
00065