CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SignedDecayLength3D.cc
Go to the documentation of this file.
1 #include <string>
2 
4 
6 
11 
12 #include "CLHEP/Vector/ThreeVector.h"
13 #include "CLHEP/Vector/LorentzVector.h"
14 #include "CLHEP/Matrix/Vector.h"
15 
16 using namespace std;
17 using namespace reco;
18 
19 pair<bool,Measurement1D> SignedDecayLength3D::apply(const TransientTrack & transientTrack,
20  const GlobalVector & direction, const Vertex & vertex) {
21 
22  double theError=0.;
23  bool theIsValid;
24 
25  //TrajectoryStateOnSurface TSOS = (aRecTrack).impactPointStateOnSurface();
28 
29  TrajectoryStateOnSurface theTSOS = closestApproachToJet(*FTS, vertex, direction,transientTrack.field());
30  theIsValid= theTSOS.isValid();
31 
32  if(theIsValid){
33  GlobalVector J = direction.unit();
34  GlobalPoint vertexPosition(vertex.x(),vertex.y(),vertex.z());
35 
36  double theValue = J.dot(theTSOS.globalPosition()-vertexPosition);
37 
38  //error calculation
39 
41  j[0] = J.x();
42  j[1] = J.y();
43  j[2] = J.z();
45  jj[0] = J.x();
46  jj[1] = J.y();
47  jj[2] = J.z();
48  jj[3] =0.;
49  jj[4] =0.;
50  jj[5] =0.;
51  double E1 = ROOT::Math::Similarity(jj,theTSOS.cartesianError().matrix());
52  // double E2 = (aJet.vertex().positionError().matrix()).similarity(j);
53  double E2 = ROOT::Math::Similarity(j,vertex.covariance());
54 
55  theError = sqrt(E1+E2);
56 
57 
58 //cout<< "Error ="<< theError<<endl;
59  Measurement1D A(theValue, theError);
60  return pair<bool,Measurement1D>(theIsValid,A);
61  }else{
62  return pair<bool,Measurement1D>(theIsValid,Measurement1D(0.,0.));
63  }// endif (isValid)
64 }// end constructor declaration
65 
66 
68 
69  GlobalVector J =aJetDirection.unit();
70 
71  Line::PositionType pos(GlobalPoint(vertex.x(),vertex.y(),vertex.z()));
73  Line Jet(pos,dir);
74 
76 
77  return TETL.extrapolate(aFTS, Jet);
78 }
static std::pair< bool, Measurement1D > apply(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: Line.h:10
double y() const
y coordinate
Definition: Vertex.h:110
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const CartesianTrajectoryError cartesianError() const
T y() const
Definition: PV3DBase.h:63
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const Line &L) const
extrapolation from FreeTrajectoryState
GlobalPoint globalPosition() const
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
TrajectoryStateOnSurface closestApproachToJet(const TrajectoryStateOnSurface &state, const reco::Vertex &vertex, const GlobalVector &aJetDirection, const MagneticField *field)
Definition: IPTools.cc:177
const MagneticField * field() const
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:123
ROOT::Math::SVector< double, 6 > AlgebraicVector6
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
ROOT::Math::SVector< double, 3 > AlgebraicVector3
int j
Definition: DBlmapReader.cc:9
double z() const
y coordinate
Definition: Vertex.h:112
const AlgebraicSymMatrix66 & matrix() const
Vector3DBase unit() const
Definition: Vector3DBase.h:57
static TrajectoryStateOnSurface closestApproachToJet(const FreeTrajectoryState &, const reco::Vertex &, const GlobalVector &, const MagneticField *)
double x() const
x coordinate
Definition: Vertex.h:108
TrajectoryStateOnSurface impactPointState() const
dbl *** dir
Definition: mlp_gen.cc:35
T x() const
Definition: PV3DBase.h:62