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...
 
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 10 of file HcalTrigTowerGeometry.h.

Constructor & Destructor Documentation

◆ HcalTrigTowerGeometry()

HcalTrigTowerGeometry::HcalTrigTowerGeometry ( const HcalTopology topology)

Definition at line 8 of file HcalTrigTowerGeometry.cc.

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

9  auto tmode = theTopology->triggerMode();
13 }
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 84 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(), bookConverter::results, theTopology, use2017_, HcalTrigTowerDetId::version(), HcalTrigTowerDetId::zside(), and ecaldqm::zside().

Referenced by L1EGCrystalClusterEmulatorProducer::produce().

84  {
85  // Written, tested by E. Berry (Princeton)
86  std::vector<HcalDetId> results;
87 
88  int tower_ieta = hcalTrigTowerDetId.ieta();
89  int tower_iphi = hcalTrigTowerDetId.iphi();
90 
91  int cell_ieta = tower_ieta;
92  int cell_iphi = tower_iphi;
93 
94  int min_depth, n_depths;
95 
96  // HB
97 
98  if (abs(cell_ieta) <= theTopology->lastHBRing()) {
100  HcalBarrel, abs(tower_ieta), tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
101  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
102  results.emplace_back(HcalDetId(HcalBarrel, cell_ieta, cell_iphi, cell_depth));
103  }
104 
105  // HO
106 
107  if (abs(cell_ieta) <= theTopology->lastHORing()) {
109  HcalOuter, abs(tower_ieta), tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
110  for (int ho_depth = min_depth; ho_depth <= min_depth + n_depths - 1; ho_depth++)
111  results.emplace_back(HcalDetId(HcalOuter, cell_ieta, cell_iphi, ho_depth));
112  }
113 
114  // HE
115 
116  if (abs(cell_ieta) >= theTopology->firstHERing() && abs(cell_ieta) < theTopology->lastHERing()) {
118  HcalEndcap, abs(tower_ieta), tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
119 
120  // Special for double-phi cells
121  if (abs(cell_ieta) >= theTopology->firstHEDoublePhiRing())
122  if (tower_iphi % 2 == 0)
123  cell_iphi = tower_iphi - 1;
124 
125  if (use2017_) {
126  if (abs(tower_ieta) == 26)
127  --n_depths;
128  if (tower_ieta == 27)
129  results.emplace_back(HcalDetId(HcalEndcap, cell_ieta - 1, cell_iphi, 7));
130  if (tower_ieta == -27)
131  results.emplace_back(HcalDetId(HcalEndcap, cell_ieta + 1, cell_iphi, 7));
132  }
133 
134  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
135  results.emplace_back(HcalDetId(HcalEndcap, cell_ieta, cell_iphi, cell_depth));
136 
137  // Special for split-eta cells
138  if (abs(tower_ieta) == 28) {
140  HcalEndcap, abs(tower_ieta) + 1, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
141  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++) {
142  if (tower_ieta < 0)
143  results.emplace_back(HcalDetId(HcalEndcap, tower_ieta - 1, cell_iphi, cell_depth));
144  if (tower_ieta > 0)
145  results.emplace_back(HcalDetId(HcalEndcap, tower_ieta + 1, cell_iphi, cell_depth));
146  }
147  }
148  }
149 
150  // HF
151 
152  if (abs(cell_ieta) >= theTopology->firstHFRing()) {
153  if (hcalTrigTowerDetId.version() == 0) {
154  int HfTowerPhiSize = 72 / nPhiBins(tower_ieta, 0);
155 
156  int HfTowerEtaSize = hfTowerEtaSize(tower_ieta);
157  int FirstHFRingInTower = firstHFRingInTower(abs(tower_ieta));
158 
159  for (int iHFTowerPhiSegment = 0; iHFTowerPhiSegment < HfTowerPhiSize; iHFTowerPhiSegment++) {
160  cell_iphi = (tower_iphi / HfTowerPhiSize) * HfTowerPhiSize; // Find the minimum phi segment
161  cell_iphi -= 2; // The first trigger tower starts at HCAL iphi = 71, not HCAL iphi = 1
162  cell_iphi += iHFTowerPhiSegment; // Get all of the HCAL iphi values in this trigger tower
163  cell_iphi += 72; // Don't want to take the mod of a negative number
164  cell_iphi = cell_iphi % 72; // There are, at most, 72 cells.
165  cell_iphi += 1; // There is no cell at iphi = 0
166 
167  if (cell_iphi % 2 == 0)
168  continue; // These cells don't exist.
169 
170  for (int iHFTowerEtaSegment = 0; iHFTowerEtaSegment < HfTowerEtaSize; iHFTowerEtaSegment++) {
171  cell_ieta = FirstHFRingInTower + iHFTowerEtaSegment;
172 
173  if (cell_ieta >= 40 && cell_iphi % 4 == 1)
174  continue; // These cells don't exist.
175 
177  HcalForward, cell_ieta, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
178 
179  // Negative tower_ieta -> negative cell_ieta
180  int zside = 1;
181  if (tower_ieta < 0)
182  zside = -1;
183 
184  cell_ieta *= zside;
185 
186  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
187  results.emplace_back(HcalDetId(HcalForward, cell_ieta, cell_iphi, cell_depth));
188 
189  if (zside * cell_ieta == 30) {
191  HcalForward, 29 * zside, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
192  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
193  results.emplace_back(HcalDetId(HcalForward, 29 * zside, cell_iphi, cell_depth));
194  }
195  }
196  }
197  } else if (hcalTrigTowerDetId.version() == 1) {
199  HcalForward, tower_ieta, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
200  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
201  results.emplace_back(HcalDetId(HcalForward, tower_ieta, tower_iphi, cell_depth));
202  if (abs(tower_ieta) == 30) {
203  int i29 = 29;
204  if (tower_ieta < 0)
205  i29 = -29;
206  theTopology->depthBinInformation(HcalForward, i29, tower_iphi, hcalTrigTowerDetId.zside(), n_depths, min_depth);
207  for (int cell_depth = min_depth; cell_depth <= min_depth + n_depths - 1; cell_depth++)
208  results.emplace_back(HcalDetId(HcalForward, i29, tower_iphi, cell_depth));
209  }
210  }
211  }
212 
213  return results;
214 }
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
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 223 of file HcalTrigTowerGeometry.cc.

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

