16 : mAlphas_(nullptr), mAPDPNRatiosRef_(nullptr), mAPDPNRatios_(nullptr), mLinearCorrections_(nullptr) {}
27 float correctionFactor = 1.0;
45 edm::LogError(
"EcalLaserDbService") <<
" DetId is NOT in ECAL" << endl;
46 return correctionFactor;
65 edm::LogError(
"EcalLaserDbService") <<
" DetId is NOT in ECAL Barrel or Endcap" << endl;
66 return correctionFactor;
74 if (itratio != laserRatiosMap.
end()) {
75 apdpnpair = (*itratio);
77 edm::LogError(
"EcalLaserDbService") <<
"error with laserRatiosMap!" << endl;
78 return correctionFactor;
81 if (iLM - 1 < (
int)laserTimeMap.size()) {
84 edm::LogError(
"EcalLaserDbService") <<
"error with laserTimeMap!" << endl;
85 return correctionFactor;
89 if (itlin != linearValueMap.
end()) {
92 edm::LogError(
"EcalLaserDbService") <<
"error with linearValueMap!" << endl;
93 return correctionFactor;
96 if (iLM - 1 < (
int)linearTimeMap.size()) {
97 linTimes = linearTimeMap[iLM - 1];
99 edm::LogError(
"EcalLaserDbService") <<
"error with laserTimeMap!" << endl;
100 return correctionFactor;
104 if (itref != laserRefMap.
end()) {
107 edm::LogError(
"EcalLaserDbService") <<
"error with laserRefMap!" << endl;
108 return correctionFactor;
112 if (italpha != laserAlphaMap.
end()) {
115 edm::LogError(
"EcalLaserDbService") <<
"error with laserAlphaMap!" << endl;
116 return correctionFactor;
135 apdpnpair = getPair(laserRatiosMap);
136 linValues = getLinear(linearValueMap);
137 apdpnref = getCond(laserRefMap);
138 alpha = getCond(laserAlphaMap);
140 if (iLM - 1 < (
int)laserTimeMap.size()) {
143 edm::LogError(
"EcalLaserDbService") <<
"error with laserTimeMap!" << endl;
144 return correctionFactor;
147 if (iLM - 1 < (
int)linearTimeMap.size()) {
148 linTimes = linearTimeMap[iLM - 1];
150 edm::LogError(
"EcalLaserDbService") <<
"error with laserTimeMap!" << endl;
151 return correctionFactor;
167 long long t_i = 0, t_f = 0;
168 float p_i = 0, p_f = 0;
169 long long lt_i = 0, lt_f = 0;
170 float lp_i = 0, lp_f = 0;
205 }
else if (
t < linTimes.
t1.
value()) {
211 }
else if (
t > linTimes.
t3.
value()) {
218 if (apdpnref != 0 && (t_i - t_f) != 0 && (lt_i - lt_f) != 0) {
220 float interpolatedLaserResponse = p_i / apdpnref +
float(
tt - t_i) * (p_f - p_i) / (apdpnref *
float(t_f - t_i));
221 float interpolatedLinearResponse =
222 lp_i / apdpnref +
float(
tt - lt_i) * (lp_f - lp_i) / (apdpnref *
float(lt_f - lt_i));
224 if (interpolatedLinearResponse > 2.
f || interpolatedLinearResponse < 0.1
f)
225 interpolatedLinearResponse = 1.f;
226 if (interpolatedLaserResponse <= 0.) {
230 edm::LogError(
"EcalLaserDbService") <<
"Interpolated Laser correction <0 for detid " << xid.
rawId();
233 return correctionFactor;
236 float interpolatedTransparencyResponse = interpolatedLaserResponse / interpolatedLinearResponse;
238 correctionFactor = 1.f / (
std::pow(interpolatedTransparencyResponse,
alpha) * interpolatedLinearResponse);
242 edm::LogError(
"EcalLaserDbService") <<
"apdpnref (" << apdpnref <<
") "
243 <<
"or t_i-t_f (" << (t_i - t_f) <<
" is zero!";
244 return correctionFactor;
247 return correctionFactor;