ATLAS Offline Software
JGTowerHelper.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGT1CALOFEXPERF_JGTOWERHELPER_H
6 #define TRIGT1CALOFEXPERF_JGTOWERHELPER_H
7 /*
8 * Class : JGTowerHelper
9 *
10 * Author : Lin, Chiao-Ying (cylin@cern.ch)
11 *
12 * Date : May 2017 - Created class
13 *
14 * This class is built for JGTower algorithm in topology
15 * including mapping to SC, eta/phi and granularity
16 *
17 */
18 
19 #include <vector>
20 #include <string>
21 #include <cstdint>
22 
23 namespace LVL1
24 {
26  {
27 
28  public:
29  // constructors
30  JGTowerHelper() = delete;
31  JGTowerHelper(float eta, float deta, float phi, float dphi);
32 
33  // destructor
34  virtual ~JGTowerHelper();
35 
36  float Eta() const { return m_eta; };
37  float Phi() const { return m_phi; };
38  float dEta() const { return m_deta; };
39  float dPhi() const { return m_dphi; };
40  float sampling() const { return m_sampling; };
41  std::vector<int> GetSCIndices() const { return m_scellIndices; };
42  std::vector<int> GetTileIndices() const { return m_tileIndices; };
43  void SetSCIndices(int sc_id) { m_scellIndices.push_back(sc_id); };
44  void SetTileIndices(int tile_id) { m_tileIndices.push_back(tile_id); };
46 
47  static bool inBox(float eta1, float eta2, float deta, float phi1, float phi2, float dphi);
48  bool inBox(float eta, float phi) const;
49 
50  float area() const { return m_area; }
51  void setArea(float value) { m_area = value; }
52 
53  // Notes on the tower relation indices:
54  // - These all return indices relating to the vectors held in the mapping makers
55  // - These are reliable in the central region where the towers are regular and grid-like.
56  // In the forward region this is much less reliable and should not be relied on
57  // - These are different to those in the JGTowerBase_IDs as the 'next' eta step always
58  // goes in increasing eta, rather than increasing |eta|.
59  // - These also stitch across region boundaries where the granularities allow
60 
62  std::size_t previousEtaIndex() const { return m_prevEtaIndex; }
64  bool hasPreviousEta() const { return m_prevEtaIndex != SIZE_MAX; }
66  std::size_t nextEtaIndex() const { return m_nextEtaIndex; }
68  bool hasNextEta() const { return m_nextEtaIndex != SIZE_MAX; }
70  std::size_t previousPhiIndex() const { return m_prevPhiIndex; }
72  bool hasPreviousPhi() const { return m_prevPhiIndex != SIZE_MAX; }
74  std::size_t nextPhiIndex() const { return m_nextPhiIndex; }
76  bool hasNextPhi() const { return m_nextPhiIndex != SIZE_MAX; }
78  std::size_t indexInFront() const { return m_indexInFront; }
80  bool isFrontTower() const { return m_indexInFront == SIZE_MAX; }
82  std::size_t indexBehind() const { return m_indexBehind; }
84  bool isBackTower() const { return m_indexBehind == SIZE_MAX; }
85 
86  void setPreviousEtaIndex(std::size_t value) { m_prevEtaIndex = value; }
87  void setNextEtaIndex(std::size_t value) { m_nextEtaIndex = value; }
88  void setPreviousPhiIndex(std::size_t value) { m_prevPhiIndex = value; }
89  void setNextPhiIndex(std::size_t value) { m_nextPhiIndex = value; }
90  void setIndexInFront(std::size_t value) { m_indexInFront = value; }
91  void setIndexBehind(std::size_t value) { m_indexBehind = value; }
92 
93  private:
94  float m_eta{-999};
95  float m_deta{-999};
96  float m_phi{-999};
97  float m_dphi{-999};
98  int m_sampling{-999};
99  std::vector<int> m_scellIndices;
100  std::vector<int> m_tileIndices;
101  float m_area{-1};
102  std::size_t m_prevEtaIndex{SIZE_MAX};
103  std::size_t m_nextEtaIndex{SIZE_MAX};
104  std::size_t m_prevPhiIndex{SIZE_MAX};
105  std::size_t m_nextPhiIndex{SIZE_MAX};
106  std::size_t m_indexInFront{SIZE_MAX};
107  std::size_t m_indexBehind{SIZE_MAX};
108  };
109 } // namespace LVL1
110 #endif
LVL1::JGTowerHelper::m_nextPhiIndex
std::size_t m_nextPhiIndex
Definition: JGTowerHelper.h:105
LVL1::JGTowerHelper::dPhi
float dPhi() const
Definition: JGTowerHelper.h:39
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
LVL1::JGTowerHelper::indexBehind
std::size_t indexBehind() const
The index of the tower behind this one.
Definition: JGTowerHelper.h:82
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
LVL1::JGTowerHelper::m_nextEtaIndex
std::size_t m_nextEtaIndex
Definition: JGTowerHelper.h:103
LVL1::JGTowerHelper::m_indexInFront
std::size_t m_indexInFront
Definition: JGTowerHelper.h:106
LVL1::JGTowerHelper::setPreviousPhiIndex
void setPreviousPhiIndex(std::size_t value)
Definition: JGTowerHelper.h:88
athena.value
value
Definition: athena.py:122
xAOD::eta1
setEt setPhi setE277 setWeta2 eta1
Definition: TrigEMCluster_v1.cxx:41
LVL1::JGTowerHelper
Definition: JGTowerHelper.h:26
LVL1::JGTowerHelper::GetTileIndices
std::vector< int > GetTileIndices() const
Definition: JGTowerHelper.h:42
LVL1::JGTowerHelper::nextPhiIndex
std::size_t nextPhiIndex() const
The index of the tower after this one in phi (SIZE_MAX if not valid)
Definition: JGTowerHelper.h:74
LVL1::JGTowerHelper::setIndexInFront
void setIndexInFront(std::size_t value)
Definition: JGTowerHelper.h:90
LVL1::JGTowerHelper::m_scellIndices
std::vector< int > m_scellIndices
Definition: JGTowerHelper.h:99
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::JGTowerHelper::m_tileIndices
std::vector< int > m_tileIndices
Definition: JGTowerHelper.h:100
LVL1::JGTowerHelper::m_indexBehind
std::size_t m_indexBehind
Definition: JGTowerHelper.h:107
LVL1::JGTowerHelper::Phi
float Phi() const
Definition: JGTowerHelper.h:37
LVL1::JGTowerHelper::hasPreviousPhi
bool hasPreviousPhi() const
Whether there is a previous phi tower.
Definition: JGTowerHelper.h:72
LVL1::JGTowerHelper::setIndexBehind
void setIndexBehind(std::size_t value)
Definition: JGTowerHelper.h:91
LVL1::JGTowerHelper::m_prevEtaIndex
std::size_t m_prevEtaIndex
Definition: JGTowerHelper.h:102
LVL1::JGTowerHelper::GetSCIndices
std::vector< int > GetSCIndices() const
Definition: JGTowerHelper.h:41
LVL1::JGTowerHelper::hasNextPhi
bool hasNextPhi() const
Whether there is a next phi tower.
Definition: JGTowerHelper.h:76
LVL1::JGTowerHelper::m_eta
float m_eta
Definition: JGTowerHelper.h:94
LVL1::JGTowerHelper::area
float area() const
Definition: JGTowerHelper.h:50
LVL1::JGTowerHelper::dEta
float dEta() const
Definition: JGTowerHelper.h:38
LVL1::JGTowerHelper::setNextEtaIndex
void setNextEtaIndex(std::size_t value)
Definition: JGTowerHelper.h:87
LVL1::JGTowerHelper::indexInFront
std::size_t indexInFront() const
The index of the tower in front of this one.
Definition: JGTowerHelper.h:78
LVL1::JGTowerHelper::m_phi
float m_phi
Definition: JGTowerHelper.h:96
LVL1::JGTowerHelper::m_dphi
float m_dphi
Definition: JGTowerHelper.h:97
LVL1::JGTowerHelper::SetTileIndices
void SetTileIndices(int tile_id)
Definition: JGTowerHelper.h:44
LVL1::JGTowerHelper::isBackTower
bool isBackTower() const
Whether there is a tower behind this one.
Definition: JGTowerHelper.h:84
LVL1::JGTowerHelper::m_deta
float m_deta
Definition: JGTowerHelper.h:95
LVL1::JGTowerHelper::m_prevPhiIndex
std::size_t m_prevPhiIndex
Definition: JGTowerHelper.h:104
LVL1::JGTowerHelper::Eta
float Eta() const
Definition: JGTowerHelper.h:36
LVL1::JGTowerHelper::previousEtaIndex
std::size_t previousEtaIndex() const
The index of the tower before this one in eta (SIZE_MAX if not valid)
Definition: JGTowerHelper.h:62
LVL1::JGTowerHelper::~JGTowerHelper
virtual ~JGTowerHelper()
Definition: JGTowerHelper.cxx:21
LVL1::JGTowerHelper::nextEtaIndex
std::size_t nextEtaIndex() const
The index of the tower after this one in eta (SIZE_MAX if not valid)
Definition: JGTowerHelper.h:66
LVL1::JGTowerHelper::setPreviousEtaIndex
void setPreviousEtaIndex(std::size_t value)
Definition: JGTowerHelper.h:86
LVL1::JGTowerHelper::hasPreviousEta
bool hasPreviousEta() const
Whether there is a previous eta tower.
Definition: JGTowerHelper.h:64
LVL1::JGTowerHelper::sampling
float sampling() const
Definition: JGTowerHelper.h:40
LVL1::JGTowerHelper::setArea
void setArea(float value)
Definition: JGTowerHelper.h:51
LVL1::JGTowerHelper::hasNextEta
bool hasNextEta() const
Whether there is a next eta tower.
Definition: JGTowerHelper.h:68
LVL1::JGTowerHelper::previousPhiIndex
std::size_t previousPhiIndex() const
The index of the tower before this one in phi (SIZE_MAX if not valid)
Definition: JGTowerHelper.h:70
LVL1::JGTowerHelper::m_area
float m_area
Definition: JGTowerHelper.h:101
LVL1::JGTowerHelper::SetSCIndices
void SetSCIndices(int sc_id)
Definition: JGTowerHelper.h:43
LVL1::JGTowerHelper::SetSampling
void SetSampling(int sampling)
Definition: JGTowerHelper.h:45
LVL1::JGTowerHelper::m_sampling
int m_sampling
Definition: JGTowerHelper.h:98
LVL1::JGTowerHelper::JGTowerHelper
JGTowerHelper()=delete
LVL1::JGTowerHelper::isFrontTower
bool isFrontTower() const
Whether there is a tower in front of this one.
Definition: JGTowerHelper.h:80
LVL1::JGTowerHelper::setNextPhiIndex
void setNextPhiIndex(std::size_t value)
Definition: JGTowerHelper.h:89
LVL1::JGTowerHelper::inBox
static bool inBox(float eta1, float eta2, float deta, float phi1, float phi2, float dphi)
Definition: JGTowerHelper.cxx:24