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 
9 
10 #include <bitset>
11 #include <vector>
12 
13 class HcalDbService;
14 
33 public:
34  static const float lsb_;
35  static const float zdc_lsb_;
36 
38  HcaluLUTTPGCoder(const HcalTopology* topo, const HcalTimeSlew* delay);
39  ~HcaluLUTTPGCoder() override;
40 
41  void init(const HcalTopology* top, const HcalTimeSlew* delay);
42 
43  void adc2Linear(const HBHEDataFrame& df, IntegerCaloSamples& ics) const override;
44  void adc2Linear(const HFDataFrame& df, IntegerCaloSamples& ics) const override;
45  void adc2Linear(const QIE10DataFrame& df, IntegerCaloSamples& ics, bool ootpu_lut) const override;
46  void adc2Linear(const QIE11DataFrame& df, IntegerCaloSamples& ics) const override;
47  std::vector<unsigned short> group0FGbits(const QIE11DataFrame& df) const;
48  void compress(const IntegerCaloSamples& ics,
49  const std::vector<bool>& featureBits,
50  HcalTriggerPrimitiveDigi& tp) const override;
51  unsigned short adc2Linear(HcalQIESample sample, HcalDetId id) const override;
52  float getLUTPedestal(HcalDetId id) const override;
53  float getLUTGain(HcalDetId id) const override;
54  std::vector<unsigned short> getLinearizationLUT(HcalDetId id) const override;
55  std::vector<unsigned short> getLinearizationLUT(HcalZDCDetId id, bool ootpu_lut) const override;
56 
57  double cosh_ieta(int ieta, int depth, HcalSubdetector subdet);
58  void make_cosh_ieta_map(void);
59  void update(const HcalDbService& conditions);
60  void update(const char* filename, bool appendMSB = false);
61  void updateXML(const char* filename);
63  void setFGHFthresholds(const std::vector<uint32_t>& fgthresholds) { FG_HF_thresholds_ = fgthresholds; };
64  void setMaskBit(int bit) { bitToMask_ = bit; };
65  void setAllLinear(bool linear, double lsb8, double lsb11, double lsb11overlap) {
67  linearLSB_QIE8_ = lsb8;
68  linearLSB_QIE11_ = lsb11;
69  linearLSB_QIE11Overlap_ = lsb11overlap;
70  };
78  }
81  }
82  void lookupMSB(const HBHEDataFrame& df, std::vector<bool>& msb) const;
83  void lookupMSB(const QIE10DataFrame& df, std::vector<std::bitset<2>>& msb) const;
84  void lookupMSB(const QIE11DataFrame& df, std::vector<std::bitset<2>>& msb) const;
85  bool getMSB(const HcalDetId& id, int adc) const;
86  int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const;
87  int getLUTId(uint32_t rawid) const;
88  int getLUTId(const HcalDetId& detid) const;
89  int getLUTId(const HcalZDCDetId& detid) const;
90 
91  static const int QIE8_LUT_BITMASK = 0x3FF;
92  static const int QIE10_LUT_BITMASK = 0x7FF;
93  static const int QIE11_LUT_BITMASK = 0x3FF;
94  static const int QIE10_ZDC_LUT_BITMASK = 0x3FF;
95 
96 private:
97  // typedef
98  typedef unsigned short LutElement;
99  typedef std::vector<LutElement> Lut;
100 
101  // constants
102  static const size_t INPUT_LUT_SIZE = 128;
103  static const size_t UPGRADE_LUT_SIZE = 256;
104  static const int nFi_ = 72;
105 
106  static const int QIE8_LUT_MSB = 0x400;
107  static const int QIE11_LUT_MSB0 = 0x400;
108  static const int QIE11_LUT_MSB1 = 0x800;
109  static const int QIE10_LUT_MSB0 = 0x1000;
110  static const int QIE10_LUT_MSB1 = 0x2000;
111 
112  // member variables
116  std::vector<uint32_t> FG_HF_thresholds_;
121  int sizeZDC_;
122  std::vector<Lut> inputLUT_;
123  std::vector<float> gain_;
124  std::vector<float> ped_;
125  std::vector<double> cosh_ieta_;
126  // edge cases not covered by the cosh_ieta_ map
130  double containPhaseNSHB_ = 6.0;
131  double containPhaseNSHE_ = 6.0;
134  std::unique_ptr<HcalPulseContainmentManager> pulseCorr_;
137 };
138 
139 #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_
void lookupMSB(const HBHEDataFrame &df, std::vector< bool > &msb) const
std::vector< unsigned short > group0FGbits(const QIE11DataFrame &df) const
double cosh_ieta_28_HE_low_depths_
void setOverrideDBweightsAndFilterHE(bool overrideDBweightsAndFilterHE)
static const int QIE10_ZDC_LUT_BITMASK
void init(const HcalTopology *top, const HcalTimeSlew *delay)
bool overrideDBweightsAndFilterHB_
static const int QIE8_LUT_BITMASK
bool getMSB(const HcalDetId &id, int adc) 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_
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
def gen(fragment, howMuch)
Tau Embedding 2016 HIPM ###.
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)
static const float zdc_lsb_
~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
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)
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
std::unique_ptr< HcalPulseContainmentManager > pulseCorr_
void setOverrideDBweightsAndFilterHB(bool overrideDBweightsAndFilterHB)
static const int QIE10_LUT_MSB1
uint16_t *__restrict__ uint16_t const *__restrict__ adc