CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HICSeedMeasurementEstimator.cc
Go to the documentation of this file.
2 //#include "CLHEP/Units/GlobalPhysicalConstants.h"
3 
4 //#define DEBUG
5 
6 namespace cms {
8  const TransientTrackingRecHit& hit) const
9 {
10  double dfimean = 0.;
11  double dzmean = 0.;
12  double pi=4.*atan(1.);
13  double twopi=8.*atan(1.);
14 #ifdef DEBUG
15  std::cout<<" HICSeedMeasurementEstimator::estimate::start::eta "<<ts.freeTrajectoryState()->parameters().momentum().eta() <<std::endl;
16 #endif
17 
18 //
19 // For mixed are 0.8<|eta|<1.6 there is a shift for + and -
20 //
21  if( fabs(ts.freeTrajectoryState()->parameters().momentum().eta()) > 0.8 &&
22  fabs(ts.freeTrajectoryState()->parameters().momentum().eta()) < 1.6 )
23  {
24  dfimean = -0.14;
25  if( ts.freeTrajectoryState()->charge() > 0. ) dfimean = -0.24;
26  dzmean = -10.;
27  }
28  if( fabs(ts.freeTrajectoryState()->parameters().momentum().eta()) > 1.6 )
29  {
30  dfimean = -0.02;
31  if( ts.freeTrajectoryState()->charge() > 0. ) dfimean = -0.1776;
32  }
33 
34  if( !(hit.isValid()) ) {
35 #ifdef DEBUG
36  std::cout<<" HICSeedMeasurementEstimator::estimate::hit is not valid " <<std::endl;
37 #endif
38  return HitReturnType(false,0.);
39  }
40 
41 #ifdef DEBUG
42  std::cout<<" HICSeedMeasurementEstimator::estimate::hit is valid " <<std::endl;
43 #endif
44 
45 
46  double dfi = fabs( ts.freeTrajectoryState()->parameters().position().phi()-
47  hit.globalPosition().phi() + dfimean );
48  if(dfi>pi) dfi=twopi-dfi;
49 
50  if(dfi>thePhi) {
51 #ifdef DEBUG
52  std::cout<<"HICSeedMeasurementEstimator::estimate::failed::phi hit::phi fts::thePhi "<<hit.globalPosition().phi()<<" "<<
53  ts.freeTrajectoryState()->parameters().position().phi()<<" "<<dfi<<
54  " "<<thePhi<<std::endl;
55 #endif
56 
57  return HitReturnType(false,0.);
58  }
59  if( fabs(hit.globalPosition().z()) > 120.)
60  {
61 
62  if(fabs(hit.globalPosition().perp()-ts.freeTrajectoryState()->parameters().position().perp())
63  >theZ) {
64 #ifdef DEBUG
65  std::cout<<"HICSeedMeasurementEstimator::estimate::failed::r hit::r fts::theZ "<<hit.globalPosition().perp()<<" "<<
67  " "<<theZ<<std::endl;
68 #endif
69  return HitReturnType(false,0.);
70  }
71  }
72  else
73  {
74 
75  if(fabs(hit.globalPosition().z()-ts.freeTrajectoryState()->parameters().position().z() + dzmean)
76  >theZ) {
77 #ifdef DEBUG
78  std::cout<<"HICSeedMeasurementEstimator::estimate::failed::z hit::z fts::theZ "<<hit.globalPosition().z()<<" "<<
80  " "<<theZ<<std::endl;
81 #endif
82 
83  return HitReturnType(false,0.);
84  }
85  }
86 #ifdef DEBUG
87  std::cout<<"HICSeedMeasurementEstimator::estimate::accepted::phi::r::z "<<hit.globalPosition().phi()<<" "<<
88  hit.globalPosition().perp()<<" "<<
89  hit.globalPosition().z()<<
90  std::endl;
91 #endif
92 
93 return HitReturnType(true,1.);
94 }
95 
97  const BoundPlane& plane) const
98 {
99 
100  double pi=4.*atan(1.);
101  double twopi=8.*atan(1.);
102 
103 #ifdef DEBUG
104  std::cout<<"HICSeedMeasurementEstimator::estimate::Det::start::r,phi,z "<<plane.position().perp()<<" "<<plane.position().phi()<<" "<<
105  plane.position().z()<<std::endl;
106  std::cout<<"HICSeedMeasurementEstimator::estimate::Track::r,phi,z "<<ts.freeTrajectoryState()->parameters().position().perp()<<" "<<
107  ts.freeTrajectoryState()->parameters().position().phi()<<" "<<
108  ts.freeTrajectoryState()->parameters().position().z()<<std::endl;
109 #endif
110  double length = plane.bounds().length();
111  double width = plane.bounds().width();
112  double deltafi = atan2( width , (double)plane.position().perp() );
113  double phitrack = ts.freeTrajectoryState()->parameters().position().phi();
114  double phiplane = plane.position().phi();
115 
116  if( phitrack < 0. ) phitrack = twopi + phitrack;
117  if( phiplane < 0. ) phiplane = twopi + phiplane;
118 
119  double dphi = fabs(phitrack - phiplane);
120 
121  if( dphi > pi ) dphi = twopi - dphi;
122  if( dphi > thePhi + deltafi ) {
123 #ifdef DEBUG
124  std::cout<<"HICSeedMeasurementEstimator::estimate::Det::phi failed "<<dphi<<" "<<thePhi<<" "<<deltafi<<std::endl;
125 #endif
126  return false;
127  }
128  if ( fabs( plane.position().z() ) < 111. )
129  {
130  // barrel
131  if( fabs(ts.freeTrajectoryState()->parameters().position().z() - plane.position().z())
132  > theZ+length ) {
133 
134 #ifdef DEBUG
135  double dz = fabs(ts.freeTrajectoryState()->parameters().position().z() - plane.position().z());
136  std::cout<<"HICSeedMeasurementEstimator::estimate::Det::z failed "<<dz<<" "<<theZ<<" "<<length<<std::endl;
137 #endif
138 
139  return false;
140  }
141  }
142  else
143  {
144  // forward
145  if( fabs(ts.freeTrajectoryState()->parameters().position().perp() - plane.position().perp())
146  > theZ + length ) {
147 #ifdef DEBUG
148  double dr = fabs(ts.freeTrajectoryState()->parameters().position().perp() - plane.position().perp());
149  std::cout<<"HICSeedMeasurementEstimator::estimate::Det::r failed "<<dr<<" "<<theZ<<" "<<length<<std::endl;
150 #endif
151 
152  return false;
153  }
154  }
155 #ifdef DEBUG
156  std::cout<<" Good detector "<<std::endl;
157 #endif
158  return true;
159 }
160 
163  const BoundPlane& plane) const
164 {
165 #ifdef DEBUG
166  std::cout<<"HICSeedMeasurementEstimator::malLocalDisplacement::start"
167  <<ts.hasError()<<std::endl;
168 #endif
169 
170  if ( ts.hasError()) {
172 #ifdef DEBUG
173  std::cout<<"HICSeedMeasurementEstimator::malLocalDisplacement::localerror::sigma"<<Local2DVector( sqrt(le.xx())*nSigmaCut(), sqrt(le.yy())*nSigmaCut())<<std::endl;
174 #endif
175  return Local2DVector( sqrt(le.xx())*nSigmaCut(), sqrt(le.yy())*nSigmaCut());
176  }
177  else return Local2DVector(0,0);
178 }
179 }
float xx() const
Definition: LocalError.h:24
Vector2DBase< float, LocalTag > Local2DVector
virtual float length() const =0
T perp() const
Definition: PV3DBase.h:71
const GlobalTrajectoryParameters & parameters() const
virtual MeasurementEstimator::Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const BoundPlane &plane) const
FreeTrajectoryState * freeTrajectoryState(bool withErrors=true) const
virtual MeasurementEstimator::HitReturnType estimate(const TrajectoryStateOnSurface &ts, const TransientTrackingRecHit &hit) const
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
TrackCharge charge() const
LocalError positionError() const
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
const LocalTrajectoryError & localError() const
std::pair< bool, double > HitReturnType
const Bounds & bounds() const
Definition: BoundSurface.h:89
bool isValid() const
T eta() const
Definition: PV3DBase.h:75
virtual GlobalPoint globalPosition() const
tuple cout
Definition: gather_cfg.py:121
double pi
virtual float width() const =0
const PositionType & position() const