CMS 3D CMS Logo

SiPixelRecHitQuality::Packing Class Reference

#include <DataFormats/TrackerRecHit2D/interface/SiPixelRecHitQuality.h>

List of all members.

Public Member Functions

float cotAlphaFromCluster (QualWordType qualWord) const
float cotBetaFromCluster (QualWordType qualWord) const
bool hasBadPixels (QualWordType qualWord) const
bool isOnEdge (QualWordType qualWord) const
 Packing ()
float probabilityX (QualWordType qualWord) const
float probabilityY (QualWordType qualWord) const
int qBin (QualWordType qualWord) const
void setCotAlphaFromCluster (float cotalpha, QualWordType &qualWord)
void setCotBetaFromCluster (float cotbeta, QualWordType &qualWord)
void setHasBadPixels (bool flag, QualWordType &qualWord)
void setIsOnEdge (bool flag, QualWordType &qualWord)
void setProbabilityX (float prob, QualWordType &qualWord)
void setProbabilityY (float prob, QualWordType &qualWord)
void setQBin (int qbin, QualWordType &qualWord)
void setSpansTwoROCs (bool flag, QualWordType &qualWord)
bool spansTwoROCs (QualWordType qualWord) const

Public Attributes

QualWordType bad_mask
int bad_shift
char bad_width
QualWordType cotAlpha_mask
int cotAlpha_shift
float cotAlpha_units
char cotAlpha_width
QualWordType cotBeta_mask
int cotBeta_shift
float cotBeta_units
char cotBeta_width
QualWordType edge_mask
int edge_shift
char edge_width
QualWordType probX_mask
int probX_shift
float probX_units
char probX_width
QualWordType probY_mask
int probY_shift
float probY_units
char probY_width
QualWordType qBin_mask
int qBin_shift
char qBin_width
char spare_width
QualWordType twoROC_mask
int twoROC_shift
char twoROC_width


Detailed Description

Definition at line 21 of file SiPixelRecHitQuality.h.


Constructor & Destructor Documentation

SiPixelRecHitQuality::Packing::Packing (  ) 

Definition at line 5 of file SiPixelRecHitQuality.cc.

References bad_mask, bad_shift, bad_width, cotAlpha_mask, cotAlpha_shift, cotAlpha_units, cotAlpha_width, cotBeta_mask, cotBeta_shift, cotBeta_units, cotBeta_width, GenMuonPlsPt100GeV_cfg::cout, edge_mask, edge_shift, edge_width, lat::endl(), probX_mask, probX_shift, probX_units, probX_width, probY_mask, probY_shift, probY_units, probY_width, qBin_mask, qBin_shift, qBin_width, spare_width, twoROC_mask, twoROC_shift, and twoROC_width.

00006 {
00007   // Constructor: pre-computes masks and shifts from field widths
00008   // Order of fields (from right to left) is
00009   // noise, pedestal, gain, status count.
00010   probX_width    = 8;
00011   probY_width    = 8;
00012   cotAlpha_width = 4;
00013   cotBeta_width  = 4;
00014   qBin_width     = 3;
00015   edge_width     = 1;
00016   bad_width      = 1;
00017   twoROC_width   = 1;
00018   spare_width    = 2;
00019   
00020   if ( probX_width + probY_width + cotAlpha_width + cotBeta_width +
00021        qBin_width  + edge_width  + bad_width      + twoROC_width  +
00022        spare_width
00023        != 32 ) {
00024     std::cout << std::endl << "Error in SiPixelRecHitQuality::Packing constructor:" 
00025               << "sum of field widths != 32" << std::endl;
00026     // &&& throw an exception?
00027   }
00028 
00029   probX_units    = 0.0625;
00030   probY_units    = 0.0625;
00031   cotAlpha_units = 1.0/16;
00032   cotBeta_units  = 1.0/16;
00033 
00034   
00035   // Fields are counted from right to left!
00036   probX_shift     = 0;
00037   probY_shift     = probX_shift + probX_width;
00038   cotAlpha_shift  = probY_shift + probY_width; 
00039   cotBeta_shift   = cotAlpha_shift + cotAlpha_width; 
00040   qBin_shift      = cotBeta_shift + cotBeta_width; 
00041   edge_shift      = qBin_shift + qBin_width; 
00042   bad_shift       = edge_shift + edge_width; 
00043   twoROC_shift    = bad_shift + bad_width;
00044   
00045   // Ensure the complement of the correct 
00046   // number of bits:
00047   QualWordType zero32 = 0;  // 32-bit wide set of 0's
00048   
00049   probX_mask     = ~(~zero32 << probX_width);
00050   probY_mask     = ~(~zero32 << probY_width);
00051   cotAlpha_mask  = ~(~zero32 << cotAlpha_width);
00052   cotBeta_mask   = ~(~zero32 << cotBeta_width);
00053   qBin_mask      = ~(~zero32 << qBin_width);
00054   edge_mask      = ~(~zero32 << edge_width);
00055   bad_mask       = ~(~zero32 << bad_width);
00056   twoROC_mask    = ~(~zero32 << twoROC_width);
00057 }


