CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ftsFromVertexToPoint.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 //
9 //
10 // Original Author: Ursula Berthon, Claude Charlot
11 // Created: Mon Mar 27 13:22:06 CEST 2006
12 //
13 //
16 
18  GlobalPoint const& xmeas,
19  GlobalPoint const& xvert,
20  float momentum,
22  auto magFieldAtPoint = magField.inTesla(xmeas);
23  auto BInTesla = magFieldAtPoint.z();
24  GlobalVector xdiff = xmeas - xvert;
25  auto mom = momentum * xdiff.unit();
26  auto pt = mom.perp();
27  auto pz = mom.z();
28  auto pxOld = mom.x();
29  auto pyOld = mom.y();
30 
31  auto curv = (BInTesla * 0.29979f * 0.01f) / pt;
32 
33  // stays as doc...
34  // auto alpha = std::asin(0.5f*xdiff.perp()*curv);
35  // auto ca = std::cos(float(charge)*alpha);
36  // auto sa = std::sin(float(charge)*alpha);
37 
38  auto sa = 0.5f * xdiff.perp() * curv * float(charge);
39  auto ca = sqrt(1.f - sa * sa);
40 
41  auto pxNew = ca * pxOld + sa * pyOld;
42  auto pyNew = -sa * pxOld + ca * pyOld;
43  GlobalVector pNew(pxNew, pyNew, pz);
44 
45  GlobalTrajectoryParameters gp(xmeas, pNew, charge, &magField, std::move(magFieldAtPoint));
46 
47  return FreeTrajectoryState(gp);
48 }
T perp() const
Definition: PV3DBase.h:69
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
const auto & magField
FreeTrajectoryState ftsFromVertexToPoint(MagneticField const &magField, GlobalPoint const &xmeas, GlobalPoint const &xvert, float momentum, TrackCharge charge)
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
def move
Definition: eostools.py:511
Vector3DBase unit() const
Definition: Vector3DBase.h:54