CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
ConfigurableTrimmedVertexFinder Class Reference

#include <ConfigurableTrimmedVertexFinder.h>

Inheritance diagram for ConfigurableTrimmedVertexFinder:
VertexReconstructor

Public Member Functions

ConfigurableTrimmedVertexFinderclone () const override
 
 ConfigurableTrimmedVertexFinder (const VertexFitter< 5 > *vf, const VertexUpdator< 5 > *vu, const VertexTrackCompatibilityEstimator< 5 > *ve)
 
int maxNbOfVertices () const
 
float ptCut () const
 
void setMaxNbOfVertices (int max)
 
void setParameters (const edm::ParameterSet &)
 
void setPtCut (float cut)
 
void setTrackCompatibilityCut (float cut)
 
void setTrackCompatibilityToSV (float cut)
 
void setVertexFitProbabilityCut (float cut)
 
float trackCompatibilityCut () const
 
float trackCompatibilityToSV () const
 
const TrimmedTrackFiltertrackFilter () const
 
float vertexFitProbabilityCut () const
 
std::vector< TransientVertexvertices (const std::vector< reco::TransientTrack > &tracks) const override
 
std::vector< TransientVertexvertices (const std::vector< reco::TransientTrack > &tracks, const reco::BeamSpot &spot) const override
 
std::vector< TransientVertexvertices (const std::vector< reco::TransientTrack > &tracks, std::vector< reco::TransientTrack > &unused, const reco::BeamSpot &spot, bool use_spot) const
 
 ~ConfigurableTrimmedVertexFinder () override
 
- Public Member Functions inherited from VertexReconstructor
 VertexReconstructor ()
 
virtual std::vector
< TransientVertex
vertices (const std::vector< reco::TransientTrack > &primaries, const std::vector< reco::TransientTrack > &tracks, const reco::BeamSpot &spot) const
 
virtual ~VertexReconstructor ()
 

Protected Member Functions

virtual void analyseClusterFinder (const std::vector< TransientVertex > &vts, const std::vector< reco::TransientTrack > &remain) const
 
virtual void analyseFoundVertices (const std::vector< TransientVertex > &vts) const
 
virtual void analyseInputTracks (const std::vector< reco::TransientTrack > &tracks) const
 
virtual void analyseVertexCandidates (const std::vector< TransientVertex > &vts) const
 
virtual void resetEvent (const std::vector< reco::TransientTrack > &tracks) const
 

Private Member Functions

std::vector< TransientVertexclean (const std::vector< TransientVertex > &candidates) const
 
std::vector< TransientVertexvertexCandidates (const std::vector< reco::TransientTrack > &tracks, std::vector< reco::TransientTrack > &unused, const reco::BeamSpot &spot, bool use_spot) const
 

Private Attributes

TrimmedVertexFinder theClusterFinder
 
TrimmedTrackFilter theFilter
 
int theMaxNbOfVertices
 
float theTrackCompatibilityToPV
 
float theTrackCompatibilityToSV
 
float theVtxFitProbCut
 

Detailed Description

Algorithm to find a series of distinct vertices among the given set of tracks. The technique is:
1) use TrimmedTrackFilter to select tracks above a certain pT;
2) use TrimmedVertexFinder to split the set of tracks into a cluster of compatible tracks and a set of remaining tracks;
3) repeat 2) with the remaining set, and repeat as long as (a) a cluster of compatible tracks can be found or (b) the maximum number of clusters asked for is reached;
4) reject vertices with a low fit probability.

This algorithm has 5 parameters that can be set at runtime via the corresponding set() methods, or a ParameterSet:

Definition at line 44 of file ConfigurableTrimmedVertexFinder.h.

Constructor & Destructor Documentation

ConfigurableTrimmedVertexFinder::ConfigurableTrimmedVertexFinder ( const VertexFitter< 5 > *  vf,
const VertexUpdator< 5 > *  vu,
const VertexTrackCompatibilityEstimator< 5 > *  ve 
)
ConfigurableTrimmedVertexFinder::~ConfigurableTrimmedVertexFinder ( )
inlineoverride

Definition at line 50 of file ConfigurableTrimmedVertexFinder.h.

50 {}

Member Function Documentation

virtual void ConfigurableTrimmedVertexFinder::analyseClusterFinder ( const std::vector< TransientVertex > &  vts,
const std::vector< reco::TransientTrack > &  remain 
) const
inlineprotectedvirtual

Definition at line 90 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertexCandidates().

91  {}
virtual void ConfigurableTrimmedVertexFinder::analyseFoundVertices ( const std::vector< TransientVertex > &  vts) const
inlineprotectedvirtual

Definition at line 95 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertices().

95 {}
virtual void ConfigurableTrimmedVertexFinder::analyseInputTracks ( const std::vector< reco::TransientTrack > &  tracks) const
inlineprotectedvirtual

Definition at line 88 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertices().

88 {}
virtual void ConfigurableTrimmedVertexFinder::analyseVertexCandidates ( const std::vector< TransientVertex > &  vts) const
inlineprotectedvirtual

