33 declareInterface<IjFEXForwardJetsAlgo>(
this);
42 ATH_CHECK(m_jFEXForwardJetsAlgo_jTowerContainerKey.initialize());
52 return StatusCode::SUCCESS;
59 if(! m_jTowerContainer.isValid()) {
60 ATH_MSG_ERROR(
"Could not retrieve jTowerContainer " << m_jFEXForwardJetsAlgo_jTowerContainerKey.key());
62 return StatusCode::FAILURE;
65 return StatusCode::SUCCESS;
69 return StatusCode::SUCCESS;
84 const LVL1::jTower *tmpTower = m_jTowerContainer->findTower(TTID);
93 auto itr = m_map_Etvalues.find(TTID);
95 if( itr == m_map_Etvalues.end()) {
99 return itr->second[0];
104 std::unordered_map<int, jFEXForwardJetsInfo> FCALJetTowerIDLists;
106 std::vector<int> lower_centre_neta;
107 std::vector<int> upper_centre_neta;
136 for(
int myCounter = 0; myCounter<3; myCounter++) {
137 for(
int centre_nphi = lower_centre_nphi[myCounter]; centre_nphi < upper_centre_nphi[myCounter]; centre_nphi++) {
138 for(
int centre_neta = lower_centre_neta[myCounter]; centre_neta < upper_centre_neta[myCounter]; centre_neta++) {
141 int myTTIDKey = m_jFEXalgoTowerID[centre_nphi][centre_neta];
148 bool bool_isLM =
false;
149 bool bool_condCorr2 =
false;
150 bool bool_isLMabove =
false;
151 bool bool_condCorr =
false;
154 unsigned int elemCorr = elementsCorr(myTTIDKey);
155 unsigned int elemCorr2 = elementsCorr2(myTTIDKey);
157 if(elemCorr == 0 and elemCorr2 == 0){
158 bool_isLM = isLM(myTTIDKey);
161 else if(elemCorr == 0 and elemCorr2 > 0){
162 bool_isLM = isLM(myTTIDKey);
163 bool_condCorr2 = condCorr2(myTTIDKey);
164 iAmJet = bool_isLM and bool_condCorr2;
166 else if(elemCorr > 0 and elemCorr2 == 0){
167 bool_isLM = isLM(myTTIDKey);
168 bool_isLMabove = isLMabove(myTTIDKey);
169 bool_condCorr = condCorr(myTTIDKey);
170 iAmJet = bool_isLM or (bool_isLMabove and bool_condCorr);
172 else if(elemCorr > 0 and elemCorr2 > 0){
173 bool_isLM = isLM(myTTIDKey);
174 bool_condCorr2 = condCorr2(myTTIDKey);
175 bool_isLMabove = isLMabove(myTTIDKey);
176 bool_condCorr = condCorr(myTTIDKey);
177 iAmJet = (bool_isLM and bool_condCorr2) or (bool_isLMabove and bool_condCorr);
188 const auto [centreTT_eta,centreTT_phi] = globalEtaPhi(myTTIDKey);
196 auto it_seed_map = m_SeedRingMap.find(myTTIDKey);
197 if(it_seed_map == m_SeedRingMap.end()) {
198 ATH_MSG_ERROR(
"Could not find TT" << myTTIDKey <<
" in Jet seed file.");
201 for(
const auto& seedTT : it_seed_map->second){
203 saturation = saturation || getTTowerSat(seedTT);
204 TriggerTowerInformation.
addToSeedET(getEt(seedTT));
208 it_seed_map = m_1stRingMap.find(myTTIDKey);
209 if(it_seed_map == m_1stRingMap.end()) {
210 ATH_MSG_ERROR(
"Could not find TT" << myTTIDKey <<
" in 1st Energy ring file.");
213 for(
const auto& firstER_TT : it_seed_map->second){
215 saturation = saturation || getTTowerSat(firstER_TT);
216 if(m_storeEnergyRingTTIDs) {
222 if(saturation) TriggerTowerInformation.
setSRjetSat();
226 it_seed_map = m_2ndRingMap.find(myTTIDKey);
227 if(it_seed_map == m_2ndRingMap.end()) {
228 ATH_MSG_ERROR(
"Could not find TT" << myTTIDKey <<
" in 2nd Energy ring file.");
231 for(
const auto& secondER_TT : it_seed_map->second){
233 saturation = saturation || getTTowerSat(secondER_TT);
234 if(m_storeEnergyRingTTIDs) {
240 if(saturation) TriggerTowerInformation.
setLRjetSat();
243 FCALJetTowerIDLists[myTTIDKey] = TriggerTowerInformation;
250 return FCALJetTowerIDLists;
256 auto it_seed_map = m_SeedRingMap.find(TTID);
257 if(it_seed_map == m_SeedRingMap.end()) {
258 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in Jet seed file.");
262 for(
const auto& seedTT : it_seed_map->second){
263 summedEt += getEt(seedTT);
271 int CentralSeedEt = SumEtSeed(TTID);
274 auto it_seed_map = m_SearchGMap.find(TTID);
275 if(it_seed_map == m_SearchGMap.end()) {
276 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the seach (>) local maxima for jets file.");
281 for (
const auto& Gtt : it_seed_map->second ){
283 int tmpEt = SumEtSeed(Gtt);
284 if( !(CentralSeedEt > tmpEt) ){
296 it_seed_map = m_SearchGeMap.find(TTID);
297 if(it_seed_map == m_SearchGeMap.end()) {
298 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the seach (>=) local maxima for jets file.");
302 bool greaterEqual =
true;
303 for (
const auto& Gtt : it_seed_map->second ){
305 int tmpEt = SumEtSeed(Gtt);
306 if( !(CentralSeedEt >= tmpEt) ){
307 greaterEqual =
false;
322 auto it_seed_map = m_CorrMap.find(TTID);
323 if(it_seed_map == m_CorrMap.end()) {
324 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the correction (LM above) for jets file.");
329 const auto & GttVec = it_seed_map->second;
330 if (! GttVec.empty())
return isLM(GttVec.front());
335 auto it_seed_map = m_CorrMap.find(TTID);
336 if(it_seed_map == m_CorrMap.end()) {
337 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the condition (greater than) for jets file.");
341 return (it_seed_map->second).size();
347 auto it_seed_map = m_CorrMap.find(TTID);
348 if(it_seed_map == m_CorrMap.end()) {
349 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the condition (greater than) for jets file.");
354 if( (it_seed_map->second).size() == 0){
355 ATH_MSG_ERROR(
"Elements=0 in condCorr function for element"<< TTID <<
". This should never happend. REPORT IT!");
359 int centralEt = getEt(TTID);
360 int centralSeed = SumEtSeed(TTID);
361 for (
const auto& Gtt : it_seed_map->second ){
363 int tmpEt = getEt(Gtt);
364 int tmpSeedEt = SumEtSeed(Gtt);
365 if( !(centralEt > tmpEt && centralSeed >= tmpSeedEt ) ){
375 auto it_seed_map = m_Corr2Map.find(TTID);
376 if(it_seed_map == m_Corr2Map.end()) {
377 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the condition (greater than) for jets file.");
381 return (it_seed_map->second).size();
387 auto it_seed_map = m_Corr2Map.find(TTID);
388 if(it_seed_map == m_Corr2Map.end()) {
389 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the correction (greater or equal) file.");
393 int centralEt = getEt(TTID);
394 int centralSeed = SumEtSeed(TTID);
396 for (
const auto& Gtt : it_seed_map->second ){
398 int tmpEt = getEt(Gtt);
401 if( !( centralEt >= tmpEt || centralSeed > SumEtSeed(Gtt) ) ){
412 std::unordered_map<int, jFEXForwardJetsInfo> localMaximas = FcalJetsTowerIDLists();
418 m_map_Etvalues=et_map;
427 const LVL1::jTower * tmpTower = m_jTowerContainer->findTower(TTID);
438 if ( !myfile.is_open() ){
440 return StatusCode::FAILURE;
444 while ( std::getline (myfile, myline) ) {
447 if(myline[0] ==
'#')
continue;
450 std::stringstream oneLine(myline);
453 std::vector<unsigned int> elements;
455 while(std::getline(oneLine, element,
' '))
457 elements.push_back(std::stoi(element));
461 if(elements.size() < 1){
463 return StatusCode::FAILURE;
467 unsigned int TTID = elements.at(0);
470 elements.erase(elements.begin());
472 fillingMap[TTID] = elements;
477 return StatusCode::SUCCESS;