34 declareInterface<IjFEXForwardElecAlgo>(
this);
42 ATH_CHECK(m_jTowerContainerKey.initialize());
50 return StatusCode::SUCCESS;
56 if(! m_jTowerContainer.isValid()) {
57 ATH_MSG_ERROR(
"Could not retrieve jTowerContainer " << m_jTowerContainerKey.key());
58 return StatusCode::FAILURE;
60 return StatusCode::SUCCESS;
64 return StatusCode::SUCCESS;
78 const LVL1::jTower *tmpTower = m_jTowerContainer->findTower(ttID);
87 if(m_map_Etvalues_EM.find(ttID) != m_map_Etvalues_EM.end()) {
88 TT_EtEM = m_map_Etvalues_EM[ttID][0];
91 if(m_map_Etvalues_HAD.find(ttID) != m_map_Etvalues_HAD.end()) {
92 TT_EtHad = m_map_Etvalues_HAD[ttID][0];
95 return {TT_EtEM, TT_EtHad};
103 const LVL1::jTower * tmpTower = m_jTowerContainer->findTower(ttID);
108 std::unordered_map<
int,std::vector<int> > etmapEM,
109 std::unordered_map<
int,std::vector<int> > etmapHAD) {
110 m_map_Etvalues_EM=etmapEM;
111 m_map_Etvalues_HAD=etmapHAD;
116 auto [centreTT_EtEM,centreTT_EtHad] = getEtEmHad(seedTTID);
119 auto it_seed_map = m_SearchGTauMap.find(seedTTID);
120 if(it_seed_map == m_SearchGTauMap.end()) {
121 ATH_MSG_ERROR(
"Could not find TT" << seedTTID <<
" in the seach (>) local maxima for tau/em file.");
124 for (
const auto& gtt : it_seed_map->second ){
125 auto [tmp_EtEM,tmp_EtHad] = getEtEmHad(gtt);
126 if(tmp_EtEM>=centreTT_EtEM) {
134 auto it_seed_map = m_SearchGeTauMap.find(seedTTID);
135 if(it_seed_map == m_SearchGeTauMap.end()) {
136 ATH_MSG_ERROR(
"Could not find TT" << seedTTID <<
" in the seach (>=) local maxima for tau/em file.");
139 for (
const auto& gtt : it_seed_map->second ){
140 auto [tmp_EtEM,tmp_EtHad] = getEtEmHad(gtt);
141 if( tmp_EtEM>centreTT_EtEM) {
153 int direction = m_jfex < 3 ? -1 : +1;
155 std::vector<std::pair<int,int>> neighbours;
161 neighbours = { {neta , nphi+1},
169 neighbours = { {neta, nphi+1},
171 {neta-direction, nphi},
172 {neta+direction, nphi/2}
177 neighbours = { {neta, nphi+1},
179 {neta+direction, nphi},
180 {neta-direction, 2*nphi+0},
181 {neta-direction, 2*nphi+1},
186 neighbours = { {neta , nphi+1},
194 neighbours = { {neta, nphi+1},
196 {neta-direction, nphi},
197 {neta+2*direction, nphi/2}
203 neighbours = { {neta-2*direction, 2*nphi+0},
204 {neta-2*direction, 2*nphi+1},
205 {neta+direction, nphi}
210 neighbours = { {neta+1, nphi},
216 neighbours = { {neta-direction, nphi}
219 ATH_MSG_ERROR(
"Eta index " << neta <<
" (side: "<< (direction>0?
"A":
"C") <<
") does not seem to belong to any valid seed region");
223 for (
const auto& candEtaPhi: neighbours) {
224 uint candID = m_jFEXalgoTowerID[candEtaPhi.second][candEtaPhi.first];
225 const auto [candTT_EtEM, candTT_EtHad] = getEtEmHad(candID);
237 std::unordered_map<uint, LVL1::jFEXForwardElecInfo> clusterList;
238 std::vector<int> lower_centre_neta;
239 std::vector<int> upper_centre_neta;
268 for(
uint region = 0; region<3; region++) {
269 for(
int nphi = lower_centre_nphi[region]; nphi < upper_centre_nphi[region]; nphi++) {
270 for(
int neta = lower_centre_neta[region]; neta < upper_centre_neta[region]; neta++) {
279 uint ttID = m_jFEXalgoTowerID[nphi][neta];
280 if(ttID == 0)
continue;
282 if(!isValidSeed(ttID))
continue;
286 elCluster.
setup(m_jfex, ttID, neta, nphi);
287 const auto [centreTT_eta, centreTT_phi] = getEtaPhi(ttID);
288 const auto [centreTT_EtEM, centreTT_EtHad] = getEtEmHad(ttID);
298 findAndFillNextTT(elCluster, neta, nphi);
303 auto it_iso_map = m_IsoMap.find(ttID);
304 if(it_iso_map != m_IsoMap.end()) {
305 for(
const auto& gtt : it_iso_map->second){
306 auto [tmp_EtEM,tmp_EtHad] = getEtEmHad(gtt);
311 ATH_MSG_ERROR(
"Could not find TT" << ttID <<
" in jEM isolation map file.");
315 if(fabs(centreTT_eta) < 3.2) {
323 auto it_frac1_map = m_Frac1Map.find(ttID);
324 if(it_frac1_map != m_Frac1Map.end()) {
325 for(
const auto& gtt : it_frac1_map->second){
326 auto [tmp_EtEM,tmp_EtHad] = getEtEmHad(gtt);
327 sumEtHad1 += tmp_EtHad;
331 ATH_MSG_ERROR(
"Could not find TT" << ttID <<
" in jEM frac1 map file.");
338 auto it_frac2_map = m_Frac2Map.find(ttID);
339 if(it_frac2_map != m_Frac2Map.end()) {
340 for(
const auto& gtt : it_frac2_map->second) {
341 auto [tmp_EtEM,tmp_EtHad] = getEtEmHad(gtt);
342 sumEtHad2 += tmp_EtHad;
346 ATH_MSG_ERROR(
"Could not find TT" << ttID <<
" in jEM frac2 map file.");
352 clusterList[ttID] = elCluster;
363 if ( !myfile.is_open() ){
365 return StatusCode::FAILURE;
369 while ( std::getline (myfile, myline) ) {
371 if(myline[0] ==
'#')
continue;
374 std::stringstream oneLine(myline);
377 std::vector<unsigned int> elements;
379 while(std::getline(oneLine, element,
' '))
381 elements.push_back(std::stoi(element));
385 if(elements.size() < 1){
387 return StatusCode::FAILURE;
391 unsigned int TTID = elements.at(0);
394 elements.erase(elements.begin());
395 fillingMap[TTID] = elements;
399 return StatusCode::SUCCESS;