Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:20

0001 #ifndef HCAL_CALIBRATIONS_H
0002 #define HCAL_CALIBRATIONS_H
0003 
0004 /** \class HcalCalibrations
0005     
0006     Container for retrieved calibration constants for HCAL
0007    $Author: ratnikov
0008 */
0009 class HcalCalibrations {
0010 public:
0011   constexpr HcalCalibrations()
0012       : mRespCorrGain{0, 0, 0, 0},
0013         mPedestal{0, 0, 0, 0},
0014         mEffectivePedestal{0, 0, 0, 0},
0015         mRespCorr(0),
0016         mTimeCorr(0),
0017         mLUTCorr(0) {}
0018   constexpr HcalCalibrations(const float fGain[4],
0019                              const float fPedestal[4],
0020                              const float fEffectivePedestal[4],
0021                              const float fRespCorr,
0022                              const float fTimeCorr,
0023                              const float fLUTCorr)
0024       : mRespCorrGain{0, 0, 0, 0},
0025         mPedestal{0, 0, 0, 0},
0026         mEffectivePedestal{0, 0, 0, 0},
0027         mRespCorr(0),
0028         mTimeCorr(0),
0029         mLUTCorr(0) {
0030     for (auto iCap = 0; iCap < 4; ++iCap) {
0031       mRespCorrGain[iCap] = fGain[iCap] * fRespCorr;
0032       mPedestal[iCap] = fPedestal[iCap];
0033       mEffectivePedestal[iCap] = fEffectivePedestal[iCap];
0034     }
0035     mRespCorr = fRespCorr;
0036     mTimeCorr = fTimeCorr;
0037     mLUTCorr = fLUTCorr;
0038   }
0039   /// get LUT corrected and response corrected gain for capid=0..3
0040   constexpr double LUTrespcorrgain(int fCapId) const { return (mLUTCorr * mRespCorrGain[fCapId]); }
0041   /// get response corrected gain for capid=0..3
0042   constexpr double respcorrgain(int fCapId) const { return mRespCorrGain[fCapId]; }
0043   /// get raw gain for capid=0..3
0044   constexpr double rawgain(int fCapId) const { return mRespCorrGain[fCapId] / mRespCorr; }
0045   /// get pedestal for capid=0..3
0046   constexpr double pedestal(int fCapId) const { return mPedestal[fCapId]; }
0047   /// get effective pedestal for capid=0..3
0048   constexpr double effpedestal(int fCapId) const { return mEffectivePedestal[fCapId]; }
0049   /// get response correction factor
0050   constexpr double respcorr() const { return mRespCorr; }
0051   /// get time correction factor
0052   constexpr double timecorr() const { return mTimeCorr; }
0053 
0054 private:
0055   double mRespCorrGain[4];
0056   double mPedestal[4];
0057   double mEffectivePedestal[4];
0058   double mRespCorr;
0059   double mTimeCorr;
0060   double mLUTCorr;
0061 };
0062 
0063 #endif