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  std::vector<unsigned> 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_map<unsigned, std::vector<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();
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;
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;
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::HGCalHD120) || (wafer_type == HGCSiliconDetId::HGCalHD200)) ? 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::HGCalHD120) || (wafer_type == HGCSiliconDetId::HGCalHD200)) ? 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 
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 
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) {
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 
657 std::vector<unsigned> HGCalTriggerGeometryV9Imp3::getLpgbtsFromStage1Fpga(const unsigned stage1_id) const {
658  std::vector<unsigned> lpgbt_ids;
659  HGCalTriggerBackendDetId id(stage1_id);
660 
661  const auto stage1_lpgbts = stage1_to_lpgbts_.at(id.label());
662  lpgbt_ids.reserve(stage1_lpgbts.size());
663  for (const auto& stage1_lpgbt : stage1_lpgbts) {
664  lpgbt_ids.emplace_back(
665  HGCalTriggerBackendDetId(id.zside(), HGCalTriggerBackendDetId::BackendType::LpGBT, id.sector(), stage1_lpgbt));
666  }
667 
668  return lpgbt_ids;
669 }
670 
671 unsigned HGCalTriggerGeometryV9Imp3::getStage1FpgaFromLpgbt(const unsigned lpgbt_id) const {
672  HGCalTriggerBackendDetId id(lpgbt_id);
673  unsigned stage1_label = lpgbt_to_stage1_.at(id.label());
674 
676  id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1FPGA, id.sector(), stage1_label);
677 }
678 
681  HGCalTriggerBackendDetId id(lpgbt_id);
682 
683  auto lpgbt_itrs = lpgbt_to_modules_.equal_range(id.label());
684  for (auto lpgbt_itr = lpgbt_itrs.first; lpgbt_itr != lpgbt_itrs.second; lpgbt_itr++) {
685  unsigned layer = 0;
686  int moduleU = 0;
687  int moduleV = 0;
688  int subdet = 0;
689  unpackLayerSubdetWaferId(lpgbt_itr->second, layer, subdet, moduleU, moduleV);
690  unsigned det = 0;
691  switch (subdet) {
693  det = DetId::HGCalEE;
694  break;
696  det = DetId::HGCalHSi;
697  break;
699  det = DetId::HGCalHSc;
700  break;
701  default:
702  det = DetId::HGCalEE;
703  break;
704  }
705 
706  int type = detIdWaferType(det, layer, moduleU, moduleV);
708  HGCalTriggerSubdetector(subdet), id.zside(), type, layer, id.sector(), moduleU, moduleV));
709  }
710 
711  return modules;
712 }
713 
715  geom_set lpgbt_ids;
717 
718  auto module_itrs = module_to_lpgbts_.equal_range(
719  packLayerSubdetWaferId(id.layer(), id.triggerSubdetId(), id.moduleU(), id.moduleV()));
720  for (auto module_itr = module_itrs.first; module_itr != module_itrs.second; module_itr++) {
721  lpgbt_ids.emplace(HGCalTriggerBackendDetId(
722  id.zside(), HGCalTriggerBackendDetId::BackendType::LpGBT, id.sector(), module_itr->second));
723  }
724 
725  return lpgbt_ids;
726 }
727 
730 
731  unsigned stage1_label =
732  module_to_stage1_.at(packLayerSubdetWaferId(id.layer(), id.triggerSubdetId(), id.moduleU(), id.moduleV()));
733 
735  id.zside(), HGCalTriggerBackendDetId::BackendType::Stage1FPGA, id.sector(), stage1_label);
736 }
737 
738 GlobalPoint HGCalTriggerGeometryV9Imp3::getTriggerCellPosition(const unsigned trigger_cell_det_id) const {
739  unsigned det = DetId(trigger_cell_det_id).det();
740 
741  // Position: barycenter of the trigger cell.
742  Basic3DVector<float> triggerCellVector(0., 0., 0.);
743  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
744  // Scintillator
745  if (det == DetId::HGCalHSc) {
746  for (const auto& cell : cell_ids) {
747  triggerCellVector += hscGeometry()->getPosition(cell).basicVector();
748  }
749  }
750  // HFNose
751  else if (det == DetId::HGCalTrigger and
752  HGCalTriggerDetId(trigger_cell_det_id).subdet() == HGCalTriggerSubdetector::HFNoseTrigger) {
753  for (const auto& cell : cell_ids) {
754  HFNoseDetId cellDetId(cell);
755  triggerCellVector += noseGeometry()->getPosition(cellDetId).basicVector();
756  }
757  }
758  // Silicon
759  else {
760  for (const auto& cell : cell_ids) {
761  HGCSiliconDetId cellDetId(cell);
762  triggerCellVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId)
763  : hsiGeometry()->getPosition(cellDetId))
764  .basicVector();
765  }
766  }
767  return GlobalPoint(triggerCellVector / cell_ids.size());
768 }
769 
770 GlobalPoint HGCalTriggerGeometryV9Imp3::getModulePosition(const unsigned module_det_id) const {
771  unsigned subdet = HGCalTriggerModuleDetId(module_det_id).triggerSubdetId();
772  // Position: barycenter of the module.
773  Basic3DVector<float> moduleVector(0., 0., 0.);
774  const auto cell_ids = getCellsFromModule(module_det_id);
775  // Scintillator
777  for (const auto& cell : cell_ids) {
778  moduleVector += hscGeometry()->getPosition(cell).basicVector();
779  }
780  }
781  // HFNose
782  else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) {
783  for (const auto& cell : cell_ids) {
784  HFNoseDetId cellDetId(cell);
785  moduleVector += noseGeometry()->getPosition(cellDetId).basicVector();
786  }
787  } // Silicon
788  else {
789  for (const auto& cell : cell_ids) {
790  HGCSiliconDetId cellDetId(cell);
791  moduleVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId)
792  : hsiGeometry()->getPosition(cellDetId))
793  .basicVector();
794  }
795  }
796 
797  return GlobalPoint(moduleVector / cell_ids.size());
798 }
799 
801  // read json mapping file
802  json mapping_config;
803  std::ifstream json_input_file(jsonMappingFile_.fullPath());
804  if (!json_input_file.is_open()) {
805  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TMapping file\n";
806  }
807  json_input_file >> mapping_config;
808 
809  try {
810  //Stage 2 to Stage 1 links mapping
811  for (unsigned stage2_id = 0; stage2_id < mapping_config.at("Stage2").size(); stage2_id++) {
812  for (unsigned link_id = 0; link_id < mapping_config.at("Stage2").at(stage2_id).at("Stage1Links").size();
813  link_id++) {
814  stage2_to_stage1links_.emplace(stage2_id, link_id);
815  stage1links_samesector_.emplace(
816  link_id, mapping_config.at("Stage2").at(stage2_id).at("Stage1Links").at(link_id).at("SameSector"));
817  }
818  }
819  } catch (const json::exception& e) {
820  edm::LogError("HGCalTriggerGeometryV9Imp3")
821  << "The mapping input json file does not have the expected structure for the Stage2 block";
822  }
823 
824  try {
825  for (unsigned link_id = 0; link_id < mapping_config.at("Stage1Links").size(); link_id++) {
826  //Stage 1 links to Stage 1 FPGAs mapping
827  stage1link_to_stage1_.emplace(link_id, mapping_config.at("Stage1Links").at(link_id).at("Stage1"));
828 
829  //Stage 1 links to Stage 2 mapping
830  stage1link_to_stage2_.emplace(link_id, mapping_config.at("Stage1Links").at(link_id).at("Stage2SameSector"));
831  }
832  } catch (const json::exception& e) {
833  edm::LogError("HGCalTriggerGeometryV9Imp3")
834  << "The mapping input json file does not have the expected structure for the Stage1Links block";
835  }
836 
837  try {
838  for (unsigned stage1_id = 0; stage1_id < mapping_config.at("Stage1").size(); stage1_id++) {
839  //Stage 1 to Stage 1 links mapping
840  for (auto& link_id : mapping_config.at("Stage1").at(stage1_id).at("Stage1Links")) {
841  stage1_to_stage1links_.emplace(stage1_id, link_id);
842  }
843 
844  //Stage 1 to lpgbt mapping
845  std::vector<unsigned> lpgbt_id_vec;
846  for (auto& lpgbt_id : mapping_config.at("Stage1").at(stage1_id).at("lpgbts")) {
847  lpgbt_id_vec.push_back(lpgbt_id);
848  }
849  stage1_to_lpgbts_.emplace(stage1_id, lpgbt_id_vec);
850  }
851 
852  } catch (const json::exception& e) {
853  edm::LogError("HGCalTriggerGeometryV9Imp3")
854  << "The mapping input json file does not have the expected structure for the Stage1 block";
855  }
856 
857  try {
858  for (unsigned lpgbt_id = 0; lpgbt_id < mapping_config.at("lpgbt").size(); lpgbt_id++) {
859  //lpgbt to Stage 1 mapping
860  unsigned stage1_id = mapping_config.at("lpgbt").at(lpgbt_id).at("Stage1");
861  lpgbt_to_stage1_.emplace(lpgbt_id, stage1_id);
862 
863  //lpgbt to module mapping
864  for (auto& modules : mapping_config.at("lpgbt").at(lpgbt_id).at("Modules")) {
865  unsigned layer = modules.at("layer");
866  int subdetId = 0;
867  bool isSilicon = modules.at("isSilicon");
868  layerWithoutOffsetAndSubdetId(layer, subdetId, isSilicon);
869  unsigned packed_value = packLayerSubdetWaferId(layer, subdetId, modules.at("u"), modules.at("v"));
870  lpgbt_to_modules_.emplace(lpgbt_id, packed_value);
871 
872  //fill subsiduary module to stage 1 mapping
873  auto result = module_to_stage1_.emplace(packed_value, stage1_id);
874  if (result.second == false &&
875  stage1_id != result.first->second) { //check that the stage1_id is the same as in the existing map
876  edm::LogError("HGCalTriggerGeometryV9Imp3") << "One module is connected to two separate Stage1 FPGAs";
877  }
878  }
879  }
880 
881  } catch (const json::exception& e) {
882  edm::LogError("HGCalTriggerGeometryV9Imp3")
883  << "The mapping input json file does not have the expected structure for the lpGBT block";
884  }
885 
886  try {
887  //module to lpgbt mapping
888  for (unsigned module = 0; module < mapping_config.at("Module").size(); module++) {
889  unsigned num_elinks = 0; //Sum number of e-links in each module over lpGBTs
890  unsigned layer = mapping_config.at("Module").at(module).at("layer");
891  unsigned moduleU = mapping_config.at("Module").at(module).at("u");
892  unsigned moduleV = mapping_config.at("Module").at(module).at("v");
893  bool isSilicon = mapping_config.at("Module").at(module).at("isSilicon");
894  int subdetId = 0;
895  layerWithoutOffsetAndSubdetId(layer, subdetId, isSilicon);
896 
897  for (auto& lpgbt : mapping_config.at("Module").at(module).at("lpgbts")) {
898  module_to_lpgbts_.emplace(packLayerSubdetWaferId(layer, subdetId, moduleU, moduleV), lpgbt.at("id"));
899  num_elinks += unsigned(lpgbt.at("nElinks"));
900  }
901  int packed_module = packLayerSubdetWaferId(layer, subdetId, moduleU, moduleV);
902  links_per_module_.emplace(packed_module, num_elinks);
903  }
904  } catch (const json::exception& e) {
905  edm::LogError("HGCalTriggerGeometryV9Imp3")
906  << "The mapping input json file does not have the expected structure for the Module block";
907  }
908 
909  json_input_file.close();
910 }
911 
912 unsigned HGCalTriggerGeometryV9Imp3::packLayerSubdetWaferId(unsigned layer, int subdet, int waferU, int waferV) const {
913  unsigned packed_value = 0;
914 
915  packed_value |=
917  packed_value |=
919  packed_value |= ((subdet & HGCalTriggerModuleDetId::kHGCalTriggerSubdetMask)
922  return packed_value;
923 }
924 
926  unsigned wafer, unsigned& layer, int& subdet, int& waferU, int& waferV) const {
929  subdet =
932 }
933 
935  if (sector == 0) {
936  return;
937  }
938  if (sector == 2) {
940  } else if (sector == 1) {
942  }
943 }
944 
946  if (subdet == HGCalTriggerSubdetector::HGCalEETrigger) { // CE-E
948  } else if (subdet == HGCalTriggerSubdetector::HGCalHSiTrigger) {
949  if ((layer % 2) == 1) { // CE-H Odd
951  } else { // CE-H Even
953  }
954  } else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) { //HFNose
956  } else {
957  edm::LogError("HGCalTriggerGeometryV9Imp3")
958  << "HGCalTriggerGeometryV9Imp3: trigger sub-detector expected to be silicon";
960  }
961 }
962 
963 unsigned HGCalTriggerGeometryV9Imp3::tcEtaphiMappingToSector0(int& tc_ieta, int& tc_iphi) const {
964  unsigned sector = 0;
965 
966  if (tc_iphi > hSc_tc_layer0_min_ && tc_iphi <= hSc_tc_layer0_min_ + ntc_per_wafer_) {
967  sector = 0;
968  } else if (tc_iphi > hSc_tc_layer0_min_ + ntc_per_wafer_ && tc_iphi <= hSc_tc_layer0_min_ + 2 * ntc_per_wafer_) {
969  sector = 2;
970  } else {
971  sector = 1;
972  }
973 
974  if (sector == 0) {
975  tc_iphi = tc_iphi - hSc_tc_layer0_min_;
976  } else if (sector == 2) {
977  tc_iphi = tc_iphi - (hSc_tc_layer0_min_ + ntc_per_wafer_);
978  } else if (sector == 1) {
979  if (tc_iphi <= hSc_tc_layer0_min_) {
980  tc_iphi = tc_iphi + nSectors_ * ntc_per_wafer_;
981  }
982  tc_iphi = tc_iphi - (nSectors_ * ntc_per_wafer_ - hSc_tc_layer0_min_);
983  }
984 
985  return sector;
986 }
987 
989  int& ieta, int& iphi, int tc_eta, int tc_phi, unsigned layer) const {
990  iphi = (tc_phi - 1) / hSc_tcs_per_module_phi_; //Phi index 1-12
991 
993  if (layer > hSc_layer_for_split_) {
995  }
996  if (tc_eta <= split) {
997  ieta = 0;
998  } else {
999  ieta = 1;
1000  }
1001 }
1002 
1003 bool HGCalTriggerGeometryV9Imp3::validTriggerCell(const unsigned trigger_cell_id) const {
1004  return validTriggerCellFromCells(trigger_cell_id);
1005 }
1006 
1008  bool disconnected = false;
1010  if (module_to_stage1_.find(packLayerSubdetWaferId(id.layer(), id.triggerSubdetId(), id.moduleU(), id.moduleV())) ==
1011  module_to_stage1_.end()) {
1012  disconnected = true;
1013  }
1015  disconnected = true;
1016  }
1017  return disconnected;
1018 }
1019 
1020 unsigned HGCalTriggerGeometryV9Imp3::triggerLayer(const unsigned id) const {
1021  unsigned layer = layerWithOffset(id);
1022 
1023  if (DetId(id).det() == DetId::HGCalTrigger and
1025  if (layer >= trigger_nose_layers_.size())
1026  return 0;
1027  return trigger_nose_layers_[layer];
1028  }
1029  if (layer >= trigger_layers_.size())
1030  return 0;
1031  return trigger_layers_[layer];
1032 }
1033 
1034 bool HGCalTriggerGeometryV9Imp3::validCell(unsigned cell_id) const {
1035  bool is_valid = false;
1036  unsigned det = DetId(cell_id).det();
1037  switch (det) {
1038  case DetId::HGCalEE:
1039  is_valid = eeTopology().valid(cell_id);
1040  break;
1041  case DetId::HGCalHSi:
1042  is_valid = hsiTopology().valid(cell_id);
1043  break;
1044  case DetId::HGCalHSc:
1045  is_valid = hscTopology().valid(cell_id);
1046  break;
1047  case DetId::Forward:
1048  is_valid = noseTopology().valid(cell_id);
1049  break;
1050  default:
1051  is_valid = false;
1052  break;
1053  }
1054  return is_valid;
1055 }
1056 
1057 bool HGCalTriggerGeometryV9Imp3::validTriggerCellFromCells(const unsigned trigger_cell_id) const {
1058  // Check the validity of a trigger cell with the
1059  // validity of the cells. One valid cell in the
1060  // trigger cell is enough to make the trigger cell
1061  // valid.
1062  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
1063  bool is_valid = false;
1064  for (const auto cell_id : cells) {
1065  unsigned det = DetId(cell_id).det();
1066  is_valid |= validCellId(det, cell_id);
1067  if (is_valid)
1068  break;
1069  }
1070  return is_valid;
1071 }
1072 
1073 bool HGCalTriggerGeometryV9Imp3::validCellId(unsigned subdet, unsigned cell_id) const {
1074  bool is_valid = false;
1075  switch (subdet) {
1076  case DetId::HGCalEE:
1077  is_valid = eeTopology().valid(cell_id);
1078  break;
1079  case DetId::HGCalHSi:
1080  is_valid = hsiTopology().valid(cell_id);
1081  break;
1082  case DetId::HGCalHSc:
1083  is_valid = hscTopology().valid(cell_id);
1084  break;
1085  case DetId::Forward:
1086  is_valid = noseTopology().valid(cell_id);
1087  break;
1088  default:
1089  is_valid = false;
1090  break;
1091  }
1092  return is_valid;
1093 }
1094 
1095 int HGCalTriggerGeometryV9Imp3::detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const {
1096  int wafer_type = 0;
1097  switch (det) {
1098  case DetId::HGCalEE:
1099  wafer_type = eeTopology().dddConstants().getTypeHex(layer, waferU, waferV);
1100  break;
1101  case DetId::HGCalHSi:
1102  wafer_type = hsiTopology().dddConstants().getTypeHex(layer, waferU, waferV);
1103  break;
1104  case DetId::HGCalHSc:
1105  wafer_type = hscTopology().dddConstants().getTypeTrap(layer);
1106  break;
1107  default:
1108  break;
1109  };
1110  return wafer_type;
1111 }
1112 
1113 void HGCalTriggerGeometryV9Imp3::layerWithoutOffsetAndSubdetId(unsigned& layer, int& subdetId, bool isSilicon) const {
1114  if (!isSilicon) {
1115  layer = layer - heOffset_;
1117  } else {
1118  if (layer > heOffset_) {
1120  layer = layer - heOffset_;
1121  } else {
1123  }
1124  }
1125 }
1126 
1127 unsigned HGCalTriggerGeometryV9Imp3::layerWithOffset(unsigned id) const {
1128  unsigned det = DetId(id).det();
1129  unsigned layer = 0;
1130 
1131  if (det == DetId::HGCalTrigger) {
1132  unsigned subdet = HGCalTriggerDetId(id).subdet();
1134  layer = HGCalTriggerDetId(id).layer();
1135  } else if (subdet == HGCalTriggerSubdetector::HGCalHSiTrigger) {
1137  } else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) {
1138  layer = HFNoseTriggerDetId(id).layer();
1139  }
1140  } else if (det == DetId::HGCalHSc) {
1142  } else if (det == DetId::Forward) {
1143  unsigned subdet = HGCalTriggerModuleDetId(id).triggerSubdetId();
1146  } else if (subdet == HGCalTriggerSubdetector::HGCalHSiTrigger ||
1148  layer = heOffset_ + HGCalDetId(id).layer();
1149  } else if (subdet == HGCalTriggerSubdetector::HFNoseTrigger) {
1151  }
1152  }
1153  return layer;
1154 }
1155 
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
std::unordered_map< unsigned, unsigned > stage1link_to_stage1_
int moduleU() const
get the module U
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void uvMappingFromSector0(WaferCentring waferCentring, int &moduleU, int &moduleV, unsigned sector) const
constexpr int iphi() const
get the phi index
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:57
std::unordered_multimap< unsigned, unsigned > stage1_to_stage1links_
void setEEGeometry(const HGCalGeometry *geom)
bool validTriggerCellFromCells(const unsigned) const
constexpr int ietaAbs() const
auto module_id(edm::ModuleCallingContext const &mcc)
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:76
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_
constexpr int zside() const
get the z-side of the cell (1/-1)
int zside(DetId const &)
std::vector< unsigned > getLpgbtsFromStage1Fpga(const unsigned) const final
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
unsigned getNextSector(const unsigned sector) const
nlohmann::json json
unsigned getModuleSize(const unsigned module_id) const final
int layer() const
get the layer #
geom_ordered_set getOrderedCellsFromModule(const unsigned) const final
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ietaAbs(uint32_t id)
char const * label
constexpr int32_t waferV() const
int type() const
get the type
GlobalPoint getPosition(const DetId &id, bool cog, bool debug) const
int layer() const
get the layer #
int getTypeHex(int layer, int waferU, int waferV) const
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
bool disconnectedModule(const unsigned) const final
HGCalTriggerSubdetector subdet() const
get the subdetector
constexpr int32_t zside() const
get the z-side of the cell (1/-1)
std::unordered_map< unsigned, std::vector< unsigned > > stage1_to_lpgbts_
void setHScGeometry(const HGCalGeometry *geom)
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 getTypeTrap(int layer) const
int type() const
get the type
Definition: HFNoseDetId.h:51
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
unsigned getLinksInModule(const unsigned module_id) const final
constexpr int type() const
get/set the type
int triggerCellU() const
Definition: HFNoseDetId.h:88
HGCalTriggerGeometryV9Imp3(const edm::ParameterSet &conf)
unsigned getStage1FpgaFromModule(const unsigned module_id) const final
Definition: DetId.h:17
geom_set getStage1FpgasFromStage2Fpga(const unsigned) const final
unsigned getPreviousSector(const unsigned sector) const
unsigned layerWithOffset(unsigned) const
int type() const
get the type
Detector
Definition: DetId.h:24
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
constexpr int32_t triggerCellV() const
int waferV() const
Definition: HFNoseDetId.h:79
std::set< unsigned > geom_ordered_set
constexpr int32_t layer() const
get the layer #
const HGCalTopology & noseTopology() const
std::vector< int > cellV() const
const HGCalTopology & hscTopology() const
HLT enums.
constexpr int layer() const
get the layer #
constexpr int32_t triggerCellU() const
std::unordered_set< unsigned > geom_set
int triggerCellV() const
Definition: HFNoseDetId.h:95
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 std::string & fullPath() const
Definition: FileInPath.cc:144
const HGCalGeometry * noseGeometry() const
unsigned getStage1FpgaFromStage1Link(const unsigned) const final
int zside() const
get the z-side of the module (1/-1)
constexpr int32_t waferU() const
int triggerSubdetId() const
get the trigger sub-detector
geom_set getStage1LinksFromStage1Fpga(const unsigned) const final
constexpr int32_t type() const
get the type
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:54
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