File indexing completed on 2024-04-06 12:02:33
0001 #ifndef CondFormats_SiPixelObjects_SiPixelDbItem_h
0002 #define CondFormats_SiPixelObjects_SiPixelDbItem_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include "CondFormats/Serialization/interface/Serializable.h"
0019 #include <cstdint>
0020
0021 class SiPixelDbItem {
0022 typedef uint32_t PackedPixDbType;
0023
0024 public:
0025 SiPixelDbItem() : packedVal_(0) { set(2, 0, 1.0, 0); }
0026 ~SiPixelDbItem() {}
0027 inline short noise() { return (packedVal_ >> packing_.noise_shift) & packing_.noise_mask; }
0028 inline short pedestal() { return (packedVal_ >> packing_.pedestal_shift) & packing_.pedestal_mask; }
0029 inline float gain() { return (packedVal_ >> packing_.gain_shift) & packing_.gain_mask; }
0030 inline char status() { return (packedVal_ >> packing_.status_shift) & packing_.status_mask; }
0031 inline PackedPixDbType packedValue() { return packedVal_; }
0032
0033 inline void setPackedVal(PackedPixDbType p) { packedVal_ = p; }
0034
0035
0036 void setNoise(short n);
0037 void setPedestal(short p);
0038 void setGain(float g);
0039 void setStatus(char s);
0040 void set(short noise, short pedestal, float gain, char status);
0041
0042 private:
0043 PackedPixDbType packedVal_;
0044
0045
0046
0047 class Packing {
0048 public:
0049
0050 Packing(int noise_w, int pedestal_w, int gain_w, int status_w);
0051
0052
0053 int status_shift;
0054 int gain_shift;
0055 int noise_shift;
0056 int pedestal_shift;
0057 PackedPixDbType status_mask;
0058 PackedPixDbType gain_mask;
0059 PackedPixDbType noise_mask;
0060 PackedPixDbType pedestal_mask;
0061 int noise_width;
0062 int pedestal_width;
0063 int status_width;
0064 };
0065 static Packing packing_;
0066
0067 COND_SERIALIZABLE;
0068 };
0069
0070 #endif