81 return StatusCode::FAILURE;
88 auto & thr_eEM = l1Menu->thrExtraInfo().eEM();
89 auto & thr_eTAU = l1Menu->thrExtraInfo().eTAU();
105 for(
int ieta =
min_eta; ieta < overflow_eta; ieta++) {
106 for(
int iphi = 1; iphi < 9; iphi++) {
132 unsigned int ptMinToTopoCounts = thr_eEM.ptMinToTopoCounts();
144 std::vector<unsigned int> threshReta;
145 threshReta.push_back(iso_loose.reta_fw());
146 threshReta.push_back(iso_medium.reta_fw());
147 threshReta.push_back(iso_tight.reta_fw());
149 std::vector<unsigned int> threshRhad;
150 threshRhad.push_back(iso_loose.rhad_fw());
151 threshRhad.push_back(iso_medium.rhad_fw());
152 threshRhad.push_back(iso_tight.rhad_fw());
154 std::vector<unsigned int> threshWstot;
155 threshWstot.push_back(iso_loose.wstot_fw());
156 threshWstot.push_back(iso_medium.wstot_fw());
157 threshWstot.push_back(iso_tight.wstot_fw());
159 ATH_MSG_DEBUG(
"ieta=" << ieta <<
" loose => reta_fw=" << threshReta[0] <<
", rhad_fw=" << threshRhad[0] <<
", wstot_fw=" << threshWstot[0]);
160 ATH_MSG_DEBUG(
"ieta=" << ieta <<
" medium => reta_fw=" << threshReta[1] <<
", rhad_fw=" << threshRhad[1] <<
", wstot_fw=" << threshWstot[1]);
161 ATH_MSG_DEBUG(
"ieta=" << ieta <<
" tight => reta_fw=" << threshReta[2] <<
", rhad_fw=" << threshRhad[2] <<
", wstot_fw=" << threshWstot[2]);
164 std::vector<unsigned int> RetaCoreEnv;
166 std::vector<unsigned int> RhadEMHad;
168 std::vector<unsigned int> WstotDenNum;
172 unsigned int RetaWP = 0;
173 unsigned int RhadWP = 0;
174 unsigned int WstotWP = 0;
177 unsigned int RetaBitS = 3;
178 unsigned int RhadBitS = 3;
179 unsigned int WstotBitS = 5;
181 unsigned int maxEtCountsEm = thr_eEM.maxEtCounts(
m_eFexStep);
182 if (eEMTobEt >= maxEtCountsEm){
188 SetIsoWP(RetaCoreEnv,threshReta,RetaWP,RetaBitS);
189 SetIsoWP(RhadEMHad,threshRhad,RhadWP,RhadBitS);
190 SetIsoWP(WstotDenNum,threshWstot,WstotWP,WstotBitS);
193 int phi_ind = iphi - 1;
197 std::vector<uint32_t> xtobwords =
m_eFEXFormTOBsTool->formEmxTOBWords(
m_efexid,
m_id,eta_ind,phi_ind,RhadWP,WstotWP,RetaWP,seed,und,eEMTobEt,ptMinToTopoCounts);
201 tmp_tob->setFPGAID(
m_id);
203 tmp_tob->setEta(ieta);
204 tmp_tob->setPhi(iphi);
205 tmp_tob->setTobword(tobword);
206 tmp_tob->setxTobword0(xtobwords[0]);
207 tmp_tob->setxTobword1(xtobwords[1]);
210 if (inputOutputCollection->getdooutput() && (tobword != 0) && (eEMTobEt != 0)) {
211 inputOutputCollection->addeFexNumber(
m_efexid);
212 inputOutputCollection->addEMtob(tobword);
213 inputOutputCollection->addValue_eg(
"WstotNum", tmp_tob->getWstotNum());
214 inputOutputCollection->addValue_eg(
"WstotDen", tmp_tob->getWstotDen());
215 inputOutputCollection->addValue_eg(
"RetaNum", tmp_tob->getRetaCore());
216 inputOutputCollection->addValue_eg(
"RetaDen", tmp_tob->getRetaEnv());
217 inputOutputCollection->addValue_eg(
"RhadNum", tmp_tob->getRhadEM());
218 inputOutputCollection->addValue_eg(
"RhadDen", tmp_tob->getRhadHad());
219 inputOutputCollection->addValue_eg(
"haveSeed",
m_eFEXegAlgoTool->hasSeed());
223 inputOutputCollection->addValue_eg(
"eta", eta);
226 inputOutputCollection->addValue_eg(
"phi", phi);
227 unsigned int em_et = 9999;
229 inputOutputCollection->addValue_eg(
"em", em_et);
230 unsigned int had_et = 9999;
232 inputOutputCollection->addValue_eg(
"had", had_et);
233 inputOutputCollection->fill_eg();
237 if ( (tobword != 0) && (eEMTobEt != 0) )
m_emTobObjects.push_back(std::move(tmp_tob));
243 for(
int ieta =
min_eta; ieta < overflow_eta; ieta++)
245 for(
int iphi = 1; iphi < 9; iphi++)
268 ATH_MSG_FATAL(
"BDT tau algo and heuristic tau algo should agree on seeding for all TOBs");
269 return StatusCode::FAILURE;
275 unsigned int ptTauMinToTopoCounts = thr_eTAU.ptMinToTopoCounts();
290 std::vector<unsigned int> threshRCore;
291 threshRCore.push_back(iso_loose.rCore_fw());
292 threshRCore.push_back(iso_medium.rCore_fw());
293 threshRCore.push_back(iso_tight.rCore_fw());
295 std::vector<unsigned int> threshRHad;
296 threshRHad.push_back(iso_loose.rHad_fw());
297 threshRHad.push_back(iso_medium.rHad_fw());
298 threshRHad.push_back(iso_tight.rHad_fw());
301 std::vector<unsigned int> rCoreVec;
304 std::vector<unsigned int> rHadVec;
308 unsigned int bdtScore = 0;
309 unsigned int bdtCondition = 0;
310 unsigned int bdtRHadWP = 0;
313 unsigned int rCoreWP = 0;
314 unsigned int rHadWP = 0;
317 unsigned int RcoreBitS = 3;
318 unsigned int RhadBitS = 3;
320 unsigned int maxEtCountsTau = thr_eTAU.maxEtCounts(
m_eFexStep);
321 unsigned int bdtMinEtCounts = thr_eTAU.minIsoEtCounts(
m_eFexStep);
322 if (eTauTobEt >= maxEtCountsTau) {
326 SetIsoWP(rCoreVec,threshRCore,rCoreWP,RcoreBitS);
327 SetIsoWP(rHadVec,threshRHad,rHadWP,RhadBitS);
332 std::vector<unsigned int> threshBDT;
333 threshBDT.push_back(iso_loose.rCore_fw());
334 threshBDT.push_back(iso_medium.rCore_fw());
335 threshBDT.push_back(iso_tight.rCore_fw());
336 m_eFEXtauBDTAlgoTool->setThresholds(threshRHad, threshBDT, ptTauMinToTopoInEfexCounts, maxEtCountsTau, bdtMinEtCounts);
354 int phi_ind = iphi - 1;
357 std::vector<uint32_t> xtobwords;
358 std::vector<uint32_t> xtobwordsBDT;
361 << phi_ind <<
", eTauBDTTobEt: " << eTauBDTTobEt
362 <<
", eTauTobEt: " << eTauTobEt <<
", ptTauMinToTopoCounts: "
363 << ptTauMinToTopoCounts <<
", maxEtCountsTau: " << maxEtCountsTau
364 <<
", bdtScore: " << bdtScore <<
" bdtMinEtCounts: " << bdtMinEtCounts <<
" bdtRHadWP " << bdtRHadWP);
366 uint32_t tobwordBDT =
m_eFEXFormTOBsTool->formTauBDTTOBWord(
m_id, eta_ind, phi_ind, eTauBDTTobEt, bdtRHadWP, bdtCondition, bdtSeed, ptTauMinToTopoCounts);
367 xtobwordsBDT =
m_eFEXFormTOBsTool->formTauBDTxTOBWords(
m_efexid,
m_id, eta_ind, phi_ind, eTauBDTTobEt, bdtRHadWP, bdtCondition, bdtSeed, ptTauMinToTopoCounts, bdtScore);
372 tmp_tau_tob->setFPGAID(
m_id);
374 tmp_tau_tob->setEta(ieta);
375 tmp_tau_tob->setPhi(iphi);
376 tmp_tau_tob->setTobword(tobword);
377 tmp_tau_tob->setxTobword0(xtobwords[0]);
378 tmp_tau_tob->setxTobword1(xtobwords[1]);
381 tmp_tau_tob_bdt->setFPGAID(
m_id);
382 tmp_tau_tob_bdt->seteFEXID(
m_efexid);
383 tmp_tau_tob_bdt->setEta(ieta);
384 tmp_tau_tob_bdt->setPhi(iphi);
385 tmp_tau_tob_bdt->setTobword(tobwordBDT);
386 tmp_tau_tob_bdt->setxTobword0(xtobwordsBDT[0]);
387 tmp_tau_tob_bdt->setxTobword1(xtobwordsBDT[1]);
390 if ((inputOutputCollection->getdooutput()) && ( tobword != 0 )) {
391 inputOutputCollection->addValue_tau(
"isCentralTowerSeed",
m_eFEXtauAlgoTool->isCentralTowerSeed());
394 inputOutputCollection->addValue_tau(
"Eta", ieta);
395 inputOutputCollection->addValue_tau(
"Phi", iphi);
399 inputOutputCollection->addValue_tau(
"CenterTowerEt", centerTower->
getTotalET());
400 inputOutputCollection->addValue_tau(
"OneOffEtaTowerEt", oneOffEtaTower ? oneOffEtaTower->
getTotalET() : 0);
401 inputOutputCollection->addValue_tau(
"OneBelowEtaTowerEt", oneBelowEtaTower ? oneBelowEtaTower->
getTotalET() : 0);
402 inputOutputCollection->addValue_tau(
"FloatEta", centerTower->
eta() * centerTower->
getPosNeg());
403 inputOutputCollection->addValue_tau(
"FloatPhi", centerTower->
phi());
404 inputOutputCollection->addValue_tau(
"RCoreCore", rCoreVec[0]);
405 inputOutputCollection->addValue_tau(
"RCoreEnv", rCoreVec[1]);
406 inputOutputCollection->addValue_tau(
"RealRCore",
m_eFEXtauAlgoTool->getRealRCore());
407 inputOutputCollection->addValue_tau(
"RCoreWP", rCoreWP);
408 inputOutputCollection->addValue_tau(
"RHadCore", rHadVec[0]);
409 inputOutputCollection->addValue_tau(
"RHadEnv", rHadVec[1]);
410 inputOutputCollection->addValue_tau(
"RealRHad",
m_eFEXtauAlgoTool->getRealRHad());
412 inputOutputCollection->addValue_tau(
"RHadWP", rHadWP);
413 inputOutputCollection->addValue_tau(
"Seed", seed);
414 inputOutputCollection->addValue_tau(
"UnD", und);
415 inputOutputCollection->addValue_tau(
"BDTScore", bdtScore);
416 inputOutputCollection->addValue_tau(
"BDTCondition", bdtCondition);
417 inputOutputCollection->addValue_tau(
"eFEXID",
m_efexid);
418 inputOutputCollection->addValue_tau(
"FPGAID",
m_id);
421 inputOutputCollection->fill_tau();
430 return StatusCode::SUCCESS;