1 |
dgele |
1.1 |
#ifndef PatAlgos_PATPrimaryVertexSelector_H_
|
2 |
|
|
#define PatAlgos_PATPrimaryVertexSelector_H_
|
3 |
|
|
|
4 |
|
|
/**
|
5 |
|
|
\class pat::PATPrimaryVertexSelector PATPrimaryVertexSelector.h "PhysicsTools/PatAlgos/interface/PATPrimaryVertexSelector.h"
|
6 |
|
|
|
7 |
|
|
The PATPrimaryVertexSelector is used together with an ObjectSelector to clean and
|
8 |
|
|
sort a collection of primary vertices. The code is very close to what is done in
|
9 |
|
|
SusyAnalyzer: it allows a selection based on the (normalized) chi2 of the vertex fit,
|
10 |
|
|
the position, the multiplicity and the pt-sum of the associated tracks. The tracks
|
11 |
|
|
entering in the calculation of the last two quantities can be restricted in eta.
|
12 |
|
|
The output collection is sorted by the sum of the track pts.
|
13 |
|
|
|
14 |
|
|
*/
|
15 |
|
|
|
16 |
|
|
#include "FWCore/Framework/interface/Event.h"
|
17 |
|
|
#include "FWCore/Framework/interface/EventSetup.h"
|
18 |
|
|
#include "DataFormats/Common/interface/Handle.h"
|
19 |
|
|
#include "DataFormats/VertexReco/interface/Vertex.h"
|
20 |
|
|
#include "DataFormats/VertexReco/interface/VertexFwd.h"
|
21 |
|
|
|
22 |
|
|
class PATPrimaryVertexSelector {
|
23 |
|
|
public:
|
24 |
|
|
typedef reco::VertexCollection collection;
|
25 |
|
|
typedef std::vector<const reco::Vertex*> container;
|
26 |
|
|
typedef container::const_iterator const_iterator;
|
27 |
|
|
PATPrimaryVertexSelector (const edm::ParameterSet& cfg);
|
28 |
|
|
/// needed for use with an ObjectSelector
|
29 |
|
|
const_iterator begin() const { return selected_.begin(); }
|
30 |
|
|
/// needed for use with an ObjectSelector
|
31 |
|
|
const_iterator end() const { return selected_.end(); }
|
32 |
|
|
/// needed for use with an ObjectSelector
|
33 |
|
|
void select(const edm::Handle<collection>&, const edm::Event&, const edm::EventSetup&);
|
34 |
|
|
/// needed for use with an ObjectSelector
|
35 |
|
|
size_t size() const { return selected_.size(); }
|
36 |
|
|
/// operator used in sorting the selected vertices
|
37 |
|
|
bool operator() (const reco::Vertex*, const reco::Vertex*) const;
|
38 |
|
|
private:
|
39 |
|
|
/// access to track-related vertex quantities (multiplicity and pt-sum)
|
40 |
|
|
void getVertexVariables (const reco::Vertex&, unsigned int&, double&) const;
|
41 |
|
|
/// track selection
|
42 |
|
|
bool acceptTrack (const reco::Track&) const;
|
43 |
|
|
|
44 |
|
|
private:
|
45 |
|
|
container selected_; /// container of selected vertices
|
46 |
|
|
unsigned int multiplicityCut_; /// minimum multiplicity of (selected) associated tracks
|
47 |
|
|
float ptSumCut_; /// minimum pt sum o (selected) associated tracks
|
48 |
|
|
float trackEtaCut_; /// eta cut used for the track selection
|
49 |
|
|
float chi2Cut_; /// cut on the normalized chi2
|
50 |
|
|
float dr2Cut_; /// cut on the (squared) transverse position
|
51 |
|
|
float dzCut_; /// cut on the longitudinal position
|
52 |
|
|
};
|
53 |
|
|
|
54 |
|
|
#endif
|
55 |
|
|
|