Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:16

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