Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:26:22

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/TrackerGeometryBuilder/interface/RectangularPixelTopology.h"

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

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

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

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

0014 
0015 // The template header files

0016 //

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

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

0029  * the Det angle to estimate the track impact angle

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

0121   //bool LoadTemplatesFromDB_;

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

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

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

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

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

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

0148   bool runDamagedClusters_;
0149 };
0150 
0151 #endif