CMS 3D CMS Logo

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< TransientVertexvertices (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
 
virtual std::vector< TransientVertexvertices (const std::vector< reco::TransientTrack > &t, const reco::BeamSpot &) const
 
virtual std::vector< TransientVertexvertices (const std::vector< reco::TransientTrack > &) const=0
 
virtual std::vector< TransientVertexvertices (const std::vector< reco::TransientTrack > &primaries, const std::vector< reco::TransientTrack > &tracks, const reco::BeamSpot &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::ConfigurableTrimmedVertexFinder ( const VertexFitter< 5 > *  vf,
const VertexUpdator< 5 > *  vu,
const VertexTrackCompatibilityEstimator< 5 > *  ve 
)

◆ ~ConfigurableTrimmedVertexFinder()

ConfigurableTrimmedVertexFinder::~ConfigurableTrimmedVertexFinder ( )
inlineoverride

Definition at line 50 of file ConfigurableTrimmedVertexFinder.h.

50 {}

Member Function Documentation

◆ analyseClusterFinder()

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  {}

◆ analyseFoundVertices()

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

Definition at line 95 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertices().

95 {}

◆ analyseInputTracks()

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

Definition at line 88 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertices().

88 {}

◆ analyseVertexCandidates()

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

Definition at line 93 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertices().

93 {}

◆ clean()

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

Definition at line 119 of file ConfigurableTrimmedVertexFinder.cc.

References HLT_2022v15_cff::candidates, 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)

◆ clone()

ConfigurableTrimmedVertexFinder* ConfigurableTrimmedVertexFinder::clone ( void  ) const
inlineoverridevirtual

Clone method

Implements VertexReconstructor.

Definition at line 83 of file ConfigurableTrimmedVertexFinder.h.

References ConfigurableTrimmedVertexFinder().

83 { return new ConfigurableTrimmedVertexFinder(*this); }
ConfigurableTrimmedVertexFinder(const VertexFitter< 5 > *vf, const VertexUpdator< 5 > *vu, const VertexTrackCompatibilityEstimator< 5 > *ve)

◆ maxNbOfVertices()

int ConfigurableTrimmedVertexFinder::maxNbOfVertices ( ) const
inline

◆ ptCut()

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

◆ resetEvent()

virtual void ConfigurableTrimmedVertexFinder::resetEvent ( const std::vector< reco::TransientTrack > &  tracks) const
inlineprotectedvirtual

Definition at line 86 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertices().

86 {}

◆ setMaxNbOfVertices()

void ConfigurableTrimmedVertexFinder::setMaxNbOfVertices ( int  max)
inline

◆ setParameters()

void ConfigurableTrimmedVertexFinder::setParameters ( const edm::ParameterSet s)

Set parameters

Definition at line 18 of file ConfigurableTrimmedVertexFinder.cc.

References alignCSCRings::s, TrimmedTrackFilter::setPtCut(), theFilter, theMaxNbOfVertices, theTrackCompatibilityToPV, theTrackCompatibilityToSV, and theVtxFitProbCut.

18  {
19  theFilter.setPtCut(s.getParameter<double>("ptCut"));
20  theTrackCompatibilityToPV = s.getParameter<double>("trackCompatibilityToPVcut");
21  theTrackCompatibilityToSV = s.getParameter<double>("trackCompatibilityToSVcut");
22  theVtxFitProbCut = s.getParameter<double>("vtxFitProbCut");
23  theMaxNbOfVertices = s.getParameter<int>("maxNbOfVertices");
24 }
void setPtCut(double ptCut)

◆ setPtCut()

void ConfigurableTrimmedVertexFinder::setPtCut ( float  cut)
inline

◆ setTrackCompatibilityCut()

void ConfigurableTrimmedVertexFinder::setTrackCompatibilityCut ( float  cut)
inline

◆ setTrackCompatibilityToSV()

void ConfigurableTrimmedVertexFinder::setTrackCompatibilityToSV ( float  cut)
inline

◆ setVertexFitProbabilityCut()

void ConfigurableTrimmedVertexFinder::setVertexFitProbabilityCut ( float  cut)
inline

◆ trackCompatibilityCut()

float ConfigurableTrimmedVertexFinder::trackCompatibilityCut ( ) const
inline

◆ trackCompatibilityToSV()

float ConfigurableTrimmedVertexFinder::trackCompatibilityToSV ( ) const
inline

◆ trackFilter()

const TrimmedTrackFilter& ConfigurableTrimmedVertexFinder::trackFilter ( ) const
inline

Definition at line 65 of file ConfigurableTrimmedVertexFinder.h.

References theFilter.

◆ vertexCandidates()

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(), createfilelist::int, 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
void setTrackCompatibilityCut(float cut)
auto const & tracks
cannot be loose
virtual void analyseClusterFinder(const std::vector< TransientVertex > &vts, const std::vector< reco::TransientTrack > &remain) const
std::vector< TransientVertex > vertices(std::vector< reco::TransientTrack > &remain) const

◆ vertexFitProbabilityCut()

float ConfigurableTrimmedVertexFinder::vertexFitProbabilityCut ( ) const
inline

◆ vertices() [1/6]

std::vector< TransientVertex > ConfigurableTrimmedVertexFinder::vertices ( const std::vector< reco::TransientTrack > &  ) const
overridevirtual

Reconstruct vertices

Implements VertexReconstructor.

Definition at line 26 of file ConfigurableTrimmedVertexFinder.cc.

References tracks.

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

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

◆ vertices() [2/6]

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 tracks, and vertices().

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

◆ vertices() [3/6]

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, tracks, 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 }
std::vector< TransientVertex > clean(const std::vector< TransientVertex > &candidates) const
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:25
virtual void analyseFoundVertices(const std::vector< TransientVertex > &vts) const
virtual void analyseVertexCandidates(const std::vector< TransientVertex > &vts) const
static const TGPicture * filtered(bool iBackgroundIsBlack)
std::vector< TransientVertex > vertexCandidates(const std::vector< reco::TransientTrack > &tracks, std::vector< reco::TransientTrack > &unused, const reco::BeamSpot &spot, bool use_spot) const
auto const & tracks
cannot be loose
virtual void analyseInputTracks(const std::vector< reco::TransientTrack > &tracks) const
virtual void resetEvent(const std::vector< reco::TransientTrack > &tracks) const

