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 12 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 57 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(), castor_dqm_sourceclient_file_cfg::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().

60  {
61  stat.ntot++;
62 
63  auto const sagCut = est.maxSagitta();
64  auto const minTol2 = est.minTolerance2();
65 
66  // std::cout << "param " << sagCut << ' ' << std::sqrt(minTol2) << std::endl;
67 
68  /*
69  auto err2 = tsos.curvilinearError().matrix()(3,3);
70  auto largeErr = err2> 0.1*tolerance2;
71  if (largeErr) stat.nle++;
72  */
73 
74  bool isIn = false;
75  float sagitta = 99999999;
76  bool close = false;
77  if
78  LIKELY(sagCut > 0) {
79  // linear approximation
80  auto const& plane = theDet->specificSurface();
82  tsos.globalPosition().basicVector(), tsos.globalMomentum().basicVector(), prop.propagationDirection());
83  auto path = crossing.pathLength(plane);
84  isIn = path.first;
85  if
86  UNLIKELY(!path.first) stat.ns1++;
87  else {
88  auto gpos = GlobalPoint(crossing.position(path.second));
89  auto tpath2 = (gpos - tsos.globalPosition()).perp2();
90  // sagitta = d^2*c/2
91  sagitta = 0.5f * std::abs(tpath2 * tsos.globalParameters().transverseCurvature());
92  close = sagitta < sagCut;
93  LogDebug("TkDetLayer") << "GeomDetCompatibilityChecker: sagitta " << sagitta << std::endl;
94  if (close) {
95  stat.nth++;
96  auto pos = plane.toLocal(GlobalPoint(crossing.position(path.second)));
97  // auto toll = LocalError(tolerance2,0,tolerance2);
98  auto tollL2 = std::max(sagitta * sagitta, minTol2);
99  auto toll = LocalError(tollL2, 0, tollL2);
100  isIn = plane.bounds().inside(pos, toll);
101  if (!isIn) {
102  stat.ns2++;
103  LogDebug("TkDetLayer") << "GeomDetCompatibilityChecker: not in " << pos << std::endl;
104  return std::make_pair(false, TrajectoryStateOnSurface());
105  }
106  }
107  }
108  }
109 
110  // precise propagation
111  TrajectoryStateOnSurface&& propSt = prop.propagate(tsos, theDet->specificSurface());
112  if
113  UNLIKELY(!propSt.isValid()) {
114  stat.nf1++;
115  return std::make_pair(false, std::move(propSt));
116  }
117 
118  auto es = est.estimate(propSt, theDet->specificSurface());
119  if (!es)
120  stat.nf2++;
121  if (close && (!isIn) && (!es))
122  stat.ns11++;
123  if (close && es && (!isIn)) {
124  stat.ns21++;
125  } // std::cout << sagitta << std::endl;}
126  return std::make_pair(es, std::move(propSt));
127 }
#define LogDebug(id)
float minTolerance2() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
#define LIKELY(x)
Definition: Likely.h:20
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
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:50
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
#define UNLIKELY(x)
Definition: Likely.h:21
def move(src, dest)
Definition: eostools.py:511
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40