ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1::jFEXForwardJetsAlgo Class Reference

#include <jFEXForwardJetsAlgo.h>

Inheritance diagram for LVL1::jFEXForwardJetsAlgo:
Collaboration diagram for LVL1::jFEXForwardJetsAlgo:

Public Member Functions

 jFEXForwardJetsAlgo (const std::string &type, const std::string &name, const IInterface *parent)
 Constructors.
virtual StatusCode initialize () override
 standard Athena-Algorithm method
virtual ~jFEXForwardJetsAlgo ()
 Destructor.
virtual StatusCode safetyTest () override
virtual void setup (int inputTable[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width], int jfex) override
virtual std::unordered_map< int, jFEXForwardJetsInfoFcalJetsTowerIDLists (int seedThreshold) override
virtual std::unordered_map< int, jFEXForwardJetsInfocalculateJetETs (int seedThreshold) override
virtual void setFPGAEnergy (std::unordered_map< int, std::vector< int > > et_map) override
virtual int SumEtSeed (unsigned int TTID) const override
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode ReadfromFile (const std::string &, std::unordered_map< unsigned int, std::vector< unsigned int > > &) const
int getEt (unsigned int TTID) const
bool isLM (unsigned int TTID) const
bool isLMabove (unsigned int TTID) const
bool getTTowerSat (unsigned int TTID)
unsigned int elementsCorr (unsigned int TTID) const
bool condCorr (unsigned int TTID) const
unsigned int elementsCorr2 (unsigned int TTID) const
bool condCorr2 (unsigned int TTID) const
std::array< float, 2 > globalEtaPhi (int TTID)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< LVL1::jTowerContainerm_jFEXForwardJetsAlgo_jTowerContainerKey {this, "MyjTowers", "jTowerContainer", "Input container for jTowers"}
SG::ReadHandle< jTowerContainerm_jTowerContainer
int m_jFEXalgoTowerID [FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width]
std::unordered_map< int, std::vector< int > > m_map_Etvalues
int m_lowerEM_eta
int m_upperEM_eta
int m_jfex
bool m_storeEnergyRingTTIDs = true
Gaudi::Property< std::string > m_SeedRingStr {this, "SeedRingMap", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_seed.dat" , "Contains Trigger tower in seed"}
Gaudi::Property< std::string > m_1stRingStr {this, "Energy1stRingMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_1stRing.dat" , "Contains Trigger tower in 1st Energy ring"}
Gaudi::Property< std::string > m_2ndRingStr {this, "Energy2ndRingMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_2ndRing.dat" , "Contains Trigger tower in 2nd energy ring"}
Gaudi::Property< std::string > m_CorrStr {this, "CorrMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_corr.dat" , "Contains Trigger tower to correct displacement (greater than)"}
Gaudi::Property< std::string > m_Corr2Str {this, "Corr2Map" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_corr2.dat" , "Contains Trigger tower to correct displacement (greater or equal than)"}
Gaudi::Property< std::string > m_SearchGStr {this, "SearchGMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_searchG.dat" , "Contains Trigger tower to find local max (greater than)"}
Gaudi::Property< std::string > m_SearchGeStr {this, "SearchGeMap", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_searchGe.dat", "Contains Trigger tower to find local max (greater or equal than)"}
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SeedRingMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_1stRingMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_2ndRingMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_CorrMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_Corr2Map
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SearchGMap
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SearchGeMap
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 27 of file jFEXForwardJetsAlgo.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ jFEXForwardJetsAlgo()

LVL1::jFEXForwardJetsAlgo::jFEXForwardJetsAlgo ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructors.

Definition at line 19 of file jFEXForwardJetsAlgo.cxx.

19 :
20 AthAlgTool(type, name, parent)
21 {
22 declareInterface<IjFEXForwardJetsAlgo>(this);
23 }
AthAlgTool()
Default constructor:

◆ ~jFEXForwardJetsAlgo()

LVL1::jFEXForwardJetsAlgo::~jFEXForwardJetsAlgo ( )
virtual

Destructor.

Definition at line 26 of file jFEXForwardJetsAlgo.cxx.

27{
28}

Member Function Documentation

◆ calculateJetETs()

std::unordered_map< int, jFEXForwardJetsInfo > LVL1::jFEXForwardJetsAlgo::calculateJetETs ( int seedThreshold)
overridevirtual

Implements LVL1::IjFEXForwardJetsAlgo.

Definition at line 404 of file jFEXForwardJetsAlgo.cxx.

404 {
405
406 std::unordered_map<int, jFEXForwardJetsInfo> localMaximas = FcalJetsTowerIDLists(seedThreshold);
407 return localMaximas;
408}
virtual std::unordered_map< int, jFEXForwardJetsInfo > FcalJetsTowerIDLists(int seedThreshold) override

◆ condCorr()

bool LVL1::jFEXForwardJetsAlgo::condCorr ( unsigned int TTID) const
private

Definition at line 338 of file jFEXForwardJetsAlgo.cxx.

338 {
339
340 // Exists the jTower in the correction tower map?
341 auto it_seed_map = m_CorrMap.find(TTID);
342 if(it_seed_map == m_CorrMap.end()) {
343 ATH_MSG_ERROR("Could not find TT" << TTID << " in the condition (greater than) for jets file.");
344 return false;
345 }
346
347 // If there is no TT to check then the Et of central is always bigger :D
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!");
350 return true;
351 }
352
353 int centralEt = getEt(TTID);
354 int centralSeed = SumEtSeed(TTID);
355 for (const auto& Gtt : it_seed_map->second ){
356 //Checking if central Et is always strictly greater than the previous TT Et
357 int tmpEt = getEt(Gtt);
358 int tmpSeedEt = SumEtSeed(Gtt);
359 if( !(centralEt > tmpEt && centralSeed >= tmpSeedEt ) ){
360 return false;
361 }
362 }
363
364 return true;
365
366}
#define ATH_MSG_ERROR(x)
int getEt(unsigned int TTID) const
virtual int SumEtSeed(unsigned int TTID) const override
std::unordered_map< unsigned int, std::vector< unsigned int > > m_CorrMap

◆ condCorr2()

bool LVL1::jFEXForwardJetsAlgo::condCorr2 ( unsigned int TTID) const
private

Definition at line 378 of file jFEXForwardJetsAlgo.cxx.

378 {
379
380 // Exists the jTower in the correction tower map?
381 auto it_seed_map = m_Corr2Map.find(TTID);
382 if(it_seed_map == m_Corr2Map.end()) {
383 ATH_MSG_ERROR("Could not find TT" << TTID << " in the correction (greater or equal) file.");
384 return false;
385 }
386
387 int centralEt = getEt(TTID);
388 int centralSeed = SumEtSeed(TTID);
389
390 for (const auto& Gtt : it_seed_map->second ){
391 //Checking if central Et is always greater or equal than the previous TT Et
392 int tmpEt = getEt(Gtt);
393
394 //(central >= 1stElem or seedcentral > seed1stElem) and ( central >= 2stElem or seedcentral > seed2stElem)
395 if( !( centralEt >= tmpEt || centralSeed > SumEtSeed(Gtt) ) ){
396 return false;
397 }
398 }
399
400 return true;
401
402}
std::unordered_map< unsigned int, std::vector< unsigned int > > m_Corr2Map

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ elementsCorr()

unsigned int LVL1::jFEXForwardJetsAlgo::elementsCorr ( unsigned int TTID) const
private

Definition at line 328 of file jFEXForwardJetsAlgo.cxx.

328 {
329 auto it_seed_map = m_CorrMap.find(TTID);
330 if(it_seed_map == m_CorrMap.end()) {
331 ATH_MSG_ERROR("Could not find TT" << TTID << " in the condition (greater than) for jets file.");
332 return 0;
333 }
334
335 return (it_seed_map->second).size();
336}

◆ elementsCorr2()

unsigned int LVL1::jFEXForwardJetsAlgo::elementsCorr2 ( unsigned int TTID) const
private

Definition at line 368 of file jFEXForwardJetsAlgo.cxx.

368 {
369 auto it_seed_map = m_Corr2Map.find(TTID);
370 if(it_seed_map == m_Corr2Map.end()) {
371 ATH_MSG_ERROR("Could not find TT" << TTID << " in the condition (greater than) for jets file.");
372 return 0;
373 }
374
375 return (it_seed_map->second).size();
376}

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ FcalJetsTowerIDLists()

std::unordered_map< int, jFEXForwardJetsInfo > LVL1::jFEXForwardJetsAlgo::FcalJetsTowerIDLists ( int seedThreshold)
overridevirtual

Implements LVL1::IjFEXForwardJetsAlgo.

Definition at line 87 of file jFEXForwardJetsAlgo.cxx.

87 {
88
89 std::unordered_map<int, jFEXForwardJetsInfo> FCALJetTowerIDLists;
90
91 std::vector<int> lower_centre_neta;
92 std::vector<int> upper_centre_neta;
93 m_lowerEM_eta = 0;
94 m_upperEM_eta = 0;
95
96 //STEP 1: check if we are in module 0 or 5 and assign corrrect eta FEXAlgoSpace parameters
97 if(m_jfex == 0) {
98 //Module 0
103 }
104 else {
105 //Module 5
108
111
112 }
113
114
115
116 //STEP 2: define phi FEXAlgoSpace parameters
119
120 //STEP 3: loop over different EM/FCAL0 eta phi core fpga regions. These are potential central trigger towers for jets
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++) {
124
125 //STEP 4: define TTID which will be the key for class in map
126 int myTTIDKey = m_jFEXalgoTowerID[centre_nphi][centre_neta];
127
128 //STEP 5: ignore when tower ID is zero. Should not happend though
129 if(myTTIDKey == 0) {
130 continue;
131 }
132 bool iAmJet = false;
133 bool bool_isLM = false;
134 bool bool_condCorr2 = false;
135 bool bool_isLMabove = false;
136 bool bool_condCorr = false;
137
138 //Know which condition should satisfy
139 unsigned int elemCorr = elementsCorr(myTTIDKey);
140 unsigned int elemCorr2 = elementsCorr2(myTTIDKey);
141
142 if(elemCorr == 0 and elemCorr2 == 0){
143 bool_isLM = isLM(myTTIDKey);
144 iAmJet = bool_isLM;
145 }
146 else if(elemCorr == 0 and elemCorr2 > 0){
147 bool_isLM = isLM(myTTIDKey);
148 bool_condCorr2 = condCorr2(myTTIDKey);
149 iAmJet = bool_isLM and bool_condCorr2;
150 }
151 else if(elemCorr > 0 and elemCorr2 == 0){
152 bool_isLM = isLM(myTTIDKey);
153 bool_isLMabove = isLMabove(myTTIDKey);
154 bool_condCorr = condCorr(myTTIDKey);
155 iAmJet = bool_isLM or (bool_isLMabove and bool_condCorr);
156 }
157 else if(elemCorr > 0 and elemCorr2 > 0){
158 bool_isLM = isLM(myTTIDKey);
159 bool_condCorr2 = condCorr2(myTTIDKey);
160 bool_isLMabove = isLMabove(myTTIDKey);
161 bool_condCorr = condCorr(myTTIDKey);
162 iAmJet = (bool_isLM and bool_condCorr2) or (bool_isLMabove and bool_condCorr);
163 }
164
165 //veto seeds below seed threshold
166 if (SumEtSeed(myTTIDKey) <= seedThreshold){
167 iAmJet = false;
168 }
169
170 if(iAmJet){
171
172 //STEP 6: define class
173 jFEXForwardJetsInfo TriggerTowerInformation;
174
175 TriggerTowerInformation.setCentreLocalTTPhi(centre_nphi);
176 TriggerTowerInformation.setCentreLocalTTEta(centre_neta);
177
178 const auto [centreTT_eta,centreTT_phi] = globalEtaPhi(myTTIDKey);
179 TriggerTowerInformation.setCentreTTPhi(centreTT_phi);
180 TriggerTowerInformation.setCentreTTEta(centreTT_eta);
181
182
183 //STEP 7: Filling energies
184 int saturation = 0;
185 // Seed
186 auto it_seed_map = m_SeedRingMap.find(myTTIDKey);
187 if(it_seed_map == m_SeedRingMap.end()) {
188 ATH_MSG_ERROR("Could not find TT" << myTTIDKey << " in Jet seed file.");
189 }
190
191 for(const auto& seedTT : it_seed_map->second){
192 TriggerTowerInformation.includeTTinSeed(seedTT);
193 saturation = saturation || getTTowerSat(seedTT);
194 TriggerTowerInformation.addToSeedET(getEt(seedTT));
195 }
196
197 // 1st Energy Ring!
198 it_seed_map = m_1stRingMap.find(myTTIDKey);
199 if(it_seed_map == m_1stRingMap.end()) {
200 ATH_MSG_ERROR("Could not find TT" << myTTIDKey << " in 1st Energy ring file.");
201 }
202
203 for(const auto& firstER_TT : it_seed_map->second){
204 TriggerTowerInformation.addToFirstEnergyRingET(getEt(firstER_TT));
205 saturation = saturation || getTTowerSat(firstER_TT);
207 TriggerTowerInformation.includeTTIDinFirstER(firstER_TT);
208 }
209 }
210
211 //setting saturation for jJ
212 if(saturation) TriggerTowerInformation.setSRjetSat();
213
214
215 // 2nd Energy Ring!
216 it_seed_map = m_2ndRingMap.find(myTTIDKey);
217 if(it_seed_map == m_2ndRingMap.end()) {
218 ATH_MSG_ERROR("Could not find TT" << myTTIDKey << " in 2nd Energy ring file.");
219 }
220
221 for(const auto& secondER_TT : it_seed_map->second){
222 TriggerTowerInformation.addToSecondEnergyRingET(getEt(secondER_TT));
223 saturation = saturation || getTTowerSat(secondER_TT);
225 TriggerTowerInformation.includeTTIDinSecondER(secondER_TT);
226 }
227 }
228
229 //setting saturation for jLJ
230 if(saturation) TriggerTowerInformation.setLRjetSat();
231
232 // Storing all jets in the same map!
233 FCALJetTowerIDLists[myTTIDKey] = std::move(TriggerTowerInformation);
234 }
235
236 }//end of centre_neta loop
237 }//end of centre_nphi loop
238 }//end of myCounter loop
239
240 return FCALJetTowerIDLists;
241}
static constexpr int jFEX_algoSpace_C_EMB_start_eta
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_C_EMIE_start_eta
static constexpr int jFEX_algoSpace_C_EMIE_end_eta
bool condCorr(unsigned int TTID) const
unsigned int elementsCorr2(unsigned int TTID) const
std::unordered_map< unsigned int, std::vector< unsigned int > > m_2ndRingMap
std::array< float, 2 > globalEtaPhi(int TTID)
std::unordered_map< unsigned int, std::vector< unsigned int > > m_1stRingMap
bool getTTowerSat(unsigned int TTID)
bool isLM(unsigned int TTID) const
int m_jFEXalgoTowerID[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width]
bool condCorr2(unsigned int TTID) const
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SeedRingMap
bool isLMabove(unsigned int TTID) const
unsigned int elementsCorr(unsigned int TTID) const

