CMS 3D CMS Logo

HcaluLUTTPGCoder.h
Go to the documentation of this file.
1 #ifndef CALIBCALORIMETRY_HCALTPGALGOS_HCALNOMINALTPGCODER_H
2 #define CALIBCALORIMETRY_HCALTPGALGOS_HCALNOMINALTPGCODER_H 1
3 
8 
9 #include <bitset>
10 #include <vector>
11 
12 class HcalDbService;
13 
32 public:
33  static const float lsb_;
34 
35  HcaluLUTTPGCoder(const HcalTopology* topo);
36  ~HcaluLUTTPGCoder() override;
37  void adc2Linear(const HBHEDataFrame& df, IntegerCaloSamples& ics) const override;
38  void adc2Linear(const HFDataFrame& df, IntegerCaloSamples& ics) const override;
39  void adc2Linear(const QIE10DataFrame& df, IntegerCaloSamples& ics) const override;
40  void adc2Linear(const QIE11DataFrame& df, IntegerCaloSamples& ics) const override;
41  void compress(const IntegerCaloSamples& ics, const std::vector<bool>& featureBits, HcalTriggerPrimitiveDigi& tp) const override;
42  unsigned short adc2Linear(HcalQIESample sample,HcalDetId id) const override;
43  float getLUTPedestal(HcalDetId id) const override;
44  float getLUTGain(HcalDetId id) const override;
45  std::vector<unsigned short> getLinearizationLUT(HcalDetId id) const override;
46 
47  void update(const HcalDbService& conditions);
48  void update(const char* filename, bool appendMSB = false);
49  void updateXML(const char* filename);
51  void setFGHFthreshold(unsigned int fgthreshold){ FG_HF_threshold_ = fgthreshold; };
52  void setMaskBit(int bit){ bitToMask_ = bit; };
53  void lookupMSB(const HBHEDataFrame& df, std::vector<bool>& msb) const;
54  void lookupMSB(const QIE10DataFrame& df, std::vector<bool>& msb) const;
55  void lookupMSB(const QIE11DataFrame& df, std::vector<std::bitset<2>>& msb) const;
56  bool getMSB(const HcalDetId& id, int adc) const;
57  int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const;
58  int getLUTId(uint32_t rawid) const;
59  int getLUTId(const HcalDetId& detid) const;
60 
61  static const int QIE8_LUT_BITMASK = 0x3FF;
62  static const int QIE10_LUT_BITMASK = 0x7FF;
63  static const int QIE11_LUT_BITMASK = 0x3FF;
64 
65 private:
66  // typedef
67  typedef unsigned short LutElement;
68  typedef std::vector<LutElement> Lut;
69 
70  // constants
71  static const size_t INPUT_LUT_SIZE = 128;
72  static const size_t UPGRADE_LUT_SIZE = 256;
73  static const int nFi_ = 72;
74 
75  static const int QIE8_LUT_MSB = 0x400;
76  static const int QIE11_LUT_MSB0 = 0x400;
77  static const int QIE11_LUT_MSB1 = 0x800;
78  static const int QIE10_LUT_MSB = 0x1000;
79 
80  // member variables
83  unsigned int FG_HF_threshold_;
88  std::vector< Lut > inputLUT_;
89  std::vector<float> gain_;
90  std::vector<float> ped_;
91 };
92 
93 #endif
int adc(sample_type sample)
get the ADC sample (12 bits)
static const int nFi_
void adc2Linear(const HBHEDataFrame &df, IntegerCaloSamples &ics) const override
static const int QIE11_LUT_MSB1
static const int QIE11_LUT_BITMASK
float getLUTGain(HcalDetId id) const override
const HcalTopology * topo_
static const int QIE11_LUT_MSB0
static const float lsb_
static const int QIE8_LUT_BITMASK
unsigned short LutElement
void update(const HcalDbService &conditions)
void updateXML(const char *filename)
void setLUTGenerationMode(bool gen)
static const int QIE10_LUT_MSB
static const size_t UPGRADE_LUT_SIZE
void lookupMSB(const HBHEDataFrame &df, std::vector< bool > &msb) const
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
HcalSubdetector
Definition: HcalAssistant.h:31
void setFGHFthreshold(unsigned int fgthreshold)
std::vector< LutElement > Lut
unsigned int FG_HF_threshold_
def gen(fragment, howMuch)
Production test section ####.
static const int QIE8_LUT_MSB
static const int QIE10_LUT_BITMASK
std::vector< float > ped_
std::vector< float > gain_
void setMaskBit(int bit)
~HcaluLUTTPGCoder() override
static const size_t INPUT_LUT_SIZE
HcaluLUTTPGCoder(const HcalTopology *topo)
bool getMSB(const HcalDetId &id, int adc) const
float getLUTPedestal(HcalDetId id) const override
void compress(const IntegerCaloSamples &ics, const std::vector< bool > &featureBits, HcalTriggerPrimitiveDigi &tp) const override
std::vector< unsigned short > getLinearizationLUT(HcalDetId id) const override
Get the full linearization LUT (128 elements). Default implementation just uses adc2Linear to get all...
std::vector< Lut > inputLUT_