CMS 3D CMS Logo

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 47 of file SiPixelDbItem.h.

Constructor & Destructor Documentation

◆ Packing()

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

Definition at line 64 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.

65  : noise_width(noise_w), pedestal_width(pedestal_w), status_width(status_w) {
66  // Constructor: pre-computes masks and shifts from field widths
67  // Order of fields (from right to left) is
68  // noise, pedestal, gain, status count.
69 
70  if (noise_w + pedestal_w + gain_w + status_w != 32) {
71  std::cout << std::endl
72  << "Error in SiPixelDbItem::Packing constructor:"
73  << "sum of field widths != 32" << std::endl;
74  // TO DO: throw an exception?
75  }
76 
77  // Fields are counted from right to left!
78 
79  noise_shift = 0;
80  pedestal_shift = noise_shift + noise_w;
81  gain_shift = pedestal_shift + pedestal_w;
82  status_shift = gain_shift + gain_w;
83 
84  // Ensure the complement of the correct
85  // number of bits:
86  PackedPixDbType zero32 = 0; // 32-bit wide
87 
88  noise_mask = ~(~zero32 << noise_w);
89  pedestal_mask = ~(~zero32 << pedestal_w);
90  gain_mask = ~(~zero32 << gain_w);
91  status_mask = ~(~zero32 << status_w);
92 }
uint32_t PackedPixDbType
Definition: SiPixelDbItem.h:22
PackedPixDbType pedestal_mask
Definition: SiPixelDbItem.h:60
PackedPixDbType status_mask
Definition: SiPixelDbItem.h:57
PackedPixDbType gain_mask
Definition: SiPixelDbItem.h:58
PackedPixDbType noise_mask
Definition: SiPixelDbItem.h:59

Member Data Documentation

◆ gain_mask

PackedPixDbType SiPixelDbItem::Packing::gain_mask

Definition at line 58 of file SiPixelDbItem.h.

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

◆ gain_shift

int SiPixelDbItem::Packing::gain_shift

◆ noise_mask

PackedPixDbType SiPixelDbItem::Packing::noise_mask

Definition at line 59 of file SiPixelDbItem.h.

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

◆ noise_shift

int SiPixelDbItem::Packing::noise_shift

◆ noise_width

int SiPixelDbItem::Packing::noise_width

Definition at line 61 of file SiPixelDbItem.h.

◆ pedestal_mask

PackedPixDbType SiPixelDbItem::Packing::pedestal_mask

Definition at line 60 of file SiPixelDbItem.h.

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

◆ pedestal_shift

int SiPixelDbItem::Packing::pedestal_shift

◆ pedestal_width

int SiPixelDbItem::Packing::pedestal_width

Definition at line 62 of file SiPixelDbItem.h.

◆ status_mask

PackedPixDbType SiPixelDbItem::Packing::status_mask

Definition at line 57 of file SiPixelDbItem.h.

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

◆ status_shift

int SiPixelDbItem::Packing::status_shift

◆ status_width

int SiPixelDbItem::Packing::status_width

Definition at line 63 of file SiPixelDbItem.h.