CMS 3D CMS Logo

Public Member Functions | Public Attributes

SiPixelDbItem::Packing Class Reference

Pack the pixel information to use less memory. More...

List of all members.

Public Member Functions

 Packing (int noise_w, int pedestal_w, int gain_w, int status_w)

Public Attributes

PackedPixDbType gain_mask
int gain_shift
PackedPixDbType noise_mask
int noise_shift
int noise_width
PackedPixDbType pedestal_mask
int pedestal_shift
int pedestal_width
PackedPixDbType status_mask
int status_shift
int status_width

Detailed Description

Pack the pixel information to use less memory.

Definition at line 48 of file SiPixelDbItem.h.


Constructor & Destructor Documentation

SiPixelDbItem::Packing::Packing ( int  noise_w,
int  pedestal_w,
int  gain_w,
int  status_w 
)

Definition at line 79 of file SiPixelDbItem.cc.

References gather_cfg::cout, gain_mask, gain_shift, noise_mask, noise_shift, pedestal_mask, pedestal_shift, status_mask, and status_shift.

  : noise_width(noise_w), pedestal_width(pedestal_w), status_width(status_w) 
{
  // Constructor: pre-computes masks and shifts from field widths
  // Order of fields (from right to left) is
  // noise, pedestal, gain, status count.
  
  if ( noise_w+pedestal_w+gain_w+status_w != 32) {
    std::cout << std::endl << "Error in SiPixelDbItem::Packing constructor:" 
              << "sum of field widths != 32" << std::endl;
    // TO DO: throw an exception?
  }

  // Fields are counted from right to left!
  
  noise_shift     = 0;
  pedestal_shift  = noise_shift + noise_w;
  gain_shift    = pedestal_shift + pedestal_w;
  status_shift     = gain_shift + gain_w;

  // Ensure the complement of the correct 
  // number of bits:
  PackedPixDbType zero32 = 0;  // 32-bit wide

  noise_mask     = ~(~zero32 << noise_w);
  pedestal_mask  = ~(~zero32 << pedestal_w);
  gain_mask    = ~(~zero32 << gain_w);
  status_mask     = ~(~zero32 << status_w);
}

Member Data Documentation

Definition at line 59 of file SiPixelDbItem.h.

Referenced by SiPixelDbItem::gain(), Packing(), and SiPixelDbItem::setGain().

Definition at line 60 of file SiPixelDbItem.h.

Referenced by SiPixelDbItem::noise(), Packing(), and SiPixelDbItem::setNoise().

Definition at line 62 of file SiPixelDbItem.h.

Definition at line 61 of file SiPixelDbItem.h.

Referenced by Packing(), SiPixelDbItem::pedestal(), and SiPixelDbItem::setPedestal().

Definition at line 63 of file SiPixelDbItem.h.

Definition at line 58 of file SiPixelDbItem.h.

Referenced by Packing(), SiPixelDbItem::setStatus(), and SiPixelDbItem::status().

Definition at line 64 of file SiPixelDbItem.h.