CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
PATPrimaryVertexSelector Class Reference

#include <PATPrimaryVertexSelector.h>

Public Types

typedef reco::VertexCollection collection
 
typedef container::const_iterator const_iterator
 
typedef std::vector< const reco::Vertex * > container
 

Public Member Functions

const_iterator begin () const
 needed for use with an ObjectSelector More...
 
const_iterator end () const
 needed for use with an ObjectSelector More...
 
bool operator() (const reco::Vertex *, const reco::Vertex *) const
 operator used in sorting the selected vertices More...
 
 PATPrimaryVertexSelector (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 
void select (const edm::Handle< collection > &, const edm::Event &, const edm::EventSetup &)
 needed for use with an ObjectSelector More...
 
size_t size () const
 needed for use with an ObjectSelector More...
 

Private Member Functions

bool acceptTrack (const reco::Track &) const
 track selection More...
 
void getVertexVariables (const reco::Vertex &, unsigned int &, double &) const
 access to track-related vertex quantities (multiplicity and pt-sum) More...
 

Private Attributes

float chi2Cut_
 eta cut used for the track selection More...
 
float dr2Cut_
 cut on the normalized chi2 More...
 
float dzCut_
 cut on the (squared) transverse position More...
 
unsigned int multiplicityCut_
 container of selected vertices More...
 
float ptSumCut_
 minimum multiplicity of (selected) associated tracks More...
 
container selected_
 
float trackEtaCut_
 minimum pt sum o (selected) associated tracks More...
 

Detailed Description

Definition at line 23 of file PATPrimaryVertexSelector.h.

Member Typedef Documentation

◆ collection

Definition at line 25 of file PATPrimaryVertexSelector.h.

◆ const_iterator

typedef container::const_iterator PATPrimaryVertexSelector::const_iterator

Definition at line 27 of file PATPrimaryVertexSelector.h.

◆ container

Definition at line 26 of file PATPrimaryVertexSelector.h.

Constructor & Destructor Documentation

◆ PATPrimaryVertexSelector()

PATPrimaryVertexSelector::PATPrimaryVertexSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)

Definition at line 6 of file PATPrimaryVertexSelector.cc.

References dr2Cut_.

7  : multiplicityCut_(cfg.getParameter<unsigned int>("minMultiplicity")),
8  ptSumCut_(cfg.getParameter<double>("minPtSum")),
9  trackEtaCut_(cfg.getParameter<double>("maxTrackEta")),
10  chi2Cut_(cfg.getParameter<double>("maxNormChi2")),
11  dr2Cut_(cfg.getParameter<double>("maxDeltaR")),
12  dzCut_(cfg.getParameter<double>("maxDeltaZ")) {
13  // store squared cut (avoid using sqrt() for each vertex)
14  dr2Cut_ *= dr2Cut_;
15 }
float dr2Cut_
cut on the normalized chi2
unsigned int multiplicityCut_
container of selected vertices
float dzCut_
cut on the (squared) transverse position
float trackEtaCut_
minimum pt sum o (selected) associated tracks
float ptSumCut_
minimum multiplicity of (selected) associated tracks
float chi2Cut_
eta cut used for the track selection

Member Function Documentation

◆ acceptTrack()

bool PATPrimaryVertexSelector::acceptTrack ( const reco::Track ) const
private

track selection

◆ begin()

const_iterator PATPrimaryVertexSelector::begin ( void  ) const
inline

needed for use with an ObjectSelector

Definition at line 30 of file PATPrimaryVertexSelector.h.

References selected_.

30 { return selected_.begin(); }

◆ end()

const_iterator PATPrimaryVertexSelector::end ( void  ) const
inline

needed for use with an ObjectSelector

Definition at line 32 of file PATPrimaryVertexSelector.h.

References selected_.

32 { return selected_.end(); }

◆ getVertexVariables()

void PATPrimaryVertexSelector::getVertexVariables ( const reco::Vertex vertex,
unsigned int &  multiplicity,
double &  ptSum 
) const
private

access to track-related vertex quantities (multiplicity and pt-sum)

Definition at line 46 of file PATPrimaryVertexSelector.cc.

References trackEtaCut_, and bphysicsOniaDQM_cfi::vertex.

Referenced by operator()(), and select().

48  {
49  multiplicity = 0;
50  ptSum = 0.;
51  for (reco::Vertex::trackRef_iterator it = vertex.tracks_begin(); it != vertex.tracks_end(); ++it) {
52  if (fabs((**it).eta()) < trackEtaCut_) {
53  ++multiplicity;
54  ptSum += (**it).pt();
55  }
56  }
57 }
float trackEtaCut_
minimum pt sum o (selected) associated tracks
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
Definition: Vertex.h:38

