#include "CalibCalorimetry/CastorCalib/interface/CastorTimeSlew.h"
#include <cmath>

// NOTE check these numbers
static const double tzero[3] = {23.960177, 13.307784, 9.109694};
static const double slope[3] = {-3.178648, -1.556668, -1.075824};
static const double tmax[3] = {16.00, 10.00, 6.25};

double CastorTimeSlew::delay(double fC, BiasSetting bias) {
  double rawDelay = tzero[bias] + slope[bias] * log(fC);
  return (rawDelay < 0) ? (0) : ((rawDelay > tmax[bias]) ? (tmax[bias]) : (rawDelay));
}
