Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
0002 #include "DataFormats/GeometrySurface/interface/Bounds.h"
0003 
0004 #include "Geometry/TrackerGeometryBuilder/interface/ProxyStripTopology.h"
0005 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetType.h"
0006 
0007 ////////////////////////////////////////////////////////////////////////////////
0008 ProxyStripTopology::ProxyStripTopology(StripGeomDetType const *type, BoundPlane *bp)
0009     : theType(type), theLength(bp->bounds().length()), theWidth(bp->bounds().width()) {}
0010 
0011 ////////////////////////////////////////////////////////////////////////////////
0012 /* inlined
0013 LocalPoint ProxyStripTopology::localPosition( const MeasurementPoint& mp ) const
0014 {
0015   return specificTopology().localPosition(mp);
0016 
0017 // FIXME: Better this way? Well, but posOrig will not contain useful y!
0018 //   if (!this->surfaceDeformation()) return specificTopology().localPosition(mp);
0019 //
0020 //   // correct with position information from input and zero track angles 
0021 //   const LocalPoint posOrig(specificTopology().localPosition(mp));
0022 //   return this->localPosition(mp, Topology::LocalTrackPred(posOrig.x(), posOrig.y(), 0., 0.));
0023 }
0024 */
0025 
0026 ////////////////////////////////////////////////////////////////////////////////
0027 LocalPoint ProxyStripTopology::localPosition(const MeasurementPoint &mp,
0028                                              const Topology::LocalTrackPred &trkPred) const {
0029   if (!this->surfaceDeformation())
0030     return specificTopology().localPosition(mp);
0031 
0032   // add correction from SurfaceDeformation
0033   const LocalPoint posOld(specificTopology().localPosition(mp));  // 'original position'
0034   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(trkPred));
0035 
0036   return LocalPoint(posOld.x() + corr.x(), posOld.y() + corr.y(), posOld.z());
0037 }
0038 
0039 ////////////////////////////////////////////////////////////////////////////////
0040 /* inlined
0041 LocalPoint ProxyStripTopology::localPosition( float strip ) const
0042 {
0043   return specificTopology().localPosition(strip);
0044 
0045 // FIXME: Better this way? Well, but posOrig will not contain useful y!
0046 //   if (!this->surfaceDeformation()) return specificTopology().localPosition(strip);
0047 
0048 //   // correct with position information from input and zero track angles 
0049 //   const LocalPoint posOrig(specificTopology().localPosition(strip));
0050 //   return this->localPosition(mp, Topology::LocalTrackPred(posOrig.x(), posOrig.y(), 0., 0.));
0051 }
0052 */
0053 
0054 ////////////////////////////////////////////////////////////////////////////////
0055 LocalPoint ProxyStripTopology::localPosition(float strip, const Topology::LocalTrackPred &trkPred) const {
0056   if (!this->surfaceDeformation())
0057     return specificTopology().localPosition(strip);
0058 
0059   // add correction from SurfaceDeformation
0060   const LocalPoint posOld(specificTopology().localPosition(strip));
0061 
0062   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(trkPred));
0063   return LocalPoint(posOld.x() + corr.x(), posOld.y() + corr.y(), posOld.z());
0064 }
0065 
0066 ////////////////////////////////////////////////////////////////////////////////
0067 LocalError ProxyStripTopology::localError(float strip, float stripErr2, const Topology::LocalTrackPred &trkPred) const {
0068   // 'strip' is from measurement frame and the topology knows to
0069   // calculate the cartesian error.
0070   // But assuming no uncertainty on the SurfaceDeformation variables,
0071   // the errors do not change from a simple shift to compensate
0072   // that the track 'sees' the surface at another place than it thinks...
0073 
0074   // In case of TwoBowedSurfacesDeformation one could add corrections here due to
0075   // relative rotations of the sensors...
0076   return specificTopology().localError(strip, stripErr2);
0077 }
0078 
0079 ////////////////////////////////////////////////////////////////////////////////
0080 LocalError ProxyStripTopology::localError(const MeasurementPoint &mp,
0081                                           const MeasurementError &me,
0082                                           const Topology::LocalTrackPred &trkPred) const {
0083   // See comment in localError(float strip, float stripErr2,
0084   //                           const Topology::LocalTrackPred &trkPred)!
0085   return specificTopology().localError(mp, me);
0086 }
0087 
0088 ////////////////////////////////////////////////////////////////////////////////
0089 MeasurementPoint ProxyStripTopology::measurementPosition(const LocalPoint &lp,
0090                                                          const Topology::LocalTrackAngles &dir) const {
0091   if (!this->surfaceDeformation())
0092     return specificTopology().measurementPosition(lp);
0093 
0094   // subtract correction from SurfaceDeformation
0095   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
0096   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
0097 
0098   return specificTopology().measurementPosition(posOrig);
0099 }
0100 
0101 ////////////////////////////////////////////////////////////////////////////////
0102 MeasurementError ProxyStripTopology::measurementError(const LocalPoint &lp,
0103                                                       const LocalError &le,
0104                                                       const Topology::LocalTrackAngles &dir) const {
0105   if (!this->surfaceDeformation())
0106     return specificTopology().measurementError(lp, le);
0107 
0108   // assuming 'lp' comes from a track prediction
0109   // (i.e. where the track thinks it hits the surface)
0110   // we need to subtract correction from SurfaceDeformation
0111   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
0112   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
0113 
0114   return specificTopology().measurementError(posOrig, le);
0115 }
0116 
0117 ////////////////////////////////////////////////////////////////////////////////
0118 int ProxyStripTopology::channel(const LocalPoint &lp, const Topology::LocalTrackAngles &dir) const {
0119   if (!this->surfaceDeformation())
0120     return specificTopology().channel(lp);
0121 
0122   // subtract correction from SurfaceDeformation
0123   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
0124   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
0125 
0126   return specificTopology().channel(posOrig);
0127 }
0128 
0129 ////////////////////////////////////////////////////////////////////////////////
0130 float ProxyStripTopology::strip(const LocalPoint &lp, const Topology::LocalTrackAngles &dir) const {
0131   if (!this->surfaceDeformation())
0132     return specificTopology().strip(lp);
0133 
0134   // subtract correction from SurfaceDeformation
0135   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
0136   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
0137 
0138   return specificTopology().strip(posOrig);
0139 }
0140 
0141 ////////////////////////////////////////////////////////////////////////////////
0142 float ProxyStripTopology::localPitch(const LocalPoint &lp, const Topology::LocalTrackAngles &dir) const {
0143   if (!this->surfaceDeformation())
0144     return specificTopology().localPitch(lp);
0145 
0146   // subtract correction from SurfaceDeformation
0147   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
0148   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
0149 
0150   return specificTopology().localPitch(posOrig);
0151 }
0152 
0153 ////////////////////////////////////////////////////////////////////////////////
0154 float ProxyStripTopology::localStripLength(const LocalPoint &lp, const Topology::LocalTrackAngles &dir) const {
0155   if (!this->surfaceDeformation())
0156     return specificTopology().localStripLength(lp);
0157 
0158   // subtract correction from SurfaceDeformation
0159   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
0160   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
0161 
0162   return specificTopology().localStripLength(posOrig);
0163 }
0164 
0165 ////////////////////////////////////////////////////////////////////////////////
0166 void ProxyStripTopology::setSurfaceDeformation(const SurfaceDeformation *deformation) {
0167   theSurfaceDeformation.reset(deformation);
0168 }
0169 
0170 ////////////////////////////////////////////////////////////////////////////////
0171 SurfaceDeformation::Local2DVector ProxyStripTopology::positionCorrection(const LocalPoint &pos,
0172                                                                          const Topology::LocalTrackAngles &dir) const {
0173   const SurfaceDeformation::Local2DPoint pos2D(pos.x(), pos.y());  // change precision and dimension
0174 
0175   return this->surfaceDeformation()->positionCorrection(pos2D, dir, theLength, theWidth);
0176 }
0177 
0178 ////////////////////////////////////////////////////////////////////////////////
0179 SurfaceDeformation::Local2DVector ProxyStripTopology::positionCorrection(const Topology::LocalTrackPred &trk) const {
0180   return this->surfaceDeformation()->positionCorrection(trk.point(), trk.angles(), theLength, theWidth);
0181 }