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 
37  ~HcaluLUTTPGCoder() override;
38  void adc2Linear(const HBHEDataFrame& df, IntegerCaloSamples& ics) const override;
39  void adc2Linear(const HFDataFrame& df, IntegerCaloSamples& ics) const override;
40  void adc2Linear(const QIE10DataFrame& df, IntegerCaloSamples& ics) const override;
41  void adc2Linear(const QIE11DataFrame& df, IntegerCaloSamples& ics) const override;
42  void compress(const IntegerCaloSamples& ics, const std::vector<bool>& featureBits, HcalTriggerPrimitiveDigi& tp) const override;
43  unsigned short adc2Linear(HcalQIESample sample,HcalDetId id) const override;
44  float getLUTPedestal(HcalDetId id) const override;
45  float getLUTGain(HcalDetId id) const override;
46  std::vector<unsigned short> getLinearizationLUT(HcalDetId id) const override;
47 
48  double cosh_ieta(int ieta, int depth, HcalSubdetector subdet);
49  void make_cosh_ieta_map(void);
50  void update(const HcalDbService& conditions);
51  void update(const char* filename, bool appendMSB = false);
52  void updateXML(const char* filename);
54  void setFGHFthresholds(const std::vector<uint32_t>& fgthresholds){ FG_HF_thresholds_ = fgthresholds; };
55  void setMaskBit(int bit){ bitToMask_ = bit; };
56  void setAllLinear(bool linear, double lsb8, double lsb11, double lsb11overlap) { allLinear_ = linear; linearLSB_QIE8_ = lsb8; linearLSB_QIE11_ = lsb11; linearLSB_QIE11Overlap_ = lsb11overlap; };
57  void lookupMSB(const HBHEDataFrame& df, std::vector<bool>& msb) const;
58  void lookupMSB(const QIE10DataFrame& df, std::vector<std::bitset<2>>& msb) const;
59  void lookupMSB(const QIE11DataFrame& df, std::vector<std::bitset<2>>& msb) const;
60  bool getMSB(const HcalDetId& id, int adc) const;
61  int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const;
62  int getLUTId(uint32_t rawid) const;
63  int getLUTId(const HcalDetId& detid) const;
64 
65  static const int QIE8_LUT_BITMASK = 0x3FF;
66  static const int QIE10_LUT_BITMASK = 0x7FF;
67  static const int QIE11_LUT_BITMASK = 0x3FF;
68 
69 private:
70  // typedef
71  typedef unsigned short LutElement;
72  typedef std::vector<LutElement> Lut;
73 
74  // constants
75  static const size_t INPUT_LUT_SIZE = 128;
76  static const size_t UPGRADE_LUT_SIZE = 256;
77  static const int nFi_ = 72;
78 
79  static const int QIE8_LUT_MSB = 0x400;
80  static const int QIE11_LUT_MSB0 = 0x400;
81  static const int QIE11_LUT_MSB1 = 0x800;
82  static const int QIE10_LUT_MSB0 = 0x1000;
83  static const int QIE10_LUT_MSB1 = 0x2000;
84 
85  // member variables
89  std::vector<uint32_t> FG_HF_thresholds_;
94  std::vector< Lut > inputLUT_;
95  std::vector<float> gain_;
96  std::vector<float> ped_;
97  std::vector<double> cosh_ieta_;
98  // edge cases not covered by the cosh_ieta_ map
102  std::unique_ptr<HcalPulseContainmentManager> pulseCorr_;
103 };
104 
105 #endif
int adc(sample_type sample)
get the ADC sample (12 bits)
std::vector< uint32_t > FG_HF_thresholds_
static const int nFi_
void adc2Linear(const HBHEDataFrame &df, IntegerCaloSamples &ics) const override
double cosh_ieta_28_HE_high_depths_
double linearLSB_QIE11Overlap_
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_
double cosh_ieta_28_HE_low_depths_
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_MSB0
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< LutElement > Lut
HcaluLUTTPGCoder(const HcalTopology *topo, const edm::ESHandle< HcalTimeSlew > &delay)
def gen(fragment, howMuch)
Production test section ####.
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)
~HcaluLUTTPGCoder() override
void setAllLinear(bool linear, double lsb8, double lsb11, double lsb11overlap)
static const size_t INPUT_LUT_SIZE
const edm::ESHandle< HcalTimeSlew > & delay_
bool getMSB(const HcalDetId &id, int adc) const
float getLUTPedestal(HcalDetId id) const override
float linear(float x)
void setFGHFthresholds(const std::vector< uint32_t > &fgthresholds)
void make_cosh_ieta_map(void)
std::unique_ptr< HcalPulseContainmentManager > pulseCorr_
static const int QIE10_LUT_MSB1
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_