Member Function Documentation

float SiPixelRecHitQuality::Packing::cotAlphaFromCluster ( QualWordType  qualWord  )  const [inline]

Definition at line 66 of file SiPixelRecHitQuality.h.

References cotAlpha_mask, cotAlpha_shift, and cotAlpha_units.

00066                                                                         {
00067       int raw = (qualWord >> cotAlpha_shift) & cotAlpha_mask;
00068       return raw * cotAlpha_units;
00069     }

float SiPixelRecHitQuality::Packing::cotBetaFromCluster ( QualWordType  qualWord  )  const [inline]

Definition at line 70 of file SiPixelRecHitQuality.h.

References cotBeta_mask, cotBeta_shift, and cotBeta_units.

00070                                                                        {
00071       int raw = (qualWord >> cotBeta_shift) & cotBeta_mask;
00072       return raw * cotBeta_units;
00073     }

bool SiPixelRecHitQuality::Packing::hasBadPixels ( QualWordType  qualWord  )  const [inline]

Definition at line 98 of file SiPixelRecHitQuality.h.

References bad_mask, and bad_shift.

00098                                                                 {
00099       return (qualWord >> bad_shift) & bad_mask;
00100     }

bool SiPixelRecHitQuality::Packing::isOnEdge ( QualWordType  qualWord  )  const [inline]

Definition at line 94 of file SiPixelRecHitQuality.h.

References edge_mask, and edge_shift.

00094                                                             {
00095       return (qualWord >> edge_shift) & edge_mask;
00096     }

float SiPixelRecHitQuality::Packing::probabilityX ( QualWordType  qualWord  )  const [inline]

Definition at line 78 of file SiPixelRecHitQuality.h.

References funct::pow(), probX_mask, probX_shift, and probX_units.

00078                                                                  {
00079       int raw = (qualWord >> probX_shift) & probX_mask;
00080       float prob = pow(10.0, (double)-raw * probX_units);
00081       return prob;
00082     }

float SiPixelRecHitQuality::Packing::probabilityY ( QualWordType  qualWord  )  const [inline]

Definition at line 83 of file SiPixelRecHitQuality.h.

References funct::pow(), probY_mask, probY_shift, and probY_units.

00083                                                                  {
00084       int raw = (qualWord >> probY_shift) & probY_mask;
00085       float prob = pow(10.0, (double)-raw * probY_units);
00086       return prob;
00087     }

int SiPixelRecHitQuality::Packing::qBin ( QualWordType  qualWord  )  const [inline]

Definition at line 89 of file SiPixelRecHitQuality.h.

References qBin_mask, and qBin_shift.

00089                                                        {
00090       return (qualWord >> qBin_shift) & qBin_mask;
00091     }

void SiPixelRecHitQuality::Packing::setCotAlphaFromCluster ( float  cotalpha,
QualWordType qualWord 
) [inline]

Definition at line 111 of file SiPixelRecHitQuality.h.

References cotAlpha_mask, cotAlpha_shift, cotAlpha_units, and int.

00111                                                                                   {
00112       int raw = (int) (cotalpha/cotAlpha_units);     // convert to integer units
00113       qualWord &= ((raw & cotAlpha_mask) << cotAlpha_shift);
00114     }

void SiPixelRecHitQuality::Packing::setCotBetaFromCluster ( float  cotbeta,
QualWordType qualWord 
) [inline]

Definition at line 115 of file SiPixelRecHitQuality.h.

