CMS 3D CMS Logo

pat::VertexAssociationSelector Class Reference

#include <PhysicsTools/PatUtils/interface/VertexAssociationSelector.h>

List of all members.

Public Member Functions

bool operator() (const reco::Candidate &c, const reco::Vertex &) const
 check if this candidate and this vertex are compatible this will just use the basic candidate vertex position, without any fancy track extrapolation.
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
 VertexAssociationSelector (const Config &conf)
 constructor from a configuration
 VertexAssociationSelector ()
 an empty constructor is sometimes needed

Private Attributes

Config conf_

Classes

struct  Config
 Structure to pack config for the constructor. More...


Detailed Description

Definition at line 9 of file VertexAssociationSelector.h.


Constructor & Destructor Documentation

pat::VertexAssociationSelector::VertexAssociationSelector (  )  [inline]

an empty constructor is sometimes needed

Definition at line 41 of file VertexAssociationSelector.h.

00041 {} 

pat::VertexAssociationSelector::VertexAssociationSelector ( const Config conf  ) 

constructor from a configuration

Definition at line 6 of file VertexAssociationSelector.cc.

00006                                                                            : 
00007     conf_(conf) 
00008 {
00009 }


Member Function Documentation

bool pat::VertexAssociationSelector::operator() ( const reco::Candidate c,
const reco::Vertex vtx 
) const

check if this candidate and this vertex are compatible this will just use the basic candidate vertex position, without any fancy track extrapolation.

Definition at line 20 of file VertexAssociationSelector.cc.

References funct::abs(), conf_, dist(), pat::VertexAssociationSelector::Config::dR, pat::VertexAssociationSelector::Config::dZ, reco::Vertex::error(), reco::Vertex::position(), pat::VertexAssociationSelector::Config::sigmasR, pat::VertexAssociationSelector::Config::sigmasZ, funct::sqrt(), reco::Particle::vertex(), reco::Particle::vx(), reco::Particle::vy(), reco::Particle::vz(), reco::Vertex::x(), reco::Vertex::y(), reco::Vertex::z(), and reco::Vertex::zError().

00020                                                                                             {    
00021     using std::abs;
00022     using std::sqrt;
00023 
00024     if ((conf_.dZ > 0)      && !( abs(c.vz() - vtx.z())                > conf_.dZ    )) return false;
00025     if ((conf_.sigmasZ > 0) && !( abs(c.vz() - vtx.z())                > conf_.sigmasZ * vtx.zError())) return false;
00026     if ((conf_.dR > 0)      && !( (c.vertex() - vtx.position()).Rho() > conf_.dR    )) return false;
00027     if ( conf_.sigmasR > 0) {
00028         // D = sqrt( DZ^2 + DY^2) => sigma^2(D) = d D/d X_i * cov(X_i, X_j) * d D/d X_j =>
00029         // d D / d X_i = DX_i / D
00030         // D > sigmaR * sigma(D)   if and only if D^4 > sigmaR^2 * DX_i DX_j cov(X_i,X_j)
00031         AlgebraicVector3 dist(c.vx() - vtx.x(), c.vy() - vtx.y(), 0);
00032         double D2 = dist[0]*dist[0] + dist[1]*dist[1];
00033         double DcovD = ROOT::Math::Similarity(dist, vtx.error());
00034         if ( D2*D2 > DcovD * (conf_.sigmasR*conf_.sigmasR) ) return false;
00035     }
00036     /*
00037     if (conf_.sigmas3d > 0) {
00038         // same as above, but 3D
00039          AlgebraicVector3 dist(c.vx() - vtx.x(), c.vy() - vtx.y(), c.vz() - vtx.z());
00040         double D2 = dist[0]*dist[0] + dist[1]*dist[1] + dist[2]*dist[2];
00041         double DcovD = ROOT::Math::Similarity(dist, vtx.error());
00042         if ( D2*D2 > DcovD * (conf_.sigmas3d*conf_.sigmas3d) ) return false;
00043     }
00044     */
00045 
00046     return true;
00047 }

bool pat::VertexAssociationSelector::operator() ( const pat::VertexAssociation vass  )  const

check if this VertexAssociation is ok

Definition at line 50 of file VertexAssociationSelector.cc.

References conf_, pat::VertexAssociationSelector::Config::dR, pat::VertexAssociation::dr(), pat::VertexAssociationSelector::Config::dZ, pat::VertexAssociation::dz(), pat::VertexAssociation::isNull(), pat::VertexAssociationSelector::Config::sigmasR, pat::VertexAssociationSelector::Config::sigmasZ, Measurement1DFloat::significance(), and Measurement1DFloat::value().

00050                                                                                {    
00051     if (vass.isNull()) return false;
00052     if ((conf_.dZ > 0)       && ( vass.dz().value()         > conf_.dZ      )) return false;
00053     if ((conf_.sigmasZ > 0)  && ( vass.dz().significance()  > conf_.sigmasZ )) return false;
00054     if ((conf_.dZ > 0)       && ( vass.dr().value()         > conf_.dR      )) return false;
00055     if ((conf_.sigmasZ > 0)  && ( vass.dr().significance()  > conf_.sigmasR )) return false;
00056     // if ((conf_.sigmas3d > 0) && ( vass.signif3d()           > conf_.sigmas3d)) return false;
00057     return true;
00058 }

pat::VertexAssociation pat::VertexAssociationSelector::simpleAssociation ( const reco::Candidate c,
const reco::VertexRef vtx 
) const

Definition at line 12 of file VertexAssociationSelector.cc.

References pat::VertexAssociation::setDistances(), and reco::Particle::vertex().

00012                                                                                                       {    
00013     pat::VertexAssociation ret(vtx);
00014     ret.setDistances(c.vertex(), vtx->position(), vtx->error());
00015     return ret;
00016 }


Member Data Documentation

Config pat::VertexAssociationSelector::conf_ [private]

Definition at line 62 of file VertexAssociationSelector.h.

Referenced by operator()().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:49:53 2009 for CMSSW by  doxygen 1.5.4