CMS 3D CMS Logo

List of all members | Static Public Member Functions
GeomDetCompatibilityChecker Class Reference

#include <GeomDetCompatibilityChecker.h>

Static Public Member Functions

static std::pair< bool, TrajectoryStateOnSurfaceisCompatible (const GeomDet *theDet, const TrajectoryStateOnSurface &ts, const Propagator &prop, const MeasurementEstimator &est)
 

Detailed Description

helper class which checks if a GeomDet is geometrically compatible with a TrajectoryState

Definition at line 13 of file GeomDetCompatibilityChecker.h.

Member Function Documentation

std::pair< bool, TrajectoryStateOnSurface > GeomDetCompatibilityChecker::isCompatible ( const GeomDet theDet,
const TrajectoryStateOnSurface ts,
const Propagator prop,
const MeasurementEstimator est 
)
static

tests the geometrical compatibility of the GeomDet with the predicted state. The TrajectoryState argument is propagated to the GeomDet surface using the Propagator argument. The resulting TrajectoryStateOnSurface is tested for compatibility with the surface bounds. If compatible, a std::pair< true, propagatedState> is returned. If the propagation fails, or if the state is not compatible, a std::pair< false, propagatedState> is returned.

Definition at line 53 of file GeomDetCompatibilityChecker.cc.

References funct::abs(), PV3DBase< T, PVType, FrameType >::basicVector(), MeasurementEstimator::estimate(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalParameters(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), likely, LogDebug, SiStripPI::max, MeasurementEstimator::maxSagitta(), MeasurementEstimator::minTolerance2(), eostools::move(), callgraph::path, perp2(), Propagator::propagate(), Propagator::propagationDirection(), GeomDet::specificSurface(), GlobalTrajectoryParameters::transverseCurvature(), and unlikely.

Referenced by ForwardDetRingOneZ::add(), CompatibleDetToGroupAdder::add(), DetRodOneR::add(), SimpleTECWedge::compatible(), PixelRod::compatibleDetsV(), and TrajectorySegmentBuilder::redoMeasurements().

56  {
57  stat.ntot++;
58 
59  auto const sagCut = est.maxSagitta();
60  auto const minTol2 = est.minTolerance2();
61 
62  // std::cout << "param " << sagCut << ' ' << std::sqrt(minTol2) << std::endl;
63 
64  /*
65  auto err2 = tsos.curvilinearError().matrix()(3,3);
66  auto largeErr = err2> 0.1*tolerance2;
67  if (largeErr) stat.nle++;
68  */
69 
70  bool isIn = false;
71  float sagitta=99999999;
72  bool close = false;
73  if likely(sagCut>0) {
74  // linear approximation
75  auto const & plane = theDet->specificSurface();
76  StraightLinePlaneCrossing crossing(tsos.globalPosition().basicVector(),tsos.globalMomentum().basicVector(), prop.propagationDirection());
77  auto path = crossing.pathLength(plane);
78  isIn = path.first;
79  if unlikely(!path.first) stat.ns1++;
80  else {
81  auto gpos = GlobalPoint(crossing.position(path.second));
82  auto tpath2 = (gpos-tsos.globalPosition()).perp2();
83  // sagitta = d^2*c/2
84  sagitta = 0.5f*std::abs(tpath2*tsos.globalParameters().transverseCurvature());
85  close = sagitta<sagCut;
86  LogDebug("TkDetLayer") << "GeomDetCompatibilityChecker: sagitta " << sagitta << std::endl;
87  if (close) {
88  stat.nth++;
89  auto pos = plane.toLocal(GlobalPoint(crossing.position(path.second)));
90  // auto toll = LocalError(tolerance2,0,tolerance2);
91  auto tollL2 = std::max(sagitta*sagitta,minTol2);
92  auto toll = LocalError(tollL2,0,tollL2);
93  isIn = plane.bounds().inside(pos,toll);
94  if (!isIn) { stat.ns2++; LogDebug("TkDetLayer") <<"GeomDetCompatibilityChecker: not in " << pos << std::endl;
95  return std::make_pair( false,TrajectoryStateOnSurface());
96  }
97  }
98  }
99  }
100 
101  // precise propagation
102  TrajectoryStateOnSurface && propSt = prop.propagate( tsos, theDet->specificSurface());
103  if unlikely ( !propSt.isValid()) { stat.nf1++; return std::make_pair( false, std::move(propSt));}
104 
105 
106  auto es = est.estimate( propSt, theDet->specificSurface());
107  if (!es) stat.nf2++;
108  if (close && (!isIn) && (!es) ) stat.ns11++;
109  if (close && es &&(!isIn)) { stat.ns21++; } // std::cout << sagitta << std::endl;}
110  return std::make_pair( es, std::move(propSt));
111 
112 }
#define LogDebug(id)
float minTolerance2() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
#define unlikely(x)
#define likely(x)
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:151
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T perp2() const
Squared magnitude of transverse component.
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
def move(src, dest)
Definition: eostools.py:510
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:45