CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalTrigTowerGeometry Class Reference

#include <HcalTrigTowerGeometry.h>

Public Member Functions

std::vector< HcalDetIddetIds (const HcalTrigTowerDetId &) const
 
int firstHFTower (int version) const
 
 HcalTrigTowerGeometry (const HcalTopology *topology)
 
int nTowers (int version) const
 number of towers (version dependent) More...
 
const HcalTopologytopology () const
 
void towerEtaBounds (int ieta, int version, double &eta1, double &eta2) const
 where this tower begins and ends in eta More...
 
std::vector< HcalTrigTowerDetIdtowerIds (const HcalDetId &cellId) const
 the mapping to and from DetIds More...
 
std::vector< HcalTrigTowerDetIdtowerIds_ZDC (const HcalZDCDetId &cellId) const
 
bool use1x1 () const
 
bool useRCT () const
 

Private Member Functions

int firstHFRingInTower (int ietaTower) const
 since the towers are irregular in eta in HF More...
 
int hfTowerEtaSize (int ieta) const
 
int nPhiBins (int ieta, int version) const
 the number of phi bins in this eta ring More...
 

Private Attributes

const HcalTopologytheTopology
 
bool use1x1_
 
bool use2017_
 
bool useRCT_
 

Detailed Description

Definition at line 11 of file HcalTrigTowerGeometry.h.

Constructor & Destructor Documentation

◆ HcalTrigTowerGeometry()

HcalTrigTowerGeometry::HcalTrigTowerGeometry ( const HcalTopology topology)

Definition at line 9 of file HcalTrigTowerGeometry.cc.

References or, theTopology, HcalTopology::triggerMode(), HcalTopologyMode::TriggerMode_2016, HcalTopologyMode::TriggerMode_2017, HcalTopologyMode::TriggerMode_2018legacy, use1x1_, use2017_, and useRCT_.

10  auto tmode = theTopology->triggerMode();
14 }
const HcalTopology * theTopology
const HcalTopology & topology() const
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:35
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12

Member Function Documentation

◆ detIds()

std::vector< HcalDetId > HcalTrigTowerGeometry::detIds ( const HcalTrigTowerDetId hcalTrigTowerDetId) const

Definition at line 100 of file HcalTrigTowerGeometry.cc.

References funct::abs(), HcalTopology::depthBinInformation(), HcalTopology::firstHEDoublePhiRing(), HcalTopology::firstHERing(), HcalTopology::firstHFRing(), firstHFRingInTower(), HcalBarrel, HcalEndcap, HcalForward, HcalOuter, hfTowerEtaSize(), HcalTrigTowerDetId::ieta(), HcalTrigTowerDetId::iphi(), HcalTopology::lastHBRing(), HcalTopology::lastHERing(), HcalTopology::lastHORing(), nPhiBins(), mysort::results, theTopology, use2017_, HcalTrigTowerDetId::version(), HcalTrigTowerDetId::zside(), and ecaldqm::zside().

Referenced by Phase2L1CaloEGammaEmulator::produce(), and L1EGCrystalClusterEmulatorProducer::produce().

