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 18 of file OuterDetCompatibility.h.

Member Typedef Documentation

Definition at line 20 of file OuterDetCompatibility.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file OuterDetCompatibility.h.

26  : theLayer(layer), barrel(true),
const Range & zRange() const
OuterHitPhiPrediction::Range hitDetPhiRange
const Range & rRange() const
OuterDetCompatibility::OuterDetCompatibility ( const ForwardDetLayer layer,
const OuterHitPhiPrediction::Range phiRange,
const Range rRange,
const Range zRange 
)
inline

Definition at line 29 of file OuterDetCompatibility.h.

33  : theLayer(layer), barrel(false),
const Range & zRange() const
OuterHitPhiPrediction::Range hitDetPhiRange
const Range & rRange() const

Member Function Documentation

GlobalPoint OuterDetCompatibility::center ( ) const

Definition at line 34 of file OuterDetCompatibility.cc.

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

35 {
36  float phi = hitDetPhiRange.mean();
37  float r = hitDetRRange.mean();
38  return GlobalPoint( r*cos(phi), r*sin(phi), hitDetZRange.mean() );
39 }
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
bool OuterDetCompatibility::checkPhi ( const OuterHitPhiPrediction::Range detPhiRange) const
private

Definition at line 20 of file OuterDetCompatibility.cc.

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

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

Definition at line 25 of file OuterDetCompatibility.cc.

References rangesIntersect().

27 { return rangesIntersect(detRRange, hitDetRRange); }
bool rangesIntersect(const Range &a, const Range &b)
bool OuterDetCompatibility::checkZ ( const Range detZRange) const
private

Definition at line 29 of file OuterDetCompatibility.cc.

References rangesIntersect().

31 { return rangesIntersect(detZRange, hitDetZRange); }
bool rangesIntersect(const Range &a, const Range &b)
double OuterDetCompatibility::loc_dist ( double  radius,
double  ts_phi,
double  range_phi,
double  cosGamma 
) const
private

Definition at line 114 of file OuterDetCompatibility.cc.

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

