CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BarrelMeasurementEstimator.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaElectronAlgos
4 // Class: BarrelMeasurementEstimator
5 //
13 //
14 // Original Author: Ursula Berthon, Claude Charlot
15 // Created: Mon Mar 27 13:22:06 CEST 2006
16 // $Id: BarrelMeasurementEstimator.cc,v 1.19 2010/07/29 15:19:45 chamont Exp $
17 //
18 //
19 
26 
27 
28 // zero value indicates incompatible ts - hit pair
30  const TransientTrackingRecHit& hit) const {
31  LocalPoint lp = hit.localPosition();
32  GlobalPoint gp = hit.det()->surface().toGlobal( lp);
33  return this->estimate(ts,gp);
34 }
35 
36 //usable in case we have no TransientTrackingRecHit
38  GlobalPoint &gp) const {
39  float tsPhi = ts.globalParameters().position().phi();
40  float myR = gp.perp();
41  float myZ = gp.z();
42 
43  float myZmax = theZMax;
44  float myZmin = theZMin;
45 
46  if(std::abs(myZ)<30. && myR>8.)
47  {
48  myZmax = 0.09;
49  myZmin = -0.09;
50  }
51 
52  float rhPhi = gp.phi();
53 
54  float zDiff = ts.globalParameters().position().z() - gp.z();
55  float phiDiff = tsPhi - rhPhi;
56  if (phiDiff > pi) phiDiff -= twopi;
57  if (phiDiff < -pi) phiDiff += twopi;
58 
59 
60 
61 
62  if ( phiDiff < thePhiMax && phiDiff > thePhiMin &&
63  zDiff < myZmax && zDiff > myZmin) {
64 
65  return std::pair<bool,double>(true,1.);
66  } else {
67 
68  return std::pair<bool,double>(false,0.);
69  }
70 }
71 
72 
73 std::pair<bool,double> BarrelMeasurementEstimator::estimate
74  ( const GlobalPoint & vprim,
75  const TrajectoryStateOnSurface & absolute_ts,
76  GlobalPoint& absolute_gp ) const
77  {
78  GlobalVector ts = absolute_ts.globalParameters().position() - vprim ;
79  GlobalVector gp = absolute_gp - vprim ;
80 
81  float tsPhi = ts.phi();
82  float myR = gp.perp();
83  float myZ = gp.z();
84 
85  float myZmax = theZMax;
86  float myZmin = theZMin;
87 
88  if(std::abs(myZ)<30. && myR>8.)
89  {
90  myZmax = 0.09;
91  myZmin = -0.09;
92  }
93 
94  float rhPhi = gp.phi() ;
95  float zDiff = gp.z()-ts.z() ;
96  float phiDiff = normalized_phi(rhPhi-tsPhi) ;
97 
98  if ( phiDiff < thePhiMax && phiDiff > thePhiMin && zDiff < myZmax && zDiff > myZmin)
99  { return std::pair<bool,double>(true,1.) ; }
100  else
101  { return std::pair<bool,double>(false,0.) ; }
102  }
103 
106  const BoundPlane& plane) const
107  {
108  typedef std::pair<float,float> Range;
109 
110 
111  GlobalPoint trajPos(ts.globalParameters().position());
112  GlobalDetRangeZPhi detRange(plane);
113 
114  Range trajZRange(trajPos.z() - std::abs(theZMin), trajPos.z() + std::abs(theZMax));
115  Range trajPhiRange(trajPos.phi() - std::abs(thePhiMin), trajPos.phi() + std::abs(thePhiMax));
116 
117  if(rangesIntersect(trajZRange, detRange.zRange()) &&
118  rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess()))
119  {
120  return true;
121  }
122  else
123  {
124  // cout <<cout<<" barrel boundpl est returns false!!"<<endl;
125  // cout<<"BarrelMeasurementEstimator(estimate) :thePhiMin,thePhiMax, theZMin,theZMax "<<thePhiMin<<" "<<thePhiMax<<" "<< theZMin<<" "<<theZMax<<endl;
126  // cout<<" trajZRange "<<trajZRange.first<<" "<<trajZRange.second<<endl;
127  // cout<<" trajPhiRange "<<trajPhiRange.first<<" "<<trajPhiRange.second<<endl;
128  // cout<<" detZRange "<<detRange.zRange().first<<" "<<detRange.zRange().second<<endl;
129  // cout<<" detPhiRange "<<detRange.phiRange().first<<" "<<detRange.phiRange().second<<endl;
130  // cout<<" intersect z: "<<rangesIntersect(trajZRange, detRange.zRange())<<endl;
131  // cout<<" intersect phi: "<<rangesIntersect(trajPhiRange, detRange.phiRange(), PhiLess())<<endl;
132  return false ;
133  }
134 
135  }
136 
140  const BoundPlane & plane) const
141  {
142  float nSigmaCut = 3. ;
143  if ( ts.hasError())
144  {
146  return Local2DVector( sqrt(le.xx())*nSigmaCut, sqrt(le.yy())*nSigmaCut) ;
147  }
148  else return Local2DVector(99999,99999) ;
149  }
150 
151 
152 
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
float xx() const
Definition: LocalError.h:19
T perp() const
Definition: PV3DBase.h:66
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
#define abs(x)
Definition: mlp_lapack.h:159
Vector2DBase< float, LocalTag > Local2DVector
LocalError positionError() const
float yy() const
Definition: LocalError.h:21
RealType normalized_phi(RealType phi)
T sqrt(T t)
Definition: SSEVec.h:28
bool rangesIntersect(const Range &a, const Range &b)
T z() const
Definition: PV3DBase.h:58
virtual std::pair< bool, double > estimate(const TrajectoryStateOnSurface &ts, const TransientTrackingRecHit &hit) const
const LocalTrajectoryError & localError() const
PixelRecoRange< float > Range
const GlobalTrajectoryParameters & globalParameters() const
const GeomDet * det() const
The GomeDet* can be zero for InvalidTransientRecHits and for TConstraintRecHit2Ds.
double pi
virtual LocalPoint localPosition() const =0
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
MeasurementEstimator::Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const