◆ getEt()

int LVL1::jFEXForwardJetsAlgo::getEt ( unsigned int TTID) const
private

Definition at line 73 of file jFEXForwardJetsAlgo.cxx.

73 {
74 if(TTID == 0) {
75 return -999;
76 }
77
78 auto itr = m_map_Etvalues.find(TTID);
79
80 if( itr == m_map_Etvalues.end()) {
81 return -999;
82 }
83
84 return itr->second[0];
85}
std::unordered_map< int, std::vector< int > > m_map_Etvalues

◆ getTTowerSat()

bool LVL1::jFEXForwardJetsAlgo::getTTowerSat ( unsigned int TTID)
private

Definition at line 416 of file jFEXForwardJetsAlgo.cxx.

416 {
417 if(TTID == 0) {
418 return false;
419 }
420
421 const LVL1::jTower * tmpTower = m_jTowerContainer->findTower(TTID);
422 return tmpTower->getTowerSat();
423}
SG::ReadHandle< jTowerContainer > m_jTowerContainer
bool getTowerSat() const
Definition jTower.h:61

◆ globalEtaPhi()

std::array< float, 2 > LVL1::jFEXForwardJetsAlgo::globalEtaPhi ( int TTID)
private

Definition at line 64 of file jFEXForwardJetsAlgo.cxx.

