test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
SiPixelDbItem::Packing Class Reference

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

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 50 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.

81  : noise_width(noise_w), pedestal_width(pedestal_w), status_width(status_w)
82 {
83  // Constructor: pre-computes masks and shifts from field widths
84  // Order of fields (from right to left) is
85  // noise, pedestal, gain, status count.
86 
87  if ( noise_w+pedestal_w+gain_w+status_w != 32) {
88  std::cout << std::endl << "Error in SiPixelDbItem::Packing constructor:"
89  << "sum of field widths != 32" << std::endl;
90  // TO DO: throw an exception?
91  }
92 
93  // Fields are counted from right to left!
94 
95  noise_shift = 0;
96  pedestal_shift = noise_shift + noise_w;
97  gain_shift = pedestal_shift + pedestal_w;
98  status_shift = gain_shift + gain_w;
99 
100  // Ensure the complement of the correct
101  // number of bits:
102  PackedPixDbType zero32 = 0; // 32-bit wide
103 
104  noise_mask = ~(~zero32 << noise_w);
105  pedestal_mask = ~(~zero32 << pedestal_w);
106  gain_mask = ~(~zero32 << gain_w);
107  status_mask = ~(~zero32 << status_w);
108 }
uint32_t PackedPixDbType
Definition: SiPixelDbItem.h:24
PackedPixDbType pedestal_mask
Definition: SiPixelDbItem.h:63
PackedPixDbType status_mask
Definition: SiPixelDbItem.h:60
PackedPixDbType gain_mask
Definition: SiPixelDbItem.h:61
PackedPixDbType noise_mask
Definition: SiPixelDbItem.h:62
tuple cout
Definition: gather_cfg.py:145

Member Data Documentation

PackedPixDbType SiPixelDbItem::Packing::gain_mask

Definition at line 61 of file SiPixelDbItem.h.

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

int SiPixelDbItem::Packing::gain_shift
PackedPixDbType SiPixelDbItem::Packing::noise_mask

Definition at line 62 of file SiPixelDbItem.h.

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

int SiPixelDbItem::Packing::noise_shift
int SiPixelDbItem::Packing::noise_width

Definition at line 64 of file SiPixelDbItem.h.

PackedPixDbType SiPixelDbItem::Packing::pedestal_mask

Definition at line 63 of file SiPixelDbItem.h.

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

int SiPixelDbItem::Packing::pedestal_shift
int SiPixelDbItem::Packing::pedestal_width

Definition at line 65 of file SiPixelDbItem.h.

PackedPixDbType SiPixelDbItem::Packing::status_mask

Definition at line 60 of file SiPixelDbItem.h.

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

int SiPixelDbItem::Packing::status_shift
int SiPixelDbItem::Packing::status_width

Definition at line 66 of file SiPixelDbItem.h.