References cotBeta_mask, cotBeta_shift, cotBeta_units, and int.

00115                                                                                 {
00116       int raw = (int) (cotbeta/cotBeta_units);     // convert to integer units
00117       qualWord &= ((raw & cotBeta_mask) << cotBeta_shift);
00118     }

void SiPixelRecHitQuality::Packing::setHasBadPixels ( bool  flag,
QualWordType qualWord 
) [inline]

Definition at line 137 of file SiPixelRecHitQuality.h.

References bad_mask, and bad_shift.

00137                                                                       {
00138       qualWord &= ((flag & bad_mask) << bad_shift);
00139     }

void SiPixelRecHitQuality::Packing::setIsOnEdge ( bool  flag,
QualWordType qualWord 
) [inline]

Definition at line 134 of file SiPixelRecHitQuality.h.

References edge_mask, and edge_shift.

00134                                                                   {
00135       qualWord &= ((flag & edge_mask) << edge_shift);
00136     }

void SiPixelRecHitQuality::Packing::setProbabilityX ( float  prob,
QualWordType qualWord 
) [inline]

Definition at line 121 of file SiPixelRecHitQuality.h.

References int, probX_mask, probX_shift, and probX_units.

00121                                                                        {
00122       int raw = (int) (prob/probX_units);     // convert to integer units
00123       qualWord &= ((raw & probX_mask) << probX_shift);
00124     }

void SiPixelRecHitQuality::Packing::setProbabilityY ( float  prob,
QualWordType qualWord 
) [inline]

Definition at line 125 of file SiPixelRecHitQuality.h.

References int, probY_mask, probY_shift, and probY_units.

00125                                                                        {
00126       int raw = (int) (prob/probY_units);     // convert to integer units
00127       qualWord &= ((raw & probY_mask) << probY_shift);
00128     }

void SiPixelRecHitQuality::Packing::setQBin ( int  qbin,
QualWordType qualWord 
) [inline]

Definition at line 130 of file SiPixelRecHitQuality.h.

References qBin_mask, and qBin_shift.

00130                                                              {
00131       qualWord &= ((qbin & qBin_mask) << qBin_shift);
00132     }

void SiPixelRecHitQuality::Packing::setSpansTwoROCs ( bool  flag,
QualWordType qualWord 
) [inline]

Definition at line 140 of file SiPixelRecHitQuality.h.

References twoROC_mask, and twoROC_shift.

00140                                                                       {
00141       qualWord &= ((flag & twoROC_mask) << twoROC_shift);
00142     }

bool SiPixelRecHitQuality::Packing::spansTwoROCs ( QualWordType  qualWord  )  const [inline]

Definition at line 102 of file SiPixelRecHitQuality.h.

References twoROC_mask, and twoROC_shift.

00102                                                                 {
00103       return (qualWord >> twoROC_shift) & twoROC_mask;
00104     }


Member Data Documentation

QualWordType SiPixelRecHitQuality::Packing::bad_mask

Definition at line 56 of file SiPixelRecHitQuality.h.

Referenced by hasBadPixels(), Packing(), and setHasBadPixels().

int SiPixelRecHitQuality::Packing::bad_shift

Definition at line 57 of file SiPixelRecHitQuality.h.

Referenced by hasBadPixels(), Packing(), and setHasBadPixels().

char SiPixelRecHitQuality::Packing::bad_width

Definition at line 58 of file SiPixelRecHitQuality.h.

Referenced by Packing().

QualWordType SiPixelRecHitQuality::Packing::cotAlpha_mask

Definition at line 38 of file SiPixelRecHitQuality.h.

Referenced by cotAlphaFromCluster(), Packing(), and setCotAlphaFromCluster().

int SiPixelRecHitQuality::Packing::cotAlpha_shift

Definition at line 39 of file SiPixelRecHitQuality.h.

Referenced by cotAlphaFromCluster(), Packing(), and setCotAlphaFromCluster().

float SiPixelRecHitQuality::Packing::cotAlpha_units

Definition at line 40 of file SiPixelRecHitQuality.h.

Referenced by cotAlphaFromCluster(), Packing(), and setCotAlphaFromCluster().

char SiPixelRecHitQuality::Packing::cotAlpha_width