◆ operator()()

bool PATPrimaryVertexSelector::operator() ( const reco::Vertex v1,
const reco::Vertex v2 
) const

operator used in sorting the selected vertices

Definition at line 36 of file PATPrimaryVertexSelector.cc.

References getVertexVariables().

36  {
37  unsigned int mult1;
38  double ptSum1;
39  getVertexVariables(*v1, mult1, ptSum1);
40  unsigned int mult2;
41  double ptSum2;
42  getVertexVariables(*v2, mult2, ptSum2);
43  return ptSum1 > ptSum2;
44 }
void getVertexVariables(const reco::Vertex &, unsigned int &, double &) const
access to track-related vertex quantities (multiplicity and pt-sum)

◆ select()

void PATPrimaryVertexSelector::select ( const edm::Handle< collection > &  handle,
const edm::Event event,
const edm::EventSetup setup 
)

needed for use with an ObjectSelector

Definition at line 17 of file PATPrimaryVertexSelector.cc.

References pwdgSkimBPark_cfi::beamSpot, chi2Cut_, dr2Cut_, dzCut_, getVertexVariables(), patZpeak::handle, gpuVertexFinder::iv, multiplicityCut_, ptSumCut_, selected_, and jetUpdater_cfi::sort.

19  {
20  selected_.clear();
21  // FIXME: the fixed reference point should be replaced with the measured beamspot
22  const math::XYZPoint beamSpot(0., 0., 0.);
23  unsigned int multiplicity;
24  double ptSum;
25  for (collection::const_iterator iv = handle->begin(); iv != handle->end(); ++iv) {
26  math::XYZVector displacement(iv->position() - beamSpot);
27  if (iv->normalizedChi2() < chi2Cut_ && fabs(displacement.z()) < dzCut_ && displacement.perp2() < dr2Cut_) {
28  getVertexVariables(*iv, multiplicity, ptSum);
29  if (multiplicity >= multiplicityCut_ && ptSum > ptSumCut_)
30  selected_.push_back(&*iv);
31  }
32  }
33  sort(selected_.begin(), selected_.end(), *this);
34 }
float dr2Cut_
cut on the normalized chi2
unsigned int multiplicityCut_
container of selected vertices
int32_t *__restrict__ iv
float dzCut_
cut on the (squared) transverse position
void getVertexVariables(const reco::Vertex &, unsigned int &, double &) const
access to track-related vertex quantities (multiplicity and pt-sum)
float ptSumCut_
minimum multiplicity of (selected) associated tracks
float chi2Cut_
eta cut used for the track selection
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12

◆ size()

size_t PATPrimaryVertexSelector::size ( void  ) const
inline

needed for use with an ObjectSelector

Definition at line 36 of file PATPrimaryVertexSelector.h.

References selected_.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

36 { return selected_.size(); }

Member Data Documentation

◆ chi2Cut_

float PATPrimaryVertexSelector::chi2Cut_
private

eta cut used for the track selection

Definition at line 51 of file PATPrimaryVertexSelector.h.

Referenced by select().

◆ dr2Cut_

float PATPrimaryVertexSelector::dr2Cut_
private

cut on the normalized chi2

Definition at line 52 of file PATPrimaryVertexSelector.h.

Referenced by PATPrimaryVertexSelector(), and select().

◆ dzCut_

float PATPrimaryVertexSelector::dzCut_
private

cut on the (squared) transverse position

Definition at line 53 of file PATPrimaryVertexSelector.h.

Referenced by select().

◆ multiplicityCut_

unsigned int PATPrimaryVertexSelector::multiplicityCut_
private

container of selected vertices

Definition at line 48 of file PATPrimaryVertexSelector.h.

Referenced by select().

◆ ptSumCut_

float PATPrimaryVertexSelector::ptSumCut_
private

minimum multiplicity of (selected) associated tracks

Definition at line 49 of file PATPrimaryVertexSelector.h.

Referenced by select().

◆ selected_

container PATPrimaryVertexSelector::selected_
private

Definition at line 47 of file PATPrimaryVertexSelector.h.

Referenced by begin(), end(), select(), and size().

◆ trackEtaCut_

float PATPrimaryVertexSelector::trackEtaCut_
private

minimum pt sum o (selected) associated tracks

Definition at line 50 of file PATPrimaryVertexSelector.h.

Referenced by getVertexVariables().