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

Definition at line 18 of file PropagationDirectionChooser.h.

18 {}
PropagationDirectionChooser::~PropagationDirectionChooser ( )
inline

Definition at line 20 of file PropagationDirectionChooser.h.

References operator()().

20 {}

Member Function Documentation

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

Definition at line 14 of file PropagationDirectionChooser.cc.

Referenced by ~PropagationDirectionChooser().

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

Definition at line 41 of file PropagationDirectionChooser.cc.

References a, alongMomentum, anyDirection, b, 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().

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

Definition at line 87 of file PropagationDirectionChooser.cc.

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

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