100  {
101  // Written, tested by E. Berry (Princeton)
102  std::vector<HcalDetId> results;
103 
104  int tower_ieta = hcalTrigTowerDetId.ieta();
105  int tower_iphi = hcalTrigTowerDetId.iphi();
106 
107  int cell_ieta = tower_ieta;
108  int cell_iphi = tower_iphi;
109 
110  int min_depth, n_depths;
111 
112  // HB
113 
114  if (abs(cell_ieta) <= theTopology->lastHBRing()) {
116  HcalBarrel, abs(tower_ieta), tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
117  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
118  results.emplace_back(HcalDetId(HcalBarrel, cell_ieta, cell_iphi, cell_depth));
119  }
120 
121  // HO
122 
123  if (abs(cell_ieta) <= theTopology->lastHORing()) {
125  HcalOuter, abs(tower_ieta), tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
126  for (int ho_depth = min_depth; ho_depth <= min_depth + n_depths - 1; ho_depth++)
127  results.emplace_back(HcalDetId(HcalOuter, cell_ieta, cell_iphi, ho_depth));
128  }
129 
130  // HE
131 
132  if (abs(cell_ieta) >= theTopology->firstHERing() && abs(cell_ieta) < theTopology->lastHERing()) {
134  HcalEndcap, abs(tower_ieta), tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
135 
136  // Special for double-phi cells
137  if (abs(cell_ieta) >= theTopology->firstHEDoublePhiRing())
138  if (tower_iphi % 2 == 0)
139  cell_iphi = tower_iphi - 1;
140 
141  if (use2017_) {
142  if (abs(tower_ieta) == 26)
143  --n_depths;
144  if (tower_ieta == 27)
145  results.emplace_back(HcalDetId(HcalEndcap, cell_ieta - 1, cell_iphi, 7));
146  if (tower_ieta == -27)
147  results.emplace_back(HcalDetId(HcalEndcap, cell_ieta + 1, cell_iphi, 7));
148  }
149 
150  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
151  results.emplace_back(HcalDetId(HcalEndcap, cell_ieta, cell_iphi, cell_depth));
152 
153  // Special for split-eta cells
154  if (abs(tower_ieta) == 28) {
156  HcalEndcap, abs(tower_ieta) + 1, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
157  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++) {
158  if (tower_ieta < 0)
159  results.emplace_back(HcalDetId(HcalEndcap, tower_ieta - 1, cell_iphi, cell_depth));
160  if (tower_ieta > 0)
161  results.emplace_back(HcalDetId(HcalEndcap, tower_ieta + 1, cell_iphi, cell_depth));
162  }
163  }
164  }
165 
166  // HF
167 
168  if (abs(cell_ieta) >= theTopology->firstHFRing()) {
169  if (hcalTrigTowerDetId.version() == 0) {
170  int HfTowerPhiSize = 72 / nPhiBins(tower_ieta, 0);
171 
172  int HfTowerEtaSize = hfTowerEtaSize(tower_ieta);
173  int FirstHFRingInTower = firstHFRingInTower(abs(tower_ieta));
174 
175  for (int iHFTowerPhiSegment = 0; iHFTowerPhiSegment < HfTowerPhiSize; iHFTowerPhiSegment++) {
176  cell_iphi = (tower_iphi / HfTowerPhiSize) * HfTowerPhiSize; // Find the minimum phi segment
177  cell_iphi -= 2; // The first trigger tower starts at HCAL iphi = 71, not HCAL iphi = 1
178  cell_iphi += iHFTowerPhiSegment; // Get all of the HCAL iphi values in this trigger tower
179  cell_iphi += 72; // Don't want to take the mod of a negative number
180  cell_iphi = cell_iphi % 72; // There are, at most, 72 cells.
181  cell_iphi += 1; // There is no cell at iphi = 0
182 
183  if (cell_iphi % 2 == 0)
184  continue; // These cells don't exist.
185 
186  for (int iHFTowerEtaSegment = 0; iHFTowerEtaSegment < HfTowerEtaSize; iHFTowerEtaSegment++) {
187  cell_ieta = FirstHFRingInTower + iHFTowerEtaSegment;
188 
189  if (cell_ieta >= 40 && cell_iphi % 4 == 1)
190  continue; // These cells don't exist.
191 
193  HcalForward, cell_ieta, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
194 
195  // Negative tower_ieta -> negative cell_ieta
196  int zside = 1;
197  if (tower_ieta < 0)
198  zside = -1;
199 
200  cell_ieta *= zside;
201 
202  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
203  results.emplace_back(HcalDetId(HcalForward, cell_ieta, cell_iphi, cell_depth));
204 
205  if (zside * cell_ieta == 30) {
207  HcalForward, 29 * zside, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
208  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
209  results.emplace_back(HcalDetId(HcalForward, 29 * zside, cell_iphi, cell_depth));
210  }
211  }
212  }
213  } else if (hcalTrigTowerDetId.version() == 1) {
215  HcalForward, tower_ieta, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
216  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
217  results.emplace_back(HcalDetId(HcalForward, tower_ieta, tower_iphi, cell_depth));
218  if (abs(tower_ieta) == 30) {
219  int i29 = 29;
220  if (tower_ieta < 0)
221  i29 = -29;
222  theTopology->depthBinInformation(HcalForward, i29, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
223  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
224  results.emplace_back(HcalDetId(HcalForward, i29, tower_iphi, cell_depth));
225  }
226  }
227  }
228 
229  return results;
230 }
const HcalTopology * theTopology
int lastHORing() const
Definition: HcalTopology.h:99
int zside(DetId const &)
int iphi() const
get the tower iphi
int lastHBRing() const
Definition: HcalTopology.h:92
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int firstHFRingInTower(int ietaTower) const
since the towers are irregular in eta in HF
int ieta() const
get the tower ieta
void depthBinInformation(HcalSubdetector subdet, int etaRing, int iphi, int zside, int &nDepthBins, int &startingBin) const
finds the number of depth bins and which is the number to start with
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:101
int lastHERing() const
Definition: HcalTopology.h:94
int zside() const
get the z-side of the tower (1/-1)
int nPhiBins(int ieta, int version) const
the number of phi bins in this eta ring
results
Definition: mysort.py:8
int hfTowerEtaSize(int ieta) const
int version() const
get the version code for the trigger tower
int firstHFRing() const
Definition: HcalTopology.h:96
int firstHERing() const
Definition: HcalTopology.h:93

