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
79  LIKELY(sagCut > 0) {
80  // linear approximation
81  auto const& plane = theDet->specificSurface();
83  tsos.globalPosition().basicVector(), tsos.globalMomentum().basicVector(), prop.propagationDirection());
84  auto path = crossing.pathLength(plane);
85  isIn = path.first;
86  if
87  UNLIKELY(!path.first) stat.ns1++;
88  else {
89  auto gpos = GlobalPoint(crossing.position(path.second));
90  auto tpath2 = (gpos - tsos.globalPosition()).perp2();
91  // sagitta = d^2*c/2
92  sagitta = 0.5f * std::abs(tpath2 * tsos.globalParameters().transverseCurvature());
93  close = sagitta < sagCut;
94  LogDebug("TkDetLayer") << "GeomDetCompatibilityChecker: sagitta " << sagitta << std::endl;
95  if (close) {
96  stat.nth++;
97  auto pos = plane.toLocal(GlobalPoint(crossing.position(path.second)));
98  // auto toll = LocalError(tolerance2,0,tolerance2);
99  auto tollL2 = std::max(sagitta * sagitta, minTol2);
100  auto toll = LocalError(tollL2, 0, tollL2);
101  isIn = plane.bounds().inside(pos, toll);
102  if (!isIn) {
103  stat.ns2++;
104  LogDebug("TkDetLayer") << "GeomDetCompatibilityChecker: not in " << pos << std::endl;
105  return std::make_pair(false, TrajectoryStateOnSurface());
106  }
107  }
108  }
109  }
110 
111  // precise propagation
112  TrajectoryStateOnSurface&& propSt = prop.propagate(tsos, theDet->specificSurface());
113  if
114  UNLIKELY(!propSt.isValid()) {
115  stat.nf1++;
116  return std::make_pair(false, std::move(propSt));
117  }
118 
119  auto es = est.estimate(propSt, theDet->specificSurface());
120  if (!es)
121  stat.nf2++;
122  if (close && (!isIn) && (!es))
123  stat.ns11++;
124  if (close && es && (!isIn)) {
125  stat.ns21++;
126  } // std::cout << sagitta << std::endl;}
127  return std::make_pair(es, std::move(propSt));
128 }

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(), hgcalPlots::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
hgcalPlots.stat
stat
Definition: hgcalPlots.py:1119
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:223
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
StraightLinePlaneCrossing
Definition: StraightLinePlaneCrossing.h:14
TrajectoryStateOnSurface::isValid
bool isValid() const
Definition: TrajectoryStateOnSurface.h:54