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 33 of file OuterDetCompatibility.cc.

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

34 {
35  float phi = hitDetPhiRange.mean();
36  float r = hitDetRRange.mean();
37  return GlobalPoint( r*cos(phi), r*sin(phi), hitDetZRange.mean() );
38 }
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 rangesIntersect().

22 { return rangesIntersect(detPhiRange, hitDetPhiRange, PhiLess()); }
OuterHitPhiPrediction::Range hitDetPhiRange
bool rangesIntersect(const Range &a, const Range &b)
bool OuterDetCompatibility::checkR ( const Range detRRange) const
private

Definition at line 24 of file OuterDetCompatibility.cc.

References rangesIntersect().

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

Definition at line 28 of file OuterDetCompatibility.cc.

References rangesIntersect().

30 { 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 113 of file OuterDetCompatibility.cc.

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

115 {
116  double sinDphi = sin(ts_phi - range_phi);
117  double cosDphi = sqrt(1-sinDphi*sinDphi);
118  double sinGamma = sqrt(1-cosGamma*cosGamma);
119  double sinBeta = fabs(cosDphi*cosGamma - sinDphi* sinGamma);
120  return radius * fabs(sinDphi) / sinBeta;
121 }
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 41 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().

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