Definition at line 41 of file SiPixelRecHitQuality.h.

Referenced by Packing().

QualWordType SiPixelRecHitQuality::Packing::cotBeta_mask

Definition at line 43 of file SiPixelRecHitQuality.h.

Referenced by cotBetaFromCluster(), Packing(), and setCotBetaFromCluster().

int SiPixelRecHitQuality::Packing::cotBeta_shift

Definition at line 44 of file SiPixelRecHitQuality.h.

Referenced by cotBetaFromCluster(), Packing(), and setCotBetaFromCluster().

float SiPixelRecHitQuality::Packing::cotBeta_units

Definition at line 45 of file SiPixelRecHitQuality.h.

Referenced by cotBetaFromCluster(), Packing(), and setCotBetaFromCluster().

char SiPixelRecHitQuality::Packing::cotBeta_width

Definition at line 46 of file SiPixelRecHitQuality.h.

Referenced by Packing().

QualWordType SiPixelRecHitQuality::Packing::edge_mask

Definition at line 52 of file SiPixelRecHitQuality.h.

Referenced by isOnEdge(), Packing(), and setIsOnEdge().

int SiPixelRecHitQuality::Packing::edge_shift

Definition at line 53 of file SiPixelRecHitQuality.h.

Referenced by isOnEdge(), Packing(), and setIsOnEdge().

char SiPixelRecHitQuality::Packing::edge_width

Definition at line 54 of file SiPixelRecHitQuality.h.

Referenced by Packing().

QualWordType SiPixelRecHitQuality::Packing::probX_mask

Definition at line 28 of file SiPixelRecHitQuality.h.

Referenced by Packing(), probabilityX(), and setProbabilityX().

int SiPixelRecHitQuality::Packing::probX_shift

Definition at line 29 of file SiPixelRecHitQuality.h.

Referenced by Packing(), probabilityX(), and setProbabilityX().

float SiPixelRecHitQuality::Packing::probX_units

Definition at line 30 of file SiPixelRecHitQuality.h.

Referenced by Packing(), probabilityX(), and setProbabilityX().

char SiPixelRecHitQuality::Packing::probX_width

Definition at line 31 of file SiPixelRecHitQuality.h.

Referenced by Packing().

QualWordType SiPixelRecHitQuality::Packing::probY_mask

Definition at line 33 of file SiPixelRecHitQuality.h.

Referenced by Packing(), probabilityY(), and setProbabilityY().

int SiPixelRecHitQuality::Packing::probY_shift

Definition at line 34 of file SiPixelRecHitQuality.h.

Referenced by Packing(), probabilityY(), and setProbabilityY().

float SiPixelRecHitQuality::Packing::probY_units

Definition at line 35 of file SiPixelRecHitQuality.h.

Referenced by Packing(), probabilityY(), and setProbabilityY().

char SiPixelRecHitQuality::Packing::probY_width

Definition at line 36 of file SiPixelRecHitQuality.h.

Referenced by Packing().

QualWordType SiPixelRecHitQuality::Packing::qBin_mask

Definition at line 48 of file SiPixelRecHitQuality.h.

Referenced by Packing(), qBin(), and setQBin().

int SiPixelRecHitQuality::Packing::qBin_shift

Definition at line 49 of file SiPixelRecHitQuality.h.

Referenced by Packing(), qBin(), and setQBin().

char SiPixelRecHitQuality::Packing::qBin_width

Definition at line 50 of file SiPixelRecHitQuality.h.

Referenced by Packing().

char SiPixelRecHitQuality::Packing::spare_width

Definition at line 64 of file SiPixelRecHitQuality.h.

Referenced by Packing().

QualWordType SiPixelRecHitQuality::Packing::twoROC_mask

Definition at line 60 of file SiPixelRecHitQuality.h.

Referenced by Packing(), setSpansTwoROCs(), and spansTwoROCs().

int SiPixelRecHitQuality::Packing::twoROC_shift

Definition at line 61 of file SiPixelRecHitQuality.h.

Referenced by Packing(), setSpansTwoROCs(), and spansTwoROCs().

char SiPixelRecHitQuality::Packing::twoROC_width

Definition at line 62 of file SiPixelRecHitQuality.h.

Referenced by Packing().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:32:04 2009 for CMSSW by  doxygen 1.5.4