CMS 3D CMS Logo

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

#include <RecoPixelVertexing/PixelVertexFinding/interface/DivisiveVertexFinder.h>

Public Member Functions

 DivisiveVertexFinder (double track_pt_min, double track_pt_max, double track_chi2_max, double track_prob_min, double zOffset=5.0, int ntrkMin=5, bool useError=true, double zSeparation=0.05, bool wtAverage=true, int verbosity=0)
 
bool findVertexes (const reco::TrackRefVector &trks, reco::VertexCollection &vertexes)
 Run the divisive algorithm and return a vector of vertexes for the input track collection. More...
 
bool findVertexesAlt (const reco::TrackRefVector &trks, reco::VertexCollection &vertexes, const math::XYZPoint &bs)
 
 ~DivisiveVertexFinder ()
 

Private Attributes

pixeltemp::DivisiveClusterizer1D< reco::Trackdivmeth_
 We use Wolfgang's templated class that implements the actual divisive method. More...
 
int ntrkMin_
 
PVClusterComparerpvComparer_
 
bool useError_
 
int verbose_
 
bool wtAverage_
 
double zOffset_
 Cuts on vertex formation and other options. More...
 
double zSeparation_
 

Detailed Description

Description: Fits a primary vertex in 1D (z) using the "divisive method"

Implementation: This class was ported from ORCA by me (Aaron). It was originally written by ... Find the PV candidates with a simple divisive method. Divide the luminosity region in several regions according to the track distance and for each of them make a PVCluster. Iteratively discard tracks and recover them in a new PVCluster. Return a sorted vector<Vertex> (aka VertexCollection) with the z coordinate of PV candidates

Parameters
ntkminMinimum number of tracks required to form a cluster.
useErrorphysical distances or weighted distances.
zsepMaximum distance between two adjacent tracks that belong to the same initial cluster.
weiCompute the cluster "center" with an unweighted or a weighted average of the tracks. Weighted means weighted with the error of the data point.
Author
Aaron Dominguez (UNL)

Definition at line 34 of file DivisiveVertexFinder.h.

Constructor & Destructor Documentation

◆ DivisiveVertexFinder()

DivisiveVertexFinder::DivisiveVertexFinder ( double  track_pt_min,
double  track_pt_max,
double  track_chi2_max,
double  track_prob_min,
double  zOffset = 5.0,
int  ntrkMin = 5,
bool  useError = true,
double  zSeparation = 0.05,
bool  wtAverage = true,
int  verbosity = 0 
)

Definition at line 13 of file DivisiveVertexFinder.cc.

References pvComparer_, HLT_2022v15_cff::track_chi2_max, HLT_2022v15_cff::track_prob_min, HLT_2022v15_cff::track_pt_max, and HLT_2022v15_cff::track_pt_min.

23  : zOffset_(zOffset),
25  ntrkMin_(ntrkMin),
26  useError_(useError),
27  wtAverage_(wtAverage),
28  divmeth_(zOffset, ntrkMin, useError, zSeparation, wtAverage),
31 }
PVClusterComparer * pvComparer_
const int verbosity
double zOffset_
Cuts on vertex formation and other options.
pixeltemp::DivisiveClusterizer1D< reco::Track > divmeth_
We use Wolfgang&#39;s templated class that implements the actual divisive method.

◆ ~DivisiveVertexFinder()

DivisiveVertexFinder::~DivisiveVertexFinder ( )

Definition at line 33 of file DivisiveVertexFinder.cc.

33 {}

Member Function Documentation

◆ findVertexes()

bool DivisiveVertexFinder::findVertexes ( const reco::TrackRefVector trks,
reco::VertexCollection vertexes 
)

Run the divisive algorithm and return a vector of vertexes for the input track collection.

Definition at line 35 of file DivisiveVertexFinder.cc.

References submitPVResolutionJobs::err, Measurement1D::error(), mps_fire::i, edm::isNotFinite(), hltEgammaHLTExtra_cfi::trks, findQualityFiles::v, Measurement1D::value(), jetsAK4_CHS_cff::vertexes, and wtAverage_.

Referenced by PixelVertexProducer::produce().

36  { // output
38  Measurement1D vz;
39  if (wtAverage_) {
40  vz = pos.wtAverage(trks);
41  } else {
42  vz = pos.average(trks);
43  }
45  err(2, 2) = vz.error() * vz.error();
46 
47  reco::Vertex v(reco::Vertex::Point(0, 0, vz.value()), err, 0, 1, trks.size());
48  for (unsigned int i = 0; i < trks.size(); i++) {
49  double vz = trks[i]->vz();
50  if (edm::isNotFinite(vz))
51  continue;
52  v.add(reco::TrackBaseRef(trks[i]));
53  }
54 
55  vertexes.push_back(v);
56 
57  return true;
58 }
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
double value() const
Definition: Measurement1D.h:25
double error() const
Definition: Measurement1D.h:27

◆ findVertexesAlt()

bool DivisiveVertexFinder::findVertexesAlt ( const reco::TrackRefVector trks,
reco::VertexCollection vertexes,
const math::XYZPoint bs 
)

Definition at line 60 of file DivisiveVertexFinder.cc.

