CMS 3D CMS Logo

List of all members | Public Member Functions
PropagationDirectionChooser Class Reference

#include <PropagationDirectionChooser.h>

Public Member Functions

PropagationDirection operator() (const FreeTrajectoryState &, const Surface &) const
 
PropagationDirection operator() (const FreeTrajectoryState &, const Plane &) const
 
PropagationDirection operator() (const FreeTrajectoryState &, const Cylinder &) const
 
 PropagationDirectionChooser ()
 
 ~PropagationDirectionChooser ()
 

Detailed Description

Determination of propagation direction towards a surface. Uses code from the old BidirectionalPropagator.

Definition at line 15 of file PropagationDirectionChooser.h.

Constructor & Destructor Documentation

◆ PropagationDirectionChooser()

PropagationDirectionChooser::PropagationDirectionChooser ( )
inline

Definition at line 17 of file PropagationDirectionChooser.h.

17 {}

◆ ~PropagationDirectionChooser()

PropagationDirectionChooser::~PropagationDirectionChooser ( )
inline

Definition at line 19 of file PropagationDirectionChooser.h.

19 {}

Member Function Documentation

◆ operator()() [1/3]

PropagationDirection PropagationDirectionChooser::operator() ( const FreeTrajectoryState fts,
const Surface surface 
) const

Definition at line 13 of file PropagationDirectionChooser.cc.

14  {
15  // understand the surface type (expect cylinder/plane)
16  // unfortunately dynamic_cast on Sun is broken -- cannot deal with const
17  // so here we get rid of const
18  const Surface* sur = (const Surface*)&surface;
19  const Cylinder* bc = dynamic_cast<const Cylinder*>(sur);
20  const Plane* bp = dynamic_cast<const Plane*>(sur);
21  if (bc != nullptr) {
22  //
23  // cylinder
24  //
25  return (*this)(fts, *bc);
26  } else if (bp != nullptr) {
27  //
28  // plane
29  //
30  return (*this)(fts, *bp);
31  } else {
32  throw PropagationException("The surface is neither Cylinder nor Plane");
33  }
34 }
Definition: Plane.h:16
Common base class.

◆ operator()() [2/3]

PropagationDirection PropagationDirectionChooser::operator() ( const FreeTrajectoryState fts,
const Plane plane 
) const

Definition at line 36 of file PropagationDirectionChooser.cc.

References a, alongMomentum, anyDirection, b, DeadROC_duringRun::dir, FreeTrajectoryState::momentum(), oppositeToMomentum, AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), Surface::toGlobal(), Vector3DBase< T, FrameTag >::unit(), findQualityFiles::v, w(), x, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

36  {
37  // propagation towards arbitrary plane
38  // need computation of intersection point between plane
39  // and track (straight line approximation) to set direction
40  // Copied from BidirectionalPropagator.
42 
43  GlobalPoint x = fts.position();
44  GlobalVector p = fts.momentum().unit();
45  GlobalPoint sp = plane.toGlobal(LocalPoint(0., 0.));
46  GlobalVector v = plane.toGlobal(LocalVector(1., 0., 0.));
47  GlobalVector w = plane.toGlobal(LocalVector(0., 1., 0.));
49  a(0, 0) = v.x();
50  a(0, 1) = w.x();
51  a(0, 2) = -p.x();
52  a(1, 0) = v.y();
53  a(1, 1) = w.y();
54  a(1, 2) = -p.y();
55  a(2, 0) = v.z();
56  a(2, 1) = w.z();
57  a(2, 2) = -p.z();
59  b[0] = x.x() - sp.x();
60  b[1] = x.y() - sp.y();
61  b[2] = x.z() - sp.z();
62 
63  int ifail = !a.Invert();
64  if (ifail == 0) {
65  // plane and momentum are not parallel
66  b = a * b;
67  // b[2] nb of steps along unit vector parallel to momentum to reach plane
68 
69  const double small = 1.e-4; // 1 micron distance
70  if (fabs(b[2]) < small) {
71  // already on plane, choose forward as default
73  } else if (b[2] < 0.) {
75  } else {
77  }
78  }
79  return dir;
80 }
Local3DVector LocalVector
Definition: LocalVector.h:12
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33
T w() const
T z() const
Definition: PV3DBase.h:61
PropagationDirection
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
GlobalVector momentum() const
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Vector3DBase unit() const
Definition: Vector3DBase.h:54

◆ operator()() [3/3]

PropagationDirection PropagationDirectionChooser::operator() ( const FreeTrajectoryState fts,
const Cylinder cylinder 
) const

Definition at line 82 of file PropagationDirectionChooser.cc.

References alongMomentum, anyDirection, DeadROC_duringRun::dir, FreeTrajectoryState::momentum(), oppositeToMomentum, AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), amptDefault_cfi::proj, Cylinder::radius(), Surface::toGlobal(), x, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

83  {
84  // propagation to cylinder with axis along z
85  // Copied from BidirectionalPropagator.
87 
88  GlobalPoint sp = cylinder.toGlobal(LocalPoint(0., 0.));
89  if (sp.x() != 0. || sp.y() != 0.) {
90  throw PropagationException("Cannot propagate to an arbitrary cylinder");
91  }
92 
93  GlobalPoint x = fts.position();
94  GlobalVector p = fts.momentum();
95 
96  const double small = 1.e-4; // 1 micron distance
97  double rdiff = x.perp() - cylinder.radius();
98 
99  if (fabs(rdiff) < small) {
100  // already on cylinder, choose forward as default
101  dir = alongMomentum;
102  } else {
103  int rSign = (rdiff >= 0.) ? 1 : -1;
104  if (rSign == -1) {
105  // starting point inside cylinder
106  // propagate always in direction of momentum
107  dir = alongMomentum;
108  } else {
109  // starting point outside cylinder
110  // choose direction so as to approach cylinder surface
111  double proj = (x.x() * p.x() + x.y() * p.y()) * rSign;
112  if (proj < 0.) {
113  dir = alongMomentum;
114  } else {
116  }
117  }
118  }
119  return dir;
120 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
PropagationDirection
GlobalPoint position() const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
GlobalVector momentum() const
Common base class.
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:64