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

◆ isCompatible()

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 58 of file GeomDetCompatibilityChecker.cc.

61  {
62  stat.ntot++;
63 
64  auto const sagCut = est.maxSagitta();
65  auto const minTol2 = est.minTolerance2();
66 
67  // std::cout << "param " << sagCut << ' ' << std::sqrt(minTol2) << std::endl;
68 
69  /*
70  auto err2 = tsos.curvilinearError().matrix()(3,3);
71  auto largeErr = err2> 0.1*tolerance2;
72  if (largeErr) stat.nle++;
73  */
74 
75  bool isIn = false;
76  float sagitta = 99999999.0f;
77  bool close = false;
78  if 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 UNLIKELY (!path.first)
86  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 UNLIKELY (!propSt.isValid()) {
113  stat.nf1++;
114  return std::make_pair(false, std::move(propSt));
115  }
116 
117  auto es = est.estimate(propSt, theDet->specificSurface());
118  if (!es)
119  stat.nf2++;
120  if (close && (!isIn) && (!es))
121  stat.ns11++;
122  if (close && es && (!isIn)) {
123  stat.ns21++;
124  } // std::cout << sagitta << std::endl;}
125  return std::make_pair(es, std::move(propSt));
126 }

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(), edm_modernize_messagelogger::stat, GlobalTrajectoryParameters::transverseCurvature(), and UNLIKELY.

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

MeasurementEstimator::maxSagitta
float maxSagitta() const
Definition: MeasurementEstimator.h:70
pos
Definition: PixelAliasList.h:18
MeasurementEstimator::estimate
virtual HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TrackingRecHit &hit) const =0
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
Propagator::propagationDirection
virtual PropagationDirection propagationDirection() const final
Definition: Propagator.h:139
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
MeasurementEstimator::minTolerance2
float minTolerance2() const
Definition: MeasurementEstimator.h:71
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
LocalError
Definition: LocalError.h:12
Propagator::propagate
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
GeomDet::specificSurface
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:40
perp2
T perp2() const
Squared magnitude of transverse component.
Definition: Basic3DVectorLD.h:130
eostools.move
def move(src, dest)
Definition: eostools.py:511
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm_modernize_messagelogger.stat
stat
Definition: edm_modernize_messagelogger.py:27
StraightLinePlaneCrossing
Definition: StraightLinePlaneCrossing.h:14
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54