26 declareInterface<eFEXegAlgo>(
this);
39 return StatusCode::SUCCESS;
48 return StatusCode::FAILURE;
51 return StatusCode::SUCCESS;
99 unsigned int coresum = 0;
100 unsigned int totalsum = 0;
101 unsigned int envsum = 0;
121 for (
int i=iTotalStart;
i<=iTotalEnd; ++
i) {
122 for(
int j=0; j<=2; ++j) {
123 if (
i>=iCoreStart && i <= iCoreEnd && j>=phiStart && j<=phiEnd) {
129 totalsum += tmptot_et;
134 envsum = totalsum - coresum;
137 if (coresum > 0xffff) coresum = 0xffff;
138 if (envsum > 0xffff) envsum = 0xffff;
141 retavec.push_back(coresum);
142 retavec.push_back(envsum);
148 unsigned int hadsum = 0;
149 unsigned int emsum = 0;
160 for (
int i=0;
i<3; ++
i) {
161 for (
int j=0; j<=2; ++j) {
175 for (
int i=iCoreStart;
i<=iCoreEnd; ++
i) {
176 for(
int j=0; j<=2; ++j) {
177 unsigned int tmp_et_a, tmp_et_b;
180 emsum += ( tmp_et_a + tmp_et_b );
192 for (
int i = 0;
i < 3; ++
i) {
193 for (
int j = 0; j <= 2; ++j) {
201 if (j == 1 && (
i == 1 ||
i == phi2)) {
215 for (
int i = iCoreStart;
i <= iCoreEnd; ++
i) {
216 for (
int j = phiStart; j <= phiEnd; ++j) {
217 unsigned int tmp_et_a, tmp_et_b;
220 emsum += (tmp_et_a + tmp_et_b);
225 if (emsum > 0xffff) emsum = 0xffff;
226 if (hadsum > 0xffff) hadsum = 0xffff;
229 rhadvec.push_back(emsum);
230 rhadvec.push_back(hadsum);
235 unsigned int numer = 0;
236 unsigned int den = 0;
240 int iStart = m_seedID - 2;
241 int iEnd = m_seedID + 2;
243 for (
int i = iStart;
i <= iEnd; ++
i) {
244 int diff =
i - m_seedID;
246 for (
int j = 0; j <= 2; ++j) {
248 getWindowET(1, j,
i,
eT);
259 if (numer > 0xffff) numer = 0xffff;
262 output.push_back(den);
263 output.push_back(numer);
272 if (m_seed_UnD) phiUpDownID = 2;
275 cellETs.resize(16,0);
278 getWindowET(0, 1, 0, cellETs[0]);
279 getWindowET(0, phiUpDownID, 0, cellETs[1]);
281 getWindowET(1, 1, m_seedID, cellETs[2]);
282 getWindowET(1, 1, m_seedID - 1, cellETs[3]);
283 getWindowET(1, 1, m_seedID + 1, cellETs[4]);
285 getWindowET(1, phiUpDownID, m_seedID, cellETs[5]);
286 getWindowET(1, phiUpDownID, m_seedID - 1, cellETs[6]);
287 getWindowET(1, phiUpDownID, m_seedID + 1, cellETs[7]);
289 getWindowET(2, 1, m_seedID, cellETs[8]);
290 getWindowET(2, 1, m_seedID - 1, cellETs[9]);
291 getWindowET(2, 1, m_seedID + 1, cellETs[10]);
293 getWindowET(2, phiUpDownID, m_seedID, cellETs[11]);
294 getWindowET(2, phiUpDownID, m_seedID - 1, cellETs[12]);
295 getWindowET(2, phiUpDownID, m_seedID + 1, cellETs[13]);
297 getWindowET(3, 1, 0, cellETs[14]);
298 getWindowET(3, phiUpDownID, 0, cellETs[15]);
307 std::vector<unsigned int> clusterCells;
308 getClusterCells(clusterCells);
312 unsigned int PS_ET = 0;
314 if(m_algoVersion==0) {
315 PS_ET = dmCorrection(clusterCells[0], 0)
316 + dmCorrection(clusterCells[1], 0);
319 PS_ET = dmCorrection(clusterCells[0], 0);
320 if ( ((m_efexid%3) == 0 && m_fpgaid == 0) || ((m_efexid%3) == 2 && m_fpgaid == 3)) {
321 PS_ET += dmCorrection(clusterCells[1], 0);
324 unsigned int L1_ET = dmCorrection(clusterCells[2], 1)
325 + dmCorrection(clusterCells[3], 1)
326 + dmCorrection(clusterCells[4], 1)
327 + dmCorrection(clusterCells[5], 1)
328 + dmCorrection(clusterCells[6], 1)
329 + dmCorrection(clusterCells[7], 1);
330 unsigned int L2_ET = dmCorrection(clusterCells[8], 2)
331 + dmCorrection(clusterCells[9], 2)
332 + dmCorrection(clusterCells[10], 2)
333 + dmCorrection(clusterCells[11], 2)
334 + dmCorrection(clusterCells[12], 2)
335 + dmCorrection(clusterCells[13], 2);
336 unsigned int L3_ET = clusterCells[14] + clusterCells[15];
339 unsigned int totET = PS_ET + L1_ET + L2_ET + L3_ET;
342 if (totET > 0xffff) totET = 0xffff;
352 for (
const auto&
p : dmCorrections) {
353 if (
p.first < 25 ||
p.first >= 50)
continue;
354 m_corrections[0][
p.first - 25] =
p.second[
"EmPS"].data<
int>();
355 m_corrections[1][
p.first - 25] =
p.second[
"EmFR"].data<
int>();
356 m_corrections[2][
p.first - 25] =
p.second[
"EmMD"].data<
int>();
358 msg <<
MSG::DEBUG <<
"DM Correction for etaIdx=" << (
p.first - 25) <<
" : [" << m_corrections[0][
p.first - 25] <<
","
359 << m_corrections[1][
p.first - 25] <<
"," << m_corrections[2][
p.first - 25] <<
"]"
367 if ( !m_dmCorr ||
layer > 2 )
return ET;
371 int efexEta = m_efexid%3;
375 ieta = 8 + m_fpgaid*4 + m_central_eta - 1;
377 else if (efexEta == 1 && m_fpgaid > 1) {
379 ieta = (m_fpgaid-2)*4 + m_central_eta - 1;
381 else if (efexEta == 1) {
383 ieta = (1-m_fpgaid)*4 + (4-m_central_eta);
387 ieta = 8 + 4*(3-m_fpgaid) + (4-m_central_eta);
390 static std::once_flag
flag;
391 std::call_once(
flag, [&]() {
393 if (!m_dmCorrectionsKey.empty()) {
395 SG::ReadCondHandle <CondAttrListCollection> dmCorrections{m_dmCorrectionsKey };
396 if (dmCorrections.isValid()) {
397 if(dmCorrections->size()==0 && Gaudi::Hive::currentContext().eventID().time_stamp()>1672527600) {
398 ATH_MSG_ERROR(
"No dead material corrections found in conditions database for this event in folder " << m_dmCorrectionsKey.key());
399 throw std::runtime_error(
"No dead material corrections found in database for this event");
408 unsigned int factor = m_corrections.corr(
layer, ieta);
416 for (
int bit = 6; bit >= 0; bit--) {
418 if (factor & (1<<bit))
428 std::unique_ptr<eFEXegTOB>
out = std::make_unique<eFEXegTOB>();
431 std::vector<unsigned int> temvector;
436 out->setWstotNum(temvector[1]);
437 out->setWstotDen(temvector[0]);
439 out->setRhadEM(temvector[0]);
440 out->setRhadHad(temvector[1]);
442 out->setRetaCore(temvector[0]);
443 out->setRetaEnv(temvector[1]);
454 if ((m_efexid%3 == 0) && (m_fpgaid == 0) && (m_central_eta == 0)) {
465 }
else if (SCID>=0 && SCID<4) {
473 if ((m_efexid%3 == 2) && (m_fpgaid == 3) && (m_central_eta == 5)) {
487 if (outET > 0xffff) outET = 0xffff;
495 std::vector<unsigned int> & RetaSums,
496 std::vector<unsigned int> & RhadSums,
497 std::vector<unsigned int> & WstotSums)
517 unsigned int tmpID = 999;
518 unsigned int maxET = 0;
520 for (
int i=0;
i<4 ; ++
i) {
527 unsigned int iSeedET;
529 unsigned int cETDown;
537 unsigned int lETDown;
545 unsigned int rETDown;
549 if (iSeedET>=lET && iSeedET>rET
550 && iSeedET>=lETUp && iSeedET>cETUp && iSeedET>rETUp
551 && iSeedET>=lETDown && iSeedET>=cETDown && iSeedET>rETDown) {
552 if (iSeedET>=maxET) {
562 unsigned int tmp_et_up, tmp_et_down;
565 if (tmp_et_up >= tmp_et_down) {