64 {
65 if(TTID == 0) {
66 return {999,999};
67 }
68
69 const LVL1::jTower *tmpTower = m_jTowerContainer->findTower(TTID);
70 return {tmpTower->centreEta(),tmpTower->centrephi_toPI()};
71}
float centreEta() const
Definition jTower.h:79
float centrephi_toPI() const
Definition jTower.h:81

◆ initialize()

StatusCode LVL1::jFEXForwardJetsAlgo::initialize ( )
overridevirtual

standard Athena-Algorithm method

Definition at line 29 of file jFEXForwardJetsAlgo.cxx.

29 {
30
32
40
41 return StatusCode::SUCCESS;
42
43}
#define ATH_CHECK
Evaluate an expression and check for errors.
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SearchGMap
Gaudi::Property< std::string > m_2ndRingStr
Gaudi::Property< std::string > m_Corr2Str
Gaudi::Property< std::string > m_CorrStr
Gaudi::Property< std::string > m_SeedRingStr
Gaudi::Property< std::string > m_1stRingStr
std::unordered_map< unsigned int, std::vector< unsigned int > > m_SearchGeMap
StatusCode ReadfromFile(const std::string &, std::unordered_map< unsigned int, std::vector< unsigned int > > &) const
SG::ReadHandleKey< LVL1::jTowerContainer > m_jFEXForwardJetsAlgo_jTowerContainerKey
Gaudi::Property< std::string > m_SearchGStr
Gaudi::Property< std::string > m_SearchGeStr
static std::string find_calib_file(const std::string &logical_file_name)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & LVL1::IjFEXForwardJetsAlgo::interfaceID ( )
inlinestaticinherited

