CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends
SiPixelDbItem Class Reference

#include <SiPixelDbItem.h>

Classes

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

Public Member Functions

float gain ()
 
short noise ()
 
PackedPixDbType packedValue ()
 
short pedestal ()
 
void set (short noise, short pedestal, float gain, char status)
 A fast version which sets all in one go. More...
 
void setGain (float g)
 
void setNoise (short n)
 
void setPackedVal (PackedPixDbType p)
 
void setPedestal (short p)
 
void setStatus (char s)
 
 SiPixelDbItem ()
 
char status ()
 
 ~SiPixelDbItem ()
 

Private Types

typedef uint32_t PackedPixDbType
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

PackedPixDbType packedVal_
 

Static Private Attributes

static Packing packing_
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 21 of file SiPixelDbItem.h.

Member Typedef Documentation

typedef uint32_t SiPixelDbItem::PackedPixDbType
private

Definition at line 22 of file SiPixelDbItem.h.

Constructor & Destructor Documentation

SiPixelDbItem::SiPixelDbItem ( )
inline

Definition at line 25 of file SiPixelDbItem.h.

25 : packedVal_(0) { set(2, 0, 1.0, 0); } // TO DO: is noise==2 in shifted rep or not???
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43
SiPixelDbItem::~SiPixelDbItem ( )
inline

Definition at line 26 of file SiPixelDbItem.h.

26 {}

Member Function Documentation

float SiPixelDbItem::gain ( )
inline

Definition at line 29 of file SiPixelDbItem.h.

References SiPixelDbItem::Packing::gain_mask, SiPixelDbItem::Packing::gain_shift, packedVal_, and packing_.

Referenced by setPackedVal().

static Packing packing_
Definition: SiPixelDbItem.h:65
PackedPixDbType gain_mask
Definition: SiPixelDbItem.h:58
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43
short SiPixelDbItem::noise ( )
inline

Definition at line 27 of file SiPixelDbItem.h.

References SiPixelDbItem::Packing::noise_mask, SiPixelDbItem::Packing::noise_shift, packedVal_, and packing_.

Referenced by setPackedVal().

static Packing packing_
Definition: SiPixelDbItem.h:65
PackedPixDbType noise_mask
Definition: SiPixelDbItem.h:59
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43
PackedPixDbType SiPixelDbItem::packedValue ( )
inline

Definition at line 31 of file SiPixelDbItem.h.

References packedVal_.

31 { return packedVal_; }
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43
short SiPixelDbItem::pedestal ( )
inline
template<class Archive >
void SiPixelDbItem::serialize ( Archive &  ar,
const unsigned int  version 
)
private
void SiPixelDbItem::set ( short  noise,
short  pedestal,
float  gain,
char  status 
)

A fast version which sets all in one go.

Definition at line 55 of file SiPixelDbItem.cc.

References SiPixelDbItem::Packing::gain_shift, createfilelist::int, SiPixelDbItem::Packing::noise_shift, packedVal_, packing_, SiPixelDbItem::Packing::pedestal_shift, and SiPixelDbItem::Packing::status_shift.

55  {
56  // Convert gain into a shifted-integer
57  int mult_factor = 1 << packing_.gain_shift; // TO DO: check usage here
58  unsigned short gInIntRep = int(gain * mult_factor);
59 
61  (gInIntRep << packing_.gain_shift) | (status << packing_.status_shift);
62 }
static Packing packing_
Definition: SiPixelDbItem.h:65
short pedestal()
Definition: SiPixelDbItem.h:28
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43
void SiPixelDbItem::setGain ( float  g)

Definition at line 38 of file SiPixelDbItem.cc.

References SiPixelDbItem::Packing::gain_mask, SiPixelDbItem::Packing::gain_shift, createfilelist::int, packedVal_, and packing_.

Referenced by setPackedVal().

38  {
39  // Convert gain into a shifted-integer
40  int mult_factor = 1 << packing_.gain_shift; // TO DO: check
41  unsigned short gInIntRep = int(g * mult_factor);
42 
43  PackedPixDbType newGain = (gInIntRep & packing_.gain_mask) << packing_.gain_shift;
45  packedVal_ = oldValue | newGain;
46 }
static Packing packing_
Definition: SiPixelDbItem.h:65
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
uint32_t PackedPixDbType
Definition: SiPixelDbItem.h:22
PackedPixDbType gain_mask
Definition: SiPixelDbItem.h:58
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43
void SiPixelDbItem::setNoise ( short  n)

The logic of individual setters: First, we put the new value into newXXX, which is a 32-bit word which has the new value at the bits where it should go, and 0's everywhere else. To make it, we:

  • assign the value
  • AND with a mask – so all others are zeroes
  • shift up by noise_shift bits

Next, we prepare the oldValue with a whole where newXXX needs to go. ~(mask << shift) has 1's everywhere except where the new value will go, so AND-ing packedVal_ with it creates a `whole' for the new value.

Finally, the new value is an OR of the two (since the wholes have 0's)

Example: 00 03 c3 02 – old, new one must blow c3 away, so we AND with ff ff 00 ff, and get 00 03 00 02. The new number is now positioned to be ff ff a2 ff, and then we AND these two and get 00 03 a2 02. We have replaced c3 with a2.

Definition at line 26 of file SiPixelDbItem.cc.

References SiPixelDbItem::Packing::noise_mask, SiPixelDbItem::Packing::noise_shift, packedVal_, and packing_.

Referenced by setPackedVal().

26  {
29  packedVal_ = oldValue | newNoise;
30 }
static Packing packing_
Definition: SiPixelDbItem.h:65
uint32_t PackedPixDbType
Definition: SiPixelDbItem.h:22
PackedPixDbType noise_mask
Definition: SiPixelDbItem.h:59
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43
void SiPixelDbItem::setPackedVal ( PackedPixDbType  p)
inline
void SiPixelDbItem::setPedestal ( short  p)

Definition at line 32 of file SiPixelDbItem.cc.

References packedVal_, packing_, SiPixelDbItem::Packing::pedestal_mask, and SiPixelDbItem::Packing::pedestal_shift.

Referenced by setPackedVal().

32  {
35  packedVal_ = oldValue | newPedestal;
36 }
static Packing packing_
Definition: SiPixelDbItem.h:65
uint32_t PackedPixDbType
Definition: SiPixelDbItem.h:22
PackedPixDbType pedestal_mask
Definition: SiPixelDbItem.h:60
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43
void SiPixelDbItem::setStatus ( char  s)

Definition at line 48 of file SiPixelDbItem.cc.

References packedVal_, packing_, SiPixelDbItem::Packing::status_mask, and SiPixelDbItem::Packing::status_shift.

Referenced by setPackedVal().

48  {
51  packedVal_ = oldValue | newStatus;
52 }
static Packing packing_
Definition: SiPixelDbItem.h:65
uint32_t PackedPixDbType
Definition: SiPixelDbItem.h:22
PackedPixDbType status_mask
Definition: SiPixelDbItem.h:57
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43
char SiPixelDbItem::status ( )
inline

Definition at line 30 of file SiPixelDbItem.h.

References packedVal_, packing_, SiPixelDbItem::Packing::status_mask, and SiPixelDbItem::Packing::status_shift.

Referenced by setPackedVal().

static Packing packing_
Definition: SiPixelDbItem.h:65
PackedPixDbType status_mask
Definition: SiPixelDbItem.h:57
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 67 of file SiPixelDbItem.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 67 of file SiPixelDbItem.h.

Member Data Documentation

PackedPixDbType SiPixelDbItem::packedVal_
private
SiPixelDbItem::Packing SiPixelDbItem::packing_
staticprivate