Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:51

0001 #ifndef Geometry_CommonTopologies_Topology_H
0002 #define Geometry_CommonTopologies_Topology_H
0003 
0004 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0005 #include "DataFormats/GeometrySurface/interface/LocalError.h"
0006 #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h"
0007 #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h"
0008 #include "DataFormats/Math/interface/AlgebraicROOTObjects.h"
0009 
0010 class GeomDetType;
0011 
0012 /** Abstract component defining the conversion between the local frame of
0013  *  a detector and the frame defined by the readout channels ,
0014  *  the so called measurement frame. For example, in a strip detector
0015  *  the strips define a coordinate frame (from 0 to Nstrips in one direction
0016  *  and from 0 to 1 in the other), and each local point can be mapped to a point 
0017  *  in this frame. The mapping may be non-linear (for example for trapezoidal 
0018  *  strips). 
0019  *
0020  *  The topology should be the ONLY place where this mapping is defined.
0021  *  The Digitizer uses the Topology to transform energy deposits in the 
0022  *  local frame into signals on the readout channels, and the clusterizer
0023  *  (or the RecHit) uses the Topology for the inverse transformation,
0024  *  from channel numbers to local coordinates.
0025  *
0026  *  If the surface of a Topology deviates from its perfect shape,
0027  *  e.g. a bowed instead of a flat surface (bowed silicon sensors)
0028  *  or if built from two surfaces that might be misaligned with respect
0029  *  to each other (double sensor silicon modules), conversion might depend 
0030  *  on a track prediction.
0031  *  Conversions from local to measurement frame therefore need the
0032  *  'LocalTrackAngles', conversions the other way round need also track
0033  *   position predictions, bound together with the angles to a 'LocalTrackPred'.
0034  *  Default implementation of methods requiring more arguments is to
0035  *  call the simple method, ignoring the track state.
0036  *  Concrete implementations should overwrite this where appropiate.
0037  */
0038 
0039 class Topology {
0040 public:
0041   typedef Basic2DVector<double> Vector2D;
0042   typedef Vector2D::MathVector MathVector2D;
0043   /** Track angles in the local frame, needed to handle surface deformations */
0044   class LocalTrackAngles : public Vector2D {
0045   public:
0046     typedef Basic2DVector<double> Base;
0047     LocalTrackAngles() {}
0048     LocalTrackAngles(const Base &v) : Base(v) {}
0049     LocalTrackAngles(double dxdz, double dydz) : Base(dxdz, dydz) {}
0050     double dxdz() const { return x(); }
0051     double dydz() const { return y(); }
0052   };
0053   typedef Point2DBase<double, LocalTag> Local2DPoint;
0054   /** Track prediction in local frame (2D point and angles), 
0055     needed to handle surface deformations*/
0056   class LocalTrackPred {
0057   public:
0058     LocalTrackPred() {}
0059     LocalTrackPred(double x, double y, double dxdz, double dydz) : point_(x, y), angles_(dxdz, dydz) {}
0060     /// Ctr. from local trajectory parameters as AlgebraicVector5 (q/p, dxdz, dydz, x, y)
0061     /// e.g. from 'LocalTrajectoryParameters::vector()'
0062     LocalTrackPred(const AlgebraicVector5 &localTrajPar)
0063         : point_(localTrajPar[3], localTrajPar[4]), angles_(localTrajPar[1], localTrajPar[2]) {}
0064     const Local2DPoint &point() const { return point_; }
0065     const LocalTrackAngles &angles() const { return angles_; }
0066 
0067   private:
0068     Local2DPoint point_;       /// local x, y
0069     LocalTrackAngles angles_;  /// local dxdz, dydz
0070   };
0071 
0072   virtual ~Topology() {}
0073 
0074   // Conversion between measurement (strip, pixel, ...) coordinates
0075   // and local cartesian coordinates
0076 
0077   virtual LocalPoint localPosition(const MeasurementPoint &) const = 0;
0078 
0079   virtual LocalError localError(const MeasurementPoint &, const MeasurementError &) const = 0;
0080 
0081   virtual MeasurementPoint measurementPosition(const LocalPoint &) const = 0;
0082 
0083   virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const = 0;
0084 
0085   virtual int channel(const LocalPoint &p) const = 0;
0086 
0087   // new sets of methods taking also an angle
0088   /// conversion taking also the angle from the predicted track state
0089   virtual LocalPoint localPosition(const MeasurementPoint &mp, const LocalTrackPred & /*trkPred*/) const {
0090     return localPosition(mp);
0091   }
0092 
0093   /// conversion taking also the angle from the predicted track state
0094   virtual LocalError localError(const MeasurementPoint &mp,
0095                                 const MeasurementError &me,
0096                                 const LocalTrackPred & /*trkPred*/) const {
0097     return localError(mp, me);
0098   }
0099 
0100   /// conversion taking also the angle from the track state
0101   virtual MeasurementPoint measurementPosition(const LocalPoint &lp, const LocalTrackAngles & /*dir*/) const {
0102     return measurementPosition(lp);
0103   }
0104 
0105   /// conversion taking also the angle from the track state
0106   virtual MeasurementError measurementError(const LocalPoint &lp,
0107                                             const LocalError &le,
0108                                             const LocalTrackAngles & /*dir*/) const {
0109     return measurementError(lp, le);
0110   }
0111 
0112   /// conversion taking also the angle from the track state
0113   virtual int channel(const LocalPoint &lp, const LocalTrackAngles & /*dir*/) const { return channel(lp); }
0114 
0115 private:
0116 };
0117 
0118 #endif