CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/Geometry/TrackerGeometryBuilder/src/ProxyPixelTopology.cc

Go to the documentation of this file.
00001 #include "DataFormats/GeometrySurface/interface/BoundPlane.h"
00002 #include "DataFormats/GeometrySurface/interface/Bounds.h"
00003 
00004 #include "Geometry/TrackerGeometryBuilder/interface/ProxyPixelTopology.h"
00005 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetType.h"
00006 
00008 ProxyPixelTopology::ProxyPixelTopology(PixelGeomDetType* type, BoundPlane * bp)
00009   :theType(type), theLength(bp->bounds().length()), theWidth(bp->bounds().width())
00010 {
00011   
00012 }
00013 
00015 LocalPoint ProxyPixelTopology::localPosition( const MeasurementPoint& mp ) const
00016 {
00017   return specificTopology().localPosition(mp);
00018 }
00019 
00021 LocalPoint ProxyPixelTopology::localPosition( const MeasurementPoint& mp, 
00022                                               const Topology::LocalTrackPred &trkPred ) const
00023 {
00024   if (!this->surfaceDeformation()) return specificTopology().localPosition(mp);
00025   
00026   // add correction from SurfaceDeformation
00027   const LocalPoint posOld(specificTopology().localPosition(mp)); // 'original position'
00028   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(trkPred));
00029   
00030   return LocalPoint(posOld.x()+corr.x(), posOld.y()+corr.y(), posOld.z());
00031 }
00032 
00034 LocalError ProxyPixelTopology::localError( const MeasurementPoint& mp,
00035                                            const MeasurementError& me ) const
00036 {
00037   return specificTopology().localError(mp, me);
00038 }
00039 
00041 LocalError ProxyPixelTopology::localError( const MeasurementPoint& mp,
00042                                            const MeasurementError& me, 
00043                                            const Topology::LocalTrackPred &trkPred ) const
00044 {
00045   // The topology knows to calculate the cartesian error from measurement frame.
00046   // But assuming no uncertainty on the SurfaceDeformation variables,
00047   // the errors do not change from a simple shift to compensate
00048   // that the track 'sees' the surface at another place than it thinks...
00049   return specificTopology().localError(mp, me);
00050 }
00051 
00053 MeasurementPoint ProxyPixelTopology::measurementPosition( const LocalPoint& lp ) const
00054 {
00055   return specificTopology().measurementPosition(lp);
00056 }
00057 
00059 MeasurementPoint ProxyPixelTopology::measurementPosition( const LocalPoint& lp, 
00060                                                           const Topology::LocalTrackAngles &dir ) const
00061 {
00062   if (!this->surfaceDeformation()) return specificTopology().measurementPosition(lp);
00063 
00064   // subtract correction from SurfaceDeformation
00065   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
00066   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
00067 
00068   return specificTopology().measurementPosition(posOrig);
00069 }
00070 
00072 MeasurementError ProxyPixelTopology::measurementError( const LocalPoint &lp, const LocalError &le ) const
00073 {
00074   return specificTopology().measurementError(lp, le);
00075 }
00076 
00078 MeasurementError ProxyPixelTopology::measurementError( const LocalPoint &lp, const LocalError &le,
00079                                                        const Topology::LocalTrackAngles &dir ) const
00080 {
00081   if (!this->surfaceDeformation()) return specificTopology().measurementError(lp, le);
00082 
00083   // subtract correction from SurfaceDeformation
00084   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
00085   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
00086 
00087   return specificTopology().measurementError(posOrig, le);
00088 }
00089 
00091 int ProxyPixelTopology::channel( const LocalPoint& lp) const
00092 {
00093   return specificTopology().channel(lp);
00094 }
00095 
00097 int ProxyPixelTopology::channel( const LocalPoint &lp, const Topology::LocalTrackAngles &dir) const
00098 {
00099    if (!this->surfaceDeformation()) return specificTopology().channel(lp);
00100 
00101   // subtract correction from SurfaceDeformation
00102   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
00103   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
00104     
00105   return specificTopology().channel(posOrig);
00106 }
00107 
00109 std::pair<float,float> ProxyPixelTopology::pixel( const LocalPoint& lp ) const
00110 {
00111   return specificTopology().pixel(lp);
00112 }
00113 
00115 std::pair<float,float> ProxyPixelTopology::pixel( const LocalPoint& lp,
00116                                                   const Topology::LocalTrackAngles &dir ) const
00117 {
00118   if (!this->surfaceDeformation()) return specificTopology().pixel(lp);
00119 
00120   // subtract correction from SurfaceDeformation
00121   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
00122   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
00123   
00124   return specificTopology().pixel(posOrig);
00125 }
00126 
00128 float ProxyPixelTopology::localX(const float mpX) const
00129 {
00130   return specificTopology().localX(mpX);
00131 }
00132 
00134 float ProxyPixelTopology::localX(const float mpX,
00135                                  const Topology::LocalTrackPred &trkPred) const
00136 {
00137   if (!this->surfaceDeformation()) return specificTopology().localX(mpX);
00138   
00139   // add correction from SurfaceDeformation
00140   float xOld = specificTopology().localX(mpX); // 'original position'
00141   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(trkPred));
00142   
00143   return xOld + corr.x();
00144 }
00145 
00147 float ProxyPixelTopology::localY(const float mpY) const
00148 {
00149   return specificTopology().localY(mpY);
00150 }
00151 
00153 float ProxyPixelTopology::localY(const float mpY,
00154                                  const Topology::LocalTrackPred &trkPred) const
00155 {
00156   if (!this->surfaceDeformation()) return specificTopology().localY(mpY);
00157 
00158   // add correction from SurfaceDeformation
00159   float yOld = specificTopology().localY(mpY); // 'original position'
00160   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(trkPred));
00161   
00162   return yOld + corr.y();
00163 }
00164 
00166 std::pair<float,float> ProxyPixelTopology::pitch() const { return specificTopology().pitch(); }
00167 
00169 int ProxyPixelTopology::nrows() const { return specificTopology().nrows(); }
00170 
00172 int ProxyPixelTopology::ncolumns() const { return specificTopology().ncolumns(); }
00173 
00175 const GeomDetType& ProxyPixelTopology::type() const { return *theType; }
00176 
00178 PixelGeomDetType& ProxyPixelTopology::specificType() const { return *theType; }
00179 
00181 const PixelTopology& ProxyPixelTopology::specificTopology() const
00182 { 
00183   return specificType().specificTopology();
00184 }
00185 
00187 void ProxyPixelTopology::setSurfaceDeformation(const SurfaceDeformation * deformation)
00188 { 
00189   theSurfaceDeformation = deformation;
00190 }
00191 
00193 SurfaceDeformation::Local2DVector
00194 ProxyPixelTopology::positionCorrection(const LocalPoint &pos,
00195                                        const Topology::LocalTrackAngles &dir) const
00196 {
00197   const SurfaceDeformation::Local2DPoint pos2D(pos.x(), pos.y());// change precision and dimension
00198 
00199   return this->surfaceDeformation()->positionCorrection(pos2D, dir,
00200                                                         theLength, theWidth);
00201 }
00202 
00204 SurfaceDeformation::Local2DVector
00205 ProxyPixelTopology::positionCorrection(const Topology::LocalTrackPred &trk) const
00206 {
00207   return this->surfaceDeformation()->positionCorrection(trk.point(), trk.angles(),
00208                                                         theLength, theWidth);
00209 }