CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
PathToPlane2Order Class Reference

#include <PathToPlane2Order.h>

Public Types

typedef GloballyPositioned< ScalarFrame
 
typedef Plane::Scalar Scalar
 
typedef Basic3DVector< ScalarVector3D
 

Public Member Functions

std::pair< bool, double > operator() (const Plane &plane, const Vector3D &position, const Vector3D &momentum, double charge, const PropagationDirection propDir=alongMomentum)
 
std::pair< bool, double > operator() (const Plane &plane, const GlobalPoint &position, const GlobalVector &momentum, double charge, const PropagationDirection propDir=alongMomentum)
 
 PathToPlane2Order (const RKLocalFieldProvider &fld, const Frame *fieldFrame)
 

Private Attributes

const RKLocalFieldProvidertheField
 
const FrametheFieldFrame
 

Detailed Description

Definition at line 21 of file PathToPlane2Order.h.

Member Typedef Documentation

Definition at line 25 of file PathToPlane2Order.h.

Definition at line 23 of file PathToPlane2Order.h.

Definition at line 24 of file PathToPlane2Order.h.

Constructor & Destructor Documentation

PathToPlane2Order::PathToPlane2Order ( const RKLocalFieldProvider fld,
const Frame fieldFrame 
)
inline

Definition at line 27 of file PathToPlane2Order.h.

References alongMomentum, ALCARECOTkAlJpsiMuMu_cff::charge, and position.

28  : theField(fld), theFieldFrame(fieldFrame) {}
const RKLocalFieldProvider & theField
const Frame * theFieldFrame

Member Function Documentation

std::pair< bool, double > PathToPlane2Order::operator() ( const Plane plane,
const Vector3D position,
const Vector3D momentum,
double  charge,
const PropagationDirection  propDir = alongMomentum 
)

the position and momentum are local in the FieldFrame; the plane is in the global frame

Definition at line 8 of file PathToPlane2Order.cc.

References TtFullHadDaughter::B, PV3DBase< T, PVType, FrameType >::basicVector(), Vector3DBase< T, FrameTag >::cross(), PixelRecoUtilities::curvature(), amptDefault_cfi::frame, RKLocalFieldProvider::inTesla(), dqmdumpme::k, phase1PixelTopology::localX(), phase1PixelTopology::localY(), PV3DBase< T, PVType, FrameType >::mag(), Basic3DVector< T >::mag(), PV3DBase< T, PVType, FrameType >::perp(), theField, theFieldFrame, GloballyPositioned< T >::toGlobal(), GloballyPositioned< T >::toLocal(), FrameChanger::transformPlane(), Vector3DBase< T, FrameTag >::unit(), Basic3DVector< T >::unit(), Basic3DVector< T >::x(), Basic3DVector< T >::y(), and Basic3DVector< T >::z().

