//////////////////////////////////////////////////////////////////// /// \class RAT::ReconCalibrator /// /// \brief Calibrations for reconstruction /// /// \author Logan Lebanowski /// /// REVISION HISTORY:\n /// 2018 Jul 25 : Logan L.: New File /// 2020 Sep 09 : Logan L.: Add version 2 /// 2021 Mar 21 : Logan L.: Add version 2, external /// 2023 Jun 16 : Anthony Zummo: Add calibration for /// EnergyRThetaFunctional in RAT 7.0.8/9 /// /// \details This class contains functions used to apply /// calibrations to reconstructed energies /// /// RAT releases 6.5.X should use verion 1: /// CalibrateEnergyRSP(isData,energy,rho,z,0,1) /// RAT releases 6.17.4-6.18.14 should use version 2: /// CalibrateEnergyRSP(isData,energy,rho,z,UdotR,2) /// /// RAT releases 7.0.8 and 7.0.9 should use version 1: /// CalibrateEnergyRTF(isData,energy,rho,z) /// /// Positions are to be provided in PSUP coordinates /// (without accounting of the AV offset in z). /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_util_ReconCalibrator__ #define __RAT_util_ReconCalibrator__ #include namespace RAT { namespace DU { class ReconCalibrator { public: static inline ReconCalibrator* Get() { static ReconCalibrator calib; calib.Init(); return &calib; } ReconCalibrator(); void BeginOfRun() {Init();} void Init(); // Calibrate Energy double CalibrateEnergyRSP( bool isData, double energy, double rho, double z, double UdotR=0, int version=1 ) const; double CalibrateEnergyRTF( bool isData, double energy, double rho, double z, int version=1 ) const; private: bool fInitDone; double fZoffsetAV; double fCalibrationMapAVOffset1; double fRadiusAVOuterSqr; std::vector fCoefficientsData1; std::vector fCoefficientsSim1; std::vector fCoefficientsData2; std::vector fCoefficientsSim2; std::vector fCoefficientsExtData2; std::vector fCoefficientsExtSim2; std::vector fRho2Values; std::vector fRhoValues; std::vector fZValues; std::vector fCalibrationMapData1; std::vector fCalibrationMapMC1; double Interpolate2D( const double xInValue, const double yInValue, const std::vector& xValues, const std::vector& yValues, const std::vector& zValues ) const; double GetEntry( const double inValue, const std::vector& values ) const; }; } } #endif