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 TrajectoryStateOnSurface &ts, const BoundPlane &plane) const
 
MeasurementEstimator::Local2DVector maximalLocalDisplacement (const GlobalPoint &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.

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

30  {
31  float phi = hitDetPhiRange.mean();
32  float r = hitDetRRange.mean();
33  return GlobalPoint(r * cos(phi), r * sin(phi), hitDetZRange.mean());
34 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
OuterHitPhiPrediction::Range hitDetPhiRange
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
T mean() const

◆ checkPhi()

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

Definition at line 22 of file OuterDetCompatibility.cc.

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

22  {
23  return rangesIntersect(detPhiRange, hitDetPhiRange, [](auto x, auto y) { return Geom::phiLess(x, y); });
24 }
OuterHitPhiPrediction::Range hitDetPhiRange
bool phiLess(float phi1, float phi2)
Definition: VectorUtil.h:18
bool rangesIntersect(const Range &a, const Range &b)

◆ checkR()

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

Definition at line 26 of file OuterDetCompatibility.cc.

References rangesIntersect().

26 { return rangesIntersect(detRRange, hitDetRRange); }
bool rangesIntersect(const Range &a, const Range &b)

◆ checkZ()

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

Definition at line 28 of file OuterDetCompatibility.cc.

References rangesIntersect().

28 { return rangesIntersect(detZRange, hitDetZRange); }
bool rangesIntersect(const Range &a, const Range &b)

◆ 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.

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

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 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:19

◆ maximalLocalDisplacement() [1/2]

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

◆ maximalLocalDisplacement() [2/2]

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

Definition at line 36 of file OuterDetCompatibility.cc.

References Reference_intrackfit_cff::barrel, funct::cos(), HLT_2024v10_cff::distance, Vector3DBase< T, FrameTag >::dot(), heavyIonCSV_trainingSettings::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().

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 }
T perp() const
Definition: PV3DBase.h:69
bool inside(const T &value) const
T z() const
Definition: PV3DBase.h:61
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
OuterHitPhiPrediction::Range hitDetPhiRange
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define M_PI
double loc_dist(double radius, double ts_phi, double range_phi, double cosGamma) const
Vector3DBase unit() const
Definition: Vector3DBase.h:54
Global3DVector GlobalVector
Definition: GlobalVector.h:10

◆ operator()()

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

Definition at line 7 of file OuterDetCompatibility.cc.

References Reference_intrackfit_cff::barrel.

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 }
bool checkR(const Range &detRRange) const
bool checkPhi(const OuterHitPhiPrediction::Range &detPhiRange) const
bool checkZ(const Range &detZRange) const

◆ phiRange()

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

Definition at line 40 of file OuterDetCompatibility.h.

40 { return hitDetPhiRange; }
OuterHitPhiPrediction::Range hitDetPhiRange

◆ rRange()

const Range& OuterDetCompatibility::rRange ( ) const
inline

Definition at line 41 of file OuterDetCompatibility.h.

◆ zRange()

const Range& OuterDetCompatibility::zRange ( ) const
inline

Definition at line 42 of file OuterDetCompatibility.h.

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.