Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:31

0001 #ifndef Tracker_MeasurementEstimator_H
0002 #define Tracker_MeasurementEstimator_H
0003 
0004 #include "DataFormats/GeometryVector/interface/Vector2DBase.h"
0005 #include "DataFormats/GeometryVector/interface/LocalTag.h"
0006 #include <limits>
0007 
0008 class Plane;
0009 class TrajectoryStateOnSurface;
0010 class Surface;
0011 class TrackingRecHit;
0012 
0013 /** The MeasurementEstimator defines the compatibility of a 
0014  *  TrajectoryStateOnSurface and a RecHit, and of a 
0015  *  TrajectoryStateOnSurface and a Plane.
0016  *  It is used in the Det interface to obtain compatible measurements.
0017  */
0018 
0019 class MeasurementEstimator {
0020 public:
0021   struct OpaquePayload {
0022     virtual ~OpaquePayload() {}
0023     int tag = 0;
0024   };
0025 
0026   using Local2DVector = Vector2DBase<float, LocalTag>;
0027 
0028   MeasurementEstimator() {}
0029   MeasurementEstimator(float maxSag, float minToll, float mpt)
0030       : m_maxSagitta(maxSag), m_minTolerance2(minToll * minToll), m_minPt2ForHitRecoveryInGluedDet(mpt * mpt) {}
0031 
0032   virtual ~MeasurementEstimator() {}
0033 
0034   using HitReturnType = std::pair<bool, double>;
0035   using SurfaceReturnType = bool;
0036 
0037   /** Returns pair( true, value) if the TrajectoryStateOnSurface is compatible
0038    *  with the RecHit, and pair( false, value) if it is not compatible.
0039    *  The TrajectoryStateOnSurface must be on the same Surface as the RecHit. 
0040    *  For an estimator where there is no value computed, e.g. fixed
0041    *  window estimator, only the first(bool) part is of interest.
0042    */
0043   virtual HitReturnType estimate(const TrajectoryStateOnSurface& ts, const TrackingRecHit& hit) const = 0;
0044 
0045   /* verify the compatibility of the Hit with the Trajectory based
0046    * on hit properties other than those used in estimate 
0047    * (that usually computes the compatibility of the Trajectory with the Hit)
0048    * 
0049    */
0050   virtual bool preFilter(const TrajectoryStateOnSurface&, OpaquePayload const&) const { return true; }
0051 
0052   /** Returns true if the TrajectoryStateOnSurface is compatible with the
0053    *  Plane, false otherwise.
0054    *  The TrajectoryStateOnSurface must be on the plane.
0055    */
0056   virtual SurfaceReturnType estimate(const TrajectoryStateOnSurface& ts, const Plane& plane) const = 0;
0057 
0058   virtual MeasurementEstimator* clone() const = 0;
0059 
0060   /** Returns the size of the compatibility region around the local position of the 
0061    *  TrajectoryStateOnSurface along the directions of local x and y axis.
0062    *  The TrajectoryStateOnSurface must be on the plane.
0063    *  This method allows to limit the search for compatible detectors or RecHits.
0064    *  The MeasurementEstimator should not return "true" for any RecHit or
0065    *  Plane which is entirely outside of the compatibility region defined 
0066    *  by maximalLocalDisplacement().
0067    */
0068   virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface& ts, const Plane& plane) const = 0;
0069 
0070   float maxSagitta() const { return m_maxSagitta; }
0071   float minTolerance2() const { return m_minTolerance2; }
0072   float minPt2ForHitRecoveryInGluedDet() const { return m_minPt2ForHitRecoveryInGluedDet; }
0073 
0074 private:
0075   /*
0076    *  why here? 
0077    * MeasurementEstimator is the only configurable item that percolates down to geometry event by event (actually hit by hit) and not at initialization time
0078    * It is therefore the natural candidate to collect all parameters that affect pattern-recongnition 
0079    * and require to be controlled with higher granularity than job level (such as iteration by iteration)
0080    */
0081   float m_maxSagitta = -1.;      // maximal sagitta for linear approximation
0082   float m_minTolerance2 = 100.;  // square of minimum tolerance ot be considered inside a detector
0083   float m_minPt2ForHitRecoveryInGluedDet = std::numeric_limits<float>::max();  // 0.81 to mitigate wrong preAmpl setting
0084 };
0085 
0086 #endif  // Tracker_MeasurementEstimator_H