CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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,
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 
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:131
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const CartesianTrajectoryError cartesianError() const
T y() const
Definition: PV3DBase.h:60
TrajectoryStateOnSurface extrapolate(const FreeTrajectoryState &fts, const Line &L) const
extrapolation from FreeTrajectoryState
GlobalPoint globalPosition() const
TrajectoryStateOnSurface closestApproachToJet(const TrajectoryStateOnSurface &state, const reco::Vertex &vertex, const GlobalVector &aJetDirection, const MagneticField *field)
Definition: IPTools.cc:182
const MagneticField * field() const
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
Definition: Vertex.h:148
FreeTrajectoryState const * freeTrajectoryState(bool withErrors=true) const
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
double z() const
z coordinate
Definition: Vertex.h:133
const AlgebraicSymMatrix66 & matrix() const
Vector3DBase unit() const
Definition: Vector3DBase.h:54
static TrajectoryStateOnSurface closestApproachToJet(const FreeTrajectoryState &, const reco::Vertex &, const GlobalVector &, const MagneticField *)
double x() const
x coordinate
Definition: Vertex.h:129
constexpr char Jet[]
Definition: modules.cc:9
ROOT::Math::SVector< double, 3 > AlgebraicVector3
ROOT::Math::SVector< double, 6 > AlgebraicVector6
TrajectoryStateOnSurface impactPointState() const
T x() const
Definition: PV3DBase.h:59