CMS 3D CMS Logo

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,
21  const Vertex& vertex) {
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  //cout<< "Error ="<< theError<<endl;
58  Measurement1D A(theValue, theError);
59  return pair<bool, Measurement1D>(theIsValid, A);
60  } else {
61  return pair<bool, Measurement1D>(theIsValid, Measurement1D(0., 0.));
62  } // endif (isValid)
63 } // end constructor declaration
64 
66  const Vertex& vertex,
67  const GlobalVector& aJetDirection,
68  const MagneticField* field) {
69  GlobalVector J = aJetDirection.unit();
70 
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
T z() const
Definition: PV3DBase.h:61
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
TrajectoryStateOnSurface closestApproachToJet(const TrajectoryStateOnSurface &state, const reco::Vertex &vertex, const GlobalVector &aJetDirection, const MagneticField *field)
Definition: IPTools.cc:182
const CartesianTrajectoryError cartesianError() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
GlobalPoint globalPosition() const
Definition: Jet.py:1
T sqrt(T t)
Definition: SSEVec.h:23
const MagneticField * field() const
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
static TrajectoryStateOnSurface closestApproachToJet(const FreeTrajectoryState &, const reco::Vertex &, const GlobalVector &, const MagneticField *)
fixed size matrix
ROOT::Math::SVector< double, 3 > AlgebraicVector3
const AlgebraicSymMatrix66 & matrix() const
ROOT::Math::SVector< double, 6 > AlgebraicVector6
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const Line &L) const
extrapolation from FreeTrajectoryState
Definition: APVGainStruct.h:7
Vector3DBase unit() const
Definition: Vector3DBase.h:54
TrajectoryStateOnSurface impactPointState() const