CMS 3D CMS Logo

HcalTrigTowerGeometry.cc
Go to the documentation of this file.
4 
5 #include <iostream>
6 #include <cassert>
7 
9  auto tmode = theTopology->triggerMode();
13 }
14 
15 std::vector<HcalTrigTowerDetId> HcalTrigTowerGeometry::towerIds(const HcalDetId& cellId) const {
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 }
83 
84 std::vector<HcalDetId> HcalTrigTowerGeometry::detIds(const HcalTrigTowerDetId& hcalTrigTowerDetId) const {
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 }
215 
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 }
222 
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 }
236 
237 void HcalTrigTowerGeometry::towerEtaBounds(int ieta, int version, double& eta1, double& eta2) const {
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 }
HcalTrigTowerGeometry::theTopology
const HcalTopology * theTopology
Definition: HcalTrigTowerGeometry.h:48
HcalTrigTowerGeometry::towerIds
std::vector< HcalTrigTowerDetId > towerIds(const HcalDetId &cellId) const
the mapping to and from DetIds
Definition: HcalTrigTowerGeometry.cc:15
HcalTrigTowerDetId::ieta
int ieta() const
get the tower ieta
Definition: HcalTrigTowerDetId.h:54
HcalTopology::maxDepthHE
int maxDepthHE() const
Definition: HcalTopology.h:140
HcalDetId::iphi
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
HcalTopology
Definition: HcalTopology.h:26
HLT_2018_cff.eta1
eta1
Definition: HLT_2018_cff.py:8220
cms::cuda::assert
assert(be >=bs)
bookConverter.results
results
Definition: bookConverter.py:144
HcalDetId::depth
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
HcalTopologyMode::TriggerMode_2016
Definition: HcalTopologyMode.h:30
HcalTrigTowerDetId::zside
int zside() const
get the z-side of the tower (1/-1)
Definition: HcalTrigTowerDetId.h:50
HcalBarrel
Definition: HcalAssistant.h:33
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
HcalTrigTowerGeometry::nPhiBins
int nPhiBins(int ieta, int version) const
the number of phi bins in this eta ring
Definition: HcalTrigTowerGeometry.h:35
HcalTopology::firstHERing
int firstHERing() const
Definition: HcalTopology.h:93
HcalTrigTowerGeometry::firstHFRingInTower
int firstHFRingInTower(int ietaTower) const
since the towers are irregular in eta in HF
Definition: HcalTrigTowerGeometry.cc:223
HcalTopologyMode::TriggerMode_2017
Definition: HcalTopologyMode.h:32
HcalTrigTowerGeometry::hfTowerEtaSize
int hfTowerEtaSize(int ieta) const
Definition: HcalTrigTowerGeometry.cc:216
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HcalTopology::firstHEDoublePhiRing
int firstHEDoublePhiRing() const
Definition: HcalTopology.h:101
HcalTopology::firstHFRing
int firstHFRing() const
Definition: HcalTopology.h:96
HcalTopology::lastHORing
int lastHORing() const
Definition: HcalTopology.h:99
ecaldqm::topology
const CaloTopology * topology(nullptr)
EnergyCorrector.etas
etas
Definition: EnergyCorrector.py:45
HcalOuter
Definition: HcalAssistant.h:35
HcalTrigTowerDetId::version
int version() const
get the version code for the trigger tower
Definition: HcalTrigTowerDetId.h:60
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HLT_2018_cff.eta2
eta2
Definition: HLT_2018_cff.py:8221
HcalTrigTowerDetId.h
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HcalDetId::ieta
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
HcalDetId.h
HcalDetId::subdet
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
HcalDetId
Definition: HcalDetId.h:12
HcalTopology::triggerMode
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:35
HcalTrigTowerGeometry::firstHFTower
int firstHFTower(int version) const
Definition: HcalTrigTowerGeometry.h:18
HcalTopology::depthBinInformation
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
Definition: HcalTopology.cc:816
HcalTopology::lastHERing
int lastHERing() const
Definition: HcalTopology.h:94
HcalTrigTowerGeometry.h
HcalForward
Definition: HcalAssistant.h:36
HcalTrigTowerGeometry::use2017_
bool use2017_
Definition: HcalTrigTowerGeometry.h:52
HcalEndcap
Definition: HcalAssistant.h:34
HcalTrigTowerDetId::iphi
int iphi() const
get the tower iphi
Definition: HcalTrigTowerDetId.h:56
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
HcalTrigTowerGeometry::HcalTrigTowerGeometry
HcalTrigTowerGeometry(const HcalTopology *topology)
Definition: HcalTrigTowerGeometry.cc:8
HcalTopology::etaRange
std::pair< double, double > etaRange(HcalSubdetector subdet, int ieta) const
Definition: HcalTopology.cc:1124
or
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
mps_fire.result
result
Definition: mps_fire.py:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HcalDetId::ietaAbs
constexpr int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
HcalDetId::zside
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
HcalTrigTowerGeometry::towerEtaBounds
void towerEtaBounds(int ieta, int version, double &eta1, double &eta2) const
where this tower begins and ends in eta
Definition: HcalTrigTowerGeometry.cc:237
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
HcalTopologyMode::TriggerMode_2018legacy
Definition: HcalTopologyMode.h:31
HcalTrigTowerGeometry::nTowers
int nTowers(int version) const
number of towers (version dependent)
Definition: HcalTrigTowerGeometry.h:24
HcalTrigTowerGeometry::detIds
std::vector< HcalDetId > detIds(const HcalTrigTowerDetId &) const
Definition: HcalTrigTowerGeometry.cc:84
HcalTrigTowerGeometry::useRCT_
bool useRCT_
Definition: HcalTrigTowerGeometry.h:50
HcalTopology::lastHBRing
int lastHBRing() const
Definition: HcalTopology.h:92
HcalTrigTowerGeometry::use1x1_
bool use1x1_
Definition: HcalTrigTowerGeometry.h:51
HcalTrigTowerDetId
Definition: HcalTrigTowerDetId.h:14