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

#include <eFEXegAlgo.h>

Inheritance diagram for LVL1::eFEXegAlgo:
Collaboration diagram for LVL1::eFEXegAlgo:

Classes

class  Corrections

Public Member Functions

 eFEXegAlgo (const std::string &type, const std::string &name, const IInterface *parent)
 Constructors.
virtual StatusCode initialize ()
 standard Athena-Algorithm method
virtual ~eFEXegAlgo ()
 Destructor.
virtual StatusCode safetyTest () const
virtual void setup (int inputTable[3][3], int efex_id, int fpga_id, int central_eta)
virtual void getReta (std::vector< unsigned int > &)
virtual void getRhad (std::vector< unsigned int > &)
virtual void getWstot (std::vector< unsigned int > &)
virtual void getRealPhi (float &phi)
virtual void getRealEta (float &eta)
virtual std::unique_ptr< eFEXegTOBgeteFEXegTOB ()
virtual void getClusterCells (std::vector< unsigned int > &cellETs)
 Return cell ET values used in cluster.
virtual unsigned int getET ()
virtual unsigned int dmCorrection (unsigned int ET, unsigned int layer)
virtual void getWindowET (int layer, int jPhi, int SCID, unsigned int &)
virtual bool hasSeed () const
virtual unsigned int getSeed () const
virtual unsigned int getUnD () const
virtual void getCoreEMTowerET (unsigned int &et)
virtual void getCoreHADTowerET (unsigned int &et)
virtual void getSums (unsigned int seed, bool UnD, std::vector< unsigned int > &RetaSums, std::vector< unsigned int > &RhadSums, std::vector< unsigned int > &WstotSums)
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

void setSeed ()
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_seed_UnD = false
unsigned int m_seedID = 999
int m_eFEXegAlgoTowerID [3][3] {}
int m_efexid {}
int m_fpgaid {}
int m_central_eta {}
bool m_hasSeed {}
Corrections m_corrections ATLAS_THREAD_SAFE
Gaudi::Property< bool > m_dmCorr {this, "dmCorr", false, "Enable dead material correctionst"}
Gaudi::Property< int > m_algoVersion {this, "algoVersion", 0, "AlgoVersion, part of the L1Menu spec"}
SG::ReadHandleKey< LVL1::eTowerContainerm_eTowerContainerKey {this, "MyETowers", "eTowerContainer", "Input container for eTowers"}
SG::ReadCondHandleKey< CondAttrListCollectionm_dmCorrectionsKey
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 31 of file eFEXegAlgo.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

◆ eFEXegAlgo()

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

Constructors.

Definition at line 23 of file eFEXegAlgo.cxx.

23 :
24 AthAlgTool(type, name, parent)
25 {
26 declareInterface<eFEXegAlgo>(this);
27 }
AthAlgTool()
Default constructor:

◆ ~eFEXegAlgo()

LVL1::eFEXegAlgo::~eFEXegAlgo ( )
virtual

Destructor.

Definition at line 30 of file eFEXegAlgo.cxx.

31 {
32 }

Member Function Documentation

◆ 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.

◆ dmCorrection()

unsigned int LVL1::eFEXegAlgo::dmCorrection ( unsigned int ET,
unsigned int layer )
virtual

Check corrections are required and layer is valid, otherwise do nothing

Get correction factor Start by calculating RoI |eta| with range 0-24

Retrieve the factor from table (eventually from DB)

Calculate correction Factors are 7 bit words, highest bit corresponding to the most significant term in the correction (ET/2). So we'll work backwards from the top bit (bit 6) to implement it

And this should now be the corrected ET

Definition at line 365 of file eFEXegAlgo.cxx.

365 {
367 if ( !m_dmCorr || layer > 2 ) return ET;
368
371 int efexEta = m_efexid%3;
372 int ieta = 0;
373 if (efexEta == 2) { // Rightmost eFEX
374 // m_central_eta has range 1-4 or 1-5
375 ieta = 8 + m_fpgaid*4 + m_central_eta - 1;
376 }
377 else if (efexEta == 1 && m_fpgaid > 1) { // central eFEX, eta > 0
378 // m_central_eta has range 1-4
379 ieta = (m_fpgaid-2)*4 + m_central_eta - 1;
380 }
381 else if (efexEta == 1) { // central eFEX, eta < 0
382 // m_central_eta had range 1-4
383 ieta = (1-m_fpgaid)*4 + (4-m_central_eta);
384 }
385 else { // Leftmost eFEX
386 // m_central_eta has range 0-4 or 1-4
387 ieta = 8 + 4*(3-m_fpgaid) + (4-m_central_eta);
388 }
389
390 static std::once_flag flag;
391 std::call_once(flag, [&]() {
392
393 if (!m_dmCorrectionsKey.empty()) {
394 // replace m_corrections values with values from database ... only try this once
395 SG::ReadCondHandle <CondAttrListCollection> dmCorrections{m_dmCorrectionsKey/*, ctx*/ };
396 if (dmCorrections.isValid()) {
397 if(dmCorrections->size()==0 && Gaudi::Hive::currentContext().eventID().time_stamp()>1672527600) { // not an error for data before 2023 (will include MC21 and MC23a)
398 ATH_MSG_ERROR("No dead material corrections found in conditions database for this event in folder " << m_dmCorrectionsKey.key());
399 throw std::runtime_error("No dead material corrections found in database for this event");
400 }
401 m_corrections = Corrections (*dmCorrections.cptr(), msg());
402 }
403 ATH_MSG_INFO("Loaded DM Corrections from database");
404 }
405 });
406
408 unsigned int factor = m_corrections.corr(layer, ieta);
409
414
415 unsigned int correction = ET;
416 for (int bit = 6; bit >= 0; bit--) {
417 correction /= 2;
418 if (factor & (1<<bit))
419 ET += correction;
420 }
422 return ET;
423 }
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
MsgStream & msg() const
SG::ReadCondHandleKey< CondAttrListCollection > m_dmCorrectionsKey
Definition eFEXegAlgo.h:100
Gaudi::Property< bool > m_dmCorr
Definition eFEXegAlgo.h:93
const_pointer_type cptr()
bool flag
Definition master.py:29
correction(mu, runmode, campaign, run=None)
Definition zlumi_mc_cf.py:4

◆ 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

◆ getClusterCells()

void LVL1::eFEXegAlgo::getClusterCells ( std::vector< unsigned int > & cellETs)
virtual

Return cell ET values used in cluster.

Placed in its own function to allow other classes to access these

Definition at line 269 of file eFEXegAlgo.cxx.

269 {
270
271 int phiUpDownID = 0;
272 if (m_seed_UnD) phiUpDownID = 2;
273
274 // Initialise results vector
275 cellETs.resize(16,0);
276 // Fill vector with 2 PS cells, 6 L1, 6 L2, 2 L3
277 // Presampler
278 getWindowET(0, 1, 0, cellETs[0]);
279 getWindowET(0, phiUpDownID, 0, cellETs[1]);
280 // central phi Layer 1
281 getWindowET(1, 1, m_seedID, cellETs[2]);
282 getWindowET(1, 1, m_seedID - 1, cellETs[3]);
283 getWindowET(1, 1, m_seedID + 1, cellETs[4]);
284 // top/bottom phi Layer 1
285 getWindowET(1, phiUpDownID, m_seedID, cellETs[5]);
286 getWindowET(1, phiUpDownID, m_seedID - 1, cellETs[6]);
287 getWindowET(1, phiUpDownID, m_seedID + 1, cellETs[7]);
288 // central phi Layer 2
289 getWindowET(2, 1, m_seedID, cellETs[8]);
290 getWindowET(2, 1, m_seedID - 1, cellETs[9]);
291 getWindowET(2, 1, m_seedID + 1, cellETs[10]);
292 // top/bottom phi Layer 2
293 getWindowET(2, phiUpDownID, m_seedID, cellETs[11]);
294 getWindowET(2, phiUpDownID, m_seedID - 1, cellETs[12]);
295 getWindowET(2, phiUpDownID, m_seedID + 1, cellETs[13]);
296 // Layer 3
297 getWindowET(3, 1, 0, cellETs[14]);
298 getWindowET(3, phiUpDownID, 0, cellETs[15]);
299
300 return;
301
302 }
unsigned int m_seedID
Definition eFEXegAlgo.h:69
virtual void getWindowET(int layer, int jPhi, int SCID, unsigned int &)

◆ getCoreEMTowerET()

void LVL1::eFEXegAlgo::getCoreEMTowerET ( unsigned int & et)
virtual

Definition at line 66 of file eFEXegAlgo.cxx.

66 {
67
68 SG::ReadHandle<eTowerContainer> eTowerContainer(m_eTowerContainerKey/*,ctx*/);
69
70 const LVL1::eTower * tmpTower = eTowerContainer->findTower(m_eFEXegAlgoTowerID[1][1]);
71 et = tmpTower->getLayerTotalET(0) + tmpTower->getLayerTotalET(1) + tmpTower->getLayerTotalET(2) + tmpTower->getLayerTotalET(3);
72 }
float et(const xAOD::jFexSRJetRoI *j)
int m_eFEXegAlgoTowerID[3][3]
Definition eFEXegAlgo.h:70
SG::ReadHandleKey< LVL1::eTowerContainer > m_eTowerContainerKey
Definition eFEXegAlgo.h:97
int getLayerTotalET(unsigned int layer) const
Get total ET sum of all cells in a given layer in MeV.
Definition eTower.cxx:249

◆ getCoreHADTowerET()

void LVL1::eFEXegAlgo::getCoreHADTowerET ( unsigned int & et)
virtual

Definition at line 74 of file eFEXegAlgo.cxx.

74 {
75
76 SG::ReadHandle<eTowerContainer> eTowerContainer(m_eTowerContainerKey/*,ctx*/);
77
78 const LVL1::eTower * tmpTower = eTowerContainer->findTower(m_eFEXegAlgoTowerID[1][1]);
79 et = tmpTower->getLayerTotalET(4);
80 }

◆ geteFEXegTOB()

std::unique_ptr< eFEXegTOB > LVL1::eFEXegAlgo::geteFEXegTOB ( )
virtual

Definition at line 426 of file eFEXegAlgo.cxx.

426 {
427
428 std::unique_ptr<eFEXegTOB> out = std::make_unique<eFEXegTOB>();
429 out->setET(getET());
430
431 std::vector<unsigned int> temvector;
432 getWstot(temvector);
433 // For wstot, num and den seem switched around, but this is because the 'numerator' and 'denominator'
434 // mean different things at different points in the processing chain
435 // When the threshold comparison is done in the SetIsoWP function, we actually check Den/Num
436 out->setWstotNum(temvector[1]);
437 out->setWstotDen(temvector[0]);
438 getRhad(temvector);
439 out->setRhadEM(temvector[0]);
440 out->setRhadHad(temvector[1]);
441 getReta(temvector);
442 out->setRetaCore(temvector[0]);
443 out->setRetaEnv(temvector[1]);
444 out->setSeedUnD(m_seed_UnD);
445 out->setSeed(m_seedID);
446 return out;
447 }
virtual unsigned int getET()
virtual void getReta(std::vector< unsigned int > &)
virtual void getWstot(std::vector< unsigned int > &)
virtual void getRhad(std::vector< unsigned int > &)

◆ getET()

unsigned int LVL1::eFEXegAlgo::getET ( )
virtual

Get cells used in cluster

Layer sums including dead material corrections

Final ET sum

Definition at line 304 of file eFEXegAlgo.cxx.

304 {
305
307 std::vector<unsigned int> clusterCells;
308 getClusterCells(clusterCells);
309
310
312 unsigned int PS_ET = 0;
313
314 if(m_algoVersion==0) {
315 PS_ET = dmCorrection(clusterCells[0], 0)
316 + dmCorrection(clusterCells[1], 0);
317 } else {
318 // 2025 algoVersion only uses 1 PS scell, except at most extreme eta values
319 PS_ET = dmCorrection(clusterCells[0], 0);
320 if ( ((m_efexid%3) == 0 && m_fpgaid == 0) || ((m_efexid%3) == 2 && m_fpgaid == 3)) {
321 PS_ET += dmCorrection(clusterCells[1], 0);
322 }
323 }
324 unsigned int L1_ET = dmCorrection(clusterCells[2], 1)
325 + dmCorrection(clusterCells[3], 1)
326 + dmCorrection(clusterCells[4], 1)
327 + dmCorrection(clusterCells[5], 1)
328 + dmCorrection(clusterCells[6], 1)
329 + dmCorrection(clusterCells[7], 1);
330 unsigned int L2_ET = dmCorrection(clusterCells[8], 2)
331 + dmCorrection(clusterCells[9], 2)
332 + dmCorrection(clusterCells[10], 2)
333 + dmCorrection(clusterCells[11], 2)
334 + dmCorrection(clusterCells[12], 2)
335 + dmCorrection(clusterCells[13], 2);
336 unsigned int L3_ET = clusterCells[14] + clusterCells[15];
337
339 unsigned int totET = PS_ET + L1_ET + L2_ET + L3_ET;
340
341 // overflow handling
342 if (totET > 0xffff) totET = 0xffff;
343
344 return totET;
345
346 }
Gaudi::Property< int > m_algoVersion
Definition eFEXegAlgo.h:94
virtual unsigned int dmCorrection(unsigned int ET, unsigned int layer)
virtual void getClusterCells(std::vector< unsigned int > &cellETs)
Return cell ET values used in cluster.

◆ getRealEta()

void LVL1::eFEXegAlgo::getRealEta ( float & eta)
virtual

Definition at line 89 of file eFEXegAlgo.cxx.

89 {
90
91 SG::ReadHandle<eTowerContainer> eTowerContainer(m_eTowerContainerKey/*,ctx*/);
92
93 eta = eTowerContainer->findTower(m_eFEXegAlgoTowerID[1][1])->eta() * eTowerContainer->findTower(m_eFEXegAlgoTowerID[1][1])->getPosNeg();
94
95 }
Scalar eta() const
pseudorapidity method

◆ getRealPhi()

void LVL1::eFEXegAlgo::getRealPhi ( float & phi)
virtual

Definition at line 82 of file eFEXegAlgo.cxx.

82 {
83
84 SG::ReadHandle<eTowerContainer> eTowerContainer(m_eTowerContainerKey/*,ctx*/);
85 phi = eTowerContainer->findTower(m_eFEXegAlgoTowerID[1][1])->phi();
86
87 }
Scalar phi() const
phi method

◆ getReta()

void LVL1::eFEXegAlgo::getReta ( std::vector< unsigned int > & retavec)
virtual

Definition at line 97 of file eFEXegAlgo.cxx.

97 {
98
99 unsigned int coresum = 0; // 3x2 L2 sum : core
100 unsigned int totalsum = 0; // 7x3 L2 sum : total
101 unsigned int envsum = 0; // total - core : env
102
103 retavec.clear(); // clear the output vector before starting
104
105 // window limits
106 int iTotalStart = m_seedID-3;
107 int iTotalEnd = m_seedID+3;
108 int iCoreStart = m_seedID-1;
109 int iCoreEnd = m_seedID+1;
110 int phiStart = -999;
111 int phiEnd = -99;
112 if (m_seed_UnD) {
113 phiStart = 1;
114 phiEnd = 2;
115 } else {
116 phiStart = 0;
117 phiEnd = 1;
118 }
119
120 // 3x2 and 7x3 L2 sum
121 for (int i=iTotalStart; i<=iTotalEnd; ++i) { // eta
122 for(int j=0; j<=2; ++j) { // phi
123 if (i>=iCoreStart && i <= iCoreEnd && j>=phiStart && j<=phiEnd) {
124 unsigned int tmp_et; getWindowET(2,j,i,tmp_et);
125 coresum += tmp_et;
126 }
127
128 unsigned int tmptot_et; getWindowET(2,j,i,tmptot_et);
129 totalsum += tmptot_et;
130 }
131 }
132
133 // get environment
134 envsum = totalsum - coresum;
135
136 // Overflow handling
137 if (coresum > 0xffff) coresum = 0xffff;
138 if (envsum > 0xffff) envsum = 0xffff;
139
140 // Return results
141 retavec.push_back(coresum);
142 retavec.push_back(envsum);
143
144 }

◆ getRhad()

void LVL1::eFEXegAlgo::getRhad ( std::vector< unsigned int > & rhadvec)
virtual

Definition at line 146 of file eFEXegAlgo.cxx.

146 {
147
148 unsigned int hadsum = 0; // 3x3 Towers Had
149 unsigned int emsum = 0; // (1x3 + 3x3 + 3x3 + 1x3) SCs EM
150
151 rhadvec.clear(); // clear the output vector before starting
152
153 int iCoreStart = m_seedID-1;
154 int iCoreEnd = m_seedID+1;
155
156 SG::ReadHandle<eTowerContainer> eTowerContainer(m_eTowerContainerKey/*,ctx*/);
157
158 if(m_algoVersion==0) {
159 // 3x3 Towers Had ; 1x3 L0 + 1x3 L3 EM
160 for (int i=0; i<3; ++i) { // phi
161 for (int j=0; j<=2; ++j) { // eta
162 if (((m_efexid%3 == 0) && (m_fpgaid == 0) && (m_central_eta == 0) && (j == 0)) || ((m_efexid%3 == 2) && (m_fpgaid == 3) && (m_central_eta == 5) && (j == 2))) {
163 continue;
164 } else {
165 const eTower * tTower = eTowerContainer->findTower(m_eFEXegAlgoTowerID[i][j]);
166 hadsum += tTower->getLayerTotalET(4);
167 if (j==1) {
168 emsum += ( tTower->getLayerTotalET(0) + tTower->getLayerTotalET(3) );
169 }
170 }
171 }
172 }
173
174 // 3x3 SCs L1 and L2 sum
175 for (int i=iCoreStart; i<=iCoreEnd; ++i) { // eta
176 for(int j=0; j<=2; ++j) { // phi
177 unsigned int tmp_et_a, tmp_et_b;
178 getWindowET(1,j,i,tmp_et_a);
179 getWindowET(2,j,i,tmp_et_b);
180 emsum += ( tmp_et_a + tmp_et_b );
181 }
182 }
183 } else {
184
185 // see slide 4 of https://indico.cern.ch/event/1513502/contributions/6389265/attachments/3019474/5326755/Rate%20Reduction%20Methods%20Overview.pdf
186 // Update 29-Apr-2025: removing 4 corners of EM3 from sum
187
188 // EM cluster depends on UnD flag
189 int phi2 = (m_seed_UnD > 0 ? 2 : 0);
190
191 // 3x3 Towers Had + EM3 (excluding corners in EM3); 1x2 L0
192 for (int i = 0; i < 3; ++i) { // phi
193 for (int j = 0; j <= 2; ++j) { // eta
194 if (((m_efexid % 3 == 0) && (m_fpgaid == 0) && (m_central_eta == 0) && (j == 0)) ||
195 ((m_efexid % 3 == 2) && (m_fpgaid == 3) && (m_central_eta == 5) && (j == 2))) {
196 continue;
197 } else {
198 const eTower *tTower = eTowerContainer->findTower(m_eFEXegAlgoTowerID[i][j]);
199 hadsum += tTower->getLayerTotalET(4) + (((i==0&&j==0)||(i==2&&j==2)||(i==0&&j==2)||(i==2&&j==0)) ? 0 : tTower->getLayerTotalET(3));
200 // For PS add central tower + UnD phi neighbour
201 if (j == 1 && (i == 1 || i == phi2)) {
202 emsum += (tTower->getLayerTotalET(0));
203 }
204 }
205 }
206 }
207
208 // 3x2 SCs L1 and L2 sum, so phi range depends on UnD flag
209 int phiStart = 0;
210 int phiEnd = 1;
211 if (m_seed_UnD > 0) {
212 phiStart = 1;
213 phiEnd = 2;
214 }
215 for (int i = iCoreStart; i <= iCoreEnd; ++i) { // eta
216 for (int j = phiStart; j <= phiEnd; ++j) { // phi
217 unsigned int tmp_et_a, tmp_et_b;
218 getWindowET(1, j, i, tmp_et_a);
219 getWindowET(2, j, i, tmp_et_b);
220 emsum += (tmp_et_a + tmp_et_b);
221 }
222 }
223 }
224 // Overflow handling
225 if (emsum > 0xffff) emsum = 0xffff;
226 if (hadsum > 0xffff) hadsum = 0xffff;
227
228 // Return results
229 rhadvec.push_back(emsum);
230 rhadvec.push_back(hadsum);
231
232 }

◆ getSeed()

virtual unsigned int LVL1::eFEXegAlgo::getSeed ( ) const
inlinevirtual

Definition at line 58 of file eFEXegAlgo.h.

58{return m_seedID;};

◆ getSums()

void LVL1::eFEXegAlgo::getSums ( unsigned int seed,
bool UnD,
std::vector< unsigned int > & RetaSums,
std::vector< unsigned int > & RhadSums,
std::vector< unsigned int > & WstotSums )
virtual

Definition at line 494 of file eFEXegAlgo.cxx.

498 {
499 // Set seed parameters to supplied values
500 m_seed_UnD = UnD;
501 m_seedID = seed;
502 m_hasSeed = true;
503
504 // Now just call the 3 discriminant calculation methods
505 getReta(RetaSums);
506 getRhad(RhadSums);
507 getWstot(WstotSums);
508
509 }

◆ getUnD()

virtual unsigned int LVL1::eFEXegAlgo::getUnD ( ) const
inlinevirtual

Definition at line 59 of file eFEXegAlgo.h.

59{return m_seed_UnD;};

◆ getWindowET()

void LVL1::eFEXegAlgo::getWindowET ( int layer,
int jPhi,
int SCID,
unsigned int & outET )
virtual

Definition at line 449 of file eFEXegAlgo.cxx.

449 {
450
451 SG::ReadHandle<eTowerContainer> eTowerContainer(m_eTowerContainerKey/*,ctx*/);
452
453 if (SCID<0) { // left towers in eta
454 if ((m_efexid%3 == 0) && (m_fpgaid == 0) && (m_central_eta == 0)) {
455 outET = 0;
456 } else {
457 int etaID = 4+SCID;
458 const eTower * tmpTower = eTowerContainer->findTower(m_eFEXegAlgoTowerID[jPhi][0]);
459 if (layer==1 || layer==2) {
460 outET = tmpTower->getET(layer,etaID);
461 } else if (layer==0 || layer==3 || layer==4) {
462 outET = tmpTower->getLayerTotalET(layer);
463 }
464 }
465 } else if (SCID>=0 && SCID<4) { // central towers in eta
466 const eTower * tmpTower = eTowerContainer->findTower(m_eFEXegAlgoTowerID[jPhi][1]);
467 if (layer==1 || layer==2) {
468 outET = tmpTower->getET(layer,SCID);
469 } else if (layer==0 || layer==3 || layer==4) {
470 outET = tmpTower->getLayerTotalET(layer);
471 }
472 } else if (SCID>=4){ // right towers in eta
473 if ((m_efexid%3 == 2) && (m_fpgaid == 3) && (m_central_eta == 5)) {
474 outET = 0;
475 } else {
476 int etaID = SCID-4;
477 const eTower * tmpTower = eTowerContainer->findTower(m_eFEXegAlgoTowerID[jPhi][2]);
478 if (layer==1 || layer==2) {
479 outET = tmpTower->getET(layer,etaID);
480 } else if (layer==0 || layer==3 || layer==4) {
481 outET = tmpTower->getLayerTotalET(layer);
482 }
483 }
484 }
485
486 // overflow handling
487 if (outET > 0xffff) outET = 0xffff;
488
489 }

◆ getWstot()

void LVL1::eFEXegAlgo::getWstot ( std::vector< unsigned int > & output)
virtual

Definition at line 234 of file eFEXegAlgo.cxx.

234 {
235 unsigned int numer = 0;
236 unsigned int den = 0;
237
238 output.clear(); // clear the output vector before starting
239
240 int iStart = m_seedID - 2;
241 int iEnd = m_seedID + 2;
242
243 for (int i = iStart; i <= iEnd; ++i) { // eta
244 int diff = i - m_seedID;
245 unsigned int weight = diff*diff;
246 for (int j = 0; j <= 2; ++j) { // phi
247 unsigned int eT;
248 getWindowET(1, j, i, eT);
249 // NB need to be careful as numer and den are defined such that wstot=numer/den,
250 // but in the firmware (and therefore this bitwise code) we actually
251 // check that den/numer < Threshold
252 numer += eT*weight;
253 den += eT;
254 }
255 }
256
257 // Overflow handling
258 //if (den > 0xffff) den = 0xffff; - commented out so that denom can overflow, will then automatically pass all thresholds (see eFEXFPGA::SetIsoWP)
259 if (numer > 0xffff) numer = 0xffff;
260
261 // Return results
262 output.push_back(den);
263 output.push_back(numer);
264
265 }
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
Definition Jet.cxx:631
float eT(const U &p)
Accessor utility function for getting the value of Tranverse energy.
output
Definition merge.py:16

◆ hasSeed()

virtual bool LVL1::eFEXegAlgo::hasSeed ( ) const
inlinevirtual

Definition at line 57 of file eFEXegAlgo.h.

57{return m_hasSeed;};

◆ initialize()

StatusCode LVL1::eFEXegAlgo::initialize ( )
virtual

standard Athena-Algorithm method

Definition at line 34 of file eFEXegAlgo.cxx.

34 {
35
36 ATH_CHECK(m_eTowerContainerKey.initialize());
38
39 return StatusCode::SUCCESS;
40 }
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ 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::eFEXegAlgo::interfaceID ( )
inlinestatic

Definition at line 37 of file eFEXegAlgo.h.

37{ return IID_IeFEXegAlgo; };
static const InterfaceID IID_IeFEXegAlgo("LVL1::eFEXegAlgo", 1, 0)
The eFEXegAlgo class calculates the egamma TOB variables: Reta, Rhad and Wstot.

◆ 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.

◆ 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::eFEXegAlgo::safetyTest ( ) const
virtual

Definition at line 43 of file eFEXegAlgo.cxx.

43 {
44
45 SG::ReadHandle<eTowerContainer> eTowerContainer(m_eTowerContainerKey/*,ctx*/);
46 if(!eTowerContainer.isValid()){
47 ATH_MSG_FATAL("Could not retrieve container " << m_eTowerContainerKey.key() );
48 return StatusCode::FAILURE;
49 }
50
51 return StatusCode::SUCCESS;
52 }
#define ATH_MSG_FATAL(x)

◆ setSeed()

void LVL1::eFEXegAlgo::setSeed ( )
private

Definition at line 513 of file eFEXegAlgo.cxx.

513 {
514
515 m_hasSeed = false;
516 m_seed_UnD = false;
517 unsigned int tmpID = 999;
518 unsigned int maxET = 0;
519
520 for (int i=0; i<4 ; ++i) {
521 int iSeedL = i-1;
522 int iSeedR = i+1;
523
524 // eta ID of candidate seed
525 unsigned int cETUp;
526 getWindowET(2,2,i,cETUp);
527 unsigned int iSeedET;
528 getWindowET(2,1,i, iSeedET);
529 unsigned int cETDown;
530 getWindowET(2,0,i, cETDown);
531
532 // left of candidate seed
533 unsigned int lETUp;
534 getWindowET(2,2,iSeedL,lETUp);
535 unsigned int lET;
536 getWindowET(2,1,iSeedL,lET);
537 unsigned int lETDown;
538 getWindowET(2,0,iSeedL,lETDown);
539
540 // right of candidate seed
541 unsigned int rETUp;
542 getWindowET(2,2,iSeedR,rETUp);
543 unsigned int rET;
544 getWindowET(2,1,iSeedR,rET);
545 unsigned int rETDown;
546 getWindowET(2,0,iSeedR,rETDown);
547
548 // greater or equal than for left and down cells, greater than for right and up ones
549 if (iSeedET>=lET && iSeedET>rET
550 && iSeedET>=lETUp && iSeedET>cETUp && iSeedET>rETUp
551 && iSeedET>=lETDown && iSeedET>=cETDown && iSeedET>rETDown) {
552 if (iSeedET>=maxET) { // if two maxima exist and have the same ET, keep the one to the right
553 maxET = iSeedET;
554 tmpID = i;
555 }
556 }
557 }
558
559 if(tmpID!=999) {
560 m_seedID = tmpID;
561 m_hasSeed = true;
562 unsigned int tmp_et_up, tmp_et_down;
563 getWindowET(2,2,m_seedID,tmp_et_up);
564 getWindowET(2,0,m_seedID,tmp_et_down);
565 if (tmp_et_up >= tmp_et_down) {
566 m_seed_UnD = true; // go up if energy greater or equal to bottom
567 }
568 }
569 }

◆ setup()

void LVL1::eFEXegAlgo::setup ( int inputTable[3][3],
int efex_id,
int fpga_id,
int central_eta )
virtual

Definition at line 54 of file eFEXegAlgo.cxx.

54 {
55
56 std::copy(&inputTable[0][0], &inputTable[0][0] + 9, &m_eFEXegAlgoTowerID[0][0]);
57
58 m_efexid = efex_id;
59 m_fpgaid = fpga_id;
60 m_central_eta = central_eta;
61
62 setSeed();
63
64 }

◆ 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 >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ 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

◆ ATLAS_THREAD_SAFE

Corrections m_corrections LVL1::eFEXegAlgo::ATLAS_THREAD_SAFE
mutableprivate

Definition at line 90 of file eFEXegAlgo.h.

◆ m_algoVersion

Gaudi::Property<int> LVL1::eFEXegAlgo::m_algoVersion {this, "algoVersion", 0, "AlgoVersion, part of the L1Menu spec"}
private

Definition at line 94 of file eFEXegAlgo.h.

94{this, "algoVersion", 0, "AlgoVersion, part of the L1Menu spec"};

◆ m_central_eta

int LVL1::eFEXegAlgo::m_central_eta {}
private

Definition at line 73 of file eFEXegAlgo.h.

73{};

◆ 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_dmCorr

Gaudi::Property<bool> LVL1::eFEXegAlgo::m_dmCorr {this, "dmCorr", false, "Enable dead material correctionst"}
private

Definition at line 93 of file eFEXegAlgo.h.

93{this, "dmCorr", false, "Enable dead material correctionst"};

◆ m_dmCorrectionsKey

SG::ReadCondHandleKey<CondAttrListCollection> LVL1::eFEXegAlgo::m_dmCorrectionsKey
private
Initial value:
{this,"DMCorrectionsKey","",
"Key to dead material corrections (AttrListCollection)"}

Definition at line 100 of file eFEXegAlgo.h.

100 {this,"DMCorrectionsKey","",
101 "Key to dead material corrections (AttrListCollection)"};

◆ m_eFEXegAlgoTowerID

int LVL1::eFEXegAlgo::m_eFEXegAlgoTowerID[3][3] {}
private

Definition at line 70 of file eFEXegAlgo.h.

70{};

◆ m_efexid

int LVL1::eFEXegAlgo::m_efexid {}
private

Definition at line 71 of file eFEXegAlgo.h.

71{};

◆ m_eTowerContainerKey

SG::ReadHandleKey<LVL1::eTowerContainer> LVL1::eFEXegAlgo::m_eTowerContainerKey {this, "MyETowers", "eTowerContainer", "Input container for eTowers"}
private

Definition at line 97 of file eFEXegAlgo.h.

97{this, "MyETowers", "eTowerContainer", "Input container for eTowers"};

◆ 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_fpgaid

int LVL1::eFEXegAlgo::m_fpgaid {}
private

Definition at line 72 of file eFEXegAlgo.h.

72{};

◆ m_hasSeed

bool LVL1::eFEXegAlgo::m_hasSeed {}
private

Definition at line 74 of file eFEXegAlgo.h.

74{};

◆ m_seed_UnD

bool LVL1::eFEXegAlgo::m_seed_UnD = false
private

Definition at line 68 of file eFEXegAlgo.h.

◆ m_seedID

unsigned int LVL1::eFEXegAlgo::m_seedID = 999
private

Definition at line 69 of file eFEXegAlgo.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: