CMS 3D CMS Logo

VertexAssociationSelector.cc
Go to the documentation of this file.
2 //#include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
3 //#include "DataFormats/TrackReco/interface/Track.h"
4 #include <cmath>
5 
7 
9  const reco::VertexRef &vtx) const {
11  ret.setDistances(c.vertex(), vtx->position(), vtx->error());
12  return ret;
13 }
14 
16  using std::abs;
17  using std::sqrt;
18 
19  if ((conf_.dZ > 0) && !(std::abs(c.vz() - vtx.z()) > conf_.dZ))
20  return false;
21  if ((conf_.sigmasZ > 0) && !(std::abs(c.vz() - vtx.z()) > conf_.sigmasZ * vtx.zError()))
22  return false;
23  if ((conf_.dR > 0) && !((c.vertex() - vtx.position()).Rho() > conf_.dR))
24  return false;
25  if (conf_.sigmasR > 0) {
26  // D = sqrt( DZ^2 + DY^2) => sigma^2(D) = d D/d X_i * cov(X_i, X_j) * d D/d X_j =>
27  // d D / d X_i = DX_i / D
28  // D > sigmaR * sigma(D) if and only if D^4 > sigmaR^2 * DX_i DX_j cov(X_i,X_j)
29  AlgebraicVector3 dist(c.vx() - vtx.x(), c.vy() - vtx.y(), 0);
30  double D2 = dist[0] * dist[0] + dist[1] * dist[1];
31  double DcovD = ROOT::Math::Similarity(dist, vtx.error());
32  if (D2 * D2 > DcovD * (conf_.sigmasR * conf_.sigmasR))
33  return false;
34  }
35  /*
36  if (conf_.sigmas3d > 0) {
37  // same as above, but 3D
38  AlgebraicVector3 dist(c.vx() - vtx.x(), c.vy() - vtx.y(), c.vz() - vtx.z());
39  double D2 = dist[0]*dist[0] + dist[1]*dist[1] + dist[2]*dist[2];
40  double DcovD = ROOT::Math::Similarity(dist, vtx.error());
41  if ( D2*D2 > DcovD * (conf_.sigmas3d*conf_.sigmas3d) ) return false;
42  }
43  */
44 
45  return true;
46 }
47 
49  if (vass.isNull())
50  return false;
51  if ((conf_.dZ > 0) && (vass.dz().value() > conf_.dZ))
52  return false;
53  if ((conf_.sigmasZ > 0) && (vass.dz().significance() > conf_.sigmasZ))
54  return false;
55  if ((conf_.dZ > 0) && (vass.dr().value() > conf_.dR))
56  return false;
57  if ((conf_.sigmasZ > 0) && (vass.dr().significance() > conf_.sigmasR))
58  return false;
59  // if ((conf_.sigmas3d > 0) && ( vass.signif3d() > conf_.sigmas3d)) return false;
60  return true;
61 }
Divides< B, C > D2
Definition: Factorize.h:137
ret
prodAgent to be discontinued
pat::VertexAssociation simpleAssociation(const reco::Candidate &c, const reco::VertexRef &vtx) const
const Measurement1DFloat & dz() const
Definition: Vertexing.h:60
T sqrt(T t)
Definition: SSEVec.h:23
const Measurement1DFloat & dr() const
Distance between the object and the vertex in the transverse plane, and it&#39;s error.
Definition: Vertexing.h:62
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float significance() const
bool operator()(const pat::VertexAssociation &vass) const
check if this VertexAssociation is ok
bool isNull() const
Return &#39;true&#39; if this is a null association (that is, no vertex)
Definition: Vertexing.h:37
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Definition: Config.py:1
Analysis-level structure for vertex-related information.
Definition: Vertexing.h:25
VertexAssociationSelector()
an empty constructor is sometimes needed