References cms::cuda::bs, divmeth_, PVValHelper::dz, submitPVResolutionJobs::err, mps_fire::i, recoMuon::in, edm::isNotFinite(), gpuVertexFinder::iv, MillePedeFileConverter_cfg::out, pvComparer_, pixeltemp::DivisiveClusterizer1D< T >::setBeamSpot(), jetUpdater_cfi::sort, mathSSE::sqrt(), groupFilesInBlocks::temp, hltEgammaHLTExtra_cfi::trks, findQualityFiles::v, verbose_, and jetsAK4_CHS_cff::vertexes.

Referenced by PixelVertexProducer::produce().

62  { // output
63  std::vector<PVCluster> in;
64  std::pair<std::vector<PVCluster>, std::vector<const reco::Track *> > out;
65 
66  // Convert input track collection into container needed by Wolfgang's templated code
67  // Need to save a map to reconvert from bare pointers, oy vey
68  std::map<const reco::Track *, reco::TrackRef> mapa;
69  // std::vector< std::vector< const reco::Track* > > trkps;
70  for (unsigned int i = 0; i < trks.size(); ++i) {
71  double vz = trks[i]->vz();
72  if (edm::isNotFinite(vz))
73  continue;
74  std::vector<const reco::Track *> temp;
75  temp.clear();
76  temp.push_back(&(*trks[i]));
77 
78  in.push_back(PVCluster(Measurement1D(trks[i]->dz(bs), trks[i]->dzError()), temp));
79  mapa[temp[0]] = trks[i];
80  }
81 
82  if (verbose_ > 0) {
83  edm::LogInfo("DivisiveVertexFinder") << "size of input vector of clusters " << in.size();
84  for (unsigned int i = 0; i < in.size(); ++i) {
85  edm::LogInfo("DivisiveVertexFinder")
86  << "Track " << i << " addr " << in[i].tracks()[0] << " dz " << in[i].tracks()[0]->dz(bs) << " +- "
87  << in[i].tracks()[0]->dzError() << " prodID " << mapa[in[i].tracks()[0]].id() << " dz from RefTrack "
88  << mapa[in[i].tracks()[0]]->dz(bs) << " +- " << mapa[in[i].tracks()[0]]->dzError();
89  }
90  }
91 
92  // Run the darn thing
94  out = divmeth_(in);
95 
96  if (verbose_ > 0)
97  edm::LogInfo("DivisiveVertexFinder") << " DivisiveClusterizer1D found " << out.first.size() << " vertexes";
98 
99  // Now convert the output yet again into something we can safely store in the event
100  for (unsigned int iv = 0; iv < out.first.size(); ++iv) { // loop over output vertexes
102  err(2, 2) = out.first[iv].position().error() * out.first[iv].position().error();
103 
104  reco::Vertex v(reco::Vertex::Point(0, 0, out.first[iv].position().value()), err, 0, 1, out.second.size());
105  if (verbose_ > 0)
106  edm::LogInfo("DivisiveVertexFinder")
107  << " DivisiveClusterizer1D vertex " << iv << " has " << out.first[iv].tracks().size()
108  << " tracks and a position of " << v.z() << " +- " << std::sqrt(v.covariance(2, 2));
109  for (unsigned int itrk = 0; itrk < out.first[iv].tracks().size(); ++itrk) {
110  v.add(reco::TrackBaseRef(mapa[out.first[iv].tracks()[itrk]]));
111  }
112  vertexes.push_back(v); // Done with horrible conversion, save it
113  }
114 
115  // Finally, sort the vertexes in decreasing sumPtSquared
116  // std::sort(vertexes.begin(), vertexes.end(), PVClusterComparer());
117  std::sort(vertexes.begin(), vertexes.end(), *pvComparer_);
118 
119  return true;
120 }
int32_t *__restrict__ iv
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
PVClusterComparer * pvComparer_
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
T sqrt(T t)
Definition: SSEVec.h:19
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
Log< level::Info, false > LogInfo
void setBeamSpot(const math::XYZPoint &bs)
Cluster1D< reco::Track > PVCluster
Definition: PVCluster.h:14
pixeltemp::DivisiveClusterizer1D< reco::Track > divmeth_
We use Wolfgang&#39;s templated class that implements the actual divisive method.

Member Data Documentation

◆ divmeth_

pixeltemp::DivisiveClusterizer1D<reco::Track> DivisiveVertexFinder::divmeth_
private

We use Wolfgang's templated class that implements the actual divisive method.

Definition at line 61 of file DivisiveVertexFinder.h.

Referenced by findVertexesAlt().

◆ ntrkMin_

int DivisiveVertexFinder::ntrkMin_
private

Definition at line 57 of file DivisiveVertexFinder.h.

◆ pvComparer_

PVClusterComparer* DivisiveVertexFinder::pvComparer_
private

Definition at line 67 of file DivisiveVertexFinder.h.

Referenced by DivisiveVertexFinder(), and findVertexesAlt().

◆ useError_

bool DivisiveVertexFinder::useError_
private

Definition at line 58 of file DivisiveVertexFinder.h.

◆ verbose_

int DivisiveVertexFinder::verbose_
private

Definition at line 65 of file DivisiveVertexFinder.h.

Referenced by findVertexesAlt().

◆ wtAverage_

bool DivisiveVertexFinder::wtAverage_
private

Definition at line 58 of file DivisiveVertexFinder.h.

Referenced by findVertexes().

◆ zOffset_

double DivisiveVertexFinder::zOffset_
private

Cuts on vertex formation and other options.

Definition at line 56 of file DivisiveVertexFinder.h.

◆ zSeparation_

double DivisiveVertexFinder::zSeparation_
private

Definition at line 56 of file DivisiveVertexFinder.h.