◆ firstHFRingInTower()

int HcalTrigTowerGeometry::firstHFRingInTower ( int  ietaTower) const
private

since the towers are irregular in eta in HF

Definition at line 239 of file HcalTrigTowerGeometry.cc.

References funct::abs(), HcalTopology::firstHFRing(), firstHFTower(), hfTowerEtaSize(), mps_fire::result, and theTopology.

Referenced by detIds(), and towerIds().

239  {
240  // count up to the correct HF ring
241  int inputTower = abs(ietaTower);
242  int result = theTopology->firstHFRing();
243  for (int iTower = firstHFTower(0); iTower != inputTower; ++iTower) {
244  result += hfTowerEtaSize(iTower);
245  }
246 
247  // negative in, negative out.
248  if (ietaTower < 0)
249  result *= -1;
250  return result;
251 }
const HcalTopology * theTopology
int firstHFTower(int version) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int hfTowerEtaSize(int ieta) const
int firstHFRing() const
Definition: HcalTopology.h:96

◆ firstHFTower()

int HcalTrigTowerGeometry::firstHFTower ( int  version) const
inline

◆ hfTowerEtaSize()

int HcalTrigTowerGeometry::hfTowerEtaSize ( int  ieta) const
private

the number of HF eta rings in this trigger tower ieta starts at firstHFTower()

Definition at line 232 of file HcalTrigTowerGeometry.cc.

References funct::abs(), cms::cuda::assert(), firstHFTower(), hcalRecHitTable_cff::ieta, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::ietaAbs(), and nTowers().

Referenced by detIds(), and firstHFRingInTower().

232  {
233  int ietaAbs = abs(ieta);
234  assert(ietaAbs >= firstHFTower(0) && ietaAbs <= nTowers(0));
235  // the first three come from rings 29-31, 32-34, 35-37. The last has 4 rings: 38-41
236  return (ietaAbs == nTowers(0)) ? 4 : 3;
237 }
int nTowers(int version) const
number of towers (version dependent)
assert(be >=bs)
int firstHFTower(int version) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ietaAbs(uint32_t id)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ nPhiBins()

int HcalTrigTowerGeometry::nPhiBins ( int  ieta,
int  version 
) const
inlineprivate

the number of phi bins in this eta ring

Definition at line 37 of file HcalTrigTowerGeometry.h.

References funct::abs(), firstHFTower(), hcalRecHitTable_cff::ieta, and BeamSplash_cfg::version.

Referenced by detIds().

37  {
38  int nPhiBinsHF = (18);
39  return (abs(ieta) < firstHFTower(version)) ? 72 : nPhiBinsHF;
40  }
int firstHFTower(int version) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ nTowers()

int HcalTrigTowerGeometry::nTowers ( int  version) const
inline

number of towers (version dependent)

Definition at line 26 of file HcalTrigTowerGeometry.h.

References BeamSplash_cfg::version.

Referenced by hfTowerEtaSize().

26 { return (version == 1) ? (41) : (32); }

◆ topology()

const HcalTopology& HcalTrigTowerGeometry::topology ( ) const
inline

Definition at line 29 of file HcalTrigTowerGeometry.h.

References theTopology.

Referenced by HcalTriggerPrimitiveAlgo::analyzeQIE11().

