CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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

◆ Frame

Definition at line 25 of file PathToPlane2Order.h.

◆ Scalar

Definition at line 23 of file PathToPlane2Order.h.

◆ Vector3D

Definition at line 24 of file PathToPlane2Order.h.

Constructor & Destructor Documentation

◆ PathToPlane2Order()

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

Definition at line 27 of file PathToPlane2Order.h.

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

Member Function Documentation

◆ operator()() [1/2]

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 B, PV3DBase< T, PVType, FrameType >::basicVector(), ALCARECOTkAlJpsiMuMu_cff::charge, Vector3DBase< T, FrameTag >::cross(), PixelRecoUtilities::curvature(), amptDefault_cfi::frame, RKLocalFieldProvider::inTesla(), dqmdumpme::k, PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::perp(), theField, theFieldFrame, GloballyPositioned< T >::toGlobal(), FrameChanger::transformPlane(), and Vector3DBase< T, FrameTag >::unit().

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 }
GlobalPoint toGlobal(const LocalPoint &lp) const
Definition: APVGainStruct.h:7
GloballyPositioned< Scalar > Frame
Vector3DBase< T, GlobalTag > GlobalVector
Definition: Plane.h:16
Vector3DBase< T, LocalTag > LocalVector
Definition: Electron.h:6
T curvature(T InversePt, const MagneticField &field)
Point3DBase< T, GlobalTag > PositionType
static Plane transformPlane(const Plane &plane, const GloballyPositioned< T > &frame)
Definition: FrameChanger.h:14
const RKLocalFieldProvider & theField
Point3DBase< T, LocalTag > LocalPoint
Vector inTesla(const LocalPoint &lp) const
the argument lp is in the local frame specified in the constructor
TkRotation< T > RotationType
const Frame * theFieldFrame

◆ operator()() [2/2]

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, position, and GloballyPositioned< T >::toLocal().

42  {
43  return operator()(plane,
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
static int position[264][3]
Definition: ReadPGInfo.cc:289
const Frame * theFieldFrame

Member Data Documentation

◆ theField

const RKLocalFieldProvider& PathToPlane2Order::theField
private

Definition at line 51 of file PathToPlane2Order.h.

Referenced by operator()().

◆ theFieldFrame

const Frame* PathToPlane2Order::theFieldFrame
private

Definition at line 52 of file PathToPlane2Order.h.

Referenced by operator()().