ATLAS Offline Software
eTowerContainer.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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/eTower.h"
10 
11 namespace LVL1{
12 
14  DataVector<LVL1::eTower>(ownPolicy)
15 {
17 }
18 
19 void eTowerContainer::push_back(float eta, float phi, float keybase, int posneg)
20 {
21  DataVector<LVL1::eTower>::push_back(std::make_unique<eTower>(eta,phi,keybase,posneg));
22 }
23 
24 void eTowerContainer::print() const {
25  REPORT_MESSAGE_WITH_CONTEXT (MSG::WARNING, "eTowerContainer") << "eTowerContainer::print not implemented";
26 }
27 
28 
29 const LVL1::eTower * eTowerContainer::findTower(int towerID) const{
30  const auto it = m_map_towerID_containerIndex.find(towerID);
31 
32  const int container_index = it->second;
33  if (container_index < 0) {
34  return nullptr;
35  }
36  return (*this)[container_index];
37 }
38 
40  const auto it = m_map_towerID_containerIndex.find(towerID);
41 
42  const int container_index = it->second;
43  if (container_index < 0) {
44  return nullptr;
45  }
46  return (*this)[container_index];
47 }
48 
50 {
52 }
53 
56  size_t ntowers = size();
57  for (size_t itower = 0; itower < ntowers; itower++) {
58  const eTower * theTower = (*this)[itower];
59  int towerID = theTower->constid();
60  int container_index = itower;
61  m_map_towerID_containerIndex.insert(std::pair<int,int>(towerID,container_index));
62  }
63  return true;
64 }
65 
66 }
eTowerContainer.h
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
LVL1::eTower
The eTower class is an interface object for eFEX trigger algorithms The purposes are twofold:
Definition: eTower.h:38
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
LVL1::eTower::constid
float constid() const
Definition: eTower.h:71
skel.it
it
Definition: skel.GENtoEVGEN.py:423
LVL1::eTowerContainer::push_back
void push_back(float eta, float phi, float keybase, int posneg)
reimplementation of const push_back
Definition: eTowerContainer.cxx:19
LVL1::eTowerContainer::clearContainerMap
void clearContainerMap()
clear map
Definition: eTowerContainer.cxx:49
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::eTowerContainer::m_map_towerID_containerIndex
std::unordered_map< int, int > m_map_towerID_containerIndex
Definition: eTowerContainer.h:79
LVL1::eTowerContainer::fillContainerMap
bool fillContainerMap()
utility function to help speed up accessing towers
Definition: eTowerContainer.cxx:54
LVL1::eTowerContainer::print
void print() const
dump (obsolete)
Definition: eTowerContainer.cxx:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
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::eTowerContainer::eTowerContainer
eTowerContainer(SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS)
Main constructor.
Definition: eTowerContainer.cxx:13
LVL1::eTowerContainer::findTower
const LVL1::eTower * findTower(int towerID) const
fast find method given identifier.
Definition: eTowerContainer.cxx:29
eTower.h
DataVector< LVL1::eTower >::size
size_type size() const noexcept
Returns the number of elements in the collection.