◆ vertices() [4/6]

virtual std::vector<TransientVertex> VertexReconstructor::vertices
inlineprivate

Reconstruct vertices, but exploit the fact that you know that some tracks cannot come from a secondary vertex. primaries Tracks that cannot come from a secondary vertex (but can, in principle, be non-primaries, also). tracks These are the tracks that are of unknown origin. These tracks are subjected to pattern recognition. spot A beamspot constraint is mandatory in this method.

Definition at line 39 of file VertexReconstructor.h.

41  {
42  return vertices(tracks, spot);
43  }
std::vector< TransientVertex > vertices(const std::vector< reco::TransientTrack > &tracks) const override
auto const & tracks
cannot be loose

◆ vertices() [5/6]

virtual std::vector<TransientVertex> VertexReconstructor::vertices
private

Reconstruct vertices

◆ vertices() [6/6]

virtual std::vector<TransientVertex> VertexReconstructor::vertices
inlineprivate

Reconstruct vertices, exploiting the beamspot constraint for the primary vertex

Definition at line 25 of file VertexReconstructor.h.

26  {
27  return vertices(t);
28  }
std::vector< TransientVertex > vertices(const std::vector< reco::TransientTrack > &tracks) const override

Member Data Documentation

◆ theClusterFinder

TrimmedVertexFinder ConfigurableTrimmedVertexFinder::theClusterFinder
mutableprivate

Definition at line 114 of file ConfigurableTrimmedVertexFinder.h.

Referenced by vertexCandidates().

◆ theFilter

TrimmedTrackFilter ConfigurableTrimmedVertexFinder::theFilter
private

◆ theMaxNbOfVertices

int ConfigurableTrimmedVertexFinder::theMaxNbOfVertices
private

◆ theTrackCompatibilityToPV

float ConfigurableTrimmedVertexFinder::theTrackCompatibilityToPV
private

◆ theTrackCompatibilityToSV

float ConfigurableTrimmedVertexFinder::theTrackCompatibilityToSV
private

◆ theVtxFitProbCut

float ConfigurableTrimmedVertexFinder::theVtxFitProbCut
private