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()) {
86 timestamp = laserTimeMap[iLM - 1];
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;
127 return isBarrel ? cond.barrel(xind) : cond.endcap(xind);
132 return isBarrel ? cond.barrel(xind) : cond.endcap(xind);
136 return isBarrel ? cond.barrel(xind) : cond.endcap(xind);
139 apdpnpair = getPair(laserRatiosMap);
140 linValues = getLinear(linearValueMap);
141 apdpnref =
getCond(laserRefMap);
142 alpha =
getCond(laserAlphaMap);
144 if (iLM - 1 < (
int)laserTimeMap.size()) {
145 timestamp = laserTimeMap[iLM - 1];
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;
181 }
else if (t >= timestamp.
t2.
value() && t <= timestamp.
t3.
value()) {
186 }
else if (t < timestamp.
t1.
value()) {
192 }
else if (t > timestamp.
t3.
value()) {
199 long long t_laser =
t;
208 }
else if (t >= linTimes.
t2.
value() && t <= linTimes.
t3.
value()) {
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 EcalTimeMap & getTimeMap() const
int hashedIndex() const
get a compact index for arrays
const EcalLaserAPDPNRatios * getAPDPNRatios() const
const self & getMap() const
ErrorMapT channelsWithInvalidCorrection_
float getLaserCorrection(DetId const &xid, edm::Timestamp const &iTime) const
constexpr uint32_t rawId() const
get the raw id
unsigned long long maxExtrapolationTime_
static int lmr(EBGlobalCoord ieta, EBGlobalCoord iphi)
Log< level::Error, false > LogError
U second(std::pair< T, U > const &p)
const EcalLinearCorrections * mLinearCorrections_
const EcalLaserAPDPNRatiosMap & getLaserMap() const
const EcalLaserAPDPNRatiosRef * mAPDPNRatiosRef_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
const EcalValueMap & getValueMap() const
unsigned long long TimeValue_t
std::vector< Times > EcalTimeMap
#define TYPELOOKUP_DATA_REG(_dataclass_)
const EcalLaserAlphas * getAlphas() const
const EcalLaserTimeStampMap & getTimeMap() const
std::vector< EcalLaserTimeStamp > EcalLaserTimeStampMap
const EcalLaserAPDPNRatios * mAPDPNRatios_
std::vector< Item >::const_iterator const_iterator
const EcalLaserAlphas * mAlphas_
const EcalLaserAPDPNRatiosRef * getAPDPNRatiosRef() const
const EcalLinearCorrections * getLinearCorrections() const
const_iterator find(uint32_t rawId) const
const_iterator end() const
TimeValue_t value() const
static int lmr(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Power< A, B >::type pow(const A &a, const B &b)
constexpr Detector det() const
get the detector field from this detid