22 declareInterface<IjFEXForwardJetsAlgo>(
this);
41 return StatusCode::SUCCESS;
51 return StatusCode::FAILURE;
54 return StatusCode::SUCCESS;
84 return itr->second[0];
89 std::unordered_map<int, jFEXForwardJetsInfo> FCALJetTowerIDLists;
91 std::vector<int> lower_centre_neta;
92 std::vector<int> upper_centre_neta;
121 for(
int myCounter = 0; myCounter<3; myCounter++) {
122 for(
int centre_nphi = lower_centre_nphi[myCounter]; centre_nphi < upper_centre_nphi[myCounter]; centre_nphi++) {
123 for(
int centre_neta = lower_centre_neta[myCounter]; centre_neta < upper_centre_neta[myCounter]; centre_neta++) {
133 bool bool_isLM =
false;
134 bool bool_condCorr2 =
false;
135 bool bool_isLMabove =
false;
136 bool bool_condCorr =
false;
142 if(elemCorr == 0 and elemCorr2 == 0){
143 bool_isLM =
isLM(myTTIDKey);
146 else if(elemCorr == 0 and elemCorr2 > 0){
147 bool_isLM =
isLM(myTTIDKey);
149 iAmJet = bool_isLM and bool_condCorr2;
151 else if(elemCorr > 0 and elemCorr2 == 0){
152 bool_isLM =
isLM(myTTIDKey);
154 bool_condCorr =
condCorr(myTTIDKey);
155 iAmJet = bool_isLM or (bool_isLMabove and bool_condCorr);
157 else if(elemCorr > 0 and elemCorr2 > 0){
158 bool_isLM =
isLM(myTTIDKey);
161 bool_condCorr =
condCorr(myTTIDKey);
162 iAmJet = (bool_isLM and bool_condCorr2) or (bool_isLMabove and bool_condCorr);
166 if (
SumEtSeed(myTTIDKey) <= seedThreshold){
178 const auto [centreTT_eta,centreTT_phi] =
globalEtaPhi(myTTIDKey);
188 ATH_MSG_ERROR(
"Could not find TT" << myTTIDKey <<
" in Jet seed file.");
191 for(
const auto& seedTT : it_seed_map->second){
200 ATH_MSG_ERROR(
"Could not find TT" << myTTIDKey <<
" in 1st Energy ring file.");
203 for(
const auto& firstER_TT : it_seed_map->second){
212 if(saturation) TriggerTowerInformation.
setSRjetSat();
218 ATH_MSG_ERROR(
"Could not find TT" << myTTIDKey <<
" in 2nd Energy ring file.");
221 for(
const auto& secondER_TT : it_seed_map->second){
230 if(saturation) TriggerTowerInformation.
setLRjetSat();
233 FCALJetTowerIDLists[myTTIDKey] = std::move(TriggerTowerInformation);
240 return FCALJetTowerIDLists;
248 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in Jet seed file.");
252 for(
const auto& seedTT : it_seed_map->second){
254 const int thisEt =
getEt(seedTT);
256 summedEt +=
getEt(seedTT);
270 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the search (>) local maxima for jets file.");
275 for (
const auto& Gtt : it_seed_map->second ){
278 if( !(CentralSeedEt > tmpEt) ){
292 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the seach (>=) local maxima for jets file.");
296 bool greaterEqual =
true;
297 for (
const auto& Gtt : it_seed_map->second ){
300 if( !(CentralSeedEt >= tmpEt) ){
301 greaterEqual =
false;
318 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the correction (LM above) for jets file.");
323 const auto & GttVec = it_seed_map->second;
324 if (! GttVec.empty())
return isLM(GttVec.front());
331 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the condition (greater than) for jets file.");
335 return (it_seed_map->second).size();
343 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the condition (greater than) for jets file.");
348 if( (it_seed_map->second).size() == 0){
349 ATH_MSG_ERROR(
"Elements=0 in condCorr function for element"<< TTID <<
". This should never happend. REPORT IT!");
353 int centralEt =
getEt(TTID);
355 for (
const auto& Gtt : it_seed_map->second ){
357 int tmpEt =
getEt(Gtt);
359 if( !(centralEt > tmpEt && centralSeed >= tmpSeedEt ) ){
371 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the condition (greater than) for jets file.");
375 return (it_seed_map->second).size();
383 ATH_MSG_ERROR(
"Could not find TT" << TTID <<
" in the correction (greater or equal) file.");
387 int centralEt =
getEt(TTID);
390 for (
const auto& Gtt : it_seed_map->second ){
392 int tmpEt =
getEt(Gtt);
395 if( !( centralEt >= tmpEt || centralSeed >
SumEtSeed(Gtt) ) ){
406 std::unordered_map<int, jFEXForwardJetsInfo> localMaximas =
FcalJetsTowerIDLists(seedThreshold);
430 std::ifstream myfile(fileName);
432 if ( !myfile.is_open() ){
434 return StatusCode::FAILURE;
438 while ( std::getline (myfile, myline) ) {
441 if(myline[0] ==
'#')
continue;
444 std::stringstream oneLine(myline);
447 std::vector<unsigned int> elements;
449 while(std::getline(oneLine, element,
' '))
451 elements.push_back(std::stoi(element));
455 if(elements.size() < 1){
456 ATH_MSG_ERROR(
"Unexpected number of elemennts (<1 expected) in file: "<< fileName);
457 return StatusCode::FAILURE;
461 unsigned int TTID = elements.at(0);
464 elements.erase(elements.begin());
466 fillingMap[TTID] = std::move(elements);
471 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
static constexpr int jFEX_algoSpace_C_EMB_start_eta
static constexpr int jFEX_wide_algoSpace_width
static constexpr int jFEX_algoSpace_A_FCAL_end_eta
static constexpr int jFEX_algoSpace_C_EMB_end_eta
static constexpr int jFEX_algoSpace_EMIE_end_phi
static constexpr int jFEX_algoSpace_C_FCAL_end_eta
static constexpr int jFEX_algoSpace_A_upperEM_eta
static constexpr int jFEX_algoSpace_A_EMB_eta
static constexpr int jFEX_algoSpace_A_FCAL_start_eta
static constexpr int jFEX_algoSpace_C_upperEM_eta
static constexpr int jFEX_algoSpace_C_FCAL_start_eta
static constexpr int jFEX_algoSpace_A_EMIE_eta
static constexpr int jFEX_algoSpace_A_lowerEM_eta
static constexpr int jFEX_algoSpace_FCAL_end_phi
static constexpr int jFEX_algoSpace_EMB_end_phi
static constexpr int jFEX_algoSpace_FCAL_start_phi
static constexpr int jFEX_algoSpace_EMIE_start_phi
static constexpr int jFEX_algoSpace_EMB_start_phi
static constexpr int jFEX_algoSpace_C_lowerEM_eta
static constexpr int jFEX_algoSpace_height
static constexpr int jFEX_algoSpace_C_EMIE_start_eta
static constexpr int jFEX_algoSpace_C_EMIE_end_eta
virtual void setup(int inputTable[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width], int jfex) override
virtual void setFPGAEnergy(std::unordered_map< int, std::vector< int > > et_map) override
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SearchGMap
bool condCorr(unsigned int TTID) const
unsigned int elementsCorr2(unsigned int TTID) const
Gaudi::Property< std::string > m_2ndRingStr
std::unordered_map< int, std::vector< int > > m_map_Etvalues
Gaudi::Property< std::string > m_Corr2Str
Gaudi::Property< std::string > m_CorrStr
std::unordered_map< unsigned int, std::vector< unsigned int > > m_2ndRingMap
Gaudi::Property< std::string > m_SeedRingStr
std::array< float, 2 > globalEtaPhi(int TTID)
virtual std::unordered_map< int, jFEXForwardJetsInfo > FcalJetsTowerIDLists(int seedThreshold) override
std::unordered_map< unsigned int, std::vector< unsigned int > > m_1stRingMap
virtual std::unordered_map< int, jFEXForwardJetsInfo > calculateJetETs(int seedThreshold) override
int getEt(unsigned int TTID) const
SG::ReadHandle< jTowerContainer > m_jTowerContainer
virtual StatusCode safetyTest() override
bool getTTowerSat(unsigned int TTID)
bool isLM(unsigned int TTID) const
virtual StatusCode initialize() override
standard Athena-Algorithm method
int m_jFEXalgoTowerID[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width]
bool condCorr2(unsigned int TTID) const
bool m_storeEnergyRingTTIDs
jFEXForwardJetsAlgo(const std::string &type, const std::string &name, const IInterface *parent)
Constructors.
std::unordered_map< unsigned int, std::vector< unsigned int > > m_Corr2Map
Gaudi::Property< std::string > m_1stRingStr
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SearchGeMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SeedRingMap
StatusCode ReadfromFile(const std::string &, std::unordered_map< unsigned int, std::vector< unsigned int > > &) const
bool isLMabove(unsigned int TTID) const
virtual int SumEtSeed(unsigned int TTID) const override
SG::ReadHandleKey< LVL1::jTowerContainer > m_jFEXForwardJetsAlgo_jTowerContainerKey
virtual ~jFEXForwardJetsAlgo()
Destructor.
std::unordered_map< unsigned int, std::vector< unsigned int > > m_CorrMap
Gaudi::Property< std::string > m_SearchGStr
Gaudi::Property< std::string > m_SearchGeStr
unsigned int elementsCorr(unsigned int TTID) const
void addToSecondEnergyRingET(int secondER_ET)
void addToFirstEnergyRingET(int firstER_ET)
void setCentreLocalTTEta(float centreLocalTTEta)
void setCentreTTPhi(float centreTTPhi)
void includeTTIDinFirstER(int firstER_TTID)
void includeTTIDinSecondER(int secondER_TTID)
void includeTTinSeed(int TT_ID)
void setCentreTTEta(float centreTTEta)
void setCentreLocalTTPhi(float centreLocalTTPhi)
void addToSeedET(int seed_ET)
The jTower class is an interface object for jFEX trigger algorithms The purposes are twofold:
float centrephi_toPI() const
static std::string find_calib_file(const std::string &logical_file_name)
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...