CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HcaluLUTTPGCoder.h
Go to the documentation of this file.
1 #ifndef CALIBCALORIMETRY_HCALTPGALGOS_HCALNOMINALTPGCODER_H
2 #define CALIBCALORIMETRY_HCALTPGALGOS_HCALNOMINALTPGCODER_H 1
3 
9 
10 #include <bitset>
11 #include <vector>
12 
13 class HcalDbService;
14 
33 public:
34  static const float lsb_;
35 
37  HcaluLUTTPGCoder(const HcalTopology* topo, const HcalTimeSlew* delay);
38  ~HcaluLUTTPGCoder() override;
39 
40  void init(const HcalTopology* top, const HcalTimeSlew* delay);
41 
42  void adc2Linear(const HBHEDataFrame& df, IntegerCaloSamples& ics) const override;
43  void adc2Linear(const HFDataFrame& df, IntegerCaloSamples& ics) const override;
44  void adc2Linear(const QIE10DataFrame& df, IntegerCaloSamples& ics) const override;
45  void adc2Linear(const QIE11DataFrame& df, IntegerCaloSamples& ics) const override;
46  std::vector<unsigned short> group0FGbits(const QIE11DataFrame& df) const;
47  void compress(const IntegerCaloSamples& ics,
48  const std::vector<bool>& featureBits,
49  HcalTriggerPrimitiveDigi& tp) const override;
50  unsigned short adc2Linear(HcalQIESample sample, HcalDetId id) const override;
51  float getLUTPedestal(HcalDetId id) const override;
52  float getLUTGain(HcalDetId id) const override;
53  std::vector<unsigned short> getLinearizationLUT(HcalDetId id) const override;
54 
55  double cosh_ieta(int ieta, int depth, HcalSubdetector subdet);
56  void make_cosh_ieta_map(void);
57  void update(const HcalDbService& conditions);
58  void update(const char* filename, bool appendMSB = false);
59  void updateXML(const char* filename);
61  void setFGHFthresholds(const std::vector<uint32_t>& fgthresholds) { FG_HF_thresholds_ = fgthresholds; };
62  void setMaskBit(int bit) { bitToMask_ = bit; };
63  void setAllLinear(bool linear, double lsb8, double lsb11, double lsb11overlap) {
65  linearLSB_QIE8_ = lsb8;
66  linearLSB_QIE11_ = lsb11;
67  linearLSB_QIE11Overlap_ = lsb11overlap;
68  };
69  void set1TSContainHB(bool contain1TSHB) { contain1TSHB_ = contain1TSHB; }
70  void set1TSContainHE(bool contain1TSHE) { contain1TSHE_ = contain1TSHE; }
71  void setContainPhaseHB(double containPhaseNSHB) { containPhaseNSHB_ = containPhaseNSHB; }
72  void setContainPhaseHE(double containPhaseNSHE) { containPhaseNSHE_ = containPhaseNSHE; }
73  void setApplyFixPCC(double applyFixPCC) { applyFixPCC_ = applyFixPCC; }
74  void setOverrideDBweightsAndFilterHB(bool overrideDBweightsAndFilterHB) {
75  overrideDBweightsAndFilterHB_ = overrideDBweightsAndFilterHB;
76  }
77  void setOverrideDBweightsAndFilterHE(bool overrideDBweightsAndFilterHE) {
78  overrideDBweightsAndFilterHE_ = overrideDBweightsAndFilterHE;
79  }
80  void lookupMSB(const HBHEDataFrame& df, std::vector<bool>& msb) const;
81  void lookupMSB(const QIE10DataFrame& df, std::vector<std::bitset<2>>& msb) const;
82  void lookupMSB(const QIE11DataFrame& df, std::vector<std::bitset<2>>& msb) const;
83  bool getMSB(const HcalDetId& id, int adc) const;
84  int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const;
85  int getLUTId(uint32_t rawid) const;
86  int getLUTId(const HcalDetId& detid) const;
87 
88  static const int QIE8_LUT_BITMASK = 0x3FF;
89  static const int QIE10_LUT_BITMASK = 0x7FF;
90  static const int QIE11_LUT_BITMASK = 0x3FF;
91 
92 private:
93  // typedef
94  typedef unsigned short LutElement;
95  typedef std::vector<LutElement> Lut;
96 
97  // constants
98  static const size_t INPUT_LUT_SIZE = 128;
99  static const size_t UPGRADE_LUT_SIZE = 256;
100  static const int nFi_ = 72;
101 
102  static const int QIE8_LUT_MSB = 0x400;
103  static const int QIE11_LUT_MSB0 = 0x400;
104  static const int QIE11_LUT_MSB1 = 0x800;
105  static const int QIE10_LUT_MSB0 = 0x1000;
106  static const int QIE10_LUT_MSB1 = 0x2000;
107 
108  // member variables
112  std::vector<uint32_t> FG_HF_thresholds_;
117  std::vector<Lut> inputLUT_;
118  std::vector<float> gain_;
119  std::vector<float> ped_;
120  std::vector<double> cosh_ieta_;
121  // edge cases not covered by the cosh_ieta_ map
125  double containPhaseNSHB_ = 6.0;
126  double containPhaseNSHE_ = 6.0;
129  std::unique_ptr<HcalPulseContainmentManager> pulseCorr_;
132 };
133 
134 #endif
std::vector< uint32_t > FG_HF_thresholds_
static const int nFi_
double cosh_ieta_28_HE_high_depths_
double linearLSB_QIE11Overlap_
static const int QIE11_LUT_MSB1
static const int QIE11_LUT_BITMASK
const HcalTopology * topo_
static const int QIE11_LUT_MSB0
static const float lsb_
double cosh_ieta_28_HE_low_depths_
void setOverrideDBweightsAndFilterHE(bool overrideDBweightsAndFilterHE)
void init(const HcalTopology *top, const HcalTimeSlew *delay)
bool overrideDBweightsAndFilterHB_
static const int QIE8_LUT_BITMASK
std::vector< unsigned short > group0FGbits(const QIE11DataFrame &df) const
unsigned short LutElement
void update(const HcalDbService &conditions)
void updateXML(const char *filename)
void setLUTGenerationMode(bool gen)
static const int QIE10_LUT_MSB0
static const size_t UPGRADE_LUT_SIZE
float getLUTGain(HcalDetId id) const override
std::vector< Lut > inputLUT_
void lookupMSB(const HBHEDataFrame &df, std::vector< bool > &msb) const
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
std::vector< unsigned short > getLinearizationLUT(HcalDetId id) const override
Get the full linearization LUT (128 elements). Default implementation just uses adc2Linear to get all...
void setApplyFixPCC(double applyFixPCC)
const HcalTimeSlew * delay_
HcalSubdetector
Definition: HcalAssistant.h:31
void setContainPhaseHE(double containPhaseNSHE)
std::vector< LutElement > Lut
bool overrideDBweightsAndFilterHE_
float getLUTPedestal(HcalDetId id) const override
static const int QIE8_LUT_MSB
static const int QIE10_LUT_BITMASK
std::vector< double > cosh_ieta_
std::vector< float > ped_
double cosh_ieta(int ieta, int depth, HcalSubdetector subdet)
std::vector< float > gain_
void setMaskBit(int bit)
void setContainPhaseHB(double containPhaseNSHB)
~HcaluLUTTPGCoder() override
void adc2Linear(const HBHEDataFrame &df, IntegerCaloSamples &ics) const override
void setAllLinear(bool linear, double lsb8, double lsb11, double lsb11overlap)
static const size_t INPUT_LUT_SIZE
bool getMSB(const HcalDetId &id, int adc) const
tuple filename
Definition: lut2db_cfg.py:20
void compress(const IntegerCaloSamples &ics, const std::vector< bool > &featureBits, HcalTriggerPrimitiveDigi &tp) const override
void set1TSContainHB(bool contain1TSHB)
float linear(float x)
void setFGHFthresholds(const std::vector< uint32_t > &fgthresholds)
void set1TSContainHE(bool contain1TSHE)
void make_cosh_ieta_map(void)
std::unique_ptr< HcalPulseContainmentManager > pulseCorr_
void setOverrideDBweightsAndFilterHB(bool overrideDBweightsAndFilterHB)
static const int QIE10_LUT_MSB1
uint16_t *__restrict__ uint16_t const *__restrict__ adc