81 return StatusCode::FAILURE;
88 auto & thr_eEM = l1Menu->thrExtraInfo().eEM();
89 auto & thr_eTAU = l1Menu->thrExtraInfo().eTAU();
91 auto emAlgoVersion = thr_eEM.algoVersion();
92 auto tauAlgoVersion = thr_eTAU.algoVersion();
109 for(
int ieta =
min_eta; ieta < overflow_eta; ieta++) {
110 for(
int iphi = 1; iphi < 9; iphi++) {
136 unsigned int ptMinToTopoCounts = thr_eEM.ptMinToTopoCounts();
148 std::vector<unsigned int> threshReta;
149 threshReta.push_back(iso_loose.reta_fw());
150 threshReta.push_back(iso_medium.reta_fw());
151 threshReta.push_back(iso_tight.reta_fw());
153 std::vector<unsigned int> threshRhad;
154 threshRhad.push_back(iso_loose.rhad_fw());
155 threshRhad.push_back(iso_medium.rhad_fw());
156 threshRhad.push_back(iso_tight.rhad_fw());
158 std::vector<unsigned int> threshWstot;
159 threshWstot.push_back(iso_loose.wstot_fw());
160 threshWstot.push_back(iso_medium.wstot_fw());
161 threshWstot.push_back(iso_tight.wstot_fw());
163 ATH_MSG_DEBUG(
"ieta=" << ieta <<
" loose => reta_fw=" << threshReta[0] <<
", rhad_fw=" << threshRhad[0] <<
", wstot_fw=" << threshWstot[0]);
164 ATH_MSG_DEBUG(
"ieta=" << ieta <<
" medium => reta_fw=" << threshReta[1] <<
", rhad_fw=" << threshRhad[1] <<
", wstot_fw=" << threshWstot[1]);
165 ATH_MSG_DEBUG(
"ieta=" << ieta <<
" tight => reta_fw=" << threshReta[2] <<
", rhad_fw=" << threshRhad[2] <<
", wstot_fw=" << threshWstot[2]);
168 std::vector<unsigned int> RetaCoreEnv;
170 std::vector<unsigned int> RhadEMHad;
172 std::vector<unsigned int> WstotDenNum;
176 unsigned int RetaWP = 0;
177 unsigned int RhadWP = 0;
178 unsigned int WstotWP = 0;
181 unsigned int RetaBitS = 3;
182 unsigned int RhadBitS = 3;
183 unsigned int WstotBitS = 5;
185 unsigned int maxEtCountsEm = thr_eEM.maxEtCounts(
m_eFexStep);
186 if (eEMTobEt >= maxEtCountsEm){
192 SetIsoWP(RetaCoreEnv,threshReta,RetaWP,RetaBitS);
193 SetIsoWP(RhadEMHad,threshRhad,RhadWP,RhadBitS);
194 SetIsoWP(WstotDenNum,threshWstot,WstotWP,WstotBitS);
197 int phi_ind = iphi - 1;
200 uint32_t tobword =
m_eFEXFormTOBsTool->formEmTOBWord(
m_id,eta_ind,phi_ind,RhadWP,WstotWP,RetaWP,seed,und,eEMTobEt,ptMinToTopoCounts, emAlgoVersion);
201 std::vector<uint32_t> xtobwords =
m_eFEXFormTOBsTool->formEmxTOBWords(
m_efexid,
m_id,eta_ind,phi_ind,RhadWP,WstotWP,RetaWP,seed,und,eEMTobEt,ptMinToTopoCounts, emAlgoVersion);
205 tmp_tob->setFPGAID(
m_id);
207 tmp_tob->setEta(ieta);
208 tmp_tob->setPhi(iphi);
209 tmp_tob->setTobword(tobword);
210 tmp_tob->setxTobword0(xtobwords[0]);
211 tmp_tob->setxTobword1(xtobwords[1]);
214 if (inputOutputCollection->getdooutput() && (tobword != 0) && (eEMTobEt != 0)) {
215 inputOutputCollection->addeFexNumber(
m_efexid);
216 inputOutputCollection->addEMtob(tobword);
217 inputOutputCollection->addValue_eg(
"WstotNum", tmp_tob->getWstotNum());
218 inputOutputCollection->addValue_eg(
"WstotDen", tmp_tob->getWstotDen());
219 inputOutputCollection->addValue_eg(
"RetaNum", tmp_tob->getRetaCore());
220 inputOutputCollection->addValue_eg(
"RetaDen", tmp_tob->getRetaEnv());
221 inputOutputCollection->addValue_eg(
"RhadNum", tmp_tob->getRhadEM());
222 inputOutputCollection->addValue_eg(
"RhadDen", tmp_tob->getRhadHad());
223 inputOutputCollection->addValue_eg(
"haveSeed",
m_eFEXegAlgoTool->hasSeed());
227 inputOutputCollection->addValue_eg(
"eta",
eta);
230 inputOutputCollection->addValue_eg(
"phi",
phi);
231 unsigned int em_et = 9999;
233 inputOutputCollection->addValue_eg(
"em", em_et);
234 unsigned int had_et = 9999;
236 inputOutputCollection->addValue_eg(
"had", had_et);
237 inputOutputCollection->fill_eg();
241 if ( (tobword != 0) && (eEMTobEt != 0) )
m_emTobObjects.push_back(std::move(tmp_tob));
247 for(
int ieta =
min_eta; ieta < overflow_eta; ieta++)
249 for(
int iphi = 1; iphi < 9; iphi++)
273 ATH_MSG_FATAL(
"BDT tau algo and heuristic tau algo should agree on seeding for all TOBs");
274 return StatusCode::FAILURE;
280 unsigned int ptTauMinToTopoCounts = thr_eTAU.ptMinToTopoCounts();
295 std::vector<unsigned int> threshRCore;
296 threshRCore.push_back(iso_loose.rCore_fw());
297 threshRCore.push_back(iso_medium.rCore_fw());
298 threshRCore.push_back(iso_tight.rCore_fw());
300 std::vector<unsigned int> threshRHad;
301 threshRHad.push_back(iso_loose.rHad_fw());
302 threshRHad.push_back(iso_medium.rHad_fw());
303 threshRHad.push_back(iso_tight.rHad_fw());
306 std::vector<unsigned int> rCoreVec;
309 std::vector<unsigned int> rHadVec;
313 unsigned int bdtScore = 0;
314 unsigned int bdtCondition = 0;
315 unsigned int bdtRHadWP = 0;
318 unsigned int rCoreWP = 0;
319 unsigned int rHadWP = 0;
322 unsigned int RcoreBitS = 3;
323 unsigned int RhadBitS = 3;
325 unsigned int maxEtCountsTau = thr_eTAU.maxEtCounts(
m_eFexStep);
326 unsigned int bdtMinEtCounts = thr_eTAU.minIsoEtCounts(
m_eFexStep);
327 if (eTauTobEt >= maxEtCountsTau) {
331 SetIsoWP(rCoreVec,threshRCore,rCoreWP,RcoreBitS);
332 SetIsoWP(rHadVec,threshRHad,rHadWP,RhadBitS);
337 std::vector<unsigned int> threshBDT;
338 threshBDT.push_back(iso_loose.rCore_fw());
339 threshBDT.push_back(iso_medium.rCore_fw());
340 threshBDT.push_back(iso_tight.rCore_fw());
342 m_eFEXtauBDTAlgoTool->setThresholds(threshRHad, threshBDT, ptTauMinToTopoInEfexCounts, maxEtCountsTau, bdtMinEtCounts, (tauAlgoVersion==2) ? 0x0ff0 : maxEtCountsTau);
360 int phi_ind = iphi - 1;
363 std::vector<uint32_t> xtobwords;
364 std::vector<uint32_t> xtobwordsBDT;
367 << phi_ind <<
", eTauBDTTobEt: " << eTauBDTTobEt
368 <<
", eTauTobEt: " << eTauTobEt <<
", ptTauMinToTopoCounts: "
369 << ptTauMinToTopoCounts <<
", maxEtCountsTau: " << maxEtCountsTau
370 <<
", bdtScore: " << bdtScore <<
" bdtMinEtCounts: " << bdtMinEtCounts <<
" bdtRHadWP " << bdtRHadWP);
372 uint32_t tobwordBDT =
m_eFEXFormTOBsTool->formTauTOBWord(
m_id, eta_ind, phi_ind, eTauBDTTobEt, bdtRHadWP, bdtCondition, bdtSeed,0, ptTauMinToTopoCounts, tauAlgoVersion);
373 xtobwordsBDT =
m_eFEXFormTOBsTool->formTauxTOBWords(
m_efexid,
m_id, eta_ind, phi_ind, eTauBDTTobEt, bdtRHadWP, bdtCondition, bdtSeed, 0, ptTauMinToTopoCounts, tauAlgoVersion, bdtScore);
375 xtobwords =
m_eFEXFormTOBsTool->formTauxTOBWords(
m_efexid,
m_id, eta_ind, phi_ind, eTauTobEt, rHadWP, rCoreWP, seed, und, ptTauMinToTopoCounts, 0, 0);
378 tmp_tau_tob->setFPGAID(
m_id);
380 tmp_tau_tob->setEta(ieta);
381 tmp_tau_tob->setPhi(iphi);
382 tmp_tau_tob->setTobword(tobword);
383 tmp_tau_tob->setxTobword0(xtobwords[0]);
384 tmp_tau_tob->setxTobword1(xtobwords[1]);
387 tmp_tau_tob_bdt->setFPGAID(
m_id);
388 tmp_tau_tob_bdt->seteFEXID(
m_efexid);
389 tmp_tau_tob_bdt->setEta(ieta);
390 tmp_tau_tob_bdt->setPhi(iphi);
391 tmp_tau_tob_bdt->setTobword(tobwordBDT);
392 tmp_tau_tob_bdt->setxTobword0(xtobwordsBDT[0]);
393 tmp_tau_tob_bdt->setxTobword1(xtobwordsBDT[1]);
396 if ((inputOutputCollection->getdooutput()) && ( tobword != 0 )) {
397 inputOutputCollection->addValue_tau(
"isCentralTowerSeed",
m_eFEXtauAlgoTool->isCentralTowerSeed());
400 inputOutputCollection->addValue_tau(
"Eta", ieta);
401 inputOutputCollection->addValue_tau(
"Phi", iphi);
405 inputOutputCollection->addValue_tau(
"CenterTowerEt", centerTower->
getTotalET());
406 inputOutputCollection->addValue_tau(
"OneOffEtaTowerEt", oneOffEtaTower ? oneOffEtaTower->
getTotalET() : 0);
407 inputOutputCollection->addValue_tau(
"OneBelowEtaTowerEt", oneBelowEtaTower ? oneBelowEtaTower->
getTotalET() : 0);
408 inputOutputCollection->addValue_tau(
"FloatEta", centerTower->
eta() * centerTower->
getPosNeg());
409 inputOutputCollection->addValue_tau(
"FloatPhi", centerTower->
phi());
410 inputOutputCollection->addValue_tau(
"RCoreCore", rCoreVec[0]);
411 inputOutputCollection->addValue_tau(
"RCoreEnv", rCoreVec[1]);
412 inputOutputCollection->addValue_tau(
"RealRCore",
m_eFEXtauAlgoTool->getRealRCore());
413 inputOutputCollection->addValue_tau(
"RCoreWP", rCoreWP);
414 inputOutputCollection->addValue_tau(
"RHadCore", rHadVec[0]);
415 inputOutputCollection->addValue_tau(
"RHadEnv", rHadVec[1]);
416 inputOutputCollection->addValue_tau(
"RealRHad",
m_eFEXtauAlgoTool->getRealRHad());
418 inputOutputCollection->addValue_tau(
"RHadWP", rHadWP);
419 inputOutputCollection->addValue_tau(
"Seed", seed);
420 inputOutputCollection->addValue_tau(
"UnD", und);
421 inputOutputCollection->addValue_tau(
"BDTScore", bdtScore);
422 inputOutputCollection->addValue_tau(
"BDTCondition", bdtCondition);
423 inputOutputCollection->addValue_tau(
"eFEXID",
m_efexid);
424 inputOutputCollection->addValue_tau(
"FPGAID",
m_id);
427 inputOutputCollection->fill_tau();
436 return StatusCode::SUCCESS;