CMS 3D CMS Logo

SiPixelDbItem.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 #include <algorithm>
5 
25 
29  packedVal_ = oldValue | newNoise;
30 }
31 
35  packedVal_ = oldValue | newPedestal;
36 }
37 
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 }
47 
51  packedVal_ = oldValue | newStatus;
52 }
53 
55 void SiPixelDbItem::set(short noise, short pedestal, float gain, char status) {
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 }
63 
64 SiPixelDbItem::Packing::Packing(int noise_w, int pedestal_w, int gain_w, int status_w)
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 }
93 
94 // Initialize the packing (order is: noise, pedestal, gain, status)
95 SiPixelDbItem::Packing SiPixelDbItem::packing_(8, 8, 8, 8); // TO DO: TBD
SiPixelDbItem::Packing::pedestal_shift
int pedestal_shift
Definition: SiPixelDbItem.h:56
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
SiPixelDbItem::packing_
static Packing packing_
Definition: SiPixelDbItem.h:65
SiPixelDbItem::Packing::status_mask
PackedPixDbType status_mask
Definition: SiPixelDbItem.h:57
mps_update.status
status
Definition: mps_update.py:68
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiPixelDbItem.h
alignCSCRings.s
s
Definition: alignCSCRings.py:92
SiPixelDbItem::pedestal
short pedestal()
Definition: SiPixelDbItem.h:28
SiPixelDbItem::status
char status()
Definition: SiPixelDbItem.h:30
SiPixelDbItem::Packing::pedestal_mask
PackedPixDbType pedestal_mask
Definition: SiPixelDbItem.h:60
SiPixelDbItem::setNoise
void setNoise(short n)
Definition: SiPixelDbItem.cc:26
SiPixelDbItem::set
void set(short noise, short pedestal, float gain, char status)
A fast version which sets all in one go.
Definition: SiPixelDbItem.cc:55
SiPixelDbItem::Packing::status_shift
int status_shift
Definition: SiPixelDbItem.h:53
SiPixelDbItem::setGain
void setGain(float g)
Definition: SiPixelDbItem.cc:38
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
SiPixelDbItem::Packing::noise_mask
PackedPixDbType noise_mask
Definition: SiPixelDbItem.h:59
SiPixelDbItem::setPedestal
void setPedestal(short p)
Definition: SiPixelDbItem.cc:32
SiPixelDbItem::gain
float gain()
Definition: SiPixelDbItem.h:29
createfilelist.int
int
Definition: createfilelist.py:10
SiPixelDbItem::Packing
Pack the pixel information to use less memory.
Definition: SiPixelDbItem.h:47
EcalCondDBWriter_cfi.pedestal
pedestal
Definition: EcalCondDBWriter_cfi.py:49
gpuVertexFinder::noise
__shared__ int noise
Definition: gpuFitVertices.h:50
SiPixelDbItem::noise
short noise()
Definition: SiPixelDbItem.h:27
PedestalClient_cfi.gain
gain
Definition: PedestalClient_cfi.py:37
SiPixelDbItem::Packing::gain_shift
int gain_shift
Definition: SiPixelDbItem.h:54
SiPixelDbItem::packedVal_
PackedPixDbType packedVal_
Definition: SiPixelDbItem.h:43
SiPixelDbItem::Packing::Packing
Packing(int noise_w, int pedestal_w, int gain_w, int status_w)
Definition: SiPixelDbItem.cc:64
SiPixelDbItem::setStatus
void setStatus(char s)
Definition: SiPixelDbItem.cc:48
SiPixelDbItem::PackedPixDbType
uint32_t PackedPixDbType
Definition: SiPixelDbItem.h:22
SiPixelDbItem::Packing::gain_mask
PackedPixDbType gain_mask
Definition: SiPixelDbItem.h:58
g
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
SiPixelDbItem::Packing::noise_shift
int noise_shift
Definition: SiPixelDbItem.h:55