29 { return *theTopology; }
const HcalTopology * theTopology

◆ towerEtaBounds()

void HcalTrigTowerGeometry::towerEtaBounds ( int  ieta,
int  version,
double &  eta1,
double &  eta2 
) const

where this tower begins and ends in eta

Definition at line 253 of file HcalTrigTowerGeometry.cc.

References funct::abs(), HLT_2024v12_cff::eta1, HLT_2024v12_cff::eta2, HcalTopology::etaRange(), EnergyCorrector::etas, firstHFTower(), HcalBarrel, HcalForward, hcalRecHitTable_cff::ieta, ALPAKA_ACCELERATOR_NAMESPACE::ecal::reconstruction::internal::barrel::ietaAbs(), theTopology, createJobs::tmp, and BeamSplash_cfg::version.

Referenced by CaloTPGTranscoderULUT::loadHCALCompress(), HcaluLUTTPGCoder::make_cosh_ieta_map(), and L1CaloHcalScaleConfigOnlineProd::newObject().

253  {
254  int ietaAbs = abs(ieta);
255  std::pair<double, double> etas = (ietaAbs < firstHFTower(version)) ? theTopology->etaRange(HcalBarrel, ietaAbs)
257  eta1 = etas.first;
258  eta2 = etas.second;
259 
260  // get the signs and order right
261  if (ieta < 0) {
262  double tmp = eta1;
263  eta1 = -eta2;
264  eta2 = -tmp;
265  }
266 }
const HcalTopology * theTopology
int firstHFTower(int version) const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ietaAbs(uint32_t id)
std::pair< double, double > etaRange(HcalSubdetector subdet, int ieta) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tmp
align.sh
Definition: createJobs.py:716

◆ towerIds()

std::vector< HcalTrigTowerDetId > HcalTrigTowerGeometry::towerIds ( const HcalDetId cellId) const

the mapping to and from DetIds

Definition at line 16 of file HcalTrigTowerGeometry.cc.

References hcalRecHitTable_cff::depth, HcalDetId::depth(), HcalTopology::firstHEDoublePhiRing(), firstHFRingInTower(), firstHFTower(), HcalForward, l1ctLayer2EG_cff::id, hcalRecHitTable_cff::ieta, HcalDetId::ieta(), HcalDetId::ietaAbs(), hcalRecHitTable_cff::iphi, HcalDetId::iphi(), HcalTopology::lastHBRing(), HcalTopology::lastHERing(), HcalTopology::maxDepthHE(), mysort::results, HcalDetId::subdet(), theTopology, use1x1_, use2017_, useRCT_, and HcalDetId::zside().

Referenced by HcalTriggerPrimitiveAlgo::addSignal(), HcalTriggerPrimitiveAlgo::addUpgradeTDCFG(), HcalTriggerPrimitiveAlgo::analyzeQIE11(), HcalTriggerPrimitiveAlgo::runFEFormatError(), and CaloTPGTranscoderULUT::setup().

