Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-22 04:03:18

0001 #ifndef RecoLocalTracker_SiPixelRecHits_PixelCPEClusterRepair_H
0002 #define RecoLocalTracker_SiPixelRecHits_PixelCPEClusterRepair_H
0003 
0004 #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEBase.h"
0005 
0006 // Already in the base class

0007 //#include "Geometry/CommonDetUnit/interface/GeomDetType.h"

0008 //#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h"

0009 //#include "Geometry/CommonDetAlgo/interface/MeasurementPoint.h"

0010 //#include "Geometry/CommonDetAlgo/interface/MeasurementError.h"

0011 //#include "Geometry/Surface/interface/GloballyPositioned.h"

0012 //#include "FWCore/ParameterSet/interface/ParameterSet.h"

0013 
0014 // The template header files

0015 //

0016 #include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco.h"
0017 #include "RecoLocalTracker/SiPixelRecHits/interface/SiPixelTemplateReco2D.h"
0018 #include "CondFormats/SiPixelTransient/interface/SiPixelTemplate.h"
0019 #include "CondFormats/SiPixelTransient/interface/SiPixelTemplate2D.h"
0020 #include "CondFormats/SiPixelObjects/interface/SiPixel2DTemplateDBObject.h"
0021 
0022 #include <utility>
0023 #include <vector>
0024 
0025 #if 0
0026 /** \class PixelCPEClusterRepair

0027  * Perform the position and error evaluation of pixel hits using

0028  * the Det angle to estimate the track impact angle

0029  */
0030 #endif
0031 
0032 class MagneticField;
0033 class PixelCPEClusterRepair : public PixelCPEBase {
0034 public:
0035   struct ClusterParamTemplate : ClusterParam {
0036     ClusterParamTemplate(const SiPixelCluster &cl) : ClusterParam(cl) {}
0037     // The result of PixelTemplateReco2D

0038     float templXrec_;
0039     float templYrec_;
0040     float templSigmaX_;
0041     float templSigmaY_;
0042     // Add new information produced by SiPixelTemplateReco::PixelTempReco2D &&&

0043     // These can only be accessed if we change silicon pixel data formats and add them to the rechit

0044     int ierr;
0045 
0046     // 2D fit stuff.

0047     float templProbXY_;
0048     bool recommended2D_;
0049     int ierr2;
0050   };
0051 
0052   // PixelCPEClusterRepair( const DetUnit& det );

0053   PixelCPEClusterRepair(edm::ParameterSet const &conf,
0054                         const MagneticField *,
0055                         const TrackerGeometry &,
0056                         const TrackerTopology &,
0057                         const SiPixelLorentzAngle *,
0058                         const std::vector<SiPixelTemplateStore> *,
0059                         const SiPixelTemplateDBObject *,
0060                         const SiPixel2DTemplateDBObject *);
0061 
0062   ~PixelCPEClusterRepair() override;
0063 
0064   static void fillPSetDescription(edm::ParameterSetDescription &desc);
0065 
0066 private:
0067   std::unique_ptr<ClusterParam> createClusterParam(const SiPixelCluster &cl) const override;
0068 
0069   // Calculate local position.  (Calls TemplateReco)

0070   LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const override;
0071   // Calculate local error. Note: it MUST be called AFTER localPosition() !!!

0072   LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const override;
0073 
0074   // Helper functions:

0075 
0076   // Call vanilla template reco, then clean-up

0077   void callTempReco1D(DetParam const &theDetParam,
0078                       ClusterParamTemplate &theClusterParam,
0079                       SiPixelTemplateReco::ClusMatrix &clusterPayload,
0080                       int ID,
0081                       LocalPoint &lp) const;
0082 
0083   // Call 2D template reco, then clean-up

0084   void callTempReco2D(DetParam const &theDetParam,
0085                       ClusterParamTemplate &theClusterParam,
0086                       SiPixelTemplateReco2D::ClusMatrix &clusterPayload,
0087                       int ID,
0088                       LocalPoint &lp) const;
0089 
0090   //Helper function to see if 2D reco should be run

0091   void checkRecommend2D(DetParam const &theDetParam,
0092                         ClusterParamTemplate &theClusterParam,
0093                         SiPixelTemplateReco::ClusMatrix &clusterPayload,
0094                         int ID) const;
0095 
0096   //Fill IDs for 2D template

0097   void fill2DTemplIDs();
0098 
0099   // Template storage

0100   std::vector<SiPixelTemplateStore> const *thePixelTemp_;
0101   std::vector<SiPixelTemplateStore> thePixelTempCache_;
0102   std::vector<SiPixelTemplateStore2D> thePixelTemp2D_;
0103 
0104   int speed_;
0105 
0106   bool UseClusterSplitter_;
0107 
0108   // Template file management (when not getting the templates from the DB)

0109   int barrelTemplateID_;
0110   int forwardTemplateID_;
0111   std::string templateDir_;
0112 
0113   const SiPixel2DTemplateDBObject *templateDBobject2D_;
0114 
0115   // Configure 2D reco.

0116   float minChargeRatio_;
0117   float maxSizeMismatchInY_;
0118 
0119   //bool DoCosmics_;

0120   //bool LoadTemplatesFromDB_;

0121 
0122   // read sub-detectors to recommend 2D

0123   class Rule {
0124   public:
0125     // parse a rule from a string

0126     Rule(const std::string &str);
0127     // check this DetId to recommend 2D or not (default false)

0128     bool recommend(DetId detid, const TrackerTopology &tTopo) const {
0129       // check detector

0130       if (detid.subdetId() == subdet_) {
0131         // check layer

0132         if ((layer_ == 0) || (layer_ == int(tTopo.layer(detid)))) {
0133           return true;
0134         } else
0135           return false;
0136       } else
0137         return false;
0138     }
0139 
0140   private:
0141     int subdet_;
0142     int layer_;
0143   };
0144   std::vector<Rule> recommend2D_;
0145 
0146   // run on damaged hits or not

0147   bool runDamagedClusters_;
0148 };
0149 
0150 #endif