CMS 3D CMS Logo

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