CMS 3D CMS Logo

HGCalTriggerGeometryV9Imp3.cc
Go to the documentation of this file.
13 
14 #include <fstream>
15 #include <vector>
16 
17 #include <nlohmann/json.hpp>
19 
21 public:
23 
24  void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final;
25  void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final;
26  void reset() final;
27 
28  unsigned getTriggerCellFromCell(const unsigned) const final;
29  unsigned getModuleFromCell(const unsigned) const final;
30  unsigned getModuleFromTriggerCell(const unsigned) const final;
31 
32  geom_set getCellsFromTriggerCell(const unsigned) const final;
33  geom_set getCellsFromModule(const unsigned) const final;
34  geom_set getTriggerCellsFromModule(const unsigned) const final;
35 
36  geom_ordered_set getOrderedCellsFromModule(const unsigned) const final;
37  geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final;
38 
39  geom_set getNeighborsFromTriggerCell(const unsigned) const final;
40 
41  geom_set getStage1FpgasFromStage2Fpga(const unsigned) const final;
42  geom_set getStage2FpgasFromStage1Fpga(const unsigned) const final;
43 
44  geom_set getStage1LinksFromStage2Fpga(const unsigned) const final;
45  unsigned getStage1FpgaFromStage1Link(const unsigned) const final;
46  unsigned getStage2FpgaFromStage1Link(const unsigned) const final;
47  geom_set getStage1LinksFromStage1Fpga(const unsigned) const final;
48  geom_set getLpgbtsFromStage1Fpga(const unsigned) const final;
49  unsigned getStage1FpgaFromLpgbt(const unsigned) const final;
50  geom_set getModulesFromLpgbt(const unsigned) const final;
51  geom_set getLpgbtsFromModule(const unsigned) const final;
52  unsigned getStage1FpgaFromModule(const unsigned module_id) const final;
53 
54  unsigned getLinksInModule(const unsigned module_id) const final;
55  unsigned getModuleSize(const unsigned module_id) const final;
56 
57  GlobalPoint getTriggerCellPosition(const unsigned) const final;
58  GlobalPoint getModulePosition(const unsigned) const final;
59 
60  bool validCell(const unsigned) const final;
61  bool validTriggerCell(const unsigned) const final;
62  bool disconnectedModule(const unsigned) const final;
63  unsigned lastTriggerLayer() const final { return last_trigger_layer_; }
64  unsigned triggerLayer(const unsigned) const final;
65 
66 private:
67  // HSc trigger cell grouping
68  unsigned hSc_triggercell_size_ = 2;
69  static constexpr unsigned hSc_num_panels_per_sector_ = 12;
70  static constexpr unsigned hSc_tcs_per_module_phi_ = 4;
71  static constexpr unsigned hSc_front_layers_split_ = 12;
72  static constexpr unsigned hSc_back_layers_split_ = 8;
73  static constexpr unsigned hSc_layer_for_split_ = 40;
74  static constexpr int hSc_tc_layer0_min_ = 24;
75  static constexpr int ntc_per_wafer_ = 48;
76  static constexpr int nSectors_ = 3;
77 
79 
80  // rotation class
82 
83  // module related maps
84  std::unordered_map<unsigned, unsigned> links_per_module_;
85 
86  std::unordered_multimap<unsigned, unsigned> stage2_to_stage1links_;
87  std::unordered_map<unsigned, bool> stage1links_samesector_;
88  std::unordered_map<unsigned, unsigned> stage1link_to_stage2_;
89  std::unordered_map<unsigned, unsigned> stage1link_to_stage1_;
90  std::unordered_multimap<unsigned, unsigned> stage1_to_stage1links_;
91  std::unordered_multimap<unsigned, unsigned> stage1_to_lpgbts_;
92  std::unordered_map<unsigned, unsigned> lpgbt_to_stage1_;
93  std::unordered_multimap<unsigned, unsigned> lpgbt_to_modules_;
94  std::unordered_multimap<unsigned, unsigned> module_to_lpgbts_;
95  std::unordered_map<unsigned, unsigned> module_to_stage1_;
96 
97  // Disconnected modules and layers
98  std::unordered_set<unsigned> disconnected_layers_;
99  std::vector<unsigned> trigger_layers_;
100  std::vector<unsigned> trigger_nose_layers_;
101  unsigned last_trigger_layer_ = 0;
102 
103  // layer offsets
104  unsigned heOffset_ = 0;
105  unsigned noseLayers_ = 0;
106  unsigned totalLayers_ = 0;
107 
108  void fillMaps();
109  bool validCellId(unsigned det, unsigned cell_id) const;
110  bool validTriggerCellFromCells(const unsigned) const;
111 
112  int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const;
113  void layerWithoutOffsetAndSubdetId(unsigned& layer, int& subdetId, bool isSilicon) const;
114  unsigned packLayerSubdetWaferId(unsigned layer, int subdet, int waferU, int waferV) const;
115  void unpackLayerSubdetWaferId(unsigned wafer, unsigned& layer, int& subdet, int& waferU, int& waferV) const;
116  HGCalGeomRotation::WaferCentring getWaferCentring(unsigned layer, int subdet) const;
117  void etaphiMappingFromSector0(int& ieta, int& iphi, unsigned sector) const;
118  unsigned tcEtaphiMappingToSector0(int& tc_ieta, int& tc_iphi) const;
119  void getScintillatoriEtaiPhi(int& ieta, int& iphi, int tc_eta, int tc_phi, unsigned layer) const;
120  unsigned layerWithOffset(unsigned) const;
121  unsigned getNextSector(const unsigned sector) const;
122  unsigned getPreviousSector(const unsigned sector) const;
123 };
124 
126  : HGCalTriggerGeometryBase(conf),
127  hSc_triggercell_size_(conf.getParameter<unsigned>("ScintillatorTriggerCellSize")),
128  jsonMappingFile_(conf.getParameter<edm::FileInPath>("JsonMappingFile")) {
129  std::vector<unsigned> tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedLayers");
130  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end()));
131 }
132 
134  stage2_to_stage1links_.clear();
135  stage1links_samesector_.clear();
136  stage1link_to_stage2_.clear();
137  stage1link_to_stage1_.clear();
138  stage1_to_stage1links_.clear();
139  stage1_to_lpgbts_.clear();
140  lpgbt_to_stage1_.clear();
141  lpgbt_to_modules_.clear();
142  module_to_lpgbts_.clear();
143  module_to_stage1_.clear();
144 }
145 
147  const HGCalGeometry* hgc_hsi_geometry,
148  const HGCalGeometry* hgc_hsc_geometry) {
149  setEEGeometry(hgc_ee_geometry);
150  setHSiGeometry(hgc_hsi_geometry);
151  setHScGeometry(hgc_hsc_geometry);
154  trigger_layers_.resize(totalLayers_ + 1);
155  trigger_layers_[0] = 0; // layer number 0 doesn't exist
156  unsigned trigger_layer = 1;
157  for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) {
158  if (disconnected_layers_.find(layer) == disconnected_layers_.end()) {
159  // Increase trigger layer number if the layer is not disconnected
160  trigger_layers_[layer] = trigger_layer;
161  trigger_layer++;
162  } else {
163  trigger_layers_[layer] = 0;
164  }
165  }
166  last_trigger_layer_ = trigger_layer - 1;
167  fillMaps();
168 }
169 
171  const HGCalGeometry* hgc_hsi_geometry,
172  const HGCalGeometry* hgc_hsc_geometry,
173  const HGCalGeometry* hgc_nose_geometry) {
174  setEEGeometry(hgc_ee_geometry);
175  setHSiGeometry(hgc_hsi_geometry);
176  setHScGeometry(hgc_hsc_geometry);
177  setNoseGeometry(hgc_nose_geometry);
178 
181 
182  trigger_layers_.resize(totalLayers_ + 1);
183  trigger_layers_[0] = 0; // layer number 0 doesn't exist
184  unsigned trigger_layer = 1;
185  for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) {
186  if (disconnected_layers_.find(layer) == disconnected_layers_.end()) {
187  // Increase trigger layer number if the layer is not disconnected
188  trigger_layers_[layer] = trigger_layer;
189  trigger_layer++;
190  } else {
191  trigger_layers_[layer] = 0;
192  }
193  }
194  last_trigger_layer_ = trigger_layer - 1;
195  fillMaps();
196 
198 
199  trigger_nose_layers_.resize(noseLayers_ + 1);
200  trigger_nose_layers_[0] = 0; // layer number 0 doesn't exist
201  unsigned trigger_nose_layer = 1;
202  for (unsigned layer = 1; layer < trigger_nose_layers_.size(); layer++) {
203  trigger_nose_layers_[layer] = trigger_nose_layer;
204  trigger_nose_layer++;
205  }
206 }
207 
208 unsigned HGCalTriggerGeometryV9Imp3::getTriggerCellFromCell(const unsigned cell_id) const {
209  unsigned det = DetId(cell_id).det();
210  unsigned trigger_cell_id = 0;
211  // Scintillator
212  if (det == DetId::HGCalHSc) {
213  // Very rough mapping from cells to TC
214  HGCScintillatorDetId cell_sc_id(cell_id);
215  int ieta = ((cell_sc_id.ietaAbs() - 1) / hSc_triggercell_size_ + 1) * cell_sc_id.zside();
216  int iphi = (cell_sc_id.iphi() - 1) / hSc_triggercell_size_ + 1;
217  trigger_cell_id = HGCScintillatorDetId(cell_sc_id.type(), cell_sc_id.layer(), ieta, iphi);
218  }
219  // HFNose
220  else if (det == DetId::Forward && DetId(cell_id).subdetId() == ForwardSubdetector::HFNose) {
221  HFNoseDetId cell_nose_id(cell_id);
223  cell_nose_id.zside(),
224  cell_nose_id.type(),
225  cell_nose_id.layer(),
226  cell_nose_id.waferU(),
227  cell_nose_id.waferV(),
228  cell_nose_id.triggerCellU(),
229  cell_nose_id.triggerCellV());
230  }
231  // Silicon
232  else if (det == DetId::HGCalEE || det == DetId::HGCalHSi) {
233  HGCSiliconDetId cell_si_id(cell_id);
234  trigger_cell_id = HGCalTriggerDetId(
236  cell_si_id.zside(),
237  cell_si_id.type(),
238  cell_si_id.layer(),
239  cell_si_id.waferU(),
240  cell_si_id.waferV(),
241  cell_si_id.triggerCellU(),
242  cell_si_id.triggerCellV());
243  }
244  return trigger_cell_id;
245 }
246 
247 unsigned HGCalTriggerGeometryV9Imp3::getModuleFromCell(const unsigned cell_id) const {
249 }
250 
251 unsigned HGCalTriggerGeometryV9Imp3::getModuleFromTriggerCell(const unsigned trigger_cell_id) const {
252  unsigned det = DetId(trigger_cell_id).det();
253  int zside = 0;
254  unsigned tc_type = 1;
255  unsigned layer = 0;
256  unsigned module_id = 0;
257 
258  // Scintillator
259  if (det == DetId::HGCalHSc) {
260  HGCScintillatorDetId trigger_cell_sc_id(trigger_cell_id);
261  tc_type = trigger_cell_sc_id.type();
262  layer = trigger_cell_sc_id.layer();
263  zside = trigger_cell_sc_id.zside();
264  int tc_eta = trigger_cell_sc_id.ietaAbs();
265  int tc_phi = trigger_cell_sc_id.iphi();
266  unsigned sector = tcEtaphiMappingToSector0(tc_eta, tc_phi);
267  int ieta = 0;
268  int iphi = 0;
269  getScintillatoriEtaiPhi(ieta, iphi, tc_eta, tc_phi, layer);
270  module_id =
272  }
273  // HFNose
274  else if (det == DetId::HGCalTrigger and
275  HGCalTriggerDetId(trigger_cell_id).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) {
276  HFNoseTriggerDetId trigger_cell_trig_id(trigger_cell_id);
277  tc_type = trigger_cell_trig_id.type();
278  layer = trigger_cell_trig_id.layer();
279  zside = trigger_cell_trig_id.zside();
280  int waferu = trigger_cell_trig_id.waferU();
281  int waferv = trigger_cell_trig_id.waferV();
282  unsigned sector = geom_rotation_120_.uvMappingToSector0(
284  module_id =
286  }
287  // Silicon
288  else {
289  HGCalTriggerDetId trigger_cell_trig_id(trigger_cell_id);
290  unsigned subdet = trigger_cell_trig_id.subdet();
291  tc_type = trigger_cell_trig_id.type();
292  layer = trigger_cell_trig_id.layer();
293  zside = trigger_cell_trig_id.zside();
294  int waferu = trigger_cell_trig_id.waferU();
295  int waferv = trigger_cell_trig_id.waferV();
296  unsigned sector = geom_rotation_120_.uvMappingToSector0(getWaferCentring(layer, subdet), waferu, waferv);
297  module_id = HGCalTriggerModuleDetId(HGCalTriggerSubdetector(subdet), zside, tc_type, layer, sector, waferu, waferv);
298  }
299  return module_id;
300 }
301 
303  const unsigned trigger_cell_id) const {
304  DetId trigger_cell_det_id(trigger_cell_id);
305  unsigned det = trigger_cell_det_id.det();
306  geom_set cell_det_ids;
307  // Scintillator
308  if (det == DetId::HGCalHSc) {
309  HGCScintillatorDetId trigger_cell_sc_id(trigger_cell_id);
310  int ieta0 = (trigger_cell_sc_id.ietaAbs() - 1) * hSc_triggercell_size_ + 1;
311  int iphi0 = (trigger_cell_sc_id.iphi() - 1) * hSc_triggercell_size_ + 1;
312  for (int ietaAbs = ieta0; ietaAbs < ieta0 + (int)hSc_triggercell_size_; ietaAbs++) {
313  int ieta = ietaAbs * trigger_cell_sc_id.zside();
314  for (int iphi = iphi0; iphi < iphi0 + (int)hSc_triggercell_size_; iphi++) {
315  unsigned cell_id = HGCScintillatorDetId(trigger_cell_sc_id.type(), trigger_cell_sc_id.layer(), ieta, iphi);
316  if (validCellId(DetId::HGCalHSc, cell_id))
317  cell_det_ids.emplace(cell_id);
318  }
319  }
320  }
321  // HFNose
322  else if (det == DetId::HGCalTrigger and
323  HGCalTriggerDetId(trigger_cell_id).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) {
324  HFNoseTriggerDetId trigger_cell_nose_id(trigger_cell_id);
325  int layer = trigger_cell_nose_id.layer();
326  int zside = trigger_cell_nose_id.zside();
327  int type = trigger_cell_nose_id.type();
328  int waferu = trigger_cell_nose_id.waferU();
329  int waferv = trigger_cell_nose_id.waferV();
330  std::vector<int> cellus = trigger_cell_nose_id.cellU();
331  std::vector<int> cellvs = trigger_cell_nose_id.cellV();
332  for (unsigned ic = 0; ic < cellus.size(); ic++) {
333  HFNoseDetId cell_det_id(zside, type, layer, waferu, waferv, cellus[ic], cellvs[ic]);
334  cell_det_ids.emplace(cell_det_id);
335  }
336  }
337  // Silicon
338  else {
339  HGCalTriggerDetId trigger_cell_trig_id(trigger_cell_id);
340  unsigned subdet = trigger_cell_trig_id.subdet();
343  int layer = trigger_cell_trig_id.layer();
344  int zside = trigger_cell_trig_id.zside();
345  int type = trigger_cell_trig_id.type();
346  int waferu = trigger_cell_trig_id.waferU();
347  int waferv = trigger_cell_trig_id.waferV();
348  std::vector<int> cellus = trigger_cell_trig_id.cellU();
349  std::vector<int> cellvs = trigger_cell_trig_id.cellV();
350  for (unsigned ic = 0; ic < cellus.size(); ic++) {
351  HGCSiliconDetId cell_det_id(cell_det, zside, type, layer, waferu, waferv, cellus[ic], cellvs[ic]);
352  cell_det_ids.emplace(cell_det_id);
353  }
354  }
355  }
356  return cell_det_ids;
357 }
358 
360  geom_set cell_det_ids;
361  geom_set trigger_cells = getTriggerCellsFromModule(module_id);
362 
363  for (auto trigger_cell_id : trigger_cells) {
364  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
365  cell_det_ids.insert(cells.begin(), cells.end());
366  }
367  return cell_det_ids;
368 }
369 
371  const unsigned module_id) const {
372  geom_ordered_set cell_det_ids;
373  geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id);
374  for (auto trigger_cell_id : trigger_cells) {
375  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
376  cell_det_ids.insert(cells.begin(), cells.end());
377  }
378  return cell_det_ids;
379 }
380 
382  const unsigned module_id) const {
383  HGCalTriggerModuleDetId hgc_module_id(module_id);
384  unsigned subdet = hgc_module_id.triggerSubdetId();
385 
386  geom_set trigger_cell_det_ids;
387  // Scintillator
389  int ieta0 = hgc_module_id.eta();
390  int iphi0 = hgc_module_id.phi();
391 
392  unsigned layer = hgc_module_id.layer();
393  etaphiMappingFromSector0(ieta0, iphi0, hgc_module_id.sector());
395  if (ieta0 == 1) {
396  ieta0 = ieta0 + split;
397  } else {
398  ieta0 = ieta0 + 1;
399  }
400  iphi0 = (iphi0 * hSc_tcs_per_module_phi_) + hSc_tc_layer0_min_ + 1;
402  if (iphi0 > total_tcs) {
403  iphi0 = iphi0 - total_tcs;
404  }
405 
406  int hSc_tcs_per_module_eta = (layer > hSc_layer_for_split_) ? hSc_back_layers_split_ : hSc_front_layers_split_;
407 
408  for (int ietaAbs = ieta0; ietaAbs < ieta0 + (int)hSc_tcs_per_module_eta; ietaAbs++) {
409  int ieta = ietaAbs * hgc_module_id.zside();
410  for (int iphi = iphi0; iphi < iphi0 + (int)hSc_tcs_per_module_phi_; iphi++) {
411  unsigned trigger_cell_id = HGCScintillatorDetId(hgc_module_id.type(), hgc_module_id.layer(), ieta, iphi);
412  if (validTriggerCellFromCells(trigger_cell_id))
413  trigger_cell_det_ids.emplace(trigger_cell_id);
414  }
415  }
416  }
417  // HFNose
418  else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) {
419  HFNoseDetId module_nose_id(module_id);
421  std::vector<HFNoseTriggerDetId> ids = hfn.getTriggerDetIds(module_nose_id);
422  for (auto const& idx : ids) {
423  if (validTriggerCellFromCells(idx.rawId()))
424  trigger_cell_det_ids.emplace(idx);
425  }
426  }
427  // Silicon
428  else {
429  HGCSiliconDetIdToROC tc2roc;
430  int moduleU = hgc_module_id.moduleU();
431  int moduleV = hgc_module_id.moduleV();
432  unsigned layer = hgc_module_id.layer();
433 
434  //Rotate to sector
435  geom_rotation_120_.uvMappingFromSector0(getWaferCentring(layer, subdet), moduleU, moduleV, hgc_module_id.sector());
436 
438 
439  unsigned wafer_type = detIdWaferType(det, layer, moduleU, moduleV);
440  int nroc = (wafer_type == HGCSiliconDetId::HGCalFine ? 6 : 3);
441  // Loop on ROCs in wafer
442  for (int roc = 1; roc <= nroc; roc++) {
443  // loop on TCs in ROC
444  auto tc_uvs = tc2roc.getTriggerId(roc, wafer_type);
445  for (const auto& tc_uv : tc_uvs) {
446  HGCalTriggerDetId trigger_cell_id(
447  subdet, hgc_module_id.zside(), wafer_type, layer, moduleU, moduleV, tc_uv.first, tc_uv.second);
448  if (validTriggerCellFromCells(trigger_cell_id.rawId()))
449  trigger_cell_det_ids.emplace(trigger_cell_id);
450  }
451  }
452  }
453 
454  return trigger_cell_det_ids;
455 }
456 
458  const unsigned module_id) const {
459  HGCalTriggerModuleDetId hgc_module_id(module_id);
460  unsigned subdet = hgc_module_id.triggerSubdetId();
461 
462  geom_ordered_set trigger_cell_det_ids;
463 
464  // Scintillator
466  int ieta0 = hgc_module_id.eta();
467  int iphi0 = hgc_module_id.phi();
468 
469  unsigned layer = hgc_module_id.layer();
470  etaphiMappingFromSector0(ieta0, iphi0, hgc_module_id.sector());
472  if (ieta0 == 1) {
473  ieta0 = ieta0 + split;
474  } else {
475  ieta0 = ieta0 + 1;
476  }
477  iphi0 = (iphi0 * hSc_tcs_per_module_phi_) + hSc_tc_layer0_min_ + 1;
479  if (iphi0 > total_tcs) {
480  iphi0 = iphi0 - total_tcs;
481  }
482 
483  int hSc_tcs_per_module_eta = (layer > hSc_layer_for_split_) ? hSc_back_layers_split_ : hSc_front_layers_split_;
484 
485  for (int ietaAbs = ieta0; ietaAbs < ieta0 + (int)hSc_tcs_per_module_eta; ietaAbs++) {
486  int ieta = ietaAbs * hgc_module_id.zside();
487  for (int iphi = iphi0; iphi < iphi0 + (int)hSc_tcs_per_module_phi_; iphi++) {
488  unsigned trigger_cell_id = HGCScintillatorDetId(hgc_module_id.type(), hgc_module_id.layer(), ieta, iphi);
489  if (validTriggerCellFromCells(trigger_cell_id))
490  trigger_cell_det_ids.emplace(trigger_cell_id);
491  }
492  }
493  }
494 
495  // HFNose
496  else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) {
497  HFNoseDetId module_nose_id(module_id);
499  std::vector<HFNoseTriggerDetId> ids = hfn.getTriggerDetIds(module_nose_id);
500  for (auto const& idx : ids) {
501  if (validTriggerCellFromCells(idx.rawId()))
502  trigger_cell_det_ids.emplace(idx);
503  }
504  }
505  // Silicon
506  else {
507  HGCSiliconDetIdToROC tc2roc;
508  int moduleU = hgc_module_id.moduleU();
509  int moduleV = hgc_module_id.moduleV();
510  unsigned layer = hgc_module_id.layer();
511 
512  //Rotate to sector
513  geom_rotation_120_.uvMappingFromSector0(getWaferCentring(layer, subdet), moduleU, moduleV, hgc_module_id.sector());
514 
516 
517  unsigned wafer_type = detIdWaferType(det, layer, moduleU, moduleV);
518  int nroc = (wafer_type == HGCSiliconDetId::HGCalFine ? 6 : 3);
519  // Loop on ROCs in wafer
520  for (int roc = 1; roc <= nroc; roc++) {
521  // loop on TCs in ROC
522  auto tc_uvs = tc2roc.getTriggerId(roc, wafer_type);
523  for (const auto& tc_uv : tc_uvs) {
524  HGCalTriggerDetId trigger_cell_id(
525  subdet, hgc_module_id.zside(), wafer_type, layer, moduleU, moduleV, tc_uv.first, tc_uv.second);
526  if (validTriggerCellFromCells(trigger_cell_id.rawId()))
527  trigger_cell_det_ids.emplace(trigger_cell_id);
528  }
529  }
530  }
531 
532  return trigger_cell_det_ids;
533 }
534 
536  const unsigned trigger_cell_id) const {
537  throw cms::Exception("FeatureNotImplemented") << "Neighbor search is not implemented in HGCalTriggerGeometryV9Imp3";
538 }
539 
540 unsigned HGCalTriggerGeometryV9Imp3::getLinksInModule(const unsigned module_id) const {
541  HGCalTriggerModuleDetId module_det_id(module_id);
542  unsigned subdet = module_det_id.triggerSubdetId();
543 
544  unsigned links = 0;
545  // HF Nose
547  links = 1;
548  }
549  // TO ADD HFNOSE : getLinksInModule
550  // Silicon and Scintillator
551  else {
552  int packed_module =
553  packLayerSubdetWaferId(module_det_id.layer(), subdet, module_det_id.moduleU(), module_det_id.moduleV());
554  links = links_per_module_.at(packed_module);
555  }
556  return links;
557 }
558 
559 unsigned HGCalTriggerGeometryV9Imp3::getModuleSize(const unsigned module_id) const {
560  unsigned nWafers = 1;
561  return nWafers;
562 }
563 
564 unsigned HGCalTriggerGeometryV9Imp3::getNextSector(const unsigned sector) const {
565  unsigned next_sector = 0;
566  if (sector < 2) {
567  next_sector = sector + 1;
568  }
569  return next_sector;
570 }
571 
572 unsigned HGCalTriggerGeometryV9Imp3::getPreviousSector(const unsigned sector) const {
573  unsigned previous_sector = 2;
574  if (sector > 0) {
575  previous_sector = sector - 1;
576  }
577  return previous_sector;
578 }
579 
581  const unsigned stage2_id) const {
582  geom_set stage1_ids;
583 
584  geom_set stage1_links = getStage1LinksFromStage2Fpga(stage2_id);
585  for (const auto& stage1_link : stage1_links) {
586  stage1_ids.emplace(getStage1FpgaFromStage1Link(stage1_link));
587  }
588 
589  return stage1_ids;
590 }
591 
593  const unsigned stage1_id) const {
594  geom_set stage2_ids;
595 
596  geom_set stage1_links = getStage1LinksFromStage1Fpga(stage1_id);
597  for (const auto& stage1_link : stage1_links) {
598  stage2_ids.emplace(getStage2FpgaFromStage1Link(stage1_link));
599  }
600 
601  return stage2_ids;
602 }
603 
605  const unsigned stage2_id) const {
606  geom_set stage1link_ids;
607  HGCalTriggerBackendDetId id(stage2_id);
608  auto stage2_itrs = stage2_to_stage1links_.equal_range(id.label());
609  for (auto stage2_itr = stage2_itrs.first; stage2_itr != stage2_itrs.second; stage2_itr++) {
610  unsigned label = stage2_itr->second;
611  if (stage1links_samesector_.at(label) == true) { //link and stage2 FPGA are the same sector
612  stage1link_ids.emplace(
613  HGCalTriggerBackendDetId(id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1Link, id.sector(), label));
614  } else { //link is from the next sector (anti-clockwise)
615  stage1link_ids.emplace(HGCalTriggerBackendDetId(
616  id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1Link, getNextSector(id.sector()), label));
617  }
618  }
619 
620  return stage1link_ids;
621 }
622 
623 unsigned HGCalTriggerGeometryV9Imp3::getStage1FpgaFromStage1Link(const unsigned link_id) const {
624  HGCalTriggerBackendDetId id(link_id);
625  unsigned stage1_label = stage1link_to_stage1_.at(id.label());
626 
628  id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1FPGA, id.sector(), stage1_label);
629 }
630 
631 unsigned HGCalTriggerGeometryV9Imp3::getStage2FpgaFromStage1Link(const unsigned link_id) const {
632  HGCalTriggerBackendDetId id(link_id);
633  bool same_sector = stage1link_to_stage2_.at(id.label());
634  unsigned sector = id.sector();
635 
636  if (!same_sector) {
637  sector = getPreviousSector(sector);
638  }
639 
640  return HGCalTriggerBackendDetId(id.zside(), HGCalTriggerBackendDetId::BackendType::Stage2FPGA, sector, 0);
641 }
642 
644  const unsigned stage1_id) const {
645  geom_set stage1link_ids;
646  HGCalTriggerBackendDetId id(stage1_id);
647 
648  auto stage1_itrs = stage1_to_stage1links_.equal_range(id.label());
649  for (auto stage1_itr = stage1_itrs.first; stage1_itr != stage1_itrs.second; stage1_itr++) {
650  stage1link_ids.emplace(HGCalTriggerBackendDetId(
651  id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1Link, id.sector(), stage1_itr->second));
652  }
653 
654  return stage1link_ids;
655 }
656 
658  geom_set lpgbt_ids;
659  HGCalTriggerBackendDetId id(stage1_id);
660 
661  auto stage1_itrs = stage1_to_lpgbts_.equal_range(id.label());
662  for (auto stage1_itr = stage1_itrs.first; stage1_itr != stage1_itrs.second; stage1_itr++) {
663  lpgbt_ids.emplace(HGCalTriggerBackendDetId(
664  id.zside(), HGCalTriggerBackendDetId::BackendType::LpGBT, id.sector(), stage1_itr->second));
665  }
666 
667  return lpgbt_ids;
668 }
669 
670 unsigned HGCalTriggerGeometryV9Imp3::getStage1FpgaFromLpgbt(const unsigned lpgbt_id) const {
671  HGCalTriggerBackendDetId id(lpgbt_id);
672  unsigned stage1_label = lpgbt_to_stage1_.at(id.label());
673 
675  id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1FPGA, id.sector(), stage1_label);
676 }
677 
680  HGCalTriggerBackendDetId id(lpgbt_id);
681 
682  auto lpgbt_itrs = lpgbt_to_modules_.equal_range(id.label());
683  for (auto lpgbt_itr = lpgbt_itrs.first; lpgbt_itr != lpgbt_itrs.second; lpgbt_itr++) {
684  unsigned layer = 0;
685  int moduleU = 0;
686  int moduleV = 0;
687  int subdet = 0;
688  unpackLayerSubdetWaferId(lpgbt_itr->second, layer, subdet, moduleU, moduleV);
689  unsigned det = 0;
690  switch (subdet) {
692  det = DetId::HGCalEE;
693  break;
695  det = DetId::HGCalHSi;
696  break;
698  det = DetId::HGCalHSc;
699  break;
700  default:
701  det = DetId::HGCalEE;
702  break;
703  }
704 
705  int type = detIdWaferType(det, layer, moduleU, moduleV);
707  HGCalTriggerSubdetector(subdet), id.zside(), type, layer, id.sector(), moduleU, moduleV));
708  }
709 
710  return modules;
711 }
712 
714  geom_set lpgbt_ids;
715  HGCalTriggerModuleDetId id(module_id);
716 
717  auto module_itrs = module_to_lpgbts_.equal_range(
718  packLayerSubdetWaferId(id.layer(), id.triggerSubdetId(), id.moduleU(), id.moduleV()));
719  for (auto module_itr = module_itrs.first; module_itr != module_itrs.second; module_itr++) {
720  lpgbt_ids.emplace(HGCalTriggerBackendDetId(
721  id.zside(), HGCalTriggerBackendDetId::BackendType::LpGBT, id.sector(), module_itr->second));
722  }
723 
724  return lpgbt_ids;
725 }
726 
727 unsigned HGCalTriggerGeometryV9Imp3::getStage1FpgaFromModule(const unsigned module_id) const {
728  HGCalTriggerModuleDetId id(module_id);
729 
730  unsigned stage1_label =
731  module_to_stage1_.at(packLayerSubdetWaferId(id.layer(), id.triggerSubdetId(), id.moduleU(), id.moduleV()));
732 
734  id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1FPGA, id.sector(), stage1_label);
735 }
736 
737 GlobalPoint HGCalTriggerGeometryV9Imp3::getTriggerCellPosition(const unsigned trigger_cell_det_id) const {
738  unsigned det = DetId(trigger_cell_det_id).det();
739 
740  // Position: barycenter of the trigger cell.
741  Basic3DVector<float> triggerCellVector(0., 0., 0.);
742  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
743  // Scintillator
744  if (det == DetId::HGCalHSc) {
745  for (const auto& cell : cell_ids) {
746  triggerCellVector += hscGeometry()->getPosition(cell).basicVector();
747  }
748  }
749  // HFNose
750  else if (det == DetId::HGCalTrigger and
751  HGCalTriggerDetId(trigger_cell_det_id).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) {
752  for (const auto& cell : cell_ids) {
753  HFNoseDetId cellDetId(cell);
754  triggerCellVector += noseGeometry()->getPosition(cellDetId).basicVector();
755  }
756  }
757  // Silicon
758  else {
759  for (const auto& cell : cell_ids) {
760  HGCSiliconDetId cellDetId(cell);
761  triggerCellVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId)
762  : hsiGeometry()->getPosition(cellDetId))
763  .basicVector();
764  }
765  }
766  return GlobalPoint(triggerCellVector / cell_ids.size());
767 }
768 
769 GlobalPoint HGCalTriggerGeometryV9Imp3::getModulePosition(const unsigned module_det_id) const {
770  unsigned subdet = HGCalTriggerModuleDetId(module_det_id).triggerSubdetId();
771  // Position: barycenter of the module.
772  Basic3DVector<float> moduleVector(0., 0., 0.);
773  const auto cell_ids = getCellsFromModule(module_det_id);
774  // Scintillator
776  for (const auto& cell : cell_ids) {
777  moduleVector += hscGeometry()->getPosition(cell).basicVector();
778  }
779  }
780  // HFNose
781  else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) {
782  for (const auto& cell : cell_ids) {
783  HFNoseDetId cellDetId(cell);
784  moduleVector += noseGeometry()->getPosition(cellDetId).basicVector();
785  }
786  } // Silicon
787  else {
788  for (const auto& cell : cell_ids) {
789  HGCSiliconDetId cellDetId(cell);
790  moduleVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId)
791  : hsiGeometry()->getPosition(cellDetId))
792  .basicVector();
793  }
794  }
795 
796  return GlobalPoint(moduleVector / cell_ids.size());
797 }
798 
800  // read json mapping file
801  json mapping_config;
802  std::ifstream json_input_file(jsonMappingFile_.fullPath());
803  if (!json_input_file.is_open()) {
804  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TMapping file\n";
805  }
806  json_input_file >> mapping_config;
807 
808  try {
809  //Stage 2 to Stage 1 links mapping
810  for (unsigned stage2_id = 0; stage2_id < mapping_config.at("Stage2").size(); stage2_id++) {
811  for (unsigned link_id = 0; link_id < mapping_config.at("Stage2").at(stage2_id).at("Stage1Links").size();
812  link_id++) {
813  stage2_to_stage1links_.emplace(stage2_id, link_id);
814  stage1links_samesector_.emplace(
815  link_id, mapping_config.at("Stage2").at(stage2_id).at("Stage1Links").at(link_id).at("SameSector"));
816  }
817  }
818  } catch (const json::exception& e) {
819  edm::LogError("HGCalTriggerGeometryV9Imp3")
820  << "The mapping input json file does not have the expected structure for the Stage2 block";
821  }
822 
823  try {
824  for (unsigned link_id = 0; link_id < mapping_config.at("Stage1Links").size(); link_id++) {
825  //Stage 1 links to Stage 1 FPGAs mapping
826  stage1link_to_stage1_.emplace(link_id, mapping_config.at("Stage1Links").at(link_id).at("Stage1"));
827 
828  //Stage 1 links to Stage 2 mapping
829  stage1link_to_stage2_.emplace(link_id, mapping_config.at("Stage1Links").at(link_id).at("Stage2SameSector"));
830  }
831  } catch (const json::exception& e) {
832  edm::LogError("HGCalTriggerGeometryV9Imp3")
833  << "The mapping input json file does not have the expected structure for the Stage1Links block";
834  }
835 
836  try {
837  for (unsigned stage1_id = 0; stage1_id < mapping_config.at("Stage1").size(); stage1_id++) {
838  //Stage 1 to Stage 1 links mapping
839  for (auto& link_id : mapping_config.at("Stage1").at(stage1_id).at("Stage1Links")) {
840  stage1_to_stage1links_.emplace(stage1_id, link_id);
841  }
842 
843  //Stage 1 to lpgbt mapping
844  for (auto& lpgbt_id : mapping_config.at("Stage1").at(stage1_id).at("lpgbts")) {
845  stage1_to_lpgbts_.emplace(stage1_id, lpgbt_id);
846  }
847  }
848 
849  } catch (const json::exception& e) {
850  edm::LogError("HGCalTriggerGeometryV9Imp3")
851  << "The mapping input json file does not have the expected structure for the Stage1 block";
852  }
853 
854  try {
855  for (unsigned lpgbt_id = 0; lpgbt_id < mapping_config.at("lpgbt").size(); lpgbt_id++) {
856  //lpgbt to Stage 1 mapping
857  unsigned stage1_id = mapping_config.at("lpgbt").at(lpgbt_id).at("Stage1");
858  lpgbt_to_stage1_.emplace(lpgbt_id, stage1_id);
859 
860  //lpgbt to module mapping
861  for (auto& modules : mapping_config.at("lpgbt").at(lpgbt_id).at("Modules")) {
862  unsigned layer = modules.at("layer");
863  int subdetId = 0;
864  bool isSilicon = modules.at("isSilicon");
865  layerWithoutOffsetAndSubdetId(layer, subdetId, isSilicon);
866  unsigned packed_value = packLayerSubdetWaferId(layer, subdetId, modules.at("u"), modules.at("v"));
867  lpgbt_to_modules_.emplace(lpgbt_id, packed_value);
868 
869  //fill subsiduary module to stage 1 mapping
870  auto result = module_to_stage1_.emplace(packed_value, stage1_id);
871  if (result.second == false &&
872  stage1_id != result.first->second) { //check that the stage1_id is the same as in the existing map
873  edm::LogError("HGCalTriggerGeometryV9Imp3") << "One module is connected to two separate Stage1 FPGAs";
874  }
875  }
876  }
877 
878  } catch (const json::exception& e) {
879  edm::LogError("HGCalTriggerGeometryV9Imp3")
880  << "The mapping input json file does not have the expected structure for the lpGBT block";
881  }
882 
883  try {
884  //module to lpgbt mapping
885  for (unsigned module = 0; module < mapping_config.at("Module").size(); module++) {
886  unsigned num_elinks = 0; //Sum number of e-links in each module over lpGBTs
887  unsigned layer = mapping_config.at("Module").at(module).at("layer");
888  unsigned moduleU = mapping_config.at("Module").at(module).at("u");
889  unsigned moduleV = mapping_config.at("Module").at(module).at("v");
890  bool isSilicon = mapping_config.at("Module").at(module).at("isSilicon");
891  int subdetId = 0;
892  layerWithoutOffsetAndSubdetId(layer, subdetId, isSilicon);
893 
894  for (auto& lpgbt : mapping_config.at("Module").at(module).at("lpgbts")) {
895  module_to_lpgbts_.emplace(packLayerSubdetWaferId(layer, subdetId, moduleU, moduleV), lpgbt.at("id"));
896  num_elinks += unsigned(lpgbt.at("nElinks"));
897  }
898  int packed_module = packLayerSubdetWaferId(layer, subdetId, moduleU, moduleV);
899  links_per_module_.emplace(packed_module, num_elinks);
900  }
901  } catch (const json::exception& e) {
902  edm::LogError("HGCalTriggerGeometryV9Imp3")
903  << "The mapping input json file does not have the expected structure for the Module block";
904  }
905 
906  json_input_file.close();
907 }
908 
909 unsigned HGCalTriggerGeometryV9Imp3::packLayerSubdetWaferId(unsigned layer, int subdet, int waferU, int waferV) const {
910  unsigned packed_value = 0;
911 
912  packed_value |=
914  packed_value |=
916  packed_value |= ((subdet & HGCalTriggerModuleDetId::kHGCalTriggerSubdetMask)
919  return packed_value;
920 }
921 
923  unsigned wafer, unsigned& layer, int& subdet, int& waferU, int& waferV) const {
926  subdet =
929 }
930 
931 void HGCalTriggerGeometryV9Imp3::etaphiMappingFromSector0(int& ieta, int& iphi, unsigned sector) const {
932  if (sector == 0) {
933  return;
934  }
935  if (sector == 2) {
937  } else if (sector == 1) {
939  }
940 }
941 
943  if (subdet == HGCalTriggerSubdetector::HGCalEETrigger) { // CE-E
945  } else if (subdet == HGCalTriggerSubdetector::HGCalHSiTrigger) {
946  if ((layer % 2) == 1) { // CE-H Odd
948  } else { // CE-H Even
950  }
951  } else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) { //HFNose
953  } else {
954  edm::LogError("HGCalTriggerGeometryV9Imp3")
955  << "HGCalTriggerGeometryV9Imp3: trigger sub-detector expected to be silicon";
957  }
958 }
959 
960 unsigned HGCalTriggerGeometryV9Imp3::tcEtaphiMappingToSector0(int& tc_ieta, int& tc_iphi) const {
961  unsigned sector = 0;
962 
963  if (tc_iphi > hSc_tc_layer0_min_ && tc_iphi <= hSc_tc_layer0_min_ + ntc_per_wafer_) {
964  sector = 0;
965  } else if (tc_iphi > hSc_tc_layer0_min_ + ntc_per_wafer_ && tc_iphi <= hSc_tc_layer0_min_ + 2 * ntc_per_wafer_) {
966  sector = 2;
967  } else {
968  sector = 1;
969  }
970 
971  if (sector == 0) {
972  tc_iphi = tc_iphi - hSc_tc_layer0_min_;
973  } else if (sector == 2) {
974  tc_iphi = tc_iphi - (hSc_tc_layer0_min_ + ntc_per_wafer_);
975  } else if (sector == 1) {
976  if (tc_iphi <= hSc_tc_layer0_min_) {
977  tc_iphi = tc_iphi + nSectors_ * ntc_per_wafer_;
978  }
979  tc_iphi = tc_iphi - (nSectors_ * ntc_per_wafer_ - hSc_tc_layer0_min_);
980  }
981 
982  return sector;
983 }
984 
986  int& ieta, int& iphi, int tc_eta, int tc_phi, unsigned layer) const {
987  iphi = (tc_phi - 1) / hSc_tcs_per_module_phi_; //Phi index 1-12
988 
990  if (layer > hSc_layer_for_split_) {
992  }
993  if (tc_eta <= split) {
994  ieta = 0;
995  } else {
996  ieta = 1;
997  }
998 }
999 
1000 bool HGCalTriggerGeometryV9Imp3::validTriggerCell(const unsigned trigger_cell_id) const {
1001  return validTriggerCellFromCells(trigger_cell_id);
1002 }
1003 
1004 bool HGCalTriggerGeometryV9Imp3::disconnectedModule(const unsigned module_id) const {
1005  bool disconnected = false;
1006  HGCalTriggerModuleDetId id(module_id);
1007  if (module_to_stage1_.find(packLayerSubdetWaferId(id.layer(), id.triggerSubdetId(), id.moduleU(), id.moduleV())) ==
1008  module_to_stage1_.end()) {
1009  disconnected = true;
1010  }
1011  if (disconnected_layers_.find(layerWithOffset(module_id)) != disconnected_layers_.end()) {
1012  disconnected = true;
1013  }
1014  return disconnected;
1015 }
1016 
1017 unsigned HGCalTriggerGeometryV9Imp3::triggerLayer(const unsigned id) const {
1018  unsigned layer = layerWithOffset(id);
1019 
1020  if (DetId(id).det() == DetId::HGCalTrigger and
1022  if (layer >= trigger_nose_layers_.size())
1023  return 0;
1024  return trigger_nose_layers_[layer];
1025  }
1026  if (layer >= trigger_layers_.size())
1027  return 0;
1028  return trigger_layers_[layer];
1029 }
1030 
1031 bool HGCalTriggerGeometryV9Imp3::validCell(unsigned cell_id) const {
1032  bool is_valid = false;
1033  unsigned det = DetId(cell_id).det();
1034  switch (det) {
1035  case DetId::HGCalEE:
1036  is_valid = eeTopology().valid(cell_id);
1037  break;
1038  case DetId::HGCalHSi:
1039  is_valid = hsiTopology().valid(cell_id);
1040  break;
1041  case DetId::HGCalHSc:
1042  is_valid = hscTopology().valid(cell_id);
1043  break;
1044  case DetId::Forward:
1045  is_valid = noseTopology().valid(cell_id);
1046  break;
1047  default:
1048  is_valid = false;
1049  break;
1050  }
1051  return is_valid;
1052 }
1053 
1054 bool HGCalTriggerGeometryV9Imp3::validTriggerCellFromCells(const unsigned trigger_cell_id) const {
1055  // Check the validity of a trigger cell with the
1056  // validity of the cells. One valid cell in the
1057  // trigger cell is enough to make the trigger cell
1058  // valid.
1059  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
1060  bool is_valid = false;
1061  for (const auto cell_id : cells) {
1062  unsigned det = DetId(cell_id).det();
1063  is_valid |= validCellId(det, cell_id);
1064  if (is_valid)
1065  break;
1066  }
1067  return is_valid;
1068 }
1069 
1070 bool HGCalTriggerGeometryV9Imp3::validCellId(unsigned subdet, unsigned cell_id) const {
1071  bool is_valid = false;
1072  switch (subdet) {
1073  case DetId::HGCalEE:
1074  is_valid = eeTopology().valid(cell_id);
1075  break;
1076  case DetId::HGCalHSi:
1077  is_valid = hsiTopology().valid(cell_id);
1078  break;
1079  case DetId::HGCalHSc:
1080  is_valid = hscTopology().valid(cell_id);
1081  break;
1082  case DetId::Forward:
1083  is_valid = noseTopology().valid(cell_id);
1084  break;
1085  default:
1086  is_valid = false;
1087  break;
1088  }
1089  return is_valid;
1090 }
1091 
1092 int HGCalTriggerGeometryV9Imp3::detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const {
1093  int wafer_type = 0;
1094  switch (det) {
1095  case DetId::HGCalEE:
1096  wafer_type = eeTopology().dddConstants().getTypeHex(layer, waferU, waferV);
1097  break;
1098  case DetId::HGCalHSi:
1099  wafer_type = hsiTopology().dddConstants().getTypeHex(layer, waferU, waferV);
1100  break;
1101  case DetId::HGCalHSc:
1102  wafer_type = hscTopology().dddConstants().getTypeTrap(layer);
1103  break;
1104  default:
1105  break;
1106  };
1107  return wafer_type;
1108 }
1109 
1110 void HGCalTriggerGeometryV9Imp3::layerWithoutOffsetAndSubdetId(unsigned& layer, int& subdetId, bool isSilicon) const {
1111  if (!isSilicon) {
1112  layer = layer - heOffset_;
1114  } else {
1115  if (layer > heOffset_) {
1117  layer = layer - heOffset_;
1118  } else {
1120  }
1121  }
1122 }
1123 
1124 unsigned HGCalTriggerGeometryV9Imp3::layerWithOffset(unsigned id) const {
1125  unsigned det = DetId(id).det();
1126  unsigned layer = 0;
1127 
1128  if (det == DetId::HGCalTrigger) {
1129  unsigned subdet = HGCalTriggerDetId(id).subdet();
1131  layer = HGCalTriggerDetId(id).layer();
1132  } else if (subdet == HGCalTriggerSubdetector::HGCalHSiTrigger) {
1134  } else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) {
1135  layer = HFNoseTriggerDetId(id).layer();
1136  }
1137  } else if (det == DetId::HGCalHSc) {
1139  } else if (det == DetId::Forward) {
1140  unsigned subdet = HGCalTriggerModuleDetId(id).triggerSubdetId();
1143  } else if (subdet == HGCalTriggerSubdetector::HGCalHSiTrigger ||
1145  layer = heOffset_ + HGCalDetId(id).layer();
1146  } else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) {
1148  }
1149  }
1150  return layer;
1151 }
1152 
HGCalTriggerSubdetector
geom_set getNeighborsFromTriggerCell(const unsigned) const final
static constexpr unsigned hSc_tcs_per_module_phi_
geom_set getLpgbtsFromModule(const unsigned) const final
GlobalPoint getTriggerCellPosition(const unsigned) const final
std::unordered_map< unsigned, unsigned > links_per_module_
HGCalGeomRotation::WaferCentring getWaferCentring(unsigned layer, int subdet) const
unsigned tcEtaphiMappingToSector0(int &tc_ieta, int &tc_iphi) const
geom_set getLpgbtsFromStage1Fpga(const unsigned) const final
std::unordered_map< unsigned, unsigned > stage1link_to_stage1_
int moduleU() const
get the module U
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
void uvMappingFromSector0(WaferCentring waferCentring, int &moduleU, int &moduleV, unsigned sector) const
static const int kHGCalTriggerSubdetMask
geom_set getStage2FpgasFromStage1Fpga(const unsigned) const final
std::vector< int > cellV() const
geom_set getTriggerCellsFromModule(const unsigned) const final
geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final
std::vector< int > cellU() const
int layer() const
get the layer #
Definition: HFNoseDetId.h:56
std::unordered_multimap< unsigned, unsigned > stage1_to_stage1links_
void setEEGeometry(const HGCalGeometry *geom)
bool validTriggerCellFromCells(const unsigned) const
std::string fullPath() const
Definition: FileInPath.cc:161
nlohmann::json json
static constexpr unsigned hSc_back_layers_split_
unsigned getStage1FpgaFromLpgbt(const unsigned) const final
int32_t waferU(const int32_t index)
GlobalPoint getModulePosition(const unsigned) const final
int waferU() const
Definition: HFNoseDetId.h:75
bool valid(const DetId &id) const override
Is this a valid cell id.
const HGCalTopology & eeTopology() const
std::unordered_multimap< unsigned, unsigned > lpgbt_to_modules_
unsigned getTriggerCellFromCell(const unsigned) const final
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
static const int kHGCalModuleVOffset
int eta() const
get the scintillator panel eta
std::unordered_map< unsigned, unsigned > lpgbt_to_stage1_
int zside() const
get the z-side of the cell (1/-1)
unsigned triggerLayer(const unsigned) const final
std::unordered_multimap< unsigned, unsigned > stage2_to_stage1links_
int zside(DetId const &)
int type() const
get/set the type
Log< level::Error, false > LogError
void setHSiGeometry(const HGCalGeometry *geom)
bool validCell(const unsigned) const final
int zside() const
get the z-side of the cell (1/-1)
unsigned getStage2FpgaFromStage1Link(const unsigned) const final
int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const
std::unordered_map< unsigned, bool > stage1links_samesector_
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
std::unordered_multimap< unsigned, unsigned > module_to_lpgbts_
static const int kHGCalModuleUOffset
void setNoseGeometry(const HGCalGeometry *geom)
bool validTriggerCell(const unsigned) const final
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned getNextSector(const unsigned sector) const
unsigned getModuleSize(const unsigned module_id) const final
int layer() const
get the layer #
geom_ordered_set getOrderedCellsFromModule(const unsigned) const final
char const * label
int layer() const
get the layer #
int type() const
get the type
int layer() const
get the layer #
int getTypeHex(int layer, int waferU, int waferV) const
int iphi() const
get the phi index
unsigned getModuleFromTriggerCell(const unsigned) const final
unsigned getModuleFromCell(const unsigned) const final
std::vector< HFNoseTriggerDetId > getTriggerDetIds(HFNoseDetId const &id) const
unsigned lastTriggerLayer() const final
void getScintillatoriEtaiPhi(int &ieta, int &iphi, int tc_eta, int tc_phi, unsigned layer) const
bool validCellId(unsigned det, unsigned cell_id) const
int triggerCellV() const
bool disconnectedModule(const unsigned) const final
int triggerCellU() const
HGCalTriggerSubdetector subdet() const
get the subdetector
int layer() const
get the layer #
void setHScGeometry(const HGCalGeometry *geom)
int waferU() const
std::vector< unsigned > trigger_layers_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
unsigned int layers(bool reco) const
int zside() const
get the z-side of the cell (1/-1)
int getTypeTrap(int layer) const
int type() const
get the type
Definition: HFNoseDetId.h:50
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
unsigned getLinksInModule(const unsigned module_id) const final
int triggerCellU() const
Definition: HFNoseDetId.h:87
HGCalTriggerGeometryV9Imp3(const edm::ParameterSet &conf)
unsigned getStage1FpgaFromModule(const unsigned module_id) const final
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ cells
Definition: DetId.h:17
std::unordered_multimap< unsigned, unsigned > stage1_to_lpgbts_
geom_set getStage1FpgasFromStage2Fpga(const unsigned) const final
int waferV() const
unsigned getPreviousSector(const unsigned sector) const
unsigned layerWithOffset(unsigned) const
int type() const
get the type
Detector
Definition: DetId.h:24
int zside() const
get the z-side of the cell (1/-1)
const HGCalGeometry * hscGeometry() const
int layer() const
get the layer #
Definition: HGCalDetId.h:46
int type() const
get the type
std::vector< int > cellU() const
int waferV() const
Definition: HFNoseDetId.h:78
std::set< unsigned > geom_ordered_set
const HGCalTopology & noseTopology() const
std::vector< int > cellV() const
GlobalPoint getPosition(const DetId &id, bool debug=false) const
const HGCalTopology & hscTopology() const
HLT enums.
std::unordered_set< unsigned > geom_set
int triggerCellV() const
Definition: HFNoseDetId.h:94
int32_t waferV(const int32_t index)
int moduleV() const
get the module V
geom_set getStage1LinksFromStage2Fpga(const unsigned) const final
geom_set getModulesFromLpgbt(const unsigned) const final
static constexpr unsigned hSc_front_layers_split_
std::unordered_map< unsigned, unsigned > stage1link_to_stage2_
geom_set getCellsFromModule(const unsigned) const final
std::vector< unsigned > trigger_nose_layers_
#define DEFINE_EDM_PLUGIN(factory, type, name)
const HGCalGeometry * noseGeometry() const
unsigned getStage1FpgaFromStage1Link(const unsigned) const final
int zside() const
get the z-side of the module (1/-1)
int type() const
get the type
int triggerSubdetId() const
get the trigger sub-detector
geom_set getStage1LinksFromStage1Fpga(const unsigned) const final
void initialize(const HGCalGeometry *, const HGCalGeometry *, const HGCalGeometry *) final
unsigned uvMappingToSector0(WaferCentring waferCentring, int &moduleU, int &moduleV) const
geom_set getCellsFromTriggerCell(const unsigned) const final
const HGCalGeometry * hsiGeometry() const
std::vector< std::pair< int, int > > getTriggerId(int roc, int type) const
static constexpr unsigned hSc_num_panels_per_sector_
const HGCalTopology & hsiTopology() const
int layer() const
get the layer #
std::unordered_map< unsigned, unsigned > module_to_stage1_
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
const HGCalGeometry * eeGeometry() const
static constexpr unsigned hSc_layer_for_split_
int sector() const
get the sector #
def move(src, dest)
Definition: eostools.py:511
unsigned packLayerSubdetWaferId(unsigned layer, int subdet, int waferU, int waferV) const
std::unordered_set< unsigned > disconnected_layers_
nlohmann::json json
void etaphiMappingFromSector0(int &ieta, int &iphi, unsigned sector) const
int phi() const
get the scintillator panel phi
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseDetId.h:53
void unpackLayerSubdetWaferId(unsigned wafer, unsigned &layer, int &subdet, int &waferU, int &waferV) const
static const int kHGCalTriggerSubdetOffset
void layerWithoutOffsetAndSubdetId(unsigned &layer, int &subdetId, bool isSilicon) const