116 {
117  double sinDphi = sin(ts_phi - range_phi);
118  double cosDphi = sqrt(1-sinDphi*sinDphi);
119  double sinGamma = sqrt(1-cosGamma*cosGamma);
120  double sinBeta = fabs(cosDphi*cosGamma - sinDphi* sinGamma);
121  return radius * fabs(sinDphi) / sinBeta;
122 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:18
MeasurementEstimator::Local2DVector OuterDetCompatibility::maximalLocalDisplacement ( const TrajectoryStateOnSurface ts,
const BoundPlane plane 
) const
MeasurementEstimator::Local2DVector OuterDetCompatibility::maximalLocalDisplacement ( const GlobalPoint ts,
const BoundPlane plane 
) const

Definition at line 42 of file OuterDetCompatibility.cc.

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

44 {
45  float x_loc = 0.;
46  float y_loc = 0.;
47  if(barrel) {
48  double radius = ts.perp();
49  GlobalVector planeNorm = plane.normalVector();
50  GlobalVector tsDir = GlobalVector( ts.x(), ts.y(),0. ).unit();
51  double ts_phi = tsDir.phi();
52  if (! hitDetPhiRange.inside(ts_phi) ) {
53  while (ts_phi >= hitDetPhiRange.max() ) ts_phi -= 2*M_PI;
54  while (ts_phi < hitDetPhiRange.min() ) ts_phi += 2*M_PI;
55  if (!hitDetPhiRange.inside(ts_phi)) return MeasurementEstimator::Local2DVector(0.,0.);
56  }
57  double cosGamma = tsDir.dot(planeNorm);
58 
59  double dx1 = loc_dist( radius, ts_phi, hitDetPhiRange.min(), cosGamma);
60  double dx2 = loc_dist( radius, ts_phi, hitDetPhiRange.max(), cosGamma);
61 
62  double ts_z = ts.z();
63  double dy1 = ts_z - hitDetZRange.min();
64  double dy2 = hitDetZRange.max() - ts_z;
65 
66  x_loc = max(dx1,dx2);
67  y_loc = max(dy1,dy2);
68 
69  // debug only
70 /*
71  double r1 = dx1 * fabs(cosGamma) / sin(ts_phi-hitDetPhiRange.min());
72  double r2 = dx2 * fabs(cosGamma) / sin(hitDetPhiRange.max()-ts_phi);
73  GlobalPoint p1( r1* cos(hitDetPhiRange.min()), r1 * sin(hitDetPhiRange.min()), hitDetZRange.min());
74  GlobalPoint p2( r2* cos(hitDetPhiRange.max()), r2 * sin(hitDetPhiRange.max()), hitDetZRange.min());
75  GlobalPoint p3( r1* cos(hitDetPhiRange.min()), r1 * sin(hitDetPhiRange.min()), hitDetZRange.max());
76  GlobalPoint p4( r2* cos(hitDetPhiRange.max()), r2 * sin(hitDetPhiRange.max()), hitDetZRange.max());
77  cout << " Local1: " << plane.toLocal(ts-p1) << endl;
78  cout << " Local2: " << plane.toLocal(ts-p2) << endl;
79  cout << " Local3: " << plane.toLocal(ts-p3) << endl;
80  cout << " Local4: " << plane.toLocal(ts-p4) << endl;
81 */
82  }
83  else {
84  LocalPoint ts_loc = plane.toLocal(ts);
85  GlobalVector planeNorm = plane.normalVector();
86 
87  double x_glob[4], y_glob[4], z_glob[4];
88  x_glob[0] = hitDetRRange.min()*cos(hitDetPhiRange.min());
89  y_glob[0] = hitDetRRange.min()*sin(hitDetPhiRange.min());
90  x_glob[1] = hitDetRRange.max()*cos(hitDetPhiRange.min());
91  y_glob[1] = hitDetRRange.max()*sin(hitDetPhiRange.min());
92  x_glob[2] = hitDetRRange.min()*cos(hitDetPhiRange.max());
93  y_glob[2] = hitDetRRange.min()*sin(hitDetPhiRange.max());
94  x_glob[3] = hitDetRRange.max()*cos(hitDetPhiRange.max());
95  y_glob[3] = hitDetRRange.max()*sin(hitDetPhiRange.max());
96 
97  for (int idx = 0; idx < 4; idx++) {
98  double dx_glob = x_glob[idx] - ts.x();
99  double dy_glob = y_glob[idx] - ts.y();
100  double dz_glob = -(dx_glob * planeNorm.x() + dy_glob*planeNorm.y()) / planeNorm.z();
101  z_glob[idx] = dz_glob + ts.z();
102  }
103 
104  for (int idx=0; idx <4; idx++) {
105  LocalPoint lp = plane.toLocal( GlobalPoint( x_glob[idx], y_glob[idx], z_glob[idx]));
106  x_loc = max(x_loc, fabs(lp.x()-ts_loc.x()));
107  y_loc = max(y_loc, fabs(lp.y()-ts_loc.y()));
108  }
109  }
111  return distance;
112 }
T perp() const
Definition: PV3DBase.h:72
T max() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double loc_dist(double radius, double ts_phi, double range_phi, double cosGamma) const
T y() const
Definition: PV3DBase.h:63
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
T min() const
OuterHitPhiPrediction::Range hitDetPhiRange
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define M_PI
bool inside(const T &value) const
T x() const
Definition: PV3DBase.h:62
Global3DVector GlobalVector
Definition: GlobalVector.h:10
bool OuterDetCompatibility::operator() ( const BoundPlane plane) const

Definition at line 7 of file OuterDetCompatibility.cc.

References Reference_intrackfit_cff::barrel.

8 {
9  if (barrel) {
10  if (!checkPhi(plane.phiSpan())) return false;
11  if (!checkZ(plane.zSpan())) return false;
12  } else {
13  if (!checkPhi(plane.phiSpan())) return false;
14  if (!checkR(plane.rSpan())) return false;
15  }
16  return true;
17 }
bool checkZ(const Range &detZRange) const
bool checkPhi(const OuterHitPhiPrediction::Range &detPhiRange) const
bool checkR(const Range &detRRange) const
const OuterHitPhiPrediction::Range& OuterDetCompatibility::phiRange ( ) const
inline

Definition at line 45 of file OuterDetCompatibility.h.

45 {return hitDetPhiRange;}
OuterHitPhiPrediction::Range hitDetPhiRange
const Range& OuterDetCompatibility::rRange ( ) const
inline

Definition at line 46 of file OuterDetCompatibility.h.

const Range& OuterDetCompatibility::zRange ( ) const
inline

Definition at line 47 of file OuterDetCompatibility.h.

References TCMET_cfi::radius.

Member Data Documentation

bool OuterDetCompatibility::barrel
private

Definition at line 59 of file OuterDetCompatibility.h.

OuterHitPhiPrediction::Range OuterDetCompatibility::hitDetPhiRange
private

Definition at line 60 of file OuterDetCompatibility.h.

Range OuterDetCompatibility::hitDetRRange
private

Definition at line 61 of file OuterDetCompatibility.h.

Range OuterDetCompatibility::hitDetZRange
private

Definition at line 61 of file OuterDetCompatibility.h.

const DetLayer* OuterDetCompatibility::theLayer
private

Definition at line 58 of file OuterDetCompatibility.h.