16  {
17  std::vector<HcalTrigTowerDetId> results;
18 
19  if (cellId.subdet() == HcalForward) {
20  if (useRCT_) {
21  // first do eta
22  int hfRing = cellId.ietaAbs();
23  int ieta = firstHFTower(0);
24  // find the tower that contains this ring
25  while (hfRing >= firstHFRingInTower(ieta + 1)) {
26  ++ieta;
27  }
28 
29  ieta *= cellId.zside();
30 
31  // now for phi
32  // HF towers are quad, 18 in phi.
33  // go two cells per trigger tower.
34 
35  int iphi = (((cellId.iphi() + 1) / 4) * 4 + 1) % 72; // 71+1 --> 1, 3+5 --> 5
36  results.emplace_back(HcalTrigTowerDetId(ieta, iphi));
37  }
38  if (use1x1_) {
39  int hfRing = cellId.ietaAbs();
40  if (hfRing == 29)
41  hfRing = 30; // sum 29 into 30.
42 
43  int ieta = hfRing * cellId.zside();
44  int iphi = cellId.iphi();
45 
47  id.setVersion(1); // version 1 for 1x1 HF granularity
48  results.emplace_back(id);
49  }
50 
51  } else {
52  // the first twenty rings are one-to-one
53  if (cellId.ietaAbs() <= theTopology->lastHBRing()) {
54  results.emplace_back(HcalTrigTowerDetId(cellId.ieta(), cellId.iphi()));
55  } else if (theTopology->maxDepthHE() == 0) {
56  // Ignore these
57  } else if (cellId.ietaAbs() < theTopology->firstHEDoublePhiRing()) {
58  results.emplace_back(HcalTrigTowerDetId(cellId.ieta(), cellId.iphi()));
59  } else {
60  // the remaining rings are two-to-one in phi
61  int iphi1 = cellId.iphi();
62  int ieta = cellId.ieta();
63  int depth = cellId.depth();
64  // the last eta ring in HE is split. Recombine.
65  if (ieta == theTopology->lastHERing())
66  --ieta;
67  if (ieta == -theTopology->lastHERing())
68  ++ieta;
69 
70  if (use2017_) {
71  if (ieta == 26 and depth == 7)
72  ++ieta;
73  if (ieta == -26 and depth == 7)
74  --ieta;
75  }
76 
77  results.emplace_back(HcalTrigTowerDetId(ieta, iphi1));
78  results.emplace_back(HcalTrigTowerDetId(ieta, iphi1 + 1));
79  }
80  }
81 
82  return results;
83 }
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
const HcalTopology * theTopology
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
int maxDepthHE() const
Definition: HcalTopology.h:140
int firstHFTower(int version) const
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
int lastHBRing() const
Definition: HcalTopology.h:92
int firstHFRingInTower(int ietaTower) const
since the towers are irregular in eta in HF
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:101
int lastHERing() const
Definition: HcalTopology.h:94
results
Definition: mysort.py:8
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164

◆ towerIds_ZDC()

std::vector< HcalTrigTowerDetId > HcalTrigTowerGeometry::towerIds_ZDC ( const HcalZDCDetId cellId) const

Definition at line 85 of file HcalTrigTowerGeometry.cc.

References HcalZDCDetId::channel(), HcalZDCDetId::depth(), hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, mysort::results, and HcalZDCDetId::zside().

Referenced by HcalTriggerPrimitiveAlgo::addSignal().

85  {
86  std::vector<HcalTrigTowerDetId> results;
87 
88  int ieta = cellId.zside() > 0 ? 42 : -42;
89  int iphi = 99;
90  int channelId = cellId.channel();
91  if (cellId.depth() != 1)
92  channelId += 5;
93 
94  results.emplace_back(HcalTrigTowerDetId(ieta, channelId));
95  results.emplace_back(HcalTrigTowerDetId(ieta, iphi));
96 
97  return results;
98 }
constexpr int32_t depth() const
get the depth (1 for EM, channel + 1 for HAD, 2 for RPD, not sure yet for LUM, leave as default) ...
Definition: HcalZDCDetId.h:100
results
Definition: mysort.py:8
constexpr int32_t channel() const
get the channel
Definition: HcalZDCDetId.h:112
constexpr int32_t zside() const
get the z-side of the cell (1/-1)
Definition: HcalZDCDetId.h:90

◆ use1x1()

bool HcalTrigTowerGeometry::use1x1 ( ) const
inline

Definition at line 33 of file HcalTrigTowerGeometry.h.

References use1x1_.

Referenced by L1TCaloLayer1FetchLUTs().

33 { return use1x1_; }

◆ useRCT()

bool HcalTrigTowerGeometry::useRCT ( ) const
inline

Definition at line 32 of file HcalTrigTowerGeometry.h.

References useRCT_.

32 { return useRCT_; }

Member Data Documentation

◆ theTopology

const HcalTopology* HcalTrigTowerGeometry::theTopology
private

◆ use1x1_

bool HcalTrigTowerGeometry::use1x1_
private

Definition at line 53 of file HcalTrigTowerGeometry.h.

Referenced by HcalTrigTowerGeometry(), towerIds(), and use1x1().

◆ use2017_

bool HcalTrigTowerGeometry::use2017_
private

Definition at line 54 of file HcalTrigTowerGeometry.h.

Referenced by detIds(), HcalTrigTowerGeometry(), and towerIds().

◆ useRCT_

bool HcalTrigTowerGeometry::useRCT_
private

Definition at line 52 of file HcalTrigTowerGeometry.h.

Referenced by HcalTrigTowerGeometry(), towerIds(), and useRCT().