17 mAPDPNRatiosRef_(nullptr),
18 mAPDPNRatios_(nullptr),
19 mLinearCorrections_(nullptr),
20 maxExtrapolationTime_(0) {}
31 float correctionFactor = 1.0;
49 edm::LogError(
"EcalLaserDbService") <<
" DetId is NOT in ECAL" << endl;
50 return correctionFactor;
69 edm::LogError(
"EcalLaserDbService") <<
" DetId is NOT in ECAL Barrel or Endcap" << endl;
70 return correctionFactor;
78 if (itratio != laserRatiosMap.
end()) {
79 apdpnpair = (*itratio);
81 edm::LogError(
"EcalLaserDbService") <<
"error with laserRatiosMap!" << endl;
82 return correctionFactor;
85 if (iLM - 1 < (
int)laserTimeMap.size()) {
88 edm::LogError(
"EcalLaserDbService") <<
"error with laserTimeMap!" << endl;
89 return correctionFactor;
93 if (itlin != linearValueMap.
end()) {
96 edm::LogError(
"EcalLaserDbService") <<
"error with linearValueMap!" << endl;
97 return correctionFactor;
100 if (iLM - 1 < (
int)linearTimeMap.size()) {
101 linTimes = linearTimeMap[iLM - 1];
103 edm::LogError(
"EcalLaserDbService") <<
"error with laserTimeMap!" << endl;
104 return correctionFactor;
108 if (itref != laserRefMap.
end()) {
111 edm::LogError(
"EcalLaserDbService") <<
"error with laserRefMap!" << endl;
112 return correctionFactor;
116 if (italpha != laserAlphaMap.
end()) {
119 edm::LogError(
"EcalLaserDbService") <<
"error with laserAlphaMap!" << endl;
120 return correctionFactor;
139 apdpnpair = getPair(laserRatiosMap);
140 linValues = getLinear(linearValueMap);
141 apdpnref = getCond(laserRefMap);
142 alpha = getCond(laserAlphaMap);
144 if (iLM - 1 < (
int)laserTimeMap.size()) {
147 edm::LogError(
"EcalLaserDbService") <<
"error with laserTimeMap!" << endl;
148 return correctionFactor;
151 if (iLM - 1 < (
int)linearTimeMap.size()) {
152 linTimes = linearTimeMap[iLM - 1];
154 edm::LogError(
"EcalLaserDbService") <<
"error with laserTimeMap!" << endl;
155 return correctionFactor;
171 long long t_i = 0, t_f = 0;
172 float p_i = 0, p_f = 0;
173 long long lt_i = 0, lt_f = 0;
174 float lp_i = 0, lp_f = 0;
199 long long t_laser =
t;
213 }
else if (
t < linTimes.
t1.
value()) {
219 }
else if (
t > linTimes.
t3.
value()) {
226 if (apdpnref != 0 && (t_i - t_f) != 0 && (lt_i - lt_f) != 0) {
228 float interpolatedLaserResponse =
229 p_i / apdpnref +
float(t_laser - t_i) * (p_f - p_i) / (apdpnref *
float(t_f - t_i));
230 float interpolatedLinearResponse =
231 lp_i / apdpnref +
float(
tt - lt_i) * (lp_f - lp_i) / (apdpnref *
float(lt_f - lt_i));
233 if (interpolatedLinearResponse > 2.
f || interpolatedLinearResponse < 0.1
f)
234 interpolatedLinearResponse = 1.f;
235 if (interpolatedLaserResponse <= 0.) {
239 edm::LogError(
"EcalLaserDbService") <<
"Interpolated Laser correction <0 for detid " << xid.
rawId();
242 return correctionFactor;
245 float interpolatedTransparencyResponse = interpolatedLaserResponse / interpolatedLinearResponse;
247 correctionFactor = 1.f / (
std::pow(interpolatedTransparencyResponse,
alpha) * interpolatedLinearResponse);
251 edm::LogError(
"EcalLaserDbService") <<
"apdpnref (" << apdpnref <<
") " 252 <<
"or t_i-t_f (" << (t_i - t_f) <<
" is zero!";
253 return correctionFactor;
256 return correctionFactor;
const EcalLaserAPDPNRatiosMap & getLaserMap() const
const EcalValueMap & getValueMap() const
const EcalLinearCorrections * getLinearCorrections() const
ErrorMapT channelsWithInvalidCorrection_
unsigned long long maxExtrapolationTime_
static int lmr(EBGlobalCoord ieta, EBGlobalCoord iphi)
Log< level::Error, false > LogError
constexpr Detector det() const
get the detector field from this detid
const EcalTimeMap & getTimeMap() const
U second(std::pair< T, U > const &p)
const EcalLinearCorrections * mLinearCorrections_
const EcalLaserAlphas * getAlphas() const
const EcalLaserAPDPNRatiosRef * mAPDPNRatiosRef_
const EcalLaserTimeStampMap & getTimeMap() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
unsigned long long TimeValue_t
std::vector< Times > EcalTimeMap
const_iterator find(uint32_t rawId) const
#define TYPELOOKUP_DATA_REG(_dataclass_)
TimeValue_t value() const
std::vector< EcalLaserTimeStamp > EcalLaserTimeStampMap
constexpr uint32_t rawId() const
get the raw id
const EcalLaserAPDPNRatios * mAPDPNRatios_
std::vector< Item >::const_iterator const_iterator
const EcalLaserAlphas * mAlphas_
int hashedIndex() const
get a compact index for arrays
const self & getMap() const
const_iterator end() const
static int lmr(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
const EcalLaserAPDPNRatiosRef * getAPDPNRatiosRef() const
Power< A, B >::type pow(const A &a, const B &b)
const EcalLaserAPDPNRatios * getAPDPNRatios() const