Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-18 09:15:16

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 protected:
0084   //---------------------------------------------------------------------------
0085   //  Data members
0086   //---------------------------------------------------------------------------
0087 
0088   //--- Global quantities
0089   const MTDGeometry& geom_;  // geometry
0090 
0091 protected:
0092   //---------------------------------------------------------------------------
0093   //  Cluster-level services.
0094   //---------------------------------------------------------------------------
0095 
0096   DetParam const& detParam(const GeomDetUnit& det) const;
0097 
0098   using DetParams = std::vector<DetParam>;
0099   DetParams m_DetParams;
0100 };
0101 
0102 #endif