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 
22 std::pair<bool,reco::TrackBase::ParameterVector>
24  const Basic3DVector<double>& momAtVtx,
25  float charge,
26  const MagneticField& magField,
27  const BeamSpot& bs) {
28  TrackBase::ParameterVector sParameters;
29  try {
30  FreeTrajectoryState ftsAtProduction(GlobalPoint(vertex.x(),vertex.y(),vertex.z()),
31  GlobalVector(momAtVtx.x(),momAtVtx.y(),momAtVtx.z()),
32  TrackCharge(charge),
33  &magField);
34  TSCBLBuilderNoMaterial tscblBuilder;
35  TrajectoryStateClosestToBeamLine tsAtClosestApproach = 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 }
50 
T y() const
Cartesian y coordinate.
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:74
TrackCharge charge() const
int TrackCharge
Definition: TrackCharge.h:4
T z() const
Cartesian z coordinate.
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:27
GlobalPoint position() const
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:17
Global3DVector GlobalVector
Definition: GlobalVector.h:10