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 Cylinder &) const
 
PropagationDirection operator() (const FreeTrajectoryState &, const Plane &) const
 
PropagationDirection operator() (const FreeTrajectoryState &, const Surface &) 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 Cylinder cylinder 
) const

Definition at line 82 of file PropagationDirectionChooser.cc.

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 }

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().

◆ operator()() [2/3]

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

Definition at line 36 of file PropagationDirectionChooser.cc.

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 }

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().

◆ operator()() [3/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 }
Vector3DBase
Definition: Vector3DBase.h:8
FreeTrajectoryState::momentum
GlobalVector momentum() const
Definition: FreeTrajectoryState.h:68
AlgebraicVector3
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Definition: AlgebraicROOTObjects.h:12
anyDirection
Definition: PropagationDirection.h:4
Cylinder::radius
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:64
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
PropagationException
Common base class.
Definition: PropagationExceptions.h:14
oppositeToMomentum
Definition: PropagationDirection.h:4
Surface
Definition: Surface.h:36
AlgebraicMatrix33
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33
Definition: AlgebraicROOTObjects.h:41
DDAxes::x
FreeTrajectoryState::position
GlobalPoint position() const
Definition: FreeTrajectoryState.h:67
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
findQualityFiles.v
v
Definition: findQualityFiles.py:179
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
w
const double w
Definition: UKUtility.cc:23
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Point3DBase< float, GlobalTag >
b
double b
Definition: hdecay.h:118
amptDefault_cfi.proj
proj
Definition: amptDefault_cfi.py:13
a
double a
Definition: hdecay.h:119
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
LocalVector
Local3DVector LocalVector
Definition: LocalVector.h:12
PropagationDirection
PropagationDirection
Definition: PropagationDirection.h:4
Plane
Definition: Plane.h:16
Cylinder
Definition: Cylinder.h:19
alongMomentum
Definition: PropagationDirection.h:4
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23