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.

23  : zOffset_(zOffset),
25  ntrkMin_(ntrkMin),
26  useError_(useError),
27  wtAverage_(wtAverage),
28  divmeth_(zOffset, ntrkMin, useError, zSeparation, wtAverage),
31 }

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

◆ ~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.

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 }

References runTheMatrix::err, Measurement1D::error(), mps_fire::i, edm::isNotFinite(), edm::RefVector< C, T, F >::size(), findQualityFiles::v, Measurement1D::value(), jets_cff::vertexes, and wtAverage_.

Referenced by PixelVertexProducer::produce().

◆ findVertexesAlt()

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

Definition at line 60 of file DivisiveVertexFinder.cc.

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 }

References cms::cuda::bs, divmeth_, PVValHelper::dz, runTheMatrix::err, mps_fire::i, recoMuon::in, edm::isNotFinite(), MillePedeFileConverter_cfg::out, pvComparer_, pixeltemp::DivisiveClusterizer1D< T >::setBeamSpot(), edm::RefVector< C, T, F >::size(), mathSSE::sqrt(), groupFilesInBlocks::temp, findQualityFiles::v, verbose_, and jets_cff::vertexes.

Referenced by PixelVertexProducer::produce().

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.

HIPAlignmentAlgorithm_cfi.verbosity
verbosity
Definition: HIPAlignmentAlgorithm_cfi.py:7
Measurement1D
Definition: Measurement1D.h:11
mps_fire.i
i
Definition: mps_fire.py:355
DivisiveVertexFinder::ntrkMin_
int ntrkMin_
Definition: DivisiveVertexFinder.h:57
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
DivisiveVertexFinder::zSeparation_
double zSeparation_
Definition: DivisiveVertexFinder.h:56
HLT_FULL_cff.zSeparation
zSeparation
Definition: HLT_FULL_cff.py:100352
HLT_2018_cff.track_pt_min
track_pt_min
Definition: HLT_2018_cff.py:256
Measurement1D::value
double value() const
Definition: Measurement1D.h:25
reco::Vertex::Error
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
pos
Definition: PixelAliasList.h:18
edm::LogInfo
Definition: MessageLogger.h:254
HLT_2018_cff.track_prob_min
track_prob_min
Definition: HLT_2018_cff.py:255
jets_cff.vertexes
vertexes
Definition: jets_cff.py:644
findQualityFiles.v
v
Definition: findQualityFiles.py:179
DivisiveVertexFinder::useError_
bool useError_
Definition: DivisiveVertexFinder.h:58
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
cms::cuda::bs
bs
Definition: HistoContainer.h:127
PVCluster
Cluster1D< reco::Track > PVCluster
Definition: PVCluster.h:14
pixeltemp::DivisiveClusterizer1D::setBeamSpot
void setBeamSpot(const math::XYZPoint &bs)
Definition: DivisiveClusterizer1D.h:40
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DivisiveVertexFinder::pvComparer_
PVClusterComparer * pvComparer_
Definition: DivisiveVertexFinder.h:67
Measurement1D::error
double error() const
Definition: Measurement1D.h:27
runTheMatrix.err
err
Definition: runTheMatrix.py:288
recoMuon::in
Definition: RecoMuonEnumerators.h:6
PVPositionBuilder
Definition: PVPositionBuilder.h:17
reco::Vertex::Point
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
PVValHelper::dz
Definition: PVValidationHelpers.h:50
HLT_2018_cff.track_chi2_max
track_chi2_max
Definition: HLT_2018_cff.py:253
DivisiveVertexFinder::divmeth_
pixeltemp::DivisiveClusterizer1D< reco::Track > divmeth_
We use Wolfgang's templated class that implements the actual divisive method.
Definition: DivisiveVertexFinder.h:61
edm::RefToBase< reco::Track >
DivisiveVertexFinder::verbose_
int verbose_
Definition: DivisiveVertexFinder.h:65
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
PVClusterComparer
Definition: PVClusterComparer.h:16
edm::RefVector::size
size_type size() const
Size of the RefVector.
Definition: RefVector.h:102
DivisiveVertexFinder::zOffset_
double zOffset_
Cuts on vertex formation and other options.
Definition: DivisiveVertexFinder.h:56
HLT_2018_cff.track_pt_max
track_pt_max
Definition: HLT_2018_cff.py:254
reco::Vertex
Definition: Vertex.h:35
DivisiveVertexFinder::wtAverage_
bool wtAverage_
Definition: DivisiveVertexFinder.h:58