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  virtual ~HcaluLUTTPGCoder();
37  virtual void adc2Linear(const HBHEDataFrame& df, IntegerCaloSamples& ics) const override;
38  virtual void adc2Linear(const HFDataFrame& df, IntegerCaloSamples& ics) const override;
39  virtual void adc2Linear(const QIE10DataFrame& df, IntegerCaloSamples& ics) const override;
40  virtual void adc2Linear(const QIE11DataFrame& df, IntegerCaloSamples& ics) const override;
41  virtual void compress(const IntegerCaloSamples& ics, const std::vector<bool>& featureBits, HcalTriggerPrimitiveDigi& tp) const override;
42  virtual unsigned short adc2Linear(HcalQIESample sample,HcalDetId id) const override;
43  virtual float getLUTPedestal(HcalDetId id) const override;
44  virtual float getLUTGain(HcalDetId id) const override;
45 
46  void update(const HcalDbService& conditions);
47  void update(const char* filename, bool appendMSB = false);
48  void updateXML(const char* filename);
50  void setMaskBit(int bit){ bitToMask_ = bit; };
51  std::vector<unsigned short> getLinearizationLUTWithMSB(const HcalDetId& id) const;
52  void lookupMSB(const HBHEDataFrame& df, std::vector<bool>& msb) const;
53  void lookupMSB(const QIE11DataFrame& df, std::vector<std::bitset<2>>& msb) const;
54  bool getMSB(const HcalDetId& id, int adc) const;
55  int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const;
56  int getLUTId(uint32_t rawid) const;
57  int getLUTId(const HcalDetId& detid) const;
58 
59  static const int QIE8_LUT_BITMASK = 0x3FF;
60  static const int QIE10_LUT_BITMASK = 0x7FF;
61  static const int QIE11_LUT_BITMASK = 0x3FF;
62 
63 private:
64  // typedef
65  typedef unsigned short LutElement;
66  typedef std::vector<LutElement> Lut;
67 
68  // constants
69  static const size_t INPUT_LUT_SIZE = 128;
70  static const size_t UPGRADE_LUT_SIZE = 256;
71  static const int nFi_ = 72;
72 
73  static const int QIE8_LUT_MSB = 0x400;
74  static const int QIE11_LUT_MSB0 = 0x400;
75  static const int QIE11_LUT_MSB1 = 0x800;
76 
77  // member variables
84  std::vector< Lut > inputLUT_;
85  std::vector< Lut > upgradeQIE10LUT_;
86  std::vector< Lut > upgradeQIE11LUT_;
87  std::vector<float> gain_;
88  std::vector<float> ped_;
89 };
90 
91 #endif
int adc(sample_type sample)
get the ADC sample (12 bits)
static const int nFi_
virtual void adc2Linear(const HBHEDataFrame &df, IntegerCaloSamples &ics) const override
static const int QIE11_LUT_MSB1
static const int QIE11_LUT_BITMASK
virtual ~HcaluLUTTPGCoder()
virtual 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 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
std::vector< unsigned short > getLinearizationLUTWithMSB(const HcalDetId &id) const
std::vector< LutElement > Lut
def gen(fragment, howMuch)
Production test section ####.
static const int QIE8_LUT_MSB
std::vector< Lut > upgradeQIE11LUT_
static const int QIE10_LUT_BITMASK
std::vector< float > ped_
std::vector< float > gain_
void setMaskBit(int bit)
static const size_t INPUT_LUT_SIZE
HcaluLUTTPGCoder(const HcalTopology *topo)
bool getMSB(const HcalDetId &id, int adc) const
virtual float getLUTPedestal(HcalDetId id) const override
std::vector< Lut > upgradeQIE10LUT_
virtual void compress(const IntegerCaloSamples &ics, const std::vector< bool > &featureBits, HcalTriggerPrimitiveDigi &tp) const override
std::vector< Lut > inputLUT_