CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
OuterDetCompatibility Class Reference

#include <OuterDetCompatibility.h>

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 HitRZConstraint::Range &rRange, const HitRZConstraint::Range &zRange)
 
 OuterDetCompatibility (const ForwardDetLayer *layer, const OuterHitPhiPrediction::Range &phiRange, const HitRZConstraint::Range &rRange, const HitRZConstraint::Range &zRange)
 
const
OuterHitPhiPrediction::Range
phiRange () const
 
const HitRZConstraint::RangerRange () const
 
const HitRZConstraint::RangezRange () const
 

Private Member Functions

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

Private Attributes

bool barrel
 
OuterHitPhiPrediction::Range hitDetPhiRange
 
HitRZConstraint::Range hitDetRRange
 
HitRZConstraint::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 13 of file OuterDetCompatibility.h.

Constructor & Destructor Documentation

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

Definition at line 16 of file OuterDetCompatibility.h.

20  : theLayer(layer), barrel(true),
21  hitDetPhiRange(phiRange), hitDetRRange(rRange), hitDetZRange(zRange) { }
OuterHitPhiPrediction::Range hitDetPhiRange
HitRZConstraint::Range hitDetRRange
HitRZConstraint::Range hitDetZRange
OuterDetCompatibility::OuterDetCompatibility ( const ForwardDetLayer layer,
const OuterHitPhiPrediction::Range phiRange,
const HitRZConstraint::Range rRange,
const HitRZConstraint::Range zRange 
)
inline

Definition at line 23 of file OuterDetCompatibility.h.

27  : theLayer(layer), barrel(false),
28  hitDetPhiRange(phiRange), hitDetRRange(rRange), hitDetZRange(zRange) { }
OuterHitPhiPrediction::Range hitDetPhiRange
HitRZConstraint::Range hitDetRRange
HitRZConstraint::Range hitDetZRange

Member Function Documentation

GlobalPoint OuterDetCompatibility::center ( ) const

Definition at line 37 of file OuterDetCompatibility.cc.

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

Referenced by OuterEstimator::center().

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
HitRZConstraint::Range hitDetRRange
T mean() const
HitRZConstraint::Range hitDetZRange
Definition: DDAxes.h:10
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 HitRZConstraint::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)
HitRZConstraint::Range hitDetRRange
bool OuterDetCompatibility::checkZ ( const HitRZConstraint::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)
HitRZConstraint::Range hitDetZRange
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:46
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(), Vector3DBase< T, FrameTag >::dot(), M_PI, max(), Plane::normalVector(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), CosmicsPD_Skims::radius, funct::sin(), GloballyPositioned< T >::toLocal(), 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  }
113  MeasurementEstimator::Local2DVector distance(x_loc,y_loc);
114  return distance;
115 }
T perp() const
Definition: PV3DBase.h:71
T max() const
GlobalVector normalVector() const
Definition: Plane.h:47
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
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:62
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:107
T min() const
OuterHitPhiPrediction::Range hitDetPhiRange
const T & max(const T &a, const T &b)
string unit
Definition: csvLumiCalc.py:46
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define M_PI
Definition: BFit3D.cc:3
HitRZConstraint::Range hitDetRRange
bool inside(const T &value) const
HitRZConstraint::Range hitDetZRange
T x() const
Definition: PV3DBase.h:61
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 HitRZConstraint::Range &detZRange) const
bool checkPhi(const OuterHitPhiPrediction::Range &detPhiRange) const
bool checkR(const HitRZConstraint::Range &detRRange) const
const OuterHitPhiPrediction::Range& OuterDetCompatibility::phiRange ( ) const
inline

Definition at line 39 of file OuterDetCompatibility.h.

References hitDetPhiRange.

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

Definition at line 40 of file OuterDetCompatibility.h.

References hitDetRRange.

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

Definition at line 41 of file OuterDetCompatibility.h.

References hitDetZRange.

41 { return hitDetZRange; }
HitRZConstraint::Range hitDetZRange

Member Data Documentation

bool OuterDetCompatibility::barrel
private

Definition at line 53 of file OuterDetCompatibility.h.

OuterHitPhiPrediction::Range OuterDetCompatibility::hitDetPhiRange
private

Definition at line 54 of file OuterDetCompatibility.h.

Referenced by phiRange().

HitRZConstraint::Range OuterDetCompatibility::hitDetRRange
private

Definition at line 55 of file OuterDetCompatibility.h.

Referenced by rRange().

HitRZConstraint::Range OuterDetCompatibility::hitDetZRange
private

Definition at line 55 of file OuterDetCompatibility.h.

Referenced by zRange().

const DetLayer* OuterDetCompatibility::theLayer
private

Definition at line 52 of file OuterDetCompatibility.h.