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  conf_(conf)
8 {
9 }
10 
13  pat::VertexAssociation ret(vtx);
14  ret.setDistances(c.vertex(), vtx->position(), vtx->error());
15  return ret;
16 }
17 
18 
19 bool
21  using std::abs;
22  using std::sqrt;
23 
24  if ((conf_.dZ > 0) && !( std::abs(c.vz() - vtx.z()) > conf_.dZ )) return false;
25  if ((conf_.sigmasZ > 0) && !( std::abs(c.vz() - vtx.z()) > conf_.sigmasZ * vtx.zError())) return false;
26  if ((conf_.dR > 0) && !( (c.vertex() - vtx.position()).Rho() > conf_.dR )) return false;
27  if ( conf_.sigmasR > 0) {
28  // D = sqrt( DZ^2 + DY^2) => sigma^2(D) = d D/d X_i * cov(X_i, X_j) * d D/d X_j =>
29  // d D / d X_i = DX_i / D
30  // D > sigmaR * sigma(D) if and only if D^4 > sigmaR^2 * DX_i DX_j cov(X_i,X_j)
31  AlgebraicVector3 dist(c.vx() - vtx.x(), c.vy() - vtx.y(), 0);
32  double D2 = dist[0]*dist[0] + dist[1]*dist[1];
33  double DcovD = ROOT::Math::Similarity(dist, vtx.error());
34  if ( D2*D2 > DcovD * (conf_.sigmasR*conf_.sigmasR) ) return false;
35  }
36  /*
37  if (conf_.sigmas3d > 0) {
38  // same as above, but 3D
39  AlgebraicVector3 dist(c.vx() - vtx.x(), c.vy() - vtx.y(), c.vz() - vtx.z());
40  double D2 = dist[0]*dist[0] + dist[1]*dist[1] + dist[2]*dist[2];
41  double DcovD = ROOT::Math::Similarity(dist, vtx.error());
42  if ( D2*D2 > DcovD * (conf_.sigmas3d*conf_.sigmas3d) ) return false;
43  }
44  */
45 
46  return true;
47 }
48 
49 bool
51  if (vass.isNull()) return false;
52  if ((conf_.dZ > 0) && ( vass.dz().value() > conf_.dZ )) return false;
53  if ((conf_.sigmasZ > 0) && ( vass.dz().significance() > conf_.sigmasZ )) return false;
54  if ((conf_.dZ > 0) && ( vass.dr().value() > conf_.dR )) return false;
55  if ((conf_.sigmasZ > 0) && ( vass.dr().significance() > conf_.sigmasR )) return false;
56  // if ((conf_.sigmas3d > 0) && ( vass.signif3d() > conf_.sigmas3d)) return false;
57  return true;
58 }
void setDistances(const AlgebraicVector3 &dist, const AlgebraicSymMatrix33 &err)
Set dz and dr given the distance and the 3x3 total covariance matrix of the distance.
Definition: Vertexing.cc:5
Divides< B, C > D2
Definition: Factorize.h:147
virtual double vx() const =0
x coordinate of vertex position
double zError() const
error on z
Definition: Vertex.h:123
double y() const
y coordinate
Definition: Vertex.h:113
bool isNull() const
Return &#39;true&#39; if this is a null association (that is, no vertex)
Definition: Vertexing.h:38
const Measurement1DFloat & dz() const
Definition: Vertexing.h:61
virtual double vy() const =0
y coordinate of vertex position
const Point & position() const
position
Definition: Vertex.h:109
T sqrt(T t)
Definition: SSEVec.h:18
float significance() const
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double z() const
z coordinate
Definition: Vertex.h:115
bool operator()(const pat::VertexAssociation &vass) const
check if this VertexAssociation is ok
pat::VertexAssociation simpleAssociation(const reco::Candidate &c, const reco::VertexRef &vtx) const
double x() const
x coordinate
Definition: Vertex.h:111
const Measurement1DFloat & dr() const
Distance between the object and the vertex in the transverse plane, and it&#39;s error.
Definition: Vertexing.h:63
float value() const
Error error() const
return SMatrix
Definition: Vertex.h:139
Definition: Config.py:1
float dZ
cuts on Z and transverse distance from the vertex, absolute values or significances ...
Analysis-level structure for vertex-related information.
Definition: Vertexing.h:26
virtual const Point & vertex() const =0
vertex position
virtual double vz() const =0
z coordinate of vertex position
VertexAssociationSelector()
an empty constructor is sometimes needed