#include <PropagationDirectionChooser.h>
Public Member Functions | |
PropagationDirection | operator() (const FreeTrajectoryState &, const Surface &) const |
PropagationDirection | operator() (const FreeTrajectoryState &, const Cylinder &) const |
PropagationDirection | operator() (const FreeTrajectoryState &, const Plane &) const |
PropagationDirectionChooser () | |
~PropagationDirectionChooser () |
Determination of propagation direction towards a surface. Uses code from the old BidirectionalPropagator.
Definition at line 15 of file PropagationDirectionChooser.h.
PropagationDirectionChooser::PropagationDirectionChooser | ( | ) | [inline] |
Definition at line 18 of file PropagationDirectionChooser.h.
{}
PropagationDirectionChooser::~PropagationDirectionChooser | ( | ) | [inline] |
Definition at line 20 of file PropagationDirectionChooser.h.
{}
PropagationDirection PropagationDirectionChooser::operator() | ( | const FreeTrajectoryState & | fts, |
const Surface & | surface | ||
) | const |
Definition at line 14 of file PropagationDirectionChooser.cc.
{ // understand the surface type (expect cylinder/plane) // unfortunately dynamic_cast on Sun is broken -- cannot deal with const // so here we get rid of const Surface* sur = (Surface*)&surface; const Cylinder* bc = dynamic_cast<Cylinder*>(sur); const Plane* bp = dynamic_cast<Plane*>(sur); if (bc != 0) { // // cylinder // return (*this)(fts, *bc); } else if (bp != 0) { // // plane // return (*this)(fts, *bp); } else { throw PropagationException("The surface is neither Cylinder nor Plane"); } }
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(), trackerHitRTTI::proj, Cylinder::radius(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), x, and PV3DBase< T, PVType, FrameType >::y().
{ // propagation to cylinder with axis along z // Copied from BidirectionalPropagator. PropagationDirection dir = anyDirection; GlobalPoint sp = cylinder.toGlobal(LocalPoint(0.,0.)); if (sp.x() != 0. || sp.y() != 0.) { throw PropagationException("Cannot propagate to an arbitrary cylinder"); } GlobalPoint x = fts.position(); GlobalVector p = fts.momentum(); const double small = 1.e-4; // 1 micron distance double rdiff = x.perp() - cylinder.radius(); if ( fabs(rdiff) < small ) { // already on cylinder, choose forward as default dir = alongMomentum; } else { int rSign = ( rdiff >= 0. ) ? 1 : -1 ; if ( rSign == -1 ) { // starting point inside cylinder // propagate always in direction of momentum dir = alongMomentum; } else { // starting point outside cylinder // choose direction so as to approach cylinder surface double proj = (x.x()*p.x() + x.y()*p.y()) * rSign; if (proj < 0.) { dir = alongMomentum; } else { dir = oppositeToMomentum; } } } return dir; }
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(), v, w(), PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
{ // propagation towards arbitrary plane // need computation of intersection point between plane // and track (straight line approximation) to set direction // Copied from BidirectionalPropagator. PropagationDirection dir = anyDirection; GlobalPoint x = fts.position(); GlobalVector p = fts.momentum().unit(); GlobalPoint sp = plane.toGlobal(LocalPoint(0.,0.)); GlobalVector v = plane.toGlobal(LocalVector(1.,0.,0.)); GlobalVector w = plane.toGlobal(LocalVector(0.,1.,0.)); AlgebraicMatrix33 a; a(0,0) = v.x(); a(0,1) = w.x(); a(0,2) = -p.x(); a(1,0) = v.y(); a(1,1) = w.y(); a(1,2) = -p.y(); a(2,0) = v.z(); a(2,1) = w.z(); a(2,2) = -p.z(); AlgebraicVector3 b; b[0] = x.x() - sp.x(); b[1] = x.y() - sp.y(); b[2] = x.z() - sp.z(); int ifail = !a.Invert(); if (ifail == 0) { // plane and momentum are not parallel b = a*b; // b[2] nb of steps along unit vector parallel to momentum to reach plane const double small = 1.e-4; // 1 micron distance if (fabs(b[2]) < small) { // already on plane, choose forward as default dir = alongMomentum; } else if (b[2] < 0.) { dir = oppositeToMomentum; } else { dir = alongMomentum; } } return dir; }