CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h

Go to the documentation of this file.
00001 #ifndef DataFormats_SiPixelRecHit_h
00002 #define DataFormats_SiPixelRecHit_h 1
00003 
00004 //---------------------------------------------------------------------------
00014 //---------------------------------------------------------------------------
00015 
00017 #include "DataFormats/TrackerRecHit2D/interface/TrackerSingleRecHit.h"
00019 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitQuality.h"
00020 
00021 
00022 class SiPixelRecHit GCC11_FINAL : public TrackerSingleRecHit {
00023   
00024 public:
00025   
00026   typedef edm::Ref<edmNew::DetSetVector<SiPixelCluster>, SiPixelCluster > ClusterRef;
00027   
00028   SiPixelRecHit(): qualWord_(0) {}
00029   
00030   ~SiPixelRecHit() {}
00031   
00032   SiPixelRecHit( const LocalPoint& pos , const LocalError& err,
00033                  const DetId& id, 
00034                  ClusterRef const&  clus) : 
00035     TrackerSingleRecHit(pos,err,id,clus), 
00036     qualWord_(0) 
00037   {}
00038   
00039   virtual SiPixelRecHit * clone() const {return new SiPixelRecHit( * this); }
00040   
00041   ClusterRef cluster()  const { return cluster_pixel(); }
00042   void setClusterRef(ClusterRef const & ref)  {setClusterPixelRef(ref);}
00043   virtual int dimension() const {return 2;}
00044   virtual void getKfComponents( KfComponentsHolder & holder ) const { getKfComponents2D(holder); }
00045   
00046   
00047   //--------------------------------------------------------------------------
00048   //--- Accessors of other auxiliary quantities
00049   //--- Added Oct 07 by Petar for 18x.
00050 private:
00051   // *************************************************************************
00052   //
00053   SiPixelRecHitQuality::QualWordType  qualWord_ ;   // unsigned int 32-bit wide
00054   //
00055   // *************************************************************************
00056   
00057 public:
00058   //--- The overall probability.  flags is the 32-bit-packed set of flags that
00059   //--- our own concrete implementation of clusterProbability() uses to direct
00060   //--- the computation based on the information stored in the quality word
00061   //--- (and which was computed by the CPE).  The default of flags==0 returns
00062   //--- probabilityY() only (as that's the safest thing to do).
00063   //--- Flags are static and kept in the transient rec hit.
00064   float clusterProbability(unsigned int flags = 0) const;
00065   
00066   
00067   //--- Allow direct access to the packed quality information.
00068   inline SiPixelRecHitQuality::QualWordType rawQualityWord() const { 
00069     return qualWord_ ; 
00070   }
00071   inline void setRawQualityWord( SiPixelRecHitQuality::QualWordType w ) { 
00072     qualWord_ = w; 
00073   }
00074 
00075 
00076   //--- Template fit probability, in X and Y directions
00077   //--- These are obsolete and will be taken care of in the quality code
00078   inline float probabilityX() const     {
00079     return SiPixelRecHitQuality::thePacking.probabilityX( qualWord_ );
00080   }
00081   inline float probabilityY() const     {
00082     return SiPixelRecHitQuality::thePacking.probabilityY( qualWord_ );
00083   }
00084 
00085   //--- Template fit probability, in X and Y direction combined and in charge
00086   inline float probabilityXY() const     {
00087     return SiPixelRecHitQuality::thePacking.probabilityXY( qualWord_ );
00088   }
00089   inline float probabilityQ() const     {
00090     return SiPixelRecHitQuality::thePacking.probabilityQ( qualWord_ );
00091   }
00092 
00093   //--- Charge `bin' (values 0, 1, 2, 3) according to Morris's template
00094   //--- code. qBin==4 is unphysical, qBin=5,6,7 are yet unused)
00095   //
00096   inline int qBin() const     {
00097     return SiPixelRecHitQuality::thePacking.qBin( qualWord_ );
00098   }
00099 
00100   //--- Quality flags (true or false):
00101 
00102   //--- The cluster is on the edge of the module, or straddles a dead ROC
00103   inline bool isOnEdge() const     {
00104     return SiPixelRecHitQuality::thePacking.isOnEdge( qualWord_ );
00105   }
00106   //--- The cluster contains bad pixels, or straddles bad column or two-column
00107   inline bool hasBadPixels() const     {
00108     return SiPixelRecHitQuality::thePacking.hasBadPixels( qualWord_ );
00109   }
00110   //--- The cluster spans two ROCS (and thus contains big pixels)
00111   inline bool spansTwoROCs() const     {
00112     return SiPixelRecHitQuality::thePacking.spansTwoROCs( qualWord_ );
00113   }
00114 
00115   //--- Quality flag for whether the probability is filled
00116   inline bool hasFilledProb() const {
00117     return SiPixelRecHitQuality::thePacking.hasFilledProb( qualWord_ );
00118   }
00119   
00120   //--- Setters for the above
00121   inline void setProbabilityXY( float prob ) {
00122     SiPixelRecHitQuality::thePacking.setProbabilityXY( prob, qualWord_ );
00123   }
00124   inline void setProbabilityQ( float prob ) {
00125     SiPixelRecHitQuality::thePacking.setProbabilityQ( prob, qualWord_ );
00126   }  
00127   inline void setQBin( int qbin ) {
00128     SiPixelRecHitQuality::thePacking.setQBin( qbin, qualWord_ );
00129   }
00130   inline void setIsOnEdge( bool flag ) {
00131     SiPixelRecHitQuality::thePacking.setIsOnEdge( flag, qualWord_ );
00132   }
00133   inline void setHasBadPixels( bool flag ) {
00134     SiPixelRecHitQuality::thePacking.setHasBadPixels( flag, qualWord_ );
00135   }
00136   inline void setSpansTwoROCs( bool flag ) {
00137     SiPixelRecHitQuality::thePacking.setSpansTwoROCs( flag, qualWord_ );
00138   }
00139   inline void setHasFilledProb( bool flag ) {
00140     SiPixelRecHitQuality::thePacking.setHasFilledProb( flag, qualWord_ );
00141   }
00142 
00143 };
00144 
00145 #endif