12  {
13  // access to the field in field frame local coordinates
15 
16  // Frame::GlobalVector localZ = Frame::GlobalVector( B.unit()); // local Z along field
17  // transform field axis to global frame
18  Frame::GlobalVector localZ = theFieldFrame->toGlobal(Frame::LocalVector(B.unit())); // local Z along field
19 
20  Frame::GlobalVector localY = localZ.cross(Frame::GlobalVector(1, 0, 0));
21  if (localY.mag() < 0.1) {
22  localY = localZ.cross(Frame::GlobalVector(0, 1, 0)).unit();
23  } else {
24  localY = localY.unit();
25  }
26  Frame::GlobalVector localX = localY.cross(localZ);
27 
29  Frame::RotationType frot(localX, localY, localZ);
30  // frame in which the field is along Z
31  Frame frame(fpos, frot);
32 
33  // cout << "PathToPlane2Order frame " << frame.position() << endl << frame.rotation() << endl;
34 
35  // transform the position and direction to that frame
36  Frame::LocalPoint localPos = frame.toLocal(fpos); // same as LocalPoint(0,0,0)
37 
38  //transform momentum from field frame to new frame via global frame
40  Frame::LocalVector localMom = frame.toLocal(gmom);
41 
42  // transform the plane to the same frame
43  Plane localPlane = FrameChanger::transformPlane(plane, frame);
44  /*
45  cout << "PathToPlane2Order input plane " << plane.position() << endl
46  << plane.rotation() << endl;
47  cout << "PathToPlane2Order transformed plane " << localPlane->position() << endl
48  << localPlane->rotation() << endl;
49 */
50  double k = 2.99792458e-3;
51  double transverseMomentum = localMom.perp(); // transverse to the field
52  if (!(transverseMomentum != 0)) { // if (!(x!=0)) will trap both 0 and NaN
53  //LogDebug("PathToPlane2Order_ZeroMomentum") << "Momentum transverse to the field is zero or Nan (" << transverseMomentum << ")\n";
54  return std::pair<bool, double>(false, 0);
55  }
56  double curvature = -k * charge * B.mag() / transverseMomentum;
57  /*
58  cout << "PathToPlane2Order curvature " << curvature << endl;
59  cout << "transverseMomentum " << transverseMomentum << endl;
60  cout << "B.mag() " << B.mag() << endl;
61  cout << "localZ " << localZ << endl;
62  cout << "pos " << pos << endl;
63  cout << "momentum " << momentum << endl;
64  cout << "localPos " << localPos << endl;
65  cout << "localMom " << localMom << endl;
66 */
67  /*
68  cout << "PathToPlane2Order: local pos " << localPos << " mom " << localMom
69  << " curvature " << curvature << endl;
70  cout << "PathToPlane2Order: local plane pos " << localPlane->position()
71  << " normal " << localPlane->normalVector() << endl;
72 */
73  HelixArbitraryPlaneCrossing crossing(localPos.basicVector(), localMom.basicVector(), curvature, propDir);
74  std::pair<bool, double> res = crossing.pathLength(localPlane);
75 
76  return res;
77 }
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
GloballyPositioned< Scalar > Frame
Basic3DVector unit() const
constexpr uint16_t localY(uint16_t py)
Vector3DBase< T, GlobalTag > GlobalVector
Definition: Plane.h:16
Vector3DBase< T, LocalTag > LocalVector
Definition: Electron.h:6
T curvature(T InversePt, const edm::EventSetup &iSetup)
static const std::string B
Point3DBase< T, GlobalTag > PositionType
GlobalPoint toGlobal(const LocalPoint &lp) const
static Plane transformPlane(const Plane &plane, const GloballyPositioned< T > &frame)
Definition: FrameChanger.h:14
constexpr uint16_t localX(uint16_t px)
const RKLocalFieldProvider & theField
Point3DBase< T, LocalTag > LocalPoint
TkRotation< T > RotationType
const Frame * theFieldFrame
Vector inTesla(const LocalPoint &lp) const
the argument lp is in the local frame specified in the constructor
std::pair<bool, double> PathToPlane2Order::operator() ( const Plane plane,
const GlobalPoint position,
const GlobalVector momentum,
double  charge,
const PropagationDirection  propDir = alongMomentum 
)
inline

Definition at line 38 of file PathToPlane2Order.h.

References PV3DBase< T, PVType, FrameType >::basicVector(), ALCARECOTkAlJpsiMuMu_cff::charge, and GloballyPositioned< T >::toLocal().

42  {
43  return operator()(plane,
44  theFieldFrame->toLocal(position).basicVector(),
45  theFieldFrame->toLocal(momentum).basicVector(),
46  charge,
47  propDir);
48  }
LocalPoint toLocal(const GlobalPoint &gp) const
std::pair< bool, double > operator()(const Plane &plane, const Vector3D &position, const Vector3D &momentum, double charge, const PropagationDirection propDir=alongMomentum)
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
const Frame * theFieldFrame

Member Data Documentation

const RKLocalFieldProvider& PathToPlane2Order::theField
private

Definition at line 51 of file PathToPlane2Order.h.

Referenced by operator()().

const Frame* PathToPlane2Order::theFieldFrame
private

Definition at line 52 of file PathToPlane2Order.h.

Referenced by operator()().