00001 #include "RecoVertex/VertexTools/interface/VertexDistance.h" 00002 #include "RecoVertex/VertexPrimitives/interface/VertexState.h" 00003 #include "RecoVertex/VertexPrimitives/interface/ConvertError.h" 00004 #include "FWCore/Utilities/interface/Exception.h" 00005 #include <cfloat> 00006 00007 00008 using namespace reco; 00009 00010 Measurement1D VertexDistance::distance(const VertexState & vtx1, 00011 const VertexState & vtx2) const 00012 { 00013 return distance(vtx1.position(), vtx1.error(), 00014 vtx2.position(), vtx2.error()); 00015 } 00016 00017 Measurement1D VertexDistance::distance(const Vertex & vtx1, 00018 const VertexState & vtx2) const 00019 { 00020 return distance(GlobalPoint(Basic3DVector<float> (vtx1.position())), 00021 RecoVertex::convertError(vtx1.covariance()), 00022 vtx2.position(), vtx2.error()); 00023 } 00024 00025 00026 Measurement1D VertexDistance::distance(const VertexState & vtx1, 00027 const Vertex & vtx2) const 00028 { 00029 return distance(vtx1.position(), vtx1.error(), 00030 GlobalPoint(Basic3DVector<float> (vtx2.position())), 00031 RecoVertex::convertError(vtx2.covariance())); 00032 } 00033 00034 00035 Measurement1D 00036 VertexDistance::distance(const Vertex & vtx1, const Vertex & vtx2) const 00037 { 00038 return distance(GlobalPoint(Basic3DVector<float> (vtx1.position())), 00039 RecoVertex::convertError(vtx1.covariance()), 00040 GlobalPoint(Basic3DVector<float> (vtx2.position())), 00041 RecoVertex::convertError(vtx2.covariance())); 00042 } 00043 00044 00045 float VertexDistance::compatibility(const VertexState & vtx1, 00046 const VertexState & vtx2) const 00047 { 00048 return compatibility(vtx1.position(), vtx1.error(), 00049 vtx2.position(), vtx2.error()); 00050 } 00051 00052 float VertexDistance::compatibility(const Vertex & vtx1, 00053 const VertexState & vtx2) const 00054 { 00055 return compatibility(GlobalPoint(Basic3DVector<float> (vtx1.position())), 00056 RecoVertex::convertError(vtx1.covariance()), 00057 vtx2.position(), vtx2.error()); 00058 } 00059 00060 float VertexDistance::compatibility(const VertexState & vtx1, 00061 const Vertex & vtx2) const 00062 { 00063 return compatibility(vtx1.position(), vtx1.error(), 00064 GlobalPoint(Basic3DVector<float> (vtx2.position())), 00065 RecoVertex::convertError(vtx2.covariance())); 00066 } 00067 00068 00069 float VertexDistance::compatibility(const Vertex & vtx1, 00070 const Vertex & vtx2) const 00071 { 00072 return compatibility(GlobalPoint(Basic3DVector<float> (vtx1.position())), 00073 RecoVertex::convertError(vtx1.covariance()), 00074 GlobalPoint(Basic3DVector<float> (vtx2.position())), 00075 RecoVertex::convertError(vtx2.covariance())); 00076 }