CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::Range
phiRange () 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 37 of file OuterDetCompatibility.cc.

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

38 {
39  float phi = hitDetPhiRange.mean();
40  float r = hitDetRRange.mean();
41  return GlobalPoint( r*cos(phi), r*sin(phi), hitDetZRange.mean() );
42 }
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 24 of file OuterDetCompatibility.cc.

References rangesIntersect().

26 { 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 28 of file OuterDetCompatibility.cc.

References rangesIntersect().

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

Definition at line 32 of file OuterDetCompatibility.cc.

References rangesIntersect().

34 { 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 117 of file OuterDetCompatibility.cc.

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

119 {
120  double sinDphi = sin(ts_phi - range_phi);
121  double cosDphi = sqrt(1-sinDphi*sinDphi);
122  double sinGamma = sqrt(1-cosGamma*cosGamma);
123  double sinBeta = fabs(cosDphi*cosGamma - sinDphi* sinGamma);
124  return radius * fabs(sinDphi) / sinBeta;
125 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:48
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 45 of file OuterDetCompatibility.cc.

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

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

References Reference_intrackfit_cff::barrel, GlobalDetRangeRPhi::phiRange(), GlobalDetRangeZPhi::phiRange(), GlobalDetRangeRPhi::rRange(), and GlobalDetRangeZPhi::zRange().

10 {
11  if (barrel) {
12  GlobalDetRangeZPhi detRange(plane);
13  if (!checkPhi(detRange.phiRange())) return 0;
14  if (!checkZ(detRange.zRange())) return 0;
15  } else {
16  GlobalDetRangeRPhi detRange(plane);
17  if (!checkPhi(detRange.phiRange())) return 0;
18  if (!checkR(detRange.rRange())) return 0;
19  }
20  return 1;
21 }
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.

46 { return hitDetRRange; }
const Range& OuterDetCompatibility::zRange ( ) const
inline

Definition at line 47 of file OuterDetCompatibility.h.

47 { return hitDetZRange; }

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.