Definition at line 41 of file IjFEXForwardJetsAlgo.h.

42 {
44 }
static const InterfaceID IID_IjFEXForwardJetsAlgo("LVL1::IjFEXForwardJetsAlgo", 1, 0)

◆ isLM()

bool LVL1::jFEXForwardJetsAlgo::isLM ( unsigned int TTID) const
private

Definition at line 263 of file jFEXForwardJetsAlgo.cxx.

263 {
264
265 int CentralSeedEt = SumEtSeed(TTID);
266
267 // Exists the jTower in the seach (greater than) tower map?
268 auto it_seed_map = m_SearchGMap.find(TTID);
269 if(it_seed_map == m_SearchGMap.end()) {
270 ATH_MSG_ERROR("Could not find TT" << TTID << " in the search (>) local maxima for jets file.");
271 return false;
272 }
273
274 bool greater = true;
275 for (const auto& Gtt : it_seed_map->second ){
276 //checking if the Central seed has strictly more energy than its neighbours
277 int tmpEt = SumEtSeed(Gtt);
278 if( !(CentralSeedEt > tmpEt) ){
279 greater = false;
280 break;
281 }
282 }
283
284 //No need to continue.. Not a LM
285 if(!greater){
286 return false;
287 }
288
289 // Exists the jTower in the seach (greater or equal than) tower map?
290 it_seed_map = m_SearchGeMap.find(TTID);
291 if(it_seed_map == m_SearchGeMap.end()) {
292 ATH_MSG_ERROR("Could not find TT" << TTID << " in the seach (>=) local maxima for jets file.");
293 return false;
294 }
295
296 bool greaterEqual = true;
297 for (const auto& Gtt : it_seed_map->second ){
298 //checking if the Central seed has more energy or equal than its neighbours
299 int tmpEt = SumEtSeed(Gtt);
300 if( !(CentralSeedEt >= tmpEt) ){
301 greaterEqual = false;
302 break;
303 }
304 }
305
306 //Not a LM
307 if(!greaterEqual){
308 return false;
309 }
310 return true;
311}
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition fpcompare.h:140

