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++)
272 ATH_MSG_FATAL(
"BDT tau algo and heuristic tau algo should agree on seeding for all TOBs");
273 return StatusCode::FAILURE;
279 unsigned int ptTauMinToTopoCounts = thr_eTAU.ptMinToTopoCounts();
294 std::vector<unsigned int> threshRCore;
295 threshRCore.push_back(iso_loose.rCore_fw());
296 threshRCore.push_back(iso_medium.rCore_fw());
297 threshRCore.push_back(iso_tight.rCore_fw());
299 std::vector<unsigned int> threshRHad;
300 threshRHad.push_back(iso_loose.rHad_fw());
301 threshRHad.push_back(iso_medium.rHad_fw());
302 threshRHad.push_back(iso_tight.rHad_fw());
305 std::vector<unsigned int> rCoreVec;
308 std::vector<unsigned int> rHadVec;
312 unsigned int bdtScore = 0;
313 unsigned int bdtCondition = 0;
314 unsigned int bdtRHadWP = 0;
317 unsigned int rCoreWP = 0;
318 unsigned int rHadWP = 0;
321 unsigned int RcoreBitS = 3;
322 unsigned int RhadBitS = 3;
324 unsigned int maxEtCountsTau = thr_eTAU.maxEtCounts(
m_eFexStep);
325 unsigned int bdtMinEtCounts = thr_eTAU.minIsoEtCounts(
m_eFexStep);
326 if (eTauTobEt >= maxEtCountsTau) {
330 SetIsoWP(rCoreVec,threshRCore,rCoreWP,RcoreBitS);
331 SetIsoWP(rHadVec,threshRHad,rHadWP,RhadBitS);
336 std::vector<unsigned int> threshBDT;
337 threshBDT.push_back(iso_loose.rCore_fw());
338 threshBDT.push_back(iso_medium.rCore_fw());
339 threshBDT.push_back(iso_tight.rCore_fw());
340 m_eFEXtauBDTAlgoTool->setThresholds(threshRHad, threshBDT, ptTauMinToTopoInEfexCounts, maxEtCountsTau, bdtMinEtCounts);
358 int phi_ind = iphi - 1;
361 std::vector<uint32_t> xtobwords;
362 std::vector<uint32_t> xtobwordsBDT;
365 << phi_ind <<
", eTauBDTTobEt: " << eTauBDTTobEt
366 <<
", eTauTobEt: " << eTauTobEt <<
", ptTauMinToTopoCounts: "
367 << ptTauMinToTopoCounts <<
", maxEtCountsTau: " << maxEtCountsTau
368 <<
", bdtScore: " << bdtScore <<
" bdtMinEtCounts: " << bdtMinEtCounts <<
" bdtRHadWP " << bdtRHadWP);
370 uint32_t tobwordBDT =
m_eFEXFormTOBsTool->formTauTOBWord(
m_id, eta_ind, phi_ind, eTauBDTTobEt, bdtRHadWP, bdtCondition, bdtSeed,0, ptTauMinToTopoCounts, tauAlgoVersion);
371 xtobwordsBDT =
m_eFEXFormTOBsTool->formTauxTOBWords(
m_efexid,
m_id, eta_ind, phi_ind, eTauBDTTobEt, bdtRHadWP, bdtCondition, bdtSeed, 0, ptTauMinToTopoCounts, tauAlgoVersion, bdtScore);
373 xtobwords =
m_eFEXFormTOBsTool->formTauxTOBWords(
m_efexid,
m_id, eta_ind, phi_ind, eTauTobEt, rHadWP, rCoreWP, seed, und, ptTauMinToTopoCounts, 0, 0);
376 tmp_tau_tob->setFPGAID(
m_id);
378 tmp_tau_tob->setEta(ieta);
379 tmp_tau_tob->setPhi(iphi);
380 tmp_tau_tob->setTobword(tobword);
381 tmp_tau_tob->setxTobword0(xtobwords[0]);
382 tmp_tau_tob->setxTobword1(xtobwords[1]);
385 tmp_tau_tob_bdt->setFPGAID(
m_id);
386 tmp_tau_tob_bdt->seteFEXID(
m_efexid);
387 tmp_tau_tob_bdt->setEta(ieta);
388 tmp_tau_tob_bdt->setPhi(iphi);
389 tmp_tau_tob_bdt->setTobword(tobwordBDT);
390 tmp_tau_tob_bdt->setxTobword0(xtobwordsBDT[0]);
391 tmp_tau_tob_bdt->setxTobword1(xtobwordsBDT[1]);
394 if ((inputOutputCollection->getdooutput()) && ( tobword != 0 )) {
395 inputOutputCollection->addValue_tau(
"isCentralTowerSeed",
m_eFEXtauAlgoTool->isCentralTowerSeed());
398 inputOutputCollection->addValue_tau(
"Eta", ieta);
399 inputOutputCollection->addValue_tau(
"Phi", iphi);
403 inputOutputCollection->addValue_tau(
"CenterTowerEt", centerTower->
getTotalET());
404 inputOutputCollection->addValue_tau(
"OneOffEtaTowerEt", oneOffEtaTower ? oneOffEtaTower->
getTotalET() : 0);
405 inputOutputCollection->addValue_tau(
"OneBelowEtaTowerEt", oneBelowEtaTower ? oneBelowEtaTower->
getTotalET() : 0);
406 inputOutputCollection->addValue_tau(
"FloatEta", centerTower->
eta() * centerTower->
getPosNeg());
407 inputOutputCollection->addValue_tau(
"FloatPhi", centerTower->
phi());
408 inputOutputCollection->addValue_tau(
"RCoreCore", rCoreVec[0]);
409 inputOutputCollection->addValue_tau(
"RCoreEnv", rCoreVec[1]);
410 inputOutputCollection->addValue_tau(
"RealRCore",
m_eFEXtauAlgoTool->getRealRCore());
411 inputOutputCollection->addValue_tau(
"RCoreWP", rCoreWP);
412 inputOutputCollection->addValue_tau(
"RHadCore", rHadVec[0]);
413 inputOutputCollection->addValue_tau(
"RHadEnv", rHadVec[1]);
414 inputOutputCollection->addValue_tau(
"RealRHad",
m_eFEXtauAlgoTool->getRealRHad());
416 inputOutputCollection->addValue_tau(
"RHadWP", rHadWP);
417 inputOutputCollection->addValue_tau(
"Seed", seed);
418 inputOutputCollection->addValue_tau(
"UnD", und);
419 inputOutputCollection->addValue_tau(
"BDTScore", bdtScore);
420 inputOutputCollection->addValue_tau(
"BDTCondition", bdtCondition);
421 inputOutputCollection->addValue_tau(
"eFEXID",
m_efexid);
422 inputOutputCollection->addValue_tau(
"FPGAID",
m_id);
425 inputOutputCollection->fill_tau();
434 return StatusCode::SUCCESS;