CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
OuterDetCompatibility Class Reference

#include <OuterDetCompatibility.h>

Public Types

typedef PixelRecoRange< float > Range
 

Public Member Functions

GlobalPoint center () const
 
MeasurementEstimator::Local2DVector maximalLocalDisplacement (const GlobalPoint &ts, const BoundPlane &plane) const
 
MeasurementEstimator::Local2DVector maximalLocalDisplacement (const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const
 
bool operator() (const BoundPlane &plane) const
 
 OuterDetCompatibility (const BarrelDetLayer *layer, const OuterHitPhiPrediction::Range &phiRange, const Range &rRange, const Range &zRange)
 
 OuterDetCompatibility (const ForwardDetLayer *layer, const OuterHitPhiPrediction::Range &phiRange, const Range &rRange, const Range &zRange)
 
const OuterHitPhiPrediction::RangephiRange () const
 
const RangerRange () const
 
const RangezRange () const
 

Private Member Functions

bool checkPhi (const OuterHitPhiPrediction::Range &detPhiRange) const
 
bool checkR (const Range &detRRange) const
 
bool checkZ (const Range &detZRange) const
 
double loc_dist (double radius, double ts_phi, double range_phi, double cosGamma) const
 

Private Attributes

bool barrel
 
OuterHitPhiPrediction::Range hitDetPhiRange
 
Range hitDetRRange
 
Range hitDetZRange
 
const DetLayertheLayer
 

Detailed Description

check det compatibility by comparistion of det BoundPlane ranges with phi,r,z ranges (given at construction).

Definition at line 16 of file OuterDetCompatibility.h.

Member Typedef Documentation

◆ Range

Definition at line 18 of file OuterDetCompatibility.h.

Constructor & Destructor Documentation

◆ OuterDetCompatibility() [1/2]

OuterDetCompatibility::OuterDetCompatibility ( const BarrelDetLayer layer,
const OuterHitPhiPrediction::Range phiRange,
const Range rRange,
const Range zRange 
)
inline

Definition at line 20 of file OuterDetCompatibility.h.

◆ OuterDetCompatibility() [2/2]

OuterDetCompatibility::OuterDetCompatibility ( const ForwardDetLayer layer,
const OuterHitPhiPrediction::Range phiRange,
const Range rRange,
const Range zRange 
)
inline

Definition at line 26 of file OuterDetCompatibility.h.

Member Function Documentation

◆ center()

GlobalPoint OuterDetCompatibility::center ( ) const

Definition at line 30 of file OuterDetCompatibility.cc.

30  {
31  float phi = hitDetPhiRange.mean();
32  float r = hitDetRRange.mean();
33  return GlobalPoint(r * cos(phi), r * sin(phi), hitDetZRange.mean());
34 }

References funct::cos(), alignCSCRings::r, and funct::sin().

◆ checkPhi()

bool OuterDetCompatibility::checkPhi ( const OuterHitPhiPrediction::Range detPhiRange) const
private

Definition at line 22 of file OuterDetCompatibility.cc.

22  {
23  return rangesIntersect(detPhiRange, hitDetPhiRange, [](auto x, auto y) { return Geom::phiLess(x, y); });
24 }

References Geom::phiLess(), and rangesIntersect().

◆ checkR()

bool OuterDetCompatibility::checkR ( const Range detRRange) const
private

Definition at line 26 of file OuterDetCompatibility.cc.

26 { return rangesIntersect(detRRange, hitDetRRange); }

References rangesIntersect().

◆ checkZ()

bool OuterDetCompatibility::checkZ ( const Range detZRange) const
private

Definition at line 28 of file OuterDetCompatibility.cc.

28 { return rangesIntersect(detZRange, hitDetZRange); }

References rangesIntersect().

◆ loc_dist()

double OuterDetCompatibility::loc_dist ( double  radius,
double  ts_phi,
double  range_phi,
double  cosGamma 
) const
private

Definition at line 109 of file OuterDetCompatibility.cc.

109  {
110  double sinDphi = sin(ts_phi - range_phi);
111  double cosDphi = sqrt(1 - sinDphi * sinDphi);
112  double sinGamma = sqrt(1 - cosGamma * cosGamma);
113  double sinBeta = fabs(cosDphi * cosGamma - sinDphi * sinGamma);
114  return radius * fabs(sinDphi) / sinBeta;
115 }

References CosmicsPD_Skims::radius, funct::sin(), and mathSSE::sqrt().

◆ maximalLocalDisplacement() [1/2]

MeasurementEstimator::Local2DVector OuterDetCompatibility::maximalLocalDisplacement ( const GlobalPoint ts,
const BoundPlane plane 
) const

Definition at line 36 of file OuterDetCompatibility.cc.

37  {
38  float x_loc = 0.;
39  float y_loc = 0.;
40  if (barrel) {
41  double radius = ts.perp();
42  GlobalVector planeNorm = plane.normalVector();
43  GlobalVector tsDir = GlobalVector(ts.x(), ts.y(), 0.).unit();
44  double ts_phi = tsDir.phi();
45  if (!hitDetPhiRange.inside(ts_phi)) {
46  while (ts_phi >= hitDetPhiRange.max())
47  ts_phi -= 2 * M_PI;
48  while (ts_phi < hitDetPhiRange.min())
49  ts_phi += 2 * M_PI;
50  if (!hitDetPhiRange.inside(ts_phi))
52  }
53  double cosGamma = tsDir.dot(planeNorm);
54 
55  double dx1 = loc_dist(radius, ts_phi, hitDetPhiRange.min(), cosGamma);
56  double dx2 = loc_dist(radius, ts_phi, hitDetPhiRange.max(), cosGamma);
57 
58  double ts_z = ts.z();
59  double dy1 = ts_z - hitDetZRange.min();
60  double dy2 = hitDetZRange.max() - ts_z;
61 
62  x_loc = max(dx1, dx2);
63  y_loc = max(dy1, dy2);
64 
65  // debug only
66  /*
67  double r1 = dx1 * fabs(cosGamma) / sin(ts_phi-hitDetPhiRange.min());
68  double r2 = dx2 * fabs(cosGamma) / sin(hitDetPhiRange.max()-ts_phi);
69  GlobalPoint p1( r1* cos(hitDetPhiRange.min()), r1 * sin(hitDetPhiRange.min()), hitDetZRange.min());
70  GlobalPoint p2( r2* cos(hitDetPhiRange.max()), r2 * sin(hitDetPhiRange.max()), hitDetZRange.min());
71  GlobalPoint p3( r1* cos(hitDetPhiRange.min()), r1 * sin(hitDetPhiRange.min()), hitDetZRange.max());
72  GlobalPoint p4( r2* cos(hitDetPhiRange.max()), r2 * sin(hitDetPhiRange.max()), hitDetZRange.max());
73  cout << " Local1: " << plane.toLocal(ts-p1) << endl;
74  cout << " Local2: " << plane.toLocal(ts-p2) << endl;
75  cout << " Local3: " << plane.toLocal(ts-p3) << endl;
76  cout << " Local4: " << plane.toLocal(ts-p4) << endl;
77 */
78  } else {
79  LocalPoint ts_loc = plane.toLocal(ts);
80  GlobalVector planeNorm = plane.normalVector();
81 
82  double x_glob[4], y_glob[4], z_glob[4];
83  x_glob[0] = hitDetRRange.min() * cos(hitDetPhiRange.min());
84  y_glob[0] = hitDetRRange.min() * sin(hitDetPhiRange.min());
85  x_glob[1] = hitDetRRange.max() * cos(hitDetPhiRange.min());
86  y_glob[1] = hitDetRRange.max() * sin(hitDetPhiRange.min());
87  x_glob[2] = hitDetRRange.min() * cos(hitDetPhiRange.max());
88  y_glob[2] = hitDetRRange.min() * sin(hitDetPhiRange.max());
89  x_glob[3] = hitDetRRange.max() * cos(hitDetPhiRange.max());
90  y_glob[3] = hitDetRRange.max() * sin(hitDetPhiRange.max());
91 
92  for (int idx = 0; idx < 4; idx++) {
93  double dx_glob = x_glob[idx] - ts.x();
94  double dy_glob = y_glob[idx] - ts.y();
95  double dz_glob = -(dx_glob * planeNorm.x() + dy_glob * planeNorm.y()) / planeNorm.z();
96  z_glob[idx] = dz_glob + ts.z();
97  }
98 
99  for (int idx = 0; idx < 4; idx++) {
100  LocalPoint lp = plane.toLocal(GlobalPoint(x_glob[idx], y_glob[idx], z_glob[idx]));
101  x_loc = max(x_loc, fabs(lp.x() - ts_loc.x()));
102  y_loc = max(y_loc, fabs(lp.y() - ts_loc.y()));
103  }
104  }
106  return distance;
107 }

References Reference_intrackfit_cff::barrel, funct::cos(), HLT_2018_cff::distance, Vector3DBase< T, FrameTag >::dot(), training_settings::idx, M_PI, SiStripPI::max, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), CosmicsPD_Skims::radius, funct::sin(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ maximalLocalDisplacement() [2/2]

MeasurementEstimator::Local2DVector OuterDetCompatibility::maximalLocalDisplacement ( const TrajectoryStateOnSurface ts,
const BoundPlane plane 
) const

◆ operator()()

bool OuterDetCompatibility::operator() ( const BoundPlane plane) const

Definition at line 7 of file OuterDetCompatibility.cc.

7  {
8  if (barrel) {
9  if (!checkPhi(plane.phiSpan()))
10  return false;
11  if (!checkZ(plane.zSpan()))
12  return false;
13  } else {
14  if (!checkPhi(plane.phiSpan()))
15  return false;
16  if (!checkR(plane.rSpan()))
17  return false;
18  }
19  return true;
20 }

References Reference_intrackfit_cff::barrel.

◆ phiRange()

const OuterHitPhiPrediction::Range& OuterDetCompatibility::phiRange ( ) const
inline

Definition at line 40 of file OuterDetCompatibility.h.

40 { return hitDetPhiRange; }

◆ rRange()

const Range& OuterDetCompatibility::rRange ( ) const
inline

Definition at line 41 of file OuterDetCompatibility.h.

41 { return hitDetRRange; }

◆ zRange()

const Range& OuterDetCompatibility::zRange ( ) const
inline

Definition at line 42 of file OuterDetCompatibility.h.

42 { return hitDetZRange; }

Member Data Documentation

◆ barrel

bool OuterDetCompatibility::barrel
private

Definition at line 53 of file OuterDetCompatibility.h.

◆ hitDetPhiRange

OuterHitPhiPrediction::Range OuterDetCompatibility::hitDetPhiRange
private

Definition at line 54 of file OuterDetCompatibility.h.

◆ hitDetRRange

Range OuterDetCompatibility::hitDetRRange
private

Definition at line 55 of file OuterDetCompatibility.h.

◆ hitDetZRange

Range OuterDetCompatibility::hitDetZRange
private

Definition at line 55 of file OuterDetCompatibility.h.

◆ theLayer

const DetLayer* OuterDetCompatibility::theLayer
private

Definition at line 52 of file OuterDetCompatibility.h.

Vector3DBase
Definition: Vector3DBase.h:8
DDAxes::y
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
PixelRecoRange::mean
T mean() const
Definition: PixelRecoRange.h:27
OuterDetCompatibility::zRange
const Range & zRange() const
Definition: OuterDetCompatibility.h:42
OuterDetCompatibility::hitDetZRange
Range hitDetZRange
Definition: OuterDetCompatibility.h:55
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
OuterDetCompatibility::checkZ
bool checkZ(const Range &detZRange) const
Definition: OuterDetCompatibility.cc:28
DDAxes::x
GlobalVector
Global3DVector GlobalVector
Definition: GlobalVector.h:10
training_settings.idx
idx
Definition: training_settings.py:16
OuterDetCompatibility::loc_dist
double loc_dist(double radius, double ts_phi, double range_phi, double cosGamma) const
Definition: OuterDetCompatibility.cc:109
OuterDetCompatibility::theLayer
const DetLayer * theLayer
Definition: OuterDetCompatibility.h:52
PixelRecoRange::min
T min() const
Definition: PixelRecoRange.h:25
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
OuterDetCompatibility::phiRange
const OuterHitPhiPrediction::Range & phiRange() const
Definition: OuterDetCompatibility.h:40
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
PixelRecoRange::max
T max() const
Definition: PixelRecoRange.h:26
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
OuterDetCompatibility::hitDetRRange
Range hitDetRRange
Definition: OuterDetCompatibility.h:55
Vector2DBase
Definition: Vector2DBase.h:8
OuterDetCompatibility::rRange
const Range & rRange() const
Definition: OuterDetCompatibility.h:41
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
OuterDetCompatibility::checkR
bool checkR(const Range &detRRange) const
Definition: OuterDetCompatibility.cc:26
Point3DBase< float, LocalTag >
Geom::phiLess
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
OuterDetCompatibility::hitDetPhiRange
OuterHitPhiPrediction::Range hitDetPhiRange
Definition: OuterDetCompatibility.h:54
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
OuterDetCompatibility::barrel
bool barrel
Definition: OuterDetCompatibility.h:53
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
Vector3DBase::dot
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
CosmicsPD_Skims.radius
radius
Definition: CosmicsPD_Skims.py:135
rangesIntersect
bool rangesIntersect(const Range &a, const Range &b)
Definition: rangesIntersect.h:14
PixelRecoRange::inside
bool inside(const T &value) const
Definition: PixelRecoRange.h:36
OuterDetCompatibility::checkPhi
bool checkPhi(const OuterHitPhiPrediction::Range &detPhiRange) const
Definition: OuterDetCompatibility.cc:22
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66