◆ isLMabove()

bool LVL1::jFEXForwardJetsAlgo::isLMabove ( unsigned int TTID) const
private

Definition at line 313 of file jFEXForwardJetsAlgo.cxx.

313 {
314
315 // Exists the jTower in the correction tower map?
316 auto it_seed_map = m_CorrMap.find(TTID);
317 if(it_seed_map == m_CorrMap.end()) {
318 ATH_MSG_ERROR("Could not find TT" << TTID << " in the correction (LM above) for jets file.");
319 return false;
320 }
321
322 // If there is not Trigger tower to correct with, then return false
323 const auto & GttVec = it_seed_map->second;
324 if (! GttVec.empty()) return isLM(GttVec.front());
325 return false;
326}

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ ReadfromFile()

StatusCode LVL1::jFEXForwardJetsAlgo::ReadfromFile ( const std::string & fileName,
std::unordered_map< unsigned int, std::vector< unsigned int > > & fillingMap ) const
private

Definition at line 425 of file jFEXForwardJetsAlgo.cxx.

425 {
426
427 std::string myline;
428
429 //opening file with ifstream
430 std::ifstream myfile(fileName);
431
432 if ( !myfile.is_open() ){
433 ATH_MSG_ERROR("Could not open file:" << fileName);
434 return StatusCode::FAILURE;
435 }
436
437 //loading the mapping information
438 while ( std::getline (myfile, myline) ) {
439
440 //removing the header of the file (it is just information!)
441 if(myline[0] == '#') continue;
442
443 //Splitting myline in different substrings
444 std::stringstream oneLine(myline);
445
446 //reading elements
447 std::vector<unsigned int> elements;
448 std::string element;
449 while(std::getline(oneLine, element, ' '))
450 {
451 elements.push_back(std::stoi(element));
452 }
453
454 // We should have at least two elements! Central TT and (at least) itself
455 if(elements.size() < 1){
456 ATH_MSG_ERROR("Unexpected number of elemennts (<1 expected) in file: "<< fileName);
457 return StatusCode::FAILURE;
458 }
459
460 //Central TiggerTower
461 unsigned int TTID = elements.at(0);
462
463 // rest of TTs that need to be checked
464 elements.erase(elements.begin());
465
466 fillingMap[TTID] = std::move(elements);
467
468 }
469 myfile.close();
470
471 return StatusCode::SUCCESS;
472}

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ safetyTest()

