Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:14:23

0001 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
0002 #include "DataFormats/GeometrySurface/interface/Bounds.h"
0003 
0004 #include "Geometry/CommonTopologies/interface/ProxyPixelTopology.h"
0005 #include "Geometry/CommonTopologies/interface/PixelGeomDetType.h"
0006 
0007 ////////////////////////////////////////////////////////////////////////////////
0008 ProxyPixelTopology::ProxyPixelTopology(PixelGeomDetType const *type, BoundPlane *bp)
0009     : theType(type), theLength(bp->bounds().length()), theWidth(bp->bounds().width()) {}
0010 
0011 ////////////////////////////////////////////////////////////////////////////////
0012 LocalPoint ProxyPixelTopology::localPosition(const MeasurementPoint &mp) const {
0013   return specificTopology().localPosition(mp);
0014 }
0015 
0016 ////////////////////////////////////////////////////////////////////////////////
0017 LocalPoint ProxyPixelTopology::localPosition(const MeasurementPoint &mp,
0018                                              const Topology::LocalTrackPred &trkPred) const {
0019   if (!this->surfaceDeformation())
0020     return specificTopology().localPosition(mp);
0021 
0022   // add correction from SurfaceDeformation
0023   const LocalPoint posOld(specificTopology().localPosition(mp));  // 'original position'
0024   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(trkPred));
0025 
0026   return LocalPoint(posOld.x() + corr.x(), posOld.y() + corr.y(), posOld.z());
0027 }
0028 
0029 ////////////////////////////////////////////////////////////////////////////////
0030 LocalError ProxyPixelTopology::localError(const MeasurementPoint &mp, const MeasurementError &me) const {
0031   return specificTopology().localError(mp, me);
0032 }
0033 
0034 ////////////////////////////////////////////////////////////////////////////////
0035 LocalError ProxyPixelTopology::localError(const MeasurementPoint &mp,
0036                                           const MeasurementError &me,
0037                                           const Topology::LocalTrackPred &trkPred) const {
0038   // The topology knows to calculate the cartesian error from measurement frame.
0039   // But assuming no uncertainty on the SurfaceDeformation variables,
0040   // the errors do not change from a simple shift to compensate
0041   // that the track 'sees' the surface at another place than it thinks...
0042   return specificTopology().localError(mp, me);
0043 }
0044 
0045 ////////////////////////////////////////////////////////////////////////////////
0046 MeasurementPoint ProxyPixelTopology::measurementPosition(const LocalPoint &lp) const {
0047   return specificTopology().measurementPosition(lp);
0048 }
0049 
0050 ////////////////////////////////////////////////////////////////////////////////
0051 MeasurementPoint ProxyPixelTopology::measurementPosition(const LocalPoint &lp,
0052                                                          const Topology::LocalTrackAngles &dir) const {
0053   if (!this->surfaceDeformation())
0054     return specificTopology().measurementPosition(lp);
0055 
0056   // subtract correction from SurfaceDeformation
0057   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
0058   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
0059 
0060   return specificTopology().measurementPosition(posOrig);
0061 }
0062 
0063 ////////////////////////////////////////////////////////////////////////////////
0064 MeasurementError ProxyPixelTopology::measurementError(const LocalPoint &lp, const LocalError &le) const {
0065   return specificTopology().measurementError(lp, le);
0066 }
0067 
0068 ////////////////////////////////////////////////////////////////////////////////
0069 MeasurementError ProxyPixelTopology::measurementError(const LocalPoint &lp,
0070                                                       const LocalError &le,
0071                                                       const Topology::LocalTrackAngles &dir) const {
0072   if (!this->surfaceDeformation())
0073     return specificTopology().measurementError(lp, le);
0074 
0075   // subtract correction from SurfaceDeformation
0076   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
0077   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
0078 
0079   return specificTopology().measurementError(posOrig, le);
0080 }
0081 
0082 ////////////////////////////////////////////////////////////////////////////////
0083 int ProxyPixelTopology::channel(const LocalPoint &lp) const { return specificTopology().channel(lp); }
0084 
0085 ////////////////////////////////////////////////////////////////////////////////
0086 int ProxyPixelTopology::channel(const LocalPoint &lp, const Topology::LocalTrackAngles &dir) const {
0087   if (!this->surfaceDeformation())
0088     return specificTopology().channel(lp);
0089 
0090   // subtract correction from SurfaceDeformation
0091   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
0092   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
0093 
0094   return specificTopology().channel(posOrig);
0095 }
0096 
0097 ////////////////////////////////////////////////////////////////////////////////
0098 std::pair<float, float> ProxyPixelTopology::pixel(const LocalPoint &lp) const { return specificTopology().pixel(lp); }
0099 
0100 ////////////////////////////////////////////////////////////////////////////////
0101 std::pair<float, float> ProxyPixelTopology::pixel(const LocalPoint &lp, const Topology::LocalTrackAngles &dir) const {
0102   if (!this->surfaceDeformation())
0103     return specificTopology().pixel(lp);
0104 
0105   // subtract correction from SurfaceDeformation
0106   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
0107   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
0108 
0109   return specificTopology().pixel(posOrig);
0110 }
0111 
0112 ////////////////////////////////////////////////////////////////////////////////
0113 float ProxyPixelTopology::localX(const float mpX) const { return specificTopology().localX(mpX); }
0114 
0115 ////////////////////////////////////////////////////////////////////////////////
0116 float ProxyPixelTopology::localX(const float mpX, const Topology::LocalTrackPred &trkPred) const {
0117   if (!this->surfaceDeformation())
0118     return specificTopology().localX(mpX);
0119 
0120   // add correction from SurfaceDeformation
0121   float xOld = specificTopology().localX(mpX);  // 'original position'
0122   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(trkPred));
0123 
0124   return xOld + corr.x();
0125 }
0126 
0127 ////////////////////////////////////////////////////////////////////////////////
0128 float ProxyPixelTopology::localY(const float mpY) const { return specificTopology().localY(mpY); }
0129 
0130 ////////////////////////////////////////////////////////////////////////////////
0131 float ProxyPixelTopology::localY(const float mpY, const Topology::LocalTrackPred &trkPred) const {
0132   if (!this->surfaceDeformation())
0133     return specificTopology().localY(mpY);
0134 
0135   // add correction from SurfaceDeformation
0136   float yOld = specificTopology().localY(mpY);  // 'original position'
0137   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(trkPred));
0138 
0139   return yOld + corr.y();
0140 }
0141 
0142 ////////////////////////////////////////////////////////////////////////////////
0143 void ProxyPixelTopology::setSurfaceDeformation(const SurfaceDeformation *deformation) {
0144   theSurfaceDeformation.reset(deformation);
0145 }
0146 
0147 ////////////////////////////////////////////////////////////////////////////////
0148 SurfaceDeformation::Local2DVector ProxyPixelTopology::positionCorrection(const LocalPoint &pos,
0149                                                                          const Topology::LocalTrackAngles &dir) const {
0150   const SurfaceDeformation::Local2DPoint pos2D(pos.x(), pos.y());  // change precision and dimension
0151 
0152   return this->surfaceDeformation()->positionCorrection(pos2D, dir, theLength, theWidth);
0153 }
0154 
0155 ////////////////////////////////////////////////////////////////////////////////
0156 SurfaceDeformation::Local2DVector ProxyPixelTopology::positionCorrection(const Topology::LocalTrackPred &trk) const {
0157   return this->surfaceDeformation()->positionCorrection(trk.point(), trk.angles(), theLength, theWidth);
0158 }