Definition at line 93 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertices().

93 {}
std::vector< TransientVertex > ConfigurableTrimmedVertexFinder::clean ( const std::vector< TransientVertex > &  candidates) const
private

Definition at line 119 of file ConfigurableTrimmedVertexFinder.cc.

References ChiSquaredProbability(), mps_fire::i, EgammaValidation_Wenu_cff::sel, and theVtxFitProbCut.

Referenced by vertices().

120  {
121  std::vector<TransientVertex> sel;
122  for (std::vector<TransientVertex>::const_iterator i = candidates.begin(); i != candidates.end(); i++) {
123  if (ChiSquaredProbability((*i).totalChiSquared(), (*i).degreesOfFreedom()) > theVtxFitProbCut) {
124  sel.push_back(*i);
125  }
126  }
127 
128  return sel;
129 }
float ChiSquaredProbability(double chiSquared, double nrDOF)
ConfigurableTrimmedVertexFinder* ConfigurableTrimmedVertexFinder::clone ( void  ) const
inlineoverridevirtual

Clone method

Implements VertexReconstructor.

Definition at line 83 of file ConfigurableTrimmedVertexFinder.h.

References ConfigurableTrimmedVertexFinder().

Referenced by KalmanTrimmedVertexFinder::KalmanTrimmedVertexFinder().

83 { return new ConfigurableTrimmedVertexFinder(*this); }
ConfigurableTrimmedVertexFinder(const VertexFitter< 5 > *vf, const VertexUpdator< 5 > *vu, const VertexTrackCompatibilityEstimator< 5 > *ve)
int ConfigurableTrimmedVertexFinder::maxNbOfVertices ( ) const
inline
float ConfigurableTrimmedVertexFinder::ptCut ( ) const
inline

Access to parameters

Definition at line 64 of file ConfigurableTrimmedVertexFinder.h.

References TrimmedTrackFilter::ptCut(), and theFilter.

Referenced by KalmanTrimmedVertexFinder::ptCut().

64 { return theFilter.ptCut(); }
double ptCut() const
virtual void ConfigurableTrimmedVertexFinder::resetEvent ( const std::vector< reco::TransientTrack > &  tracks) const
inlineprotectedvirtual

Definition at line 86 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertices().

86 {}
void ConfigurableTrimmedVertexFinder::setMaxNbOfVertices ( int  max)
inline
void ConfigurableTrimmedVertexFinder::setParameters ( const edm::ParameterSet s)
void ConfigurableTrimmedVertexFinder::setPtCut ( float  cut)
inline
void ConfigurableTrimmedVertexFinder::setTrackCompatibilityCut ( float  cut)
inline
void ConfigurableTrimmedVertexFinder::setTrackCompatibilityToSV ( float  cut)
inline
void ConfigurableTrimmedVertexFinder::setVertexFitProbabilityCut ( float  cut)
inline
float ConfigurableTrimmedVertexFinder::trackCompatibilityCut ( ) const
inline
float ConfigurableTrimmedVertexFinder::trackCompatibilityToSV ( ) const
inline
const TrimmedTrackFilter& ConfigurableTrimmedVertexFinder::trackFilter ( ) const
inline

Definition at line 65 of file ConfigurableTrimmedVertexFinder.h.

References theFilter.

65 { return theFilter; }
std::vector< TransientVertex > ConfigurableTrimmedVertexFinder::vertexCandidates ( const std::vector< reco::TransientTrack > &  tracks,
std::vector< reco::TransientTrack > &  unused,
const reco::BeamSpot spot,
bool  use_spot 
) const
private

Definition at line 65 of file ConfigurableTrimmedVertexFinder.cc.

References analyseClusterFinder(), gpuVertexFinder::iv, TrimmedVertexFinder::setTrackCompatibilityCut(), theClusterFinder, theMaxNbOfVertices, theTrackCompatibilityToPV, theTrackCompatibilityToSV, tracks, and TrimmedVertexFinder::vertices().

Referenced by vertices().