StatusCode LVL1::jFEXForwardJetsAlgo::safetyTest ( )
overridevirtual

Implements LVL1::IjFEXForwardJetsAlgo.

Definition at line 46 of file jFEXForwardJetsAlgo.cxx.

46 {
47 m_jTowerContainer = SG::ReadHandle<jTowerContainer>(m_jFEXForwardJetsAlgo_jTowerContainerKey);
48 if(! m_jTowerContainer.isValid()) {
49 ATH_MSG_ERROR("Could not retrieve jTowerContainer " << m_jFEXForwardJetsAlgo_jTowerContainerKey.key());
50
51 return StatusCode::FAILURE;
52 }
53
54 return StatusCode::SUCCESS;
55}

◆ setFPGAEnergy()

void LVL1::jFEXForwardJetsAlgo::setFPGAEnergy ( std::unordered_map< int, std::vector< int > > et_map)
overridevirtual

Implements LVL1::IjFEXForwardJetsAlgo.

Definition at line 411 of file jFEXForwardJetsAlgo.cxx.

411 {
412 m_map_Etvalues=std::move(et_map);
413}

◆ setup()

void LVL1::jFEXForwardJetsAlgo::setup ( int inputTable[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width],
int jfex )
overridevirtual

Implements LVL1::IjFEXForwardJetsAlgo.

Definition at line 57 of file jFEXForwardJetsAlgo.cxx.

