CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FTSFromVertexToPointFactory.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaElectronAlgos
4 // Class: FTSFromVertexToPointFactory
5 //
13 //
14 // Original Author: Ursula Berthon, Claude Charlot
15 // Created: Mon Mar 27 13:22:06 CEST 2006
16 //
17 //
20 
21 
23  GlobalPoint const & xmeas,
24  GlobalPoint const & xvert,
25  float momentum,
27 {
28  auto BInTesla = magField.inTesla(xmeas).z();
29  GlobalVector xdiff = xmeas - xvert;
30  auto mom = momentum*xdiff.unit();
31  auto pt = mom.perp();
32  auto pz = mom.z();
33  auto pxOld = mom.x();
34  auto pyOld = mom.y();
35 
36 
37  auto curv = (BInTesla*0.29979f*0.01f)/pt;
38 
39  // stays as doc...
40  // auto alpha = std::asin(0.5f*xdiff.perp()*curv);
41  // auto ca = std::cos(float(charge)*alpha);
42  // auto sa = std::sin(float(charge)*alpha);
43 
44  auto sa = 0.5f*xdiff.perp()*curv*float(charge);
45  auto ca = sqrt(1.f-sa*sa);
46 
47  auto pxNew = ca*pxOld + sa*pyOld;
48  auto pyNew = -sa*pxOld + ca*pyOld;
49  GlobalVector pNew(pxNew, pyNew, pz);
50 
51  GlobalTrajectoryParameters gp(xmeas, pNew, charge, & magField);
52 
53  return FreeTrajectoryState(gp);
54 }
static FreeTrajectoryState get(MagneticField const &magField, GlobalPoint const &xmeas, GlobalPoint const &xvert, float momentum, TrackCharge charge)
T perp() const
Definition: PV3DBase.h:72
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
int TrackCharge
Definition: TrackCharge.h:4
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
double f[11][100]
Vector3DBase unit() const
Definition: Vector3DBase.h:57