CMS 3D CMS Logo

Functions
tkDetUtil Namespace Reference

Functions

float calculatePhiWindow (const MeasurementEstimator::Local2DVector &imaxDistance, const TrajectoryStateOnSurface &ts, const Plane &plane)
 
float computeWindowSize (const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
 
bool overlapInPhi (float phi, const GeomDet &det, float phiWindow)
 
bool overlapInPhi (GlobalPoint crossPoint, const GeomDet &det, float phiWindow)
 

Function Documentation

◆ calculatePhiWindow()

float tkDetUtil::calculatePhiWindow ( const MeasurementEstimator::Local2DVector imaxDistance,
const TrajectoryStateOnSurface ts,
const Plane plane 
)

Definition at line 16 of file TkDetUtil.cc.

18  {
19  MeasurementEstimator::Local2DVector maxDistance(std::abs(imaxDistance.x()), std::abs(imaxDistance.y()));
20 
21  constexpr float tolerance = 1.e-6;
23  // std::cout << "plane z " << plane.normalVector() << std::endl;
24  float dphi = 0;
25  if
26  LIKELY(std::abs(1.f - std::abs(plane.normalVector().z())) < tolerance) {
27  auto ori = plane.toLocal(GlobalPoint(0., 0., 0.));
28  auto xc = std::abs(start.x() - ori.x());
29  auto yc = std::abs(start.y() - ori.y());
30 
31  if (yc < maxDistance.y() && xc < maxDistance.x())
32  return M_PI;
33 
34  auto hori = yc > maxDistance.y(); // quadrant 1 (&2), otherwiase quadrant 1&4
35  auto y0 = hori ? yc + std::copysign(maxDistance.y(), xc - maxDistance.x()) : xc - maxDistance.x();
36  auto x0 = hori ? xc - maxDistance.x() : -yc - maxDistance.y();
37  auto y1 = hori ? yc - maxDistance.y() : xc - maxDistance.x();
38  auto x1 = hori ? xc + maxDistance.x() : -yc + maxDistance.y();
39 
40  auto sp = (x0 * x1 + y0 * y1) / std::sqrt((x0 * x0 + y0 * y0) * (x1 * x1 + y1 * y1));
41  sp = std::min(std::max(sp, -1.f), 1.f);
42  dphi = std::acos(sp);
43 
44  return dphi;
45  }
46 
47  // generic algo
48  float corners[] = {plane.toGlobal(LocalPoint(start.x() + maxDistance.x(), start.y() + maxDistance.y())).barePhi(),
49  plane.toGlobal(LocalPoint(start.x() - maxDistance.x(), start.y() + maxDistance.y())).barePhi(),
50  plane.toGlobal(LocalPoint(start.x() - maxDistance.x(), start.y() - maxDistance.y())).barePhi(),
51  plane.toGlobal(LocalPoint(start.x() + maxDistance.x(), start.y() - maxDistance.y())).barePhi()};
52 
53  float phimin = corners[0];
54  float phimax = phimin;
55  for (int i = 1; i < 4; i++) {
56  float cPhi = corners[i];
57  if (Geom::phiLess(cPhi, phimin)) {
58  phimin = cPhi;
59  }
60  if (Geom::phiLess(phimax, cPhi)) {
61  phimax = cPhi;
62  }
63  }
64  float phiWindow = phimax - phimin;
65  if (phiWindow < 0.) {
66  phiWindow += 2. * Geom::pi();
67  }
68  // std::cout << "phiWindow " << phiWindow << ' ' << dphi << ' ' << dphi-phiWindow << std::endl;
69  return phiWindow;
70  }

References funct::abs(), PV3DBase< T, PVType, FrameType >::barePhi(), f, mps_fire::i, LIKELY, TrajectoryStateOnSurface::localPosition(), M_PI, SiStripPI::max, particleFlowClusterHGC_cfi::maxDistance, min(), Plane::normalVector(), Geom::phiLess(), phimax, phimin, trackingPOGFilters_cfi::phiWindow, Geom::pi(), mathSSE::sqrt(), Surface::toGlobal(), tolerance, GloballyPositioned< T >::toLocal(), PV2DBase< T, PVType, FrameType >::x(), testProducerWithPsetDescEmpty_cfi::x1, PV2DBase< T, PVType, FrameType >::y(), testProducerWithPsetDescEmpty_cfi::y1, and PV3DBase< T, PVType, FrameType >::z().

Referenced by computeWindowSize().

◆ computeWindowSize()

float tkDetUtil::computeWindowSize ( const GeomDet det,
const TrajectoryStateOnSurface tsos,
const MeasurementEstimator est 
)

◆ overlapInPhi() [1/2]

bool tkDetUtil::overlapInPhi ( float  phi,
const GeomDet det,
float  phiWindow 
)
inline

Definition at line 18 of file TkDetUtil.h.

18  {
19  std::pair<float, float> phiRange(phi - phiWindow, phi + phiWindow);
20  return rangesIntersect(phiRange, det.surface().phiSpan(), [](auto x, auto y) { return Geom::phiLess(x, y); });
21  }

References Geom::phiLess(), Surface::phiSpan(), trackingPOGFilters_cfi::phiWindow, rangesIntersect(), and GeomDet::surface().

Referenced by overlapInPhi(), CompositeTECWedge::searchNeighbors(), TIDRing::searchNeighbors(), and Phase2EndcapRing::searchNeighbors().

◆ overlapInPhi() [2/2]

bool tkDetUtil::overlapInPhi ( GlobalPoint  crossPoint,
const GeomDet det,
float  phiWindow 
)
inline

Definition at line 23 of file TkDetUtil.h.

23  {
24  return overlapInPhi(crossPoint.barePhi(), det, phiWindow);
25  }

References PV3DBase< T, PVType, FrameType >::barePhi(), overlapInPhi(), and trackingPOGFilters_cfi::phiWindow.

mps_fire.i
i
Definition: mps_fire.py:428
start
Definition: start.py:1
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
min
T min(T a, T b)
Definition: MathUtil.h:58
phimin
float phimin
Definition: ReggeGribovPartonMCHadronizer.h:107
tkDetUtil::calculatePhiWindow
float calculatePhiWindow(const MeasurementEstimator::Local2DVector &imaxDistance, const TrajectoryStateOnSurface &ts, const Plane &plane)
Definition: TkDetUtil.cc:16
particleFlowClusterHGC_cfi.maxDistance
maxDistance
Definition: particleFlowClusterHGC_cfi.py:23
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
Surface::phiSpan
std::pair< float, float > const & phiSpan() const
Definition: Surface.h:90
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Surface::toGlobal
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:79
Geom::pi
constexpr double pi()
Definition: Pi.h:31
Vector2DBase
Definition: Vector2DBase.h:8
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, LocalTag >
trackingPOGFilters_cfi.phiWindow
phiWindow
Definition: trackingPOGFilters_cfi.py:109
TrajectoryStateOnSurface::localPosition
LocalPoint localPosition() const
Definition: TrajectoryStateOnSurface.h:74
Geom::phiLess
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
PVValHelper::phi
Definition: PVValidationHelpers.h:68
PV3DBase::barePhi
T barePhi() const
Definition: PV3DBase.h:65
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PV2DBase::y
T y() const
Definition: PV2DBase.h:44
PV2DBase::x
T x() const
Definition: PV2DBase.h:43
tolerance
const double tolerance
Definition: HGCalGeomParameters.cc:26
tkDetUtil::overlapInPhi
bool overlapInPhi(GlobalPoint crossPoint, const GeomDet &det, float phiWindow)
Definition: TkDetUtil.h:23
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
phimax
float phimax
Definition: ReggeGribovPartonMCHadronizer.h:106
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
GloballyPositioned::toLocal
LocalPoint toLocal(const GlobalPoint &gp) const
Definition: GloballyPositioned.h:98
genVertex_cff.x
x
Definition: genVertex_cff.py:12
Plane
Definition: Plane.h:16
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
rangesIntersect
bool rangesIntersect(const Range &a, const Range &b)
Definition: rangesIntersect.h:14
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MeasurementEstimator::maximalLocalDisplacement
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
Plane::normalVector
GlobalVector normalVector() const
Definition: Plane.h:41