CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Geometry/TrackerGeometryBuilder/src/ProxyStripTopology.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/ProxyStripTopology.h"
00005 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetType.h"
00006 
00008 ProxyStripTopology::ProxyStripTopology(StripGeomDetType* type, BoundPlane * bp)
00009   :theType(type), theLength(bp->bounds().length()), theWidth(bp->bounds().width())
00010 {
00011 }
00012 
00014 LocalPoint ProxyStripTopology::localPosition( const MeasurementPoint& mp ) const
00015 {
00016   return specificTopology().localPosition(mp);
00017 
00018 // FIXME: Better this way? Well, but posOrig will not contain useful y!
00019 //   if (!this->surfaceDeformation()) return specificTopology().localPosition(mp);
00020 //
00021 //   // correct with position information from input and zero track angles 
00022 //   const LocalPoint posOrig(specificTopology().localPosition(mp));
00023 //   return this->localPosition(mp, Topology::LocalTrackPred(posOrig.x(), posOrig.y(), 0., 0.));
00024 }
00025 
00027 LocalPoint ProxyStripTopology::localPosition( const MeasurementPoint& mp, 
00028                                               const Topology::LocalTrackPred &trkPred ) const
00029 {
00030   if (!this->surfaceDeformation()) return specificTopology().localPosition(mp);
00031   
00032   // add correction from SurfaceDeformation
00033   const LocalPoint posOld(specificTopology().localPosition(mp)); // 'original position'
00034   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(trkPred));
00035 
00036   return LocalPoint(posOld.x()+corr.x(), posOld.y()+corr.y(), posOld.z());
00037 }
00038 
00040 LocalPoint ProxyStripTopology::localPosition( float strip ) const
00041 {
00042   return specificTopology().localPosition(strip);
00043 
00044 // FIXME: Better this way? Well, but posOrig will not contain useful y!
00045 //   if (!this->surfaceDeformation()) return specificTopology().localPosition(strip);
00046 
00047 //   // correct with position information from input and zero track angles 
00048 //   const LocalPoint posOrig(specificTopology().localPosition(strip));
00049 //   return this->localPosition(mp, Topology::LocalTrackPred(posOrig.x(), posOrig.y(), 0., 0.));
00050 }
00051 
00053 LocalPoint ProxyStripTopology::localPosition(float strip, const Topology::LocalTrackPred &trkPred) const
00054 {
00055   if (!this->surfaceDeformation()) return specificTopology().localPosition(strip);
00056   
00057   // add correction from SurfaceDeformation
00058   const LocalPoint posOld(specificTopology().localPosition(strip));
00059 
00060   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(trkPred));
00061   return LocalPoint(posOld.x()+corr.x(), posOld.y()+corr.y(), posOld.z());
00062 }
00063 
00065 LocalError ProxyStripTopology::localError( float strip, float stripErr2 ) const
00066 {
00067   return specificTopology().localError(strip, stripErr2);
00068 }
00069 
00071 LocalError ProxyStripTopology::localError(float strip, float stripErr2,
00072                                           const Topology::LocalTrackPred &trkPred) const
00073 {
00074   // 'strip' is from measurement frame and the topology knows to
00075   // calculate the cartesian error.
00076   // But assuming no uncertainty on the SurfaceDeformation variables,
00077   // the errors do not change from a simple shift to compensate
00078   // that the track 'sees' the surface at another place than it thinks...
00079   
00080   // In case of TwoBowedSurfacesDeformation one could add corrections here due to 
00081   // relative rotations of the sensors...
00082   return specificTopology().localError(strip, stripErr2);
00083 }
00084 
00086 LocalError ProxyStripTopology::localError( const MeasurementPoint& mp,
00087                                            const MeasurementError& me) const
00088 {
00089   return specificTopology().localError(mp, me);
00090 }
00091 
00093 LocalError ProxyStripTopology::localError( const MeasurementPoint& mp,
00094                                            const MeasurementError& me, 
00095                                            const Topology::LocalTrackPred &trkPred) const
00096 {
00097   // See comment in localError(float strip, float stripErr2,
00098   //                           const Topology::LocalTrackPred &trkPred)!
00099   return specificTopology().localError(mp, me);
00100 }
00101 
00103 MeasurementPoint ProxyStripTopology::measurementPosition( const LocalPoint& lp) const
00104 {
00105   return specificTopology().measurementPosition(lp);
00106 }
00107 
00109 MeasurementPoint ProxyStripTopology::measurementPosition( const LocalPoint& lp, 
00110                                                           const Topology::LocalTrackAngles &dir) const
00111 {
00112   if (!this->surfaceDeformation()) return specificTopology().measurementPosition(lp);
00113 
00114   // subtract correction from SurfaceDeformation
00115   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
00116   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
00117 
00118   return specificTopology().measurementPosition(posOrig);
00119 }
00120 
00122 MeasurementError ProxyStripTopology::measurementError( const LocalPoint& lp, const LocalError& le ) const
00123 {
00124   return specificTopology().measurementError(lp, le);
00125 }
00126 
00128 MeasurementError ProxyStripTopology::measurementError( const LocalPoint &lp, const LocalError &le,
00129                                                        const Topology::LocalTrackAngles &dir) const
00130 {
00131   if (!this->surfaceDeformation()) return specificTopology().measurementError(lp, le);
00132 
00133   // assuming 'lp' comes from a track prediction
00134   // (i.e. where the track thinks it hits the surface)
00135   // we need to subtract correction from SurfaceDeformation
00136   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
00137   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
00138 
00139   return specificTopology().measurementError(posOrig, le);
00140 }
00141 
00143 int ProxyStripTopology::channel( const LocalPoint& lp) const
00144 {
00145   return specificTopology().channel(lp);
00146 }
00147 
00149 int ProxyStripTopology::channel( const LocalPoint &lp, const Topology::LocalTrackAngles &dir) const
00150 {
00151    if (!this->surfaceDeformation()) return specificTopology().channel(lp);
00152 
00153   // subtract correction from SurfaceDeformation
00154   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
00155   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
00156     
00157   return specificTopology().channel(posOrig);
00158 }
00159 
00161 float ProxyStripTopology::strip(const LocalPoint& lp) const
00162 {
00163   return specificTopology().strip(lp);
00164 }
00165 
00167 float ProxyStripTopology::strip( const LocalPoint& lp, const Topology::LocalTrackAngles &dir ) const
00168 {
00169   if (!this->surfaceDeformation()) return specificTopology().strip(lp);
00170 
00171   // subtract correction from SurfaceDeformation
00172   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
00173   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
00174 
00175   return specificTopology().strip(posOrig);
00176 }
00177 
00178 float ProxyStripTopology::pitch() const
00179 {
00180   return specificTopology().pitch();
00181 }
00182 
00184 float ProxyStripTopology::localPitch( const LocalPoint& lp) const
00185 {
00186   return specificTopology().localPitch(lp);
00187 }
00188 
00190 float ProxyStripTopology::localPitch( const LocalPoint& lp, const Topology::LocalTrackAngles &dir ) const
00191 {
00192   if (!this->surfaceDeformation()) return specificTopology().localPitch(lp);
00193 
00194   // subtract correction from SurfaceDeformation
00195   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
00196   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
00197 
00198   return specificTopology().localPitch(posOrig);
00199 }
00200 
00202 float ProxyStripTopology::stripAngle( float strip ) const
00203 {
00204   return specificTopology().stripAngle(strip);
00205 }
00206 
00208 int ProxyStripTopology::nstrips() const
00209 {
00210   return specificTopology().nstrips();
00211 }
00212 
00214 float ProxyStripTopology::stripLength() const
00215 {
00216   return specificTopology().stripLength();
00217 }
00218 
00220 float ProxyStripTopology::localStripLength(const LocalPoint& lp) const
00221 {
00222   return specificTopology().localStripLength(lp);
00223 }
00224 
00226 float ProxyStripTopology::localStripLength( const LocalPoint& lp, const Topology::LocalTrackAngles &dir ) const
00227 {
00228   if (!this->surfaceDeformation()) return specificTopology().localStripLength(lp);
00229 
00230   // subtract correction from SurfaceDeformation
00231   const SurfaceDeformation::Local2DVector corr(this->positionCorrection(lp, dir));
00232   const LocalPoint posOrig(lp.x() - corr.x(), lp.y() - corr.y(), lp.z());
00233 
00234   return specificTopology().localStripLength(posOrig);
00235 }
00236 
00238 const GeomDetType& ProxyStripTopology::type() const { return *theType;}
00239 
00241 StripGeomDetType& ProxyStripTopology::specificType() const { return *theType;}
00242 
00244 const StripTopology& ProxyStripTopology::specificTopology() const
00245 { 
00246   return specificType().specificTopology();
00247 }
00248 
00250 void ProxyStripTopology::setSurfaceDeformation(const SurfaceDeformation * deformation)
00251 { 
00252   theSurfaceDeformation = deformation;
00253 }
00254 
00256 SurfaceDeformation::Local2DVector
00257 ProxyStripTopology::positionCorrection(const LocalPoint &pos,
00258                                        const Topology::LocalTrackAngles &dir) const
00259 {
00260   const SurfaceDeformation::Local2DPoint pos2D(pos.x(), pos.y());// change precision and dimension
00261 
00262   return this->surfaceDeformation()->positionCorrection(pos2D, dir,
00263                                                         theLength, theWidth);
00264 }
00265 
00267 SurfaceDeformation::Local2DVector
00268 ProxyStripTopology::positionCorrection(const Topology::LocalTrackPred &trk) const
00269 {
00270   return this->surfaceDeformation()->positionCorrection(trk.point(), trk.angles(),
00271                                                         theLength, theWidth);
00272 }