35 #include "GaudiKernel/ServiceHandle.h"
36 #include "GaudiKernel/ISvcLocator.h"
37 #include "GaudiKernel/ITHistSvc.h"
38 #include "GaudiKernel/IClassIDSvc.h"
50 declareInterface<IjFEXFPGA>(
this);
65 return StatusCode::SUCCESS;
72 return StatusCode::SUCCESS;
105 return StatusCode::FAILURE;
130 std::vector<int> pileup_ID;
131 std::vector<int> pileup_HAD_jet;
132 std::vector<int> pileup_EM_jet;
133 std::vector<int> pileup_Total_jet;
134 std::vector<int> pileup_HAD_met;
135 std::vector<int> pileup_EM_met;
136 std::vector<int> pileup_Total_met;
139 pileup_ID.push_back(
key);
140 pileup_HAD_jet.push_back(
val[0]);
143 pileup_HAD_met.push_back(
val[1]);
151 inputOutputCollection->
addValue_pileup(
"pileup_rho_EM", pileup_rho[0]);
152 inputOutputCollection->
addValue_pileup(
"pileup_rho_HAD1", pileup_rho[1]);
153 inputOutputCollection->
addValue_pileup(
"pileup_rho_HAD2", pileup_rho[2]);
154 inputOutputCollection->
addValue_pileup(
"pileup_rho_HAD3", pileup_rho[3]);
155 inputOutputCollection->
addValue_pileup(
"pileup_rho_FCAL", pileup_rho[4]);
157 inputOutputCollection->
addValue_pileup(
"pileup_map_Et_values_HAD_jet" , pileup_HAD_jet);
158 inputOutputCollection->
addValue_pileup(
"pileup_map_Et_values_EM_jet" , pileup_EM_jet);
159 inputOutputCollection->
addValue_pileup(
"pileup_map_Et_values_Total_jet", pileup_Total_jet);
160 inputOutputCollection->
addValue_pileup(
"pileup_map_Et_values_HAD_met" , pileup_HAD_met);
161 inputOutputCollection->
addValue_pileup(
"pileup_map_Et_values_EM_met" , pileup_EM_met);
162 inputOutputCollection->
addValue_pileup(
"pileup_map_Et_values_Total_met", pileup_Total_met);
176 std::unique_ptr<jFEXTOB> jXE_tob = std::make_unique<jFEXTOB>();
179 std::unique_ptr<jFEXTOB> jTE_tob = std::make_unique<jFEXTOB>();
183 int hemisphere =
m_id == 0 ? 1 : -1;
200 for(
int mphi = 0; mphi <= max_phi_it; mphi++) {
201 for(
int meta = 0; meta <= max_eta_it; meta++) {
228 std::tuple<int,bool> jTElow;
229 std::tuple<int,bool> jTEhigh;
247 ATH_MSG_DEBUG(
"================ Central Algorithms ================");
261 int TT_seed_ID[3][3]= {{0}};
262 int TT_First_ETring[36]= {0};
263 int First_ETring_it = 0;
265 int Jet_SearchWindow[7][7] = {{0}};
266 int Jet_SearchWindowDisplaced[7][7] = {{0}};
267 int largeRCluster_IDs[15][15]= {{0}};
270 for(
int i = -7;
i< 8;
i++ ) {
271 for(
int j = -7; j< 8; j++) {
273 if(std::abs(
i)<4 && std::abs(j)<4) {
318 std::unique_ptr<jFEXTOB> jJ_tob = std::make_unique<jFEXTOB>();
320 if ( SRJet_tobword != 0 ){
327 std::unique_ptr<jFEXTOB> jLJ_tob = std::make_unique<jFEXTOB>();
339 if ( is_tau_LocalMax ) {
347 std::unique_ptr<jFEXTOB> jTau_tob = std::make_unique<jFEXTOB>();
350 if ( jTau_tobword != 0 ){
382 std::unique_ptr<jFEXTOB> jJ_tob = std::make_unique<jFEXTOB>();
385 if ( SRFCAL_Jet_tobword != 0 ){
393 std::unique_ptr<jFEXTOB> jLJ_tob = std::make_unique<jFEXTOB>();
395 if ( LRFCAL_Jet_tobword != 0 )
m_LRJet_tobwords.push_back(std::move(jLJ_tob));
413 std::vector<int> Ciso;
414 std::vector<int> Chad1;
415 std::vector<int> Chad2;
429 Ciso.push_back(wp_loose.iso_fw());
430 Ciso.push_back(wp_medium.iso_fw());
431 Ciso.push_back(wp_tight.iso_fw());
432 Chad1.push_back(wp_loose.frac_fw());
433 Chad1.push_back(wp_medium.frac_fw());
434 Chad1.push_back(wp_tight.frac_fw());
435 Chad2.push_back(wp_loose.frac2_fw());
436 Chad2.push_back(wp_medium.frac2_fw());
437 Chad2.push_back(wp_tight.frac2_fw());
438 int Cval[9] = {Ciso[0], Ciso[1], Ciso[2], Chad1[0], Chad1[1], Chad1[2], Chad2[0], Chad2[1], Chad2[2]};
440 elCluster.
setup(Cval,jFEXETResolution);
447 std::vector<uint32_t> FwdEltob_aux{FwdEl_tobword,TTID};
448 if ( FwdEl_tobword != 0 && etEM>minEtThreshold)
m_FwdEl_tobwords.push_back(FwdEltob_aux);
467 for(
int j=4; j<17; j++) {
472 ATH_MSG_DEBUG(
"============================ jFEXtauAlgo ============================");
475 for(
int mphi = 8; mphi < 24; mphi++) {
476 for(
int meta = 8; meta < max_meta; meta++) {
478 bool is_tau_LocalMax =
m_jFEXtauAlgoTool->isSeedLocalMaxima_fwd(jTowersIDs[mphi][meta]);
481 if ( is_tau_LocalMax ) {
485 std::unique_ptr<jFEXTOB> jTau_tob = std::make_unique<jFEXTOB>();
487 if ( jTau_tobword != 0 ){
494 return StatusCode::SUCCESS;
500 const int cols =
sizeof tmp_jTowersIDs_subset[0] /
sizeof tmp_jTowersIDs_subset[0][0];
504 ATH_MSG_DEBUG(
"\n==== jFEXFPGA ========= FPGA (" <<
m_id <<
") [on jFEX " <<
m_jfexid <<
"] IS RESPONSIBLE FOR jTOWERS :");
506 for (
int thisRow=
rows-1; thisRow>=0; thisRow--){
507 for (
int thisCol=0; thisCol<
cols; thisCol++){
518 const int cols =
sizeof tmp_jTowersIDs_subset[0] /
sizeof tmp_jTowersIDs_subset[0][0];
523 ATH_MSG_DEBUG(
"\n==== jFEXFPGA ========= FPGA (" <<
m_id <<
") [on jFEX " <<
m_jfexid <<
"] IS RESPONSIBLE FOR jTOWERS :");
525 for (
int thisRow=
rows-1; thisRow>=0; thisRow--) {
526 for (
int thisCol=0; thisCol<
cols; thisCol++) {
527 if(thisCol !=
cols-1) {
541 std::vector<std::unique_ptr<jFEXTOB>> tobsSort;
546 tobsSort.push_back(std::move(j));
548 std::sort (tobsSort.begin(), tobsSort.end(), std::bind(
TOBetSort<std::unique_ptr<jFEXTOB>>, std::placeholders::_1, std::placeholders::_2,
FEXAlgoSpaceDefs::jJ_etBit, 0x7ff));
558 std::vector<std::unique_ptr<jFEXTOB>> tobsSort;
563 tobsSort.push_back(std::move(j));
565 std::sort (tobsSort.begin(), tobsSort.end(), std::bind(
TOBetSort<std::unique_ptr<jFEXTOB>>, std::placeholders::_1, std::placeholders::_2,
FEXAlgoSpaceDefs::jLJ_etBit, 0x1fff));
575 ATH_MSG_DEBUG(
"number of Forward Elec tobs: " << tobsSort.size() <<
" in FPGA: " <<
m_id<<
" before truncation");
577 std::sort (tobsSort.begin(), tobsSort.end(),
etFwdElSort);
586 std::vector<std::unique_ptr<jFEXTOB>> tobsSort;
591 tobsSort.push_back(std::move(j));
600 std::vector<std::unique_ptr<jFEXTOB>> tobsSort;
605 tobsSort.push_back(std::move(j));
616 std::vector<std::unique_ptr<jFEXTOB>> tobsSort;
621 tobsSort.push_back(std::move(j));
636 ATH_MSG_DEBUG(
"In jFEXFPGA::getTTowerET_EM, TTower ID not found in map: " << TTID );
649 ATH_MSG_DEBUG(
"In jFEXFPGA::getTTowerET_HAD, TTower ID not found in map: " << TTID );
671 ATH_MSG_DEBUG(
"In jFEXFPGA::getTTowerET_forMET (EM energy), TTower ID not found in map: " << TTID );
681 ATH_MSG_DEBUG(
"In jFEXFPGA::getTTowerET_forMET (HAD energy), TTower ID not found in map: " << TTID );
686 return tmp_EM + tmp_HAD;