CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Static Public Member Functions
GeomDetCompatibilityChecker Class Reference

#include <GeomDetCompatibilityChecker.h>

Static Public Member Functions

static std::pair< bool,
TrajectoryStateOnSurface
isCompatible (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 52 of file GeomDetCompatibilityChecker.cc.

References funct::abs(), PV3DBase< T, PVType, FrameType >::basicVector(), MeasurementEstimator::estimate(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalParameters(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), likely, bookConverter::max, MeasurementEstimator::maxSagitta(), MeasurementEstimator::minTolerance2(), eostools::move(), fed_dqm_sourceclient-live_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().

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