Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:25:56

0001 #ifndef RecoLocalFastTime_FTLClusterizer_MTDCPEBase_H
0002 #define RecoLocalFastTime_FTLClusterizer_MTDCPEBase_H 1
0003 
0004 //-----------------------------------------------------------------------------
0005 // \class        MTDCPEBase
0006 //-----------------------------------------------------------------------------
0007 
0008 #include <utility>
0009 #include <memory>
0010 #include <vector>
0011 #include "TMath.h"
0012 
0013 #include "MTDClusterParameterEstimator.h"
0014 
0015 #include "Geometry/MTDGeometryBuilder/interface/MTDGeometry.h"
0016 #include "Geometry/MTDGeometryBuilder/interface/MTDGeomDetUnit.h"
0017 #include "Geometry/MTDGeometryBuilder/interface/ProxyMTDTopology.h"
0018 #include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h"
0019 #include "Geometry/CommonDetUnit/interface/GeomDetType.h"
0020 
0021 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0022 
0023 #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementPoint.h"
0024 #include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h"
0025 #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h"
0026 
0027 #include <unordered_map>
0028 
0029 #include <iostream>
0030 
0031 class MTDCPEBase : public MTDClusterParameterEstimator {
0032 public:
0033   struct DetParam {
0034     DetParam() {}
0035     const MTDGeomDetUnit* theDet;
0036     const ProxyMTDTopology* theTopol;
0037     const RectangularMTDTopology* theRecTopol;
0038 
0039     GeomDetType::SubDetector thePart;
0040     Local3DPoint theOrigin;
0041     float theThickness;
0042     float thePitchX;
0043     float thePitchY;
0044   };
0045 
0046   struct ClusterParam {
0047     ClusterParam(const FTLCluster& cl) : theCluster(&cl) {}
0048 
0049     virtual ~ClusterParam() = default;
0050 
0051     const FTLCluster* theCluster;
0052   };
0053 
0054 public:
0055   MTDCPEBase(edm::ParameterSet const& conf, const MTDGeometry& geom);
0056 
0057   inline ReturnType getParameters(const FTLCluster& cl, const GeomDetUnit& det) const override {
0058     DetParam const& dp = detParam(det);
0059     ClusterParam cp(cl);
0060     auto tuple =
0061         std::make_tuple(localPosition(dp, cp), localError(dp, cp), clusterTime(dp, cp), clusterTimeError(dp, cp));
0062     return tuple;
0063   }
0064 
0065   //--------------------------------------------------------------------------
0066   // In principle we could use the track too to get an angle if needed
0067   //--------------------------------------------------------------------------
0068   inline ReturnType getParameters(const FTLCluster& cl,
0069                                   const GeomDetUnit& det,
0070                                   const LocalTrajectoryParameters& ltp) const override {
0071     return getParameters(cl, det);
0072   }
0073 
0074 private:
0075   //--------------------------------------------------------------------------
0076   // This is where the action happens.
0077   //--------------------------------------------------------------------------
0078   virtual LocalPoint localPosition(DetParam const& dp, ClusterParam& cp) const;
0079   virtual LocalError localError(DetParam const& dp, ClusterParam& cp) const;
0080   virtual TimeValue clusterTime(DetParam const& dp, ClusterParam& cp) const;
0081   virtual TimeValueError clusterTimeError(DetParam const& dp, ClusterParam& cp) const;
0082 
0083   static constexpr float sigma_flat = 0.2886751f;  // 1.f / std::sqrt(12.f);
0084 
0085 protected:
0086   //---------------------------------------------------------------------------
0087   //  Data members
0088   //---------------------------------------------------------------------------
0089 
0090   //--- Global quantities
0091   const MTDGeometry& geom_;  // geometry
0092 
0093 protected:
0094   //---------------------------------------------------------------------------
0095   //  Cluster-level services.
0096   //---------------------------------------------------------------------------
0097 
0098   DetParam const& detParam(const GeomDetUnit& det) const;
0099 
0100   using DetParams = std::vector<DetParam>;
0101   DetParams m_DetParams;
0102 };
0103 
0104 #endif