57 {
58 std::copy(&inputTable[0][0], &inputTable[0][0] + (FEXAlgoSpaceDefs::jFEX_algoSpace_height*FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width), &m_jFEXalgoTowerID[0][0]);
59 m_jfex=jfex;
60}
static constexpr int jFEX_wide_algoSpace_width
static constexpr int jFEX_algoSpace_height

◆ SumEtSeed()

int LVL1::jFEXForwardJetsAlgo::SumEtSeed ( unsigned int TTID) const
overridevirtual

Implements LVL1::IjFEXForwardJetsAlgo.

Definition at line 243 of file jFEXForwardJetsAlgo.cxx.

243 {
244
245 // Exists the jTower in the mapping?
246 auto it_seed_map = m_SeedRingMap.find(TTID);
247 if(it_seed_map == m_SeedRingMap.end()) {
248 ATH_MSG_ERROR("Could not find TT" << TTID << " in Jet seed file.");
249 return 0;
250 }
251 int summedEt = 0;
252 for(const auto& seedTT : it_seed_map->second){
253 //getEt can return -999 as an error value
254 const int thisEt = getEt(seedTT);
255 if (thisEt != -999){
256 summedEt += getEt(seedTT);
257 }
258 }
259
260 return summedEt;
261}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_1stRingMap

std::unordered_map<unsigned int, std::vector<unsigned int> > LVL1::jFEXForwardJetsAlgo::m_1stRingMap
private

Definition at line 73 of file jFEXForwardJetsAlgo.h.

◆ m_1stRingStr

Gaudi::Property<std::string> LVL1::jFEXForwardJetsAlgo::m_1stRingStr {this, "Energy1stRingMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_1stRing.dat" , "Contains Trigger tower in 1st Energy ring"}
private

Definition at line 65 of file jFEXForwardJetsAlgo.h.

65{this, "Energy1stRingMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_1stRing.dat" , "Contains Trigger tower in 1st Energy ring"};

◆ m_2ndRingMap

std::unordered_map<unsigned int, std::vector<unsigned int> > LVL1::jFEXForwardJetsAlgo::m_2ndRingMap
private

Definition at line 74 of file jFEXForwardJetsAlgo.h.

◆ m_2ndRingStr

Gaudi::Property<std::string> LVL1::jFEXForwardJetsAlgo::m_2ndRingStr {this, "Energy2ndRingMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_2ndRing.dat" , "Contains Trigger tower in 2nd energy ring"}
private

Definition at line 66 of file jFEXForwardJetsAlgo.h.

66{this, "Energy2ndRingMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_2ndRing.dat" , "Contains Trigger tower in 2nd energy ring"};

◆ m_Corr2Map

std::unordered_map<unsigned int, std::vector<unsigned int> > LVL1::jFEXForwardJetsAlgo::m_Corr2Map
private

Definition at line 76 of file jFEXForwardJetsAlgo.h.

◆ m_Corr2Str

