1 |
#ifndef PhysicsTools_PatAlgos_PATSingleVertexSelector_h
|
2 |
#define PhysicsTools_PatAlgos_PATSingleVertexSelector_h
|
3 |
//
|
4 |
// $Id: PATSingleVertexSelector.h,v 1.1 2008/07/22 12:47:02 gpetrucc Exp $
|
5 |
//
|
6 |
|
7 |
/**
|
8 |
\class pat::PATSingleVertexSelector PATSingleVertexSelector.h "PhysicsTools/PatAlgos/plugins/PATSingleVertexSelector.h"
|
9 |
\brief Produces a list containing a single vertex selected by some criteria
|
10 |
|
11 |
|
12 |
\author Giovanni Petrucciani
|
13 |
\version $Id: PATSingleVertexSelector.h,v 1.1 2008/07/22 12:47:02 gpetrucc Exp $
|
14 |
*/
|
15 |
|
16 |
#include "FWCore/Framework/interface/EDFilter.h"
|
17 |
#include "FWCore/Framework/interface/Event.h"
|
18 |
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
19 |
#include "FWCore/ParameterSet/interface/InputTag.h"
|
20 |
#include "PhysicsTools/Utilities/interface/StringCutObjectSelector.h"
|
21 |
|
22 |
#include "DataFormats/VertexReco/interface/Vertex.h"
|
23 |
#include "DataFormats/Candidate/interface/Candidate.h"
|
24 |
|
25 |
namespace pat {
|
26 |
|
27 |
class PATSingleVertexSelector : public edm::EDFilter {
|
28 |
|
29 |
public:
|
30 |
|
31 |
explicit PATSingleVertexSelector(const edm::ParameterSet & iConfig);
|
32 |
~PATSingleVertexSelector();
|
33 |
|
34 |
virtual bool filter(edm::Event & iEvent, const edm::EventSetup & iSetup);
|
35 |
|
36 |
private:
|
37 |
enum Mode { First, NearestToCand, FromCand, FromBeamSpot };
|
38 |
typedef StringCutObjectSelector<reco::Vertex> VtxSel;
|
39 |
typedef StringCutObjectSelector<reco::Candidate> CandSel;
|
40 |
|
41 |
static Mode parseMode(const std::string &name) ;
|
42 |
bool filter_(Mode mode, edm::Event & iEvent, const edm::EventSetup & iSetup) ;
|
43 |
bool hasMode_(Mode mode) const ;
|
44 |
// configurables
|
45 |
std::vector<Mode> modes_; // mode + optional fallbacks
|
46 |
edm::InputTag vertices_;
|
47 |
std::vector<edm::InputTag> candidates_;
|
48 |
std::auto_ptr<VtxSel > vtxPreselection_;
|
49 |
std::auto_ptr<CandSel> candPreselection_;
|
50 |
edm::InputTag beamSpot_;
|
51 |
// transient data. meaningful while 'filter()' is on the stack
|
52 |
std::vector<const reco::Vertex *> selVtxs_;
|
53 |
const reco::Candidate * bestCand_;
|
54 |
|
55 |
};
|
56 |
|
57 |
}
|
58 |
|
59 |
#endif
|
60 |
|