Referenced by detIds(), and towerIds().

223  {
224  // count up to the correct HF ring
225  int inputTower = abs(ietaTower);
226  int result = theTopology->firstHFRing();
227  for (int iTower = firstHFTower(0); iTower != inputTower; ++iTower) {
228  result += hfTowerEtaSize(iTower);
229  }
230 
231  // negative in, negative out.
232  if (ietaTower < 0)
233  result *= -1;
234  return result;
235 }
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 216 of file HcalTrigTowerGeometry.cc.

References funct::abs(), cms::cuda::assert(), firstHFTower(), LEDCalibrationChannels::ieta, and nTowers().

Referenced by detIds(), and firstHFRingInTower().

216  {
217  int ietaAbs = abs(ieta);
218  assert(ietaAbs >= firstHFTower(0) && ietaAbs <= nTowers(0));
219  // the first three come from rings 29-31, 32-34, 35-37. The last has 4 rings: 38-41
220  return (ietaAbs == nTowers(0)) ? 4 : 3;
221 }
int nTowers(int version) const
number of towers (version dependent)
assert(be >=bs)
int firstHFTower(int version) const
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 35 of file HcalTrigTowerGeometry.h.

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

Referenced by detIds().

35  {
36  int nPhiBinsHF = (18);
37  return (abs(ieta) < firstHFTower(version)) ? 72 : nPhiBinsHF;
38  }
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 24 of file HcalTrigTowerGeometry.h.

References BeamSplash_cfg::version.

Referenced by hfTowerEtaSize().

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

◆ topology()

const HcalTopology& HcalTrigTowerGeometry::topology ( ) const
inline

Definition at line 27 of file HcalTrigTowerGeometry.h.

References theTopology.

Referenced by HcalTriggerPrimitiveAlgo::analyzeQIE11().

27 { 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 237 of file HcalTrigTowerGeometry.cc.

References funct::abs(), HLT_2022v15_cff::eta1, HLT_2022v15_cff::eta2, HcalTopology::etaRange(), EnergyCorrector::etas, firstHFTower(), HcalBarrel, HcalForward, LEDCalibrationChannels::ieta, theTopology, createJobs::tmp, and BeamSplash_cfg::version.

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

237  {
238  int ietaAbs = abs(ieta);
239  std::pair<double, double> etas = (ietaAbs < firstHFTower(version)) ? theTopology->etaRange(HcalBarrel, ietaAbs)
240  : theTopology->etaRange(HcalForward, ietaAbs);
241  eta1 = etas.first;
242  eta2 = etas.second;
243 
244  // get the signs and order right
245  if (ieta < 0) {
246  double tmp = eta1;
247  eta1 = -eta2;
248  eta2 = -tmp;
249  }
250 }
const HcalTopology * theTopology
int firstHFTower(int version) const
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 15 of file HcalTrigTowerGeometry.cc.

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

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

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

◆ use1x1()

bool HcalTrigTowerGeometry::use1x1 ( ) const
inline

Definition at line 31 of file HcalTrigTowerGeometry.h.

References use1x1_.

Referenced by L1TCaloLayer1FetchLUTs().

31 { return use1x1_; }

◆ useRCT()

bool HcalTrigTowerGeometry::useRCT ( ) const
inline

Definition at line 30 of file HcalTrigTowerGeometry.h.

References useRCT_.

30 { return useRCT_; }

Member Data Documentation

◆ theTopology

const HcalTopology* HcalTrigTowerGeometry::theTopology
private

◆ use1x1_

bool HcalTrigTowerGeometry::use1x1_
private

Definition at line 51 of file HcalTrigTowerGeometry.h.

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

◆ use2017_

bool HcalTrigTowerGeometry::use2017_
private

Definition at line 52 of file HcalTrigTowerGeometry.h.

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

◆ useRCT_

bool HcalTrigTowerGeometry::useRCT_
private

Definition at line 50 of file HcalTrigTowerGeometry.h.

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