68  {
69  std::vector<TransientVertex> cand;
70 
71  std::vector<TransientTrack> remain = tracks;
72 
73  while (true) {
74  float tkCompCut = (cand.empty() ? theTrackCompatibilityToPV : theTrackCompatibilityToSV);
75 
76  // std::cout << "PVR:compat cut " << tkCompCut << std::endl;
78  // std::cout << "PVCF:compat cut after setting "
79  // << theClusterFinder.trackCompatibilityCut() << std::endl;
80 
81  std::vector<TransientVertex> newVertices;
82  if (cand.empty() && use_spot) {
83  newVertices = theClusterFinder.vertices(remain, spot);
84  } else {
85  newVertices = theClusterFinder.vertices(remain);
86  }
87  if (newVertices.empty())
88  break;
89 
90  analyseClusterFinder(newVertices, remain);
91 
92  for (std::vector<TransientVertex>::const_iterator iv = newVertices.begin(); iv != newVertices.end(); iv++) {
93  if (iv->originalTracks().size() > 1) {
94  cand.push_back(*iv);
95  } else {
96  // candidate has too few tracks - get them back into the vector
97  for (std::vector<TransientTrack>::const_iterator trk = iv->originalTracks().begin();
98  trk != iv->originalTracks().end();
99  ++trk) {
100  unused.push_back(*trk);
101  }
102  }
103  }
104 
105  // when max number of vertices reached, stop
106  if (theMaxNbOfVertices != 0) {
107  if (cand.size() >= (unsigned int)theMaxNbOfVertices)
108  break;
109  }
110  }
111 
112  for (std::vector<TransientTrack>::const_iterator it = remain.begin(); it != remain.end(); it++) {
113  unused.push_back(*it);
114  }
115 
116  return cand;
117 }
int32_t *__restrict__ iv
auto const & tracks
cannot be loose
void setTrackCompatibilityCut(float cut)
std::vector< TransientVertex > vertices(std::vector< reco::TransientTrack > &remain) const
virtual void analyseClusterFinder(const std::vector< TransientVertex > &vts, const std::vector< reco::TransientTrack > &remain) const
float ConfigurableTrimmedVertexFinder::vertexFitProbabilityCut ( ) const
inline
std::vector< TransientVertex > ConfigurableTrimmedVertexFinder::vertices ( const std::vector< reco::TransientTrack > &  ) const
overridevirtual

Reconstruct vertices

Implements VertexReconstructor.

Definition at line 26 of file ConfigurableTrimmedVertexFinder.cc.

Referenced by KalmanTrimmedVertexFinder::vertices(), and vertices().

26  {
27  std::vector<TransientTrack> remaining;
28 
29  return vertices(tracks, remaining, reco::BeamSpot(), false);
30 }
auto const & tracks
cannot be loose
std::vector< TransientVertex > vertices(const std::vector< reco::TransientTrack > &tracks) const override
std::vector< TransientVertex > ConfigurableTrimmedVertexFinder::vertices ( const std::vector< reco::TransientTrack > &  t,
const reco::BeamSpot  
) const
overridevirtual

Reconstruct vertices, exploiting the beamspot constraint for the primary vertex

Reimplemented from VertexReconstructor.

Definition at line 32 of file ConfigurableTrimmedVertexFinder.cc.

References vertices().

33  {
34  std::vector<TransientTrack> remaining;
35  return vertices(tracks, remaining, spot, true);
36 }
auto const & tracks
cannot be loose
std::vector< TransientVertex > vertices(const std::vector< reco::TransientTrack > &tracks) const override
std::vector< TransientVertex > ConfigurableTrimmedVertexFinder::vertices ( const std::vector< reco::TransientTrack > &  tracks,
std::vector< reco::TransientTrack > &  unused,
const reco::BeamSpot spot,
bool  use_spot 
) const

Definition at line 38 of file ConfigurableTrimmedVertexFinder.cc.

References python.cmstools::all(), analyseFoundVertices(), analyseInputTracks(), analyseVertexCandidates(), clean(), filtered(), resetEvent(), EgammaValidation_Wenu_cff::sel, theFilter, and vertexCandidates().

41  {
44 
45  std::vector<TransientTrack> filtered;
46  for (std::vector<TransientTrack>::const_iterator it = tracks.begin(); it != tracks.end(); it++) {
47  if (theFilter(*it)) {
48  filtered.push_back(*it);
49  } else {
50  unused.push_back(*it);
51  }
52  }
53 
54  std::vector<TransientVertex> all = vertexCandidates(filtered, unused, spot, use_spot);
55 
57 
58  std::vector<TransientVertex> sel = clean(all);
59 
61 
62  return sel;
63 }
virtual void analyseFoundVertices(const std::vector< TransientVertex > &vts) const
std::vector< TransientVertex > clean(const std::vector< TransientVertex > &candidates) const
auto const & tracks
cannot be loose
static const TGPicture * filtered(bool iBackgroundIsBlack)
virtual void analyseInputTracks(const std::vector< reco::TransientTrack > &tracks) const
def all
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
std::vector< TransientVertex > vertexCandidates(const std::vector< reco::TransientTrack > &tracks, std::vector< reco::TransientTrack > &unused, const reco::BeamSpot &spot, bool use_spot) const
virtual void analyseVertexCandidates(const std::vector< TransientVertex > &vts) const
virtual void resetEvent(const std::vector< reco::TransientTrack > &tracks) const

Member Data Documentation

TrimmedVertexFinder ConfigurableTrimmedVertexFinder::theClusterFinder
mutableprivate

Definition at line 114 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertexCandidates().

TrimmedTrackFilter ConfigurableTrimmedVertexFinder::theFilter
private
int ConfigurableTrimmedVertexFinder::theMaxNbOfVertices
private
float ConfigurableTrimmedVertexFinder::theTrackCompatibilityToPV
private
float ConfigurableTrimmedVertexFinder::theTrackCompatibilityToSV
private
float ConfigurableTrimmedVertexFinder::theVtxFitProbCut
private