Gaudi::Property<std::string> LVL1::jFEXForwardJetsAlgo::m_Corr2Str {this, "Corr2Map" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_corr2.dat" , "Contains Trigger tower to correct displacement (greater or equal than)"}
private

Definition at line 68 of file jFEXForwardJetsAlgo.h.

68{this, "Corr2Map" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_corr2.dat" , "Contains Trigger tower to correct displacement (greater or equal than)"};

◆ m_CorrMap

std::unordered_map<unsigned int, std::vector<unsigned int> > LVL1::jFEXForwardJetsAlgo::m_CorrMap
private

Definition at line 75 of file jFEXForwardJetsAlgo.h.

◆ m_CorrStr

Gaudi::Property<std::string> LVL1::jFEXForwardJetsAlgo::m_CorrStr {this, "CorrMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_corr.dat" , "Contains Trigger tower to correct displacement (greater than)"}
private

Definition at line 67 of file jFEXForwardJetsAlgo.h.

67{this, "CorrMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_corr.dat" , "Contains Trigger tower to correct displacement (greater than)"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_jfex

int LVL1::jFEXForwardJetsAlgo::m_jfex
private

Definition at line 57 of file jFEXForwardJetsAlgo.h.

◆ m_jFEXalgoTowerID

int LVL1::jFEXForwardJetsAlgo::m_jFEXalgoTowerID[FEXAlgoSpaceDefs::jFEX_algoSpace_height][FEXAlgoSpaceDefs::jFEX_wide_algoSpace_width]
private

Definition at line 53 of file jFEXForwardJetsAlgo.h.

◆ m_jFEXForwardJetsAlgo_jTowerContainerKey

SG::ReadHandleKey<LVL1::jTowerContainer> LVL1::jFEXForwardJetsAlgo::m_jFEXForwardJetsAlgo_jTowerContainerKey {this, "MyjTowers", "jTowerContainer", "Input container for jTowers"}
private

Definition at line 51 of file jFEXForwardJetsAlgo.h.

51{this, "MyjTowers", "jTowerContainer", "Input container for jTowers"};

◆ m_jTowerContainer

SG::ReadHandle<jTowerContainer> LVL1::jFEXForwardJetsAlgo::m_jTowerContainer
private

Definition at line 52 of file jFEXForwardJetsAlgo.h.

◆ m_lowerEM_eta

int LVL1::jFEXForwardJetsAlgo::m_lowerEM_eta
private

Definition at line 55 of file jFEXForwardJetsAlgo.h.

◆ m_map_Etvalues

std::unordered_map<int,std::vector<int> > LVL1::jFEXForwardJetsAlgo::m_map_Etvalues
private

Definition at line 54 of file jFEXForwardJetsAlgo.h.

◆ m_SearchGeMap

std::unordered_map<unsigned int, std::vector<unsigned int> > LVL1::jFEXForwardJetsAlgo::m_SearchGeMap
private

Definition at line 78 of file jFEXForwardJetsAlgo.h.

◆ m_SearchGeStr

Gaudi::Property<std::string> LVL1::jFEXForwardJetsAlgo::m_SearchGeStr {this, "SearchGeMap", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_searchGe.dat", "Contains Trigger tower to find local max (greater or equal than)"}
private

Definition at line 70 of file jFEXForwardJetsAlgo.h.

70{this, "SearchGeMap", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_searchGe.dat", "Contains Trigger tower to find local max (greater or equal than)"};

◆ m_SearchGMap

std::unordered_map<unsigned int, std::vector<unsigned int> > LVL1::jFEXForwardJetsAlgo::m_SearchGMap
private

Definition at line 77 of file jFEXForwardJetsAlgo.h.

◆ m_SearchGStr

Gaudi::Property<std::string> LVL1::jFEXForwardJetsAlgo::m_SearchGStr {this, "SearchGMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_searchG.dat" , "Contains Trigger tower to find local max (greater than)"}
private

Definition at line 69 of file jFEXForwardJetsAlgo.h.

69{this, "SearchGMap" , "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_searchG.dat" , "Contains Trigger tower to find local max (greater than)"};

◆ m_SeedRingMap

std::unordered_map<unsigned int, std::vector<unsigned int> > LVL1::jFEXForwardJetsAlgo::m_SeedRingMap
private

Definition at line 72 of file jFEXForwardJetsAlgo.h.

◆ m_SeedRingStr

Gaudi::Property<std::string> LVL1::jFEXForwardJetsAlgo::m_SeedRingStr {this, "SeedRingMap", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_seed.dat" , "Contains Trigger tower in seed"}
private

Definition at line 64 of file jFEXForwardJetsAlgo.h.

64{this, "SeedRingMap", "Run3L1CaloSimulation/JetMaps/2024_04_09/jFEX_FWD_seed.dat" , "Contains Trigger tower in seed"};

◆ m_storeEnergyRingTTIDs

bool LVL1::jFEXForwardJetsAlgo::m_storeEnergyRingTTIDs = true
private

Definition at line 61 of file jFEXForwardJetsAlgo.h.

◆ m_upperEM_eta

int LVL1::jFEXForwardJetsAlgo::m_upperEM_eta
private

Definition at line 56 of file jFEXForwardJetsAlgo.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: