ATLAS Offline Software
jTowerContainer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Code stolen shamelessly from Calorimeter/CaloEvent/src/CaloCellContainer.cxx and modified
6 
8 #include "L1CaloFEXSim/jTower.h"
10 
11 namespace LVL1 {
12 
14  DataVector<LVL1::jTower>(ownPolicy)
15 {
17 }
18 
19 void jTowerContainer::push_back(float eta, float phi, int towerid, int posneg, float centre_eta, float centre_phi, int fcal_layer)
20 {
21  DataVector<LVL1::jTower>::push_back(std::make_unique<jTower>(eta,phi,towerid,posneg,centre_eta,centre_phi,fcal_layer));
22 }
23 
24 void jTowerContainer::print() const {
25  REPORT_MESSAGE_WITH_CONTEXT (MSG::WARNING, "jTowerContainer") << "jTowerContainer::print not implemented";
26 }
27 
28 
29 const LVL1::jTower * jTowerContainer::findTower(int towerID) const
30 {
31  const auto it = m_map_towerID_containerIndex.find(towerID);
32  if (it==m_map_towerID_containerIndex.cend()) {
33  return nullptr;
34  }
35  const int container_index = it->second;
36  if (container_index < 0) {
37  return nullptr;
38  }
39  return (*this)[container_index];
40 }
41 
43  const auto it = m_map_towerID_containerIndex.find(towerID);
44  if (it==m_map_towerID_containerIndex.cend()) {
45  return nullptr;
46  }
47  const int container_index = it->second;
48  if (container_index < 0) {
49  return nullptr;
50  }
51  return (*this)[container_index];
52 }
53 
55 {
57 }
58 
61  size_t ntowers = size();
62  for (size_t itower = 0; itower < ntowers; itower++) {
63  const jTower * theTower = (*this)[itower];
64  int towerID = theTower->constid();
65  int container_index = itower;
66  m_map_towerID_containerIndex.insert(std::pair<int,int>(towerID,container_index));
67  }
68  return true;
69 }
70 
71 }
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
LVL1::jTowerContainer::print
void print() const
dump (obsolete)
Definition: jTowerContainer.cxx:24
skel.it
it
Definition: skel.GENtoEVGEN.py:407
LVL1::jTowerContainer::findTower
const LVL1::jTower * findTower(int towerID) const
fast find method given identifier.
Definition: jTowerContainer.cxx:29
LVL1::jTowerContainer::fillContainerMap
bool fillContainerMap()
utility function to help speed up accessing towers
Definition: jTowerContainer.cxx:59
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
SG::OwnershipPolicy
OwnershipPolicy
describes the possible element ownership policies (see e.g. DataVector)
Definition: OwnershipPolicy.h:16
LVL1::jTowerContainer::m_map_towerID_containerIndex
std::unordered_map< int, int > m_map_towerID_containerIndex
Definition: jTowerContainer.h:77
LVL1::jTowerContainer::jTowerContainer
jTowerContainer(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS)
Main constructor.
Definition: jTowerContainer.cxx:13
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
LVL1::jTowerContainer::push_back
void push_back(float eta, float phi, int towerid, int posneg, float centre_et=0.0, float centre_phi=0.0, int fcal_layer=-1)
reimplementation of const push_back
Definition: jTowerContainer.cxx:19
jTowerContainer.h
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
errorcheck.h
Helpers for checking error return status codes and reporting errors.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
LVL1::jTower
The jTower class is an interface object for jFEX trigger algorithms The purposes are twofold:
Definition: jTower.h:36
LVL1::jTowerContainer::clearContainerMap
void clearContainerMap()
clear map
Definition: jTowerContainer.cxx:54
LVL1::jTower::constid
float constid() const
Definition: jTower.h:110
jTower.h
DataVector< LVL1::jTower >::size
size_type size() const noexcept
Returns the number of elements in the collection.