diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/MdtCalibData/MdtSlewCorFuncHardcoded.h b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/MdtCalibData/MdtSlewCorFuncHardcoded.h index be54a41dfe05fedca205be4ec5510f026b58a030..16a62211a3bf30c6c1af6f2c5cc518513695fb13 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/MdtCalibData/MdtSlewCorFuncHardcoded.h +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/MdtCalibData/MdtSlewCorFuncHardcoded.h @@ -14,17 +14,11 @@ namespace MuonCalib { class MdtSlewCorFuncHardcoded : public IMdtSlewCorFunc { public: explicit MdtSlewCorFuncHardcoded( const CalibFunc::ParVec& vec ) : IMdtSlewCorFunc(vec){} - inline virtual std::string name() const { return "MdtSlewCorFuncHardCoded"; } + inline virtual std::string name() const override { return "MdtSlewCorFuncHardCoded"; } static unsigned int nUsedPar() { return 0; } - virtual double correction(double t, double adc) const; - static double calibrated_p(const double &adc); - static const std::vector<double> initialize_LUT(); + virtual double correction(double t, double adc) const override; + - private: - // s_LUT is vector of timeslew correction values [ns] using ADC ticks as index - // It is static since all calibration regions use the same correction function. - static const std::vector<double> s_LUT; - }; } //namespace MuonCalib diff --git a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/MdtSlewCorFuncHardcoded.cxx b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/MdtSlewCorFuncHardcoded.cxx index 8074f876a20a77b51789040d7ec6cc7cc42f69d8..0ffb632c40f90bd42a108c0e710780ba270e72ea 100644 --- a/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/MdtSlewCorFuncHardcoded.cxx +++ b/MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData/src/MdtSlewCorFuncHardcoded.cxx @@ -19,32 +19,18 @@ namespace MuonCalib { -const std::vector<double> MdtSlewCorFuncHardcoded::s_LUT = MdtSlewCorFuncHardcoded::initialize_LUT(); - -const std::vector<double> MdtSlewCorFuncHardcoded::initialize_LUT() { +double MdtSlewCorFuncHardcoded::correction(double /*t*/, double adc) const { // Timeslew correction is negligible (<0.05 ns) for ADC>400 so do not bother computing it. // In addition there are very few hits with ADC>400 // Constant 109 is from an optimization of the timeslew correction // calibrated_p(i) is the integrated charge as a function of ADC - std::vector<double> LUT; - LUT.reserve(400); - -for( int i=0; i<400; i++ ) { - LUT.push_back(109./calibrated_p(i)); - } - return LUT; -} - -double MdtSlewCorFuncHardcoded::correction(double /*t*/, double adc) const { - if( adc>400. || adc<0. ) return 0.; - return s_LUT[static_cast<int>(adc)]; -} - -// Convert ADC to integrated charge for AMT chip, see ATL-MUON-2002-003 -double MdtSlewCorFuncHardcoded::calibrated_p(const double &adc) { + if( adc> 400. || adc<0. ) return 0.; + constexpr double A = 109. * std::exp(-1.11925e+00 ); constexpr double adc_chan_conversion = 25./32.; - double w = adc*adc_chan_conversion; //ADC to ns - return std::exp(1.11925e+00 + 2.08708e-02*w); + constexpr double Lambda = -2.08708e-02*adc_chan_conversion; //ADC to ns + const int adc_int = adc; + // Convert ADC to integrated charge for AMT chip, see ATL-MUON-2002-003 + return A * std::exp( adc_int * Lambda); } } //namespace MuonCalib