CMS 3D CMS Logo

trackingParametersAtClosestApproachToBeamSpot.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: TrackingTools/PatternTools
4 // Class : trackingParametersAtClosestApproachToBeamSpot
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Christopher Jones
10 // Created: Fri, 02 Jan 2015 19:32:37 GMT
11 //
12 
13 // system include files
14 
15 // user include files
20 
21 std::pair<bool, reco::TrackBase::ParameterVector> reco::trackingParametersAtClosestApproachToBeamSpot(
23  const Basic3DVector<double>& momAtVtx,
24  float charge,
25  const MagneticField& magField,
26  const BeamSpot& bs) {
27  TrackBase::ParameterVector sParameters;
28  try {
29  FreeTrajectoryState ftsAtProduction(GlobalPoint(vertex.x(), vertex.y(), vertex.z()),
30  GlobalVector(momAtVtx.x(), momAtVtx.y(), momAtVtx.z()),
32  &magField);
33  TSCBLBuilderNoMaterial tscblBuilder;
34  TrajectoryStateClosestToBeamLine tsAtClosestApproach =
35  tscblBuilder(ftsAtProduction, bs); //as in TrackProducerAlgorithm
36 
37  GlobalPoint v = tsAtClosestApproach.trackStateAtPCA().position();
38  GlobalVector p = tsAtClosestApproach.trackStateAtPCA().momentum();
39  sParameters[0] = tsAtClosestApproach.trackStateAtPCA().charge() / p.mag();
40  sParameters[1] = Geom::halfPi() - p.theta();
41  sParameters[2] = p.phi();
42  sParameters[3] = (-v.x() * sin(p.phi()) + v.y() * cos(p.phi()));
43  sParameters[4] = v.z() * p.perp() / p.mag() - (v.x() * p.x() + v.y() * p.y()) / p.perp() * p.z() / p.mag();
44 
45  return std::make_pair(true, sParameters);
46  } catch (cms::Exception const&) {
47  return std::make_pair(false, sParameters);
48  }
49 }
T x() const
Cartesian x coordinate.
constexpr double halfPi()
Definition: Pi.h:33
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
math::Vector< dimension >::type ParameterVector
parameter vector
Definition: TrackBase.h:71
T y() const
Cartesian y coordinate.
GlobalPoint position() const
int TrackCharge
Definition: TrackCharge.h:4
TrackCharge charge() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
GlobalVector momentum() const
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalVector
vector in glovbal coordinate system
Definition: Vector3D.h:28
T z() const
Cartesian z coordinate.
std::pair< bool, reco::TrackBase::ParameterVector > trackingParametersAtClosestApproachToBeamSpot(const Basic3DVector< double > &vertex, const Basic3DVector< double > &momAtVtx, float charge, const MagneticField &magField, const BeamSpot &bs)
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float >, ROOT::Math::GlobalCoordinateSystemTag > GlobalPoint
point in global coordinate system
Definition: Point3D.h:18
Global3DVector GlobalVector
Definition: GlobalVector.h:10