Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:20

0001 #ifndef DataFormats_SiPixelRecHit_h
0002 #define DataFormats_SiPixelRecHit_h 1
0003 
0004 //---------------------------------------------------------------------------
0005 //!  \class SiPixelRecHit
0006 //!  \brief Pixel Reconstructed Hit
0007 //!
0008 //!  A pixel hit is a 2D position and error in a given
0009 //!  pixel sensor. It contains a persistent reference edm::Ref to the
0010 //!  pixel cluster.
0011 //!
0012 //!  \author porting from ORCA: Petar Maksimovic (JHU),
0013 //!          DetSetVector and persistent references: V.Chiochia (Uni Zurich)
0014 //---------------------------------------------------------------------------
0015 
0016 //! Our base class
0017 #include "DataFormats/TrackerRecHit2D/interface/TrackerSingleRecHit.h"
0018 //! Quality word packing
0019 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitQuality.h"
0020 
0021 #include "TkCloner.h"
0022 
0023 class SiPixelRecHit final : public TrackerSingleRecHit {
0024 public:
0025   typedef edm::Ref<edmNew::DetSetVector<SiPixelCluster>, SiPixelCluster> ClusterRef;
0026 
0027   SiPixelRecHit() {}
0028 
0029   ~SiPixelRecHit() override {}
0030 
0031   SiPixelRecHit(const LocalPoint& pos,
0032                 const LocalError& err,
0033                 SiPixelRecHitQuality::QualWordType qual,
0034                 GeomDet const& idet,
0035                 ClusterRef const& clus)
0036       : TrackerSingleRecHit(pos, err, idet, clus) {
0037     qualWord_ = qual;
0038   }
0039 
0040   bool isPixel() const override { return true; }
0041 
0042   SiPixelRecHit* clone() const override { return new SiPixelRecHit(*this); }
0043 #ifndef __GCCXML__
0044   RecHitPointer cloneSH() const override { return std::make_shared<SiPixelRecHit>(*this); }
0045 #endif
0046 
0047   ClusterRef cluster() const { return cluster_pixel(); }
0048 
0049   void setClusterRef(ClusterRef const& ref) { setClusterPixelRef(ref); }
0050 
0051   int dimension() const override { return 2; }
0052   void getKfComponents(KfComponentsHolder& holder) const override { getKfComponents2D(holder); }
0053 
0054   bool canImproveWithTrack() const override { return true; }
0055 
0056 private:
0057   // double dispatch
0058   SiPixelRecHit* clone_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
0059     return cloner(*this, tsos).release();
0060   }
0061 #ifndef __GCCXML__
0062   RecHitPointer cloneSH_(TkCloner const& cloner, TrajectoryStateOnSurface const& tsos) const override {
0063     return cloner.makeShared(*this, tsos);
0064   }
0065 #endif
0066 
0067 public:
0068   //--- The overall probability.  flags is the 32-bit-packed set of flags that
0069   //--- our own concrete implementation of clusterProbability() uses to direct
0070   //--- the computation based on the information stored in the quality word
0071   //--- (and which was computed by the CPE).  The default of flags==0 returns
0072   //--- probabilityY() only (as that's the safest thing to do).
0073   //--- Flags are static and kept in the transient rec hit.
0074   using BaseTrackerRecHit::clusterProbability;
0075   float clusterProbability(unsigned int flags = 0) const;
0076 
0077   //--- Allow direct access to the packed quality information.
0078   inline SiPixelRecHitQuality::QualWordType rawQualityWord() const { return qualWord_; }
0079 
0080   //--- Template fit probability, in X and Y directions
0081   //--- These are obsolete and will be taken care of in the quality code
0082   inline float probabilityX() const { return SiPixelRecHitQuality::thePacking.probabilityX(qualWord_); }
0083   inline float probabilityY() const { return SiPixelRecHitQuality::thePacking.probabilityY(qualWord_); }
0084 
0085   //--- Template fit probability, in X and Y direction combined and in charge
0086   inline float probabilityXY() const { return SiPixelRecHitQuality::thePacking.probabilityXY(qualWord_); }
0087   inline float probabilityQ() const { return SiPixelRecHitQuality::thePacking.probabilityQ(qualWord_); }
0088 
0089   //--- Charge `bin' (values 0, 1, 2, 3) according to Morris's template
0090   //--- code. qBin==4 is unphysical, qBin=5,6,7 are yet unused)
0091   //
0092   inline int qBin() const { return SiPixelRecHitQuality::thePacking.qBin(qualWord_); }
0093 
0094   //--- Quality flags (true or false):
0095 
0096   //--- The cluster is on the edge of the module, or straddles a dead ROC
0097   inline bool isOnEdge() const { return SiPixelRecHitQuality::thePacking.isOnEdge(qualWord_); }
0098   //--- The cluster contains bad pixels, or straddles bad column or two-column
0099   inline bool hasBadPixels() const { return SiPixelRecHitQuality::thePacking.hasBadPixels(qualWord_); }
0100   //--- The cluster spans two ROCS (and thus contains big pixels)
0101   inline bool spansTwoROCs() const { return SiPixelRecHitQuality::thePacking.spansTwoROCs(qualWord_); }
0102 
0103   //--- Quality flag for whether the probability is filled
0104   inline bool hasFilledProb() const { return SiPixelRecHitQuality::thePacking.hasFilledProb(qualWord_); }
0105 };
0106 
0107 #endif