Go to the documentation of this file.00001 #include "DataFormats/GeometrySurface/interface/Line.h"
00002
00003 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00004 #include "TrackingTools/GeomPropagators/interface/AnalyticalTrajectoryExtrapolatorToLine.h"
00005 #include "DataFormats/GeometryCommonDetAlgo/interface/Measurement1D.h"
00006 #include "RecoBTag/BTagTools/interface/SignedTransverseImpactParameter.h"
00007 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00008 #include "TrackingTools/PatternTools/interface/TransverseImpactPointExtrapolator.h"
00009
00010 #include "CLHEP/Vector/ThreeVector.h"
00011 #include "CLHEP/Vector/LorentzVector.h"
00012 #include "CLHEP/Matrix/Vector.h"
00013 #include <string>
00014
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016
00017 using namespace std;
00018 using namespace reco;
00019
00020 pair<bool,Measurement1D> SignedTransverseImpactParameter::apply(const TransientTrack & track,
00021 const GlobalVector & direction, const Vertex & vertex)
00022 const {
00023
00024 TrajectoryStateOnSurface stateOnSurface = track.impactPointState();
00025
00026 FreeTrajectoryState * FTS = stateOnSurface.freeState();
00027
00028 GlobalPoint vertexPosition(vertex.x(),vertex.y(),vertex.z());
00029
00030 double theValue=0.;
00031 double theError=0.;
00032 TransverseImpactPointExtrapolator TIPE(track.field());
00033 TrajectoryStateOnSurface TSOS = TIPE.extrapolate(*FTS, vertexPosition);
00034
00035 if(!TSOS.isValid()){
00036 theValue=0.;
00037 theError=0.;
00038 }
00039 else{
00040
00041 GlobalPoint D0(TSOS.globalPosition());
00042
00043 GlobalVector DD0(D0.x()-vertex.x(),D0.y()-vertex.y(),0.);
00044 GlobalVector JetDir(direction);
00045 double ps = DD0.dot(JetDir);
00046 theValue = DD0.mag()*(ps/abs(ps));
00047
00048
00049
00050 AlgebraicVector6 deriv;
00051 AlgebraicVector3 deriv_v;
00052 GlobalVector dd0 = DD0.unit();
00053
00054 deriv_v[0] = - dd0.x();
00055 deriv_v[1] = - dd0.y();
00056 deriv_v[2] = - dd0.z();
00057
00058 deriv[0] = dd0.x();
00059 deriv[1] = dd0.y();
00060 deriv[2] = dd0.z();
00061 deriv[3] = 0.;
00062 deriv[4] = 0.;
00063 deriv[5] = 0.;
00064
00065
00066 double E1 = ROOT::Math::Similarity(deriv,TSOS.cartesianError().matrix());
00067 double E2 = ROOT::Math::Similarity(deriv_v,vertex.covariance());
00068
00069 theError = sqrt(E1+E2);
00070 LogDebug("BTagTools") << "Tk error : " << E1 << " , Vtx error : " << E2 << " tot : " << theError;
00071
00072 }
00073
00074 bool x = true;
00075
00076 Measurement1D A(theValue, theError);
00077 return pair<bool,Measurement1D>(x,A);
00078 }
00079
00080
00081
00082 pair<bool,Measurement1D> SignedTransverseImpactParameter::zImpactParameter ( const TransientTrack & track,
00083 const GlobalVector & direction, const Vertex & vertex) const {
00084
00085 TransverseImpactPointExtrapolator TIPE(track.field()) ;
00086 TrajectoryStateOnSurface TSOS = track.impactPointState();
00087
00088 if ( !TSOS.isValid() ) {
00089 LogDebug("BTagTools") << "====>>>> SignedTransverseImpactParameter::zImpactParameter : TSOS not valid" ;
00090 return pair<bool,Measurement1D> (false,Measurement1D(0.0,0.0)) ;
00091 }
00092
00093 GlobalPoint PV(vertex.x(),vertex.y(),vertex.z());
00094 TrajectoryStateOnSurface statePCA = TIPE.extrapolate( TSOS , PV ) ;
00095
00096 if ( !statePCA.isValid() ) {
00097 LogDebug("BTagTools") << "====>>>> SignedTransverseImpactParameter::zImpactParameter : statePCA not valid" ;
00098 return pair<bool,Measurement1D> (false,Measurement1D(0.0,0.0)) ;
00099 }
00100
00101 GlobalPoint PCA = statePCA.globalPosition() ;
00102
00103
00104 GlobalVector PVPCA ( PCA.x()-PV.x() , PCA.y()-PV.y() , 0. );
00105 GlobalVector JetDir(direction);
00106 double sign = PVPCA.dot(JetDir);
00107 sign /= fabs(sign) ;
00108
00109
00110 double deltaZ = fabs(PCA.z()-PV.z()) * sign ;
00111
00112
00113 double errPvZ2 = vertex.covariance()(2,2) ;
00114
00115
00116 double errTrackZ2 = statePCA.cartesianError().matrix()(2,2) ;
00117 double errZ = sqrt ( errPvZ2 + errTrackZ2 ) ;
00118
00119
00120
00121
00122
00123 return pair<bool,Measurement1D> ( true , Measurement1D( deltaZ , errZ ) ) ;
00124 }