CMS 3D CMS Logo

HGCalTriggerGeometryV9Imp1.cc
Go to the documentation of this file.
2 
7 
8 #include <fstream>
9 #include <iostream>
10 #include <regex>
11 #include <vector>
12 
14 public:
16 
17  void initialize(const CaloGeometry*) final;
18  void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final;
19  void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) final;
20 
21  void reset() final;
22 
23  unsigned getTriggerCellFromCell(const unsigned) const final;
24  unsigned getModuleFromCell(const unsigned) const final;
25  unsigned getModuleFromTriggerCell(const unsigned) const final;
26 
27  geom_set getCellsFromTriggerCell(const unsigned) const final;
28  geom_set getCellsFromModule(const unsigned) const final;
29  geom_set getTriggerCellsFromModule(const unsigned) const final;
30 
31  geom_ordered_set getOrderedCellsFromModule(const unsigned) const final;
32  geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final;
33 
34  geom_set getNeighborsFromTriggerCell(const unsigned) const final;
35 
36  unsigned getLinksInModule(const unsigned module_id) const final;
37  unsigned getModuleSize(const unsigned module_id) const final;
38 
39  GlobalPoint getTriggerCellPosition(const unsigned) const final;
40  GlobalPoint getModulePosition(const unsigned) const final;
41 
42  bool validCell(const unsigned) const final;
43  bool validTriggerCell(const unsigned) const final;
44  bool disconnectedModule(const unsigned) const final;
45  unsigned lastTriggerLayer() const final { return last_trigger_layer_; }
46  unsigned triggerLayer(const unsigned) const final;
47 
48 private:
56 
57  unsigned hSc_links_per_module_ = 1;
58  unsigned hSc_wafers_per_module_ = 3;
59 
60  // module related maps
61  std::unordered_map<unsigned, unsigned> wafer_to_module_;
62  std::unordered_multimap<unsigned, unsigned> module_to_wafers_;
63  std::unordered_map<unsigned, unsigned> links_per_module_;
64 
65  // trigger cell related maps
66  std::unordered_map<unsigned, unsigned> cells_to_trigger_cells_;
67  std::unordered_multimap<unsigned, unsigned> trigger_cells_to_cells_;
68  std::unordered_map<unsigned, unsigned> cells_to_trigger_cells_sci_;
69  std::unordered_multimap<unsigned, unsigned> trigger_cells_to_cells_sci_;
70  std::unordered_map<unsigned, unsigned short> number_trigger_cells_in_wafers_;
71  std::unordered_map<unsigned, unsigned short> number_trigger_cells_in_wafers_sci_;
72  std::unordered_map<unsigned, unsigned> wafers_to_wafers_old_;
73  std::unordered_map<unsigned, unsigned> wafers_old_to_wafers_;
74  std::unordered_set<unsigned> invalid_triggercells_;
75 
76  // neighbor related maps
77  // trigger cell neighbors:
78  // - The key includes the module and trigger cell id
79  // - The value is a set of (module_id, trigger_cell_id)
80  typedef std::unordered_map<int, std::set<std::pair<short, short>>> neighbor_map;
83 
84  // Disconnected modules and layers
85  std::unordered_set<unsigned> disconnected_modules_;
86  std::unordered_set<unsigned> disconnected_layers_;
87  std::vector<unsigned> trigger_layers_;
88  unsigned last_trigger_layer_ = 0;
89 
90  // layer offsets
91  unsigned heOffset_ = 0;
92  unsigned totalLayers_ = 0;
93 
94  void fillMaps();
95  void fillNeighborMap(const edm::FileInPath&, neighbor_map&, bool);
97  unsigned packTriggerCell(unsigned, unsigned) const;
98  unsigned packTriggerCellWithType(unsigned, unsigned, unsigned) const;
99  bool validCellId(unsigned det, unsigned cell_id) const;
100  bool validTriggerCellFromCells(const unsigned) const;
101 
102  int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const;
103  unsigned packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const;
104  unsigned packLayerWaferId(unsigned layer, unsigned wafer) const;
105  unsigned packWaferId(int waferU, int waferV) const;
106  unsigned packCellId(unsigned type, unsigned cellU, unsigned cellV) const;
107  unsigned packCellId(unsigned type, unsigned cell) const;
108  unsigned packIetaIphi(unsigned ieta, unsigned iphi) const;
109  void unpackWaferCellId(unsigned wafer_cell, unsigned& wafer, unsigned& cell) const;
110  void unpackLayerWaferId(unsigned layer_wafer, unsigned& layer, unsigned& wafer) const;
111  void unpackWaferId(unsigned wafer, int& waferU, int& waferV) const;
112  void unpackCellId(unsigned cell, unsigned& cellU, unsigned& cellV) const;
113  void unpackIetaIphi(unsigned ieta_iphi, unsigned& ieta, unsigned& iphi) const;
114 
115  unsigned layerWithOffset(unsigned) const;
116 };
117 
119  : HGCalTriggerGeometryBase(conf),
120  l1tCellsMapping_(conf.getParameter<edm::FileInPath>("L1TCellsMapping")),
121  l1tCellsSciMapping_(conf.getParameter<edm::FileInPath>("L1TCellsSciMapping")),
122  l1tWafersMapping_(conf.getParameter<edm::FileInPath>("L1TWafersMapping")),
123  l1tModulesMapping_(conf.getParameter<edm::FileInPath>("L1TModulesMapping")),
124  l1tLinksMapping_(conf.getParameter<edm::FileInPath>("L1TLinksMapping")),
125  l1tCellNeighborsMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsMapping")),
126  l1tCellNeighborsSciMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsSciMapping")),
127  hSc_links_per_module_(conf.getParameter<unsigned>("ScintillatorLinksPerModule")),
128  hSc_wafers_per_module_(conf.getParameter<unsigned>("ScintillatorWafersPerModule")) {
129  std::vector<unsigned> tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedModules");
130  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_modules_, disconnected_modules_.end()));
131  tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedLayers");
132  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end()));
133 }
134 
136  cells_to_trigger_cells_.clear();
137  trigger_cells_to_cells_.clear();
140  wafers_to_wafers_old_.clear();
141  wafers_old_to_wafers_.clear();
142  wafer_to_module_.clear();
143  module_to_wafers_.clear();
146  trigger_cell_neighbors_.clear();
148 }
149 
151  throw cms::Exception("BadGeometry")
152  << "HGCalTriggerGeometryV9Imp1 geometry cannot be initialized with the V7/V8 HGCAL geometry";
153 }
154 
156  const HGCalGeometry* hgc_hsi_geometry,
157  const HGCalGeometry* hgc_hsc_geometry) {
158  setEEGeometry(hgc_ee_geometry);
159  setHSiGeometry(hgc_hsi_geometry);
160  setHScGeometry(hgc_hsc_geometry);
163  trigger_layers_.resize(totalLayers_ + 1);
164  trigger_layers_[0] = 0; // layer number 0 doesn't exist
165  unsigned trigger_layer = 1;
166  for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) {
167  if (disconnected_layers_.find(layer) == disconnected_layers_.end()) {
168  // Increase trigger layer number if the layer is not disconnected
169  trigger_layers_[layer] = trigger_layer;
170  trigger_layer++;
171  } else {
172  trigger_layers_[layer] = 0;
173  }
174  }
175  last_trigger_layer_ = trigger_layer - 1;
176  fillMaps();
180 }
181 
183  const HGCalGeometry* hgc_hsi_geometry,
184  const HGCalGeometry* hgc_hsc_geometry,
185  const HGCalGeometry* hgc_nose_geometry) {
186  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometryV9Imp1 geometry cannot be initialized with the "
187  "HFNose geometry; use HGCalTriggerGeometryV9Imp2";
188 }
189 
190 unsigned HGCalTriggerGeometryV9Imp1::getTriggerCellFromCell(const unsigned cell_id) const {
191  unsigned det = DetId(cell_id).det();
192  unsigned subdet = 0;
193  int zside = 0;
194  unsigned tc_type = 1;
195  unsigned layer = 0;
196  unsigned wafer_trigger_cell = 0;
197  unsigned trigger_cell = 0;
198  // Scintillator
199  if (det == DetId::HGCalHSc) {
200  HGCScintillatorDetId cell_det_id(cell_id);
201  unsigned ieta = cell_det_id.ietaAbs();
202  unsigned iphi = cell_det_id.iphi();
203  tc_type = cell_det_id.type();
204  layer = cell_det_id.layer();
206  zside = cell_det_id.zside();
207  auto trigger_cell_itr = cells_to_trigger_cells_sci_.find(packIetaIphi(ieta, iphi));
208  if (trigger_cell_itr == cells_to_trigger_cells_sci_.end()) {
209  throw cms::Exception("BadGeometry")
210  << "HGCalTriggerGeometry: scintillator cell ieta=" << ieta << ", iphi=" << iphi
211  << " is not mapped to any trigger cell. The trigger cell mapping should be modified.\n";
212  }
213  trigger_cell = 0;
214  wafer_trigger_cell = 0;
215  unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell);
216  }
217  // Silicon
218  else if (det == DetId::HGCalEE || det == DetId::HGCalHSi) {
219  HGCSiliconDetId cell_det_id(cell_id);
221  layer = cell_det_id.layer();
222  zside = cell_det_id.zside();
223  int type = cell_det_id.type();
224  int waferu = cell_det_id.waferU();
225  int waferv = cell_det_id.waferV();
226  unsigned cellu = cell_det_id.cellU();
227  unsigned cellv = cell_det_id.cellV();
228  auto trigger_cell_itr = cells_to_trigger_cells_.find(packCellId(type, cellu, cellv));
229  if (trigger_cell_itr == cells_to_trigger_cells_.end()) {
230  throw cms::Exception("BadGeometry")
231  << "HGCalTriggerGeometry: HGCal cell " << cellu << "," << cellv << " in wafer type " << type
232  << " is not mapped to any trigger cell. The trigger cell mapping should be modified.\n";
233  }
234  auto wafer_trigger_cell_itr = wafers_to_wafers_old_.find(packWaferId(waferu, waferv));
235  if (wafer_trigger_cell_itr == wafers_to_wafers_old_.end()) {
236  throw cms::Exception("BadGeometry")
237  << "HGCalTriggerGeometry: Wafer " << waferu << "," << waferv
238  << " is not mapped to any trigger wafer ID. The wafer mapping should be modified.\n";
239  }
240  trigger_cell = trigger_cell_itr->second;
241  wafer_trigger_cell = wafer_trigger_cell_itr->second;
242  }
243  // Using the old HGCalDetId for trigger cells is temporary
244  // For easy switch between V8 and V9 geometries
245  return HGCalDetId((ForwardSubdetector)subdet, zside, layer, tc_type, wafer_trigger_cell, trigger_cell).rawId();
246 }
247 
248 unsigned HGCalTriggerGeometryV9Imp1::getModuleFromCell(const unsigned cell_id) const {
250 }
251 
252 unsigned HGCalTriggerGeometryV9Imp1::getModuleFromTriggerCell(const unsigned trigger_cell_id) const {
253  HGCalDetId trigger_cell_det_id(trigger_cell_id);
254  unsigned module = 0;
255  // Scintillator
256  if (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
257  // For scintillator, the module ID is currently encoded as the wafer in HGCalDetId
258  module = trigger_cell_det_id.wafer();
259  }
260  // Silicon
261  else {
262  unsigned layer_with_offset = layerWithOffset(trigger_cell_id);
263  auto module_itr = wafer_to_module_.find(packLayerWaferId(layer_with_offset, trigger_cell_det_id.wafer()));
264  if (module_itr == wafer_to_module_.end()) {
265  throw cms::Exception("BadGeometry")
266  << trigger_cell_det_id << "HGCalTriggerGeometry: Wafer " << trigger_cell_det_id.wafer()
267  << " is not mapped to any trigger module. The module mapping should be modified. See "
268  "https://twiki.cern.ch/twiki/bin/viewauth/CMS/HGCALTriggerPrimitivesSimulation#Trigger_geometry for "
269  "details.\n";
270  }
271  module = module_itr->second;
272  }
273  return HGCalDetId((ForwardSubdetector)trigger_cell_det_id.subdetId(),
274  trigger_cell_det_id.zside(),
275  trigger_cell_det_id.layer(),
276  trigger_cell_det_id.waferType(),
277  module,
279  .rawId();
280 }
281 
283  const unsigned trigger_cell_id) const {
284  HGCalDetId trigger_cell_det_id(trigger_cell_id);
285  geom_set cell_det_ids;
286  unsigned subdet = trigger_cell_det_id.subdetId();
287  unsigned trigger_wafer = trigger_cell_det_id.wafer();
288  unsigned trigger_cell = trigger_cell_det_id.cell();
289  unsigned layer = trigger_cell_det_id.layer();
290  // Scintillator
291  if (subdet == ForwardSubdetector::HGCHEB) {
292  int type = hscTopology().dddConstants().getTypeTrap(layer);
293  const auto& cell_range =
294  trigger_cells_to_cells_sci_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell));
295  for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) {
296  unsigned ieta = 0;
297  unsigned iphi = 0;
298  unpackIetaIphi(tc_c_itr->second, ieta, iphi);
299  unsigned cell_det_id = HGCScintillatorDetId(type, layer, trigger_cell_det_id.zside() * ieta, iphi).rawId();
300  if (validCellId(subdet, cell_det_id))
301  cell_det_ids.emplace(cell_det_id);
302  }
303  }
304  // Silicon
305  else {
306  int waferu = 0;
307  int waferv = 0;
308  auto wafer_itr = wafers_old_to_wafers_.find(trigger_wafer);
309  if (wafer_itr == wafers_old_to_wafers_.end()) {
310  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Trigger wafer ID " << trigger_wafer
311  << " is not mapped to any wafer. The wafer mapping should be modified.\n";
312  }
313  unpackWaferId(wafer_itr->second, waferu, waferv);
314  DetId::Detector det =
315  (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCEE ? DetId::HGCalEE : DetId::HGCalHSi);
316  unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv);
317  const auto& cell_range = trigger_cells_to_cells_.equal_range(packCellId(wafer_type, trigger_cell));
318  for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) {
319  unsigned cellu = 0;
320  unsigned cellv = 0;
321  unpackCellId(tc_c_itr->second, cellu, cellv);
322  unsigned cell_det_id =
323  HGCSiliconDetId(det, trigger_cell_det_id.zside(), wafer_type, layer, waferu, waferv, cellu, cellv).rawId();
324  if (validCellId(subdet, cell_det_id))
325  cell_det_ids.emplace(cell_det_id);
326  }
327  }
328  return cell_det_ids;
329 }
330 
332  geom_set cell_det_ids;
333  geom_set trigger_cells = getTriggerCellsFromModule(module_id);
334  for (auto trigger_cell_id : trigger_cells) {
335  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
336  cell_det_ids.insert(cells.begin(), cells.end());
337  }
338  return cell_det_ids;
339 }
340 
342  const unsigned module_id) const {
343  geom_ordered_set cell_det_ids;
344  geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id);
345  for (auto trigger_cell_id : trigger_cells) {
346  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
347  cell_det_ids.insert(cells.begin(), cells.end());
348  }
349  return cell_det_ids;
350 }
351 
353  const unsigned module_id) const {
354  HGCalDetId module_det_id(module_id);
355  geom_set trigger_cell_det_ids;
356  unsigned module = module_det_id.wafer();
357  unsigned layer = module_det_id.layer();
358  // Scintillator
359  if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
360  // loop on the trigger cells in each module
361  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_sci_.at(module); trigger_cell++) {
362  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
363  module_det_id.zside(),
364  layer,
365  module_det_id.waferType(),
366  module,
367  trigger_cell);
368  if (validTriggerCell(trigger_cell_id))
369  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
370  }
371  }
372  // Silicon
373  else {
374  auto wafer_itrs = module_to_wafers_.equal_range(packLayerWaferId(layerWithOffset(module_id), module));
375  // loop on the wafers included in the module
376  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
377  unsigned wafer = wafer_itr->second;
378  auto waferuv_itr = wafers_old_to_wafers_.find(wafer);
379  if (waferuv_itr == wafers_old_to_wafers_.end())
380  continue;
381  int waferu = 0;
382  int waferv = 0;
383  unpackWaferId(waferuv_itr->second, waferu, waferv);
385  unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv);
386  // loop on the trigger cells in each wafer
387  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++) {
388  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
389  module_det_id.zside(),
390  layer,
391  module_det_id.waferType(),
392  wafer,
393  trigger_cell);
394  if (validTriggerCell(trigger_cell_id))
395  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
396  }
397  }
398  }
399  return trigger_cell_det_ids;
400 }
401 
403  const unsigned module_id) const {
404  HGCalDetId module_det_id(module_id);
405  geom_ordered_set trigger_cell_det_ids;
406  unsigned module = module_det_id.wafer();
407  unsigned layer = module_det_id.layer();
408  // Scintillator
409  if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
410  // loop on the trigger cells in each module
411  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_sci_.at(module); trigger_cell++) {
412  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
413  module_det_id.zside(),
414  layer,
415  module_det_id.waferType(),
416  module,
417  trigger_cell);
418  if (validTriggerCell(trigger_cell_id))
419  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
420  }
421  }
422  // EE or FH
423  else {
424  auto wafer_itrs = module_to_wafers_.equal_range(packLayerWaferId(layerWithOffset(module_id), module));
425  // loop on the wafers included in the module
426  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
427  unsigned wafer = wafer_itr->second;
428  auto waferuv_itr = wafers_old_to_wafers_.find(wafer);
429  if (waferuv_itr == wafers_old_to_wafers_.end())
430  continue;
431  int waferu = 0;
432  int waferv = 0;
433  unpackWaferId(waferuv_itr->second, waferu, waferv);
435  unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv);
436  // loop on the trigger cells in each wafer
437  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++) {
438  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
439  module_det_id.zside(),
440  layer,
441  module_det_id.waferType(),
442  wafer,
443  trigger_cell);
444  if (validTriggerCell(trigger_cell_id))
445  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
446  }
447  }
448  }
449  return trigger_cell_det_ids;
450 }
451 
453  const unsigned trigger_cell_id) const {
454  HGCalDetId trigger_cell_det_id(trigger_cell_id);
455  // Choose scintillator or silicon map
456  const auto& neighbors_map =
459  unsigned layer = trigger_cell_det_id.layer();
460  unsigned type =
461  (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB ? hscTopology().dddConstants().getTypeTrap(layer)
462  : 1);
463  unsigned module = trigger_cell_det_id.wafer();
464  unsigned trigger_cell = trigger_cell_det_id.cell();
465  // retrieve neighbors
466  unsigned trigger_cell_key = (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB
467  ? packTriggerCellWithType(type, module, trigger_cell)
468  : packTriggerCell(module, trigger_cell));
469  geom_set neighbor_detids;
470  auto neighbors_itr = neighbors_map.find(trigger_cell_key);
471  if (neighbors_itr == neighbors_map.end()) {
472  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Neighbors are not defined for trigger cell "
473  << trigger_cell << " in module " << module
474  << ". The trigger cell neighbor mapping should be modified. \n";
475  }
476  const auto& neighbors = neighbors_itr->second;
477  // create HGCalDetId of neighbors and check their validity
478  neighbor_detids.reserve(neighbors.size());
479  for (const auto& module_tc : neighbors) {
480  HGCalDetId neighbor_det_id((ForwardSubdetector)trigger_cell_det_id.subdetId(),
481  trigger_cell_det_id.zside(),
482  layer,
483  type,
484  module_tc.first,
485  module_tc.second);
486  if (validTriggerCell(neighbor_det_id.rawId())) {
487  neighbor_detids.emplace(neighbor_det_id.rawId());
488  }
489  }
490  return neighbor_detids;
491 }
492 
493 unsigned HGCalTriggerGeometryV9Imp1::getLinksInModule(const unsigned module_id) const {
494  HGCalDetId module_det_id(module_id);
495  unsigned links = 0;
496  unsigned module = module_det_id.wafer();
497  unsigned layer = layerWithOffset(module_det_id);
498  // Scintillator
499  if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
501  }
502  // Silicon
503  else {
504  const unsigned sector0_mask = 0x7F;
505  module = (module & sector0_mask);
507  }
508  return links;
509 }
510 
511 unsigned HGCalTriggerGeometryV9Imp1::getModuleSize(const unsigned module_id) const {
512  HGCalDetId module_det_id(module_id);
513  unsigned module = module_det_id.wafer();
514  unsigned layer = layerWithOffset(module_det_id);
515  unsigned nWafers = 1;
516  // Scintillator
517  if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
518  nWafers = hSc_wafers_per_module_;
519  }
520  // Silicon
521  else {
522  nWafers = module_to_wafers_.count(packLayerWaferId(layer, module));
523  }
524  return nWafers;
525 }
526 
527 GlobalPoint HGCalTriggerGeometryV9Imp1::getTriggerCellPosition(const unsigned trigger_cell_det_id) const {
528  unsigned subdet = HGCalDetId(trigger_cell_det_id).subdetId();
529  // Position: barycenter of the trigger cell.
530  Basic3DVector<float> triggerCellVector(0., 0., 0.);
531  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
532  // Scintillator
533  if (subdet == ForwardSubdetector::HGCHEB) {
534  for (const auto& cell : cell_ids) {
535  triggerCellVector += hscGeometry()->getPosition(cell).basicVector();
536  }
537  }
538  // Silicon
539  else {
540  for (const auto& cell : cell_ids) {
541  HGCSiliconDetId cellDetId(cell);
542  triggerCellVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId)
543  : hsiGeometry()->getPosition(cellDetId))
544  .basicVector();
545  }
546  }
547  return GlobalPoint(triggerCellVector / cell_ids.size());
548 }
549 
550 GlobalPoint HGCalTriggerGeometryV9Imp1::getModulePosition(const unsigned module_det_id) const {
551  unsigned subdet = HGCalDetId(module_det_id).subdetId();
552  // Position: barycenter of the module.
553  Basic3DVector<float> moduleVector(0., 0., 0.);
554  const auto cell_ids = getCellsFromModule(module_det_id);
555  // Scintillator
556  if (subdet == ForwardSubdetector::HGCHEB) {
557  for (const auto& cell : cell_ids) {
558  moduleVector += hscGeometry()->getPosition(cell).basicVector();
559  }
560  }
561  // Silicon
562  else {
563  for (const auto& cell : cell_ids) {
564  HGCSiliconDetId cellDetId(cell);
565  moduleVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId)
566  : hsiGeometry()->getPosition(cellDetId))
567  .basicVector();
568  }
569  }
570  return GlobalPoint(moduleVector / cell_ids.size());
571 }
572 
574  //
575  // read module mapping file
576  std::ifstream l1tModulesMappingStream(l1tModulesMapping_.fullPath());
577  if (!l1tModulesMappingStream.is_open()) {
578  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TModulesMapping file\n";
579  }
580  short trigger_wafer = 0;
581  short module = 0;
582  short layer = 0;
583  for (; l1tModulesMappingStream >> layer >> trigger_wafer >> module;) {
584  wafer_to_module_.emplace(packLayerWaferId(layer, trigger_wafer), module);
585  module_to_wafers_.emplace(packLayerWaferId(layer, module), trigger_wafer);
586  }
587  if (!l1tModulesMappingStream.eof()) {
588  throw cms::Exception("BadGeometryFile")
589  << "Error reading L1TModulesMapping '" << layer << " " << trigger_wafer << " " << module << "' \n";
590  }
591  l1tModulesMappingStream.close();
592  // read links mapping file
593  std::ifstream l1tLinksMappingStream(l1tLinksMapping_.fullPath());
594  if (!l1tLinksMappingStream.is_open()) {
595  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TLinksMapping file\n";
596  }
597  short links = 0;
598  for (; l1tLinksMappingStream >> layer >> module >> links;) {
599  if (module_to_wafers_.find(packLayerWaferId(layer, module)) == module_to_wafers_.end()) {
600  throw cms::Exception("BadGeometryFile")
601  << "Error reading L1TLinksMapping: (" << layer << "," << module << ") is not defined in the module file \n";
602  }
604  }
605  if (!l1tLinksMappingStream.eof()) {
606  throw cms::Exception("BadGeometryFile")
607  << "Error reading L1TLinksMapping '" << layer << " " << module << " " << links << "' \n";
608  }
609  l1tLinksMappingStream.close();
610  // read trigger cell mapping file
611  std::ifstream l1tCellsMappingStream(l1tCellsMapping_.fullPath());
612  if (!l1tCellsMappingStream.is_open()) {
613  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsMapping file\n";
614  }
615  short type = 0;
616  short cellu = 0;
617  short cellv = 0;
618  short trigger_cell = 0;
619  for (; l1tCellsMappingStream >> type >> cellu >> cellv >> trigger_cell;) {
620  unsigned cell_key = packCellId(type, cellu, cellv);
621  unsigned trigger_cell_key = packCellId(type, trigger_cell);
622  // fill cell <-> trigger cell mappings
623  cells_to_trigger_cells_.emplace(cell_key, trigger_cell);
624  trigger_cells_to_cells_.emplace(trigger_cell_key, cell_key);
625  // fill number of trigger cells in wafers
626  auto itr_insert = number_trigger_cells_in_wafers_.emplace(type, 0);
627  if (trigger_cell + 1 > itr_insert.first->second)
628  itr_insert.first->second = trigger_cell + 1;
629  }
630  if (!l1tCellsMappingStream.eof()) {
631  throw cms::Exception("BadGeometryFile")
632  << "Error reading L1TCellsMapping '" << type << " " << cellu << " " << cellv << " " << trigger_cell << "' \n";
633  }
634  l1tCellsMappingStream.close();
635  // read scintillator trigger cell mapping file
636  std::ifstream l1tCellsSciMappingStream(l1tCellsSciMapping_.fullPath());
637  if (!l1tCellsSciMappingStream.is_open()) {
638  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsSciMapping file\n";
639  }
640  short ieta = 0;
641  short iphi = 0;
642  trigger_wafer = 0;
643  trigger_cell = 0;
644  for (; l1tCellsSciMappingStream >> ieta >> iphi >> trigger_wafer >> trigger_cell;) {
645  unsigned cell_key = packIetaIphi(ieta, iphi);
646  unsigned trigger_cell_key = packWaferCellId(ForwardSubdetector::HGCHEB, trigger_wafer, trigger_cell);
647  // fill cell <-> trigger cell mappings
648  cells_to_trigger_cells_sci_.emplace(cell_key, trigger_cell_key);
649  trigger_cells_to_cells_sci_.emplace(trigger_cell_key, cell_key);
650  // fill number of trigger cells in wafers
651  auto itr_insert = number_trigger_cells_in_wafers_sci_.emplace(trigger_wafer, 0);
652  if (trigger_cell + 1 > itr_insert.first->second)
653  itr_insert.first->second = trigger_cell + 1;
654  }
655  if (!l1tCellsSciMappingStream.eof()) {
656  throw cms::Exception("BadGeometryFile") << "Error reading L1TCellsSciMapping '" << ieta << " " << iphi << " "
657  << trigger_wafer << " " << trigger_cell << "' \n";
658  }
659  l1tCellsSciMappingStream.close();
660  // read wafer mapping file
661  std::ifstream l1tWafersMappingStream(l1tWafersMapping_.fullPath());
662  if (!l1tWafersMappingStream.is_open()) {
663  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TWafersMapping file\n";
664  }
665  short waferu = 0;
666  short waferv = 0;
667  trigger_wafer = 0;
668  for (; l1tWafersMappingStream >> waferu >> waferv >> trigger_wafer;) {
669  unsigned wafer_key = packWaferId(waferu, waferv);
670  // fill wafer u,v <-> old wafer ID mappings
671  wafers_to_wafers_old_.emplace(wafer_key, trigger_wafer);
672  wafers_old_to_wafers_.emplace(trigger_wafer, wafer_key);
673  }
674  if (!l1tWafersMappingStream.eof()) {
675  throw cms::Exception("BadGeometryFile")
676  << "Error reading L1TWafersMapping '" << waferu << " " << waferv << " " << trigger_wafer << "' \n";
677  }
678  l1tWafersMappingStream.close();
679 }
680 
682  neighbor_map& neighbors_map,
683  bool scintillator) {
684  // Fill trigger neighbor map
685  std::ifstream l1tCellNeighborsMappingStream(file.fullPath());
686  if (!l1tCellNeighborsMappingStream.is_open()) {
687  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellNeighborsMapping file\n";
688  }
689  const unsigned line_size = 512;
690  for (std::array<char, line_size> buffer; l1tCellNeighborsMappingStream.getline(&buffer[0], line_size);) {
691  std::string line(&buffer[0]);
692  // Extract keys consisting of the module id
693  // and of the trigger cell id
694  // Match patterns (X,Y)
695  // where X is a number with less than 4 digis
696  // and Y is a number with less than 4 digits
697  // For the scintillator case, match instead (X,Y,Z) patterns
698  std::regex key_regex(scintillator ? "\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)"
699  : "\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)");
700  std::vector<std::string> key_tokens{std::sregex_token_iterator(line.begin(), line.end(), key_regex), {}};
701  if (key_tokens.empty()) {
702  throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n"
703  << " Cannot find the trigger cell key in line:\n"
704  << " '" << &buffer[0] << "'\n";
705  }
706  std::regex digits_regex("\\d{1,3}");
707  std::vector<std::string> module_tc{
708  std::sregex_token_iterator(key_tokens[0].begin(), key_tokens[0].end(), digits_regex), {}};
709  // get module and cell id
710  unsigned map_key = 0;
711  if (scintillator) {
712  int type = std::stoi(module_tc[0]);
713  int module = std::stoi(module_tc[1]);
714  int trigger_cell = std::stoi(module_tc[2]);
715  map_key = packTriggerCellWithType(type, module, trigger_cell);
716  } else {
717  int module = std::stoi(module_tc[0]);
718  int trigger_cell = std::stoi(module_tc[1]);
719  map_key = packTriggerCell(module, trigger_cell);
720  }
721  // Extract neighbors
722  // Match patterns (X,Y)
723  // where X is a number with less than 4 digits
724  // and Y is a number with less than 4 digits
725  std::regex neighbors_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)");
726  std::vector<std::string> neighbors_tokens{std::sregex_token_iterator(line.begin(), line.end(), neighbors_regex),
727  {}};
728  if ((scintillator && neighbors_tokens.empty()) || (!scintillator && neighbors_tokens.size() < 2)) {
729  throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n"
730  << " Cannot find any neighbor in line:\n"
731  << " '" << &buffer[0] << "'\n";
732  }
733  auto itr_insert = neighbors_map.emplace(map_key, std::set<std::pair<short, short>>());
734  // The first element for silicon neighbors is the key, so start at index 1
735  unsigned first_element = (scintillator ? 0 : 1);
736  for (unsigned i = first_element; i < neighbors_tokens.size(); i++) {
737  const auto& neighbor = neighbors_tokens[i];
738  std::vector<std::string> pair_neighbor{std::sregex_token_iterator(neighbor.begin(), neighbor.end(), digits_regex),
739  {}};
740  short neighbor_module(std::stoi(pair_neighbor[0]));
741  short neighbor_cell(std::stoi(pair_neighbor[1]));
742  itr_insert.first->second.emplace(neighbor_module, neighbor_cell);
743  }
744  }
745  if (!l1tCellNeighborsMappingStream.eof()) {
746  throw cms::Exception("BadGeometryFile") << "Error reading L1TCellNeighborsMapping'\n";
747  }
748  l1tCellNeighborsMappingStream.close();
749 }
750 
752  unsigned n_layers_ee = eeTopology().dddConstants().layers(true);
753  for (unsigned layer = 1; layer <= n_layers_ee; layer++) {
754  for (const auto& waferuv_wafer : wafers_to_wafers_old_) {
755  int waferu = 0;
756  int waferv = 0;
757  unpackWaferId(waferuv_wafer.first, waferu, waferv);
758  unsigned waferee_type = detIdWaferType(DetId::HGCalEE, layer, waferu, waferv);
759  unsigned waferfh_type = detIdWaferType(DetId::HGCalHSi, layer, waferu, waferv);
760  unsigned trigger_wafer = waferuv_wafer.second;
761  // loop on the trigger cells in each wafer
762  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(waferee_type); trigger_cell++) {
763  for (int zside : {-1, 1}) {
764  HGCalDetId trigger_cell_id(ForwardSubdetector::HGCEE, zside, layer, 1, trigger_wafer, trigger_cell);
765  if (!validTriggerCellFromCells(trigger_cell_id))
766  invalid_triggercells_.emplace(trigger_cell_id);
767  for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell_id)) {
768  auto wafer_itr = wafers_old_to_wafers_.find(HGCalDetId(neighbor).wafer());
769  if (wafer_itr == wafers_old_to_wafers_.end())
770  invalid_triggercells_.emplace(neighbor);
771  else if (!validTriggerCellFromCells(neighbor))
772  invalid_triggercells_.emplace(neighbor);
773  }
774  }
775  }
776  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(waferfh_type); trigger_cell++) {
777  for (int zside : {-1, 1}) {
778  HGCalDetId trigger_cell_id(ForwardSubdetector::HGCHEF, zside, layer, 1, trigger_wafer, trigger_cell);
779  if (!validTriggerCellFromCells(trigger_cell_id))
780  invalid_triggercells_.emplace(trigger_cell_id);
781  for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell_id)) {
782  auto wafer_itr = wafers_old_to_wafers_.find(HGCalDetId(neighbor).wafer());
783  if (wafer_itr == wafers_old_to_wafers_.end())
784  invalid_triggercells_.emplace(neighbor);
785  else if (!validTriggerCellFromCells(neighbor))
786  invalid_triggercells_.emplace(neighbor);
787  }
788  }
789  }
790  }
791  }
792  unsigned n_layers_hsc = hscTopology().dddConstants().layers(true);
793  unsigned first_layer_hsc = hscTopology().dddConstants().firstLayer();
794  for (unsigned layer = first_layer_hsc; layer <= first_layer_hsc + n_layers_hsc; layer++) {
795  int type = hscTopology().dddConstants().getTypeTrap(layer);
796  for (const auto& module_ncells : number_trigger_cells_in_wafers_sci_) {
797  unsigned trigger_wafer = module_ncells.first;
798  // loop on the trigger cells in each wafer
799  for (int trigger_cell = 1; trigger_cell < module_ncells.second; trigger_cell++) {
800  for (int zside : {-1, 1}) {
801  HGCalDetId trigger_cell_id(ForwardSubdetector::HGCHEB, zside, layer, type, trigger_wafer, trigger_cell);
802  if (!validTriggerCellFromCells(trigger_cell_id))
803  invalid_triggercells_.emplace(trigger_cell_id);
804  for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell_id)) {
805  if (!validTriggerCellFromCells(neighbor))
806  invalid_triggercells_.emplace(neighbor);
807  }
808  }
809  }
810  }
811  }
812 }
813 
814 unsigned HGCalTriggerGeometryV9Imp1::packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const {
815  unsigned packed_value = 0;
816  const int kSubdetMask = 0x7;
817  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
818  packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset);
819  packed_value |= ((subdet & kSubdetMask) << (HGCalDetId::kHGCalWaferTypeOffset));
820  return packed_value;
821 }
822 
823 unsigned HGCalTriggerGeometryV9Imp1::packLayerWaferId(unsigned layer, unsigned wafer) const {
824  unsigned packed_value = 0;
825  unsigned subdet = ForwardSubdetector::HGCEE;
826  if (layer > heOffset_) {
827  layer -= heOffset_;
829  }
830  packed_value |= ((layer & HGCalDetId::kHGCalLayerMask) << HGCalDetId::kHGCalLayerOffset);
831  packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset);
832  packed_value |= ((subdet & DetId::kSubdetMask) << DetId::kSubdetOffset);
833  return packed_value;
834 }
835 
836 unsigned HGCalTriggerGeometryV9Imp1::packCellId(unsigned type, unsigned cell) const {
837  unsigned packed_value = 0;
838  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
840  return packed_value;
841 }
842 
843 unsigned HGCalTriggerGeometryV9Imp1::packCellId(unsigned type, unsigned cellU, unsigned cellV) const {
844  unsigned packed_value = 0;
848  return packed_value;
849 }
850 
851 unsigned HGCalTriggerGeometryV9Imp1::packWaferId(int waferU, int waferV) const {
852  unsigned packed_value = 0;
853  unsigned waferUabs = std::abs(waferU);
854  unsigned waferVabs = std::abs(waferV);
855  unsigned waferUsign = (waferU >= 0) ? 0 : 1;
856  unsigned waferVsign = (waferV >= 0) ? 0 : 1;
861  return packed_value;
862 }
863 
864 unsigned HGCalTriggerGeometryV9Imp1::packIetaIphi(unsigned ieta, unsigned iphi) const {
865  unsigned packed_value = 0;
868  return packed_value;
869 }
870 
871 void HGCalTriggerGeometryV9Imp1::unpackWaferCellId(unsigned wafer_cell, unsigned& wafer, unsigned& cell) const {
872  cell = wafer_cell & HGCalDetId::kHGCalCellMask;
874 }
875 
876 void HGCalTriggerGeometryV9Imp1::unpackLayerWaferId(unsigned layer_wafer, unsigned& layer, unsigned& wafer) const {
879  unsigned subdet = (layer_wafer >> DetId::kSubdetOffset) & DetId::kSubdetMask;
880  if (subdet == ForwardSubdetector::HGCHEF)
881  layer += heOffset_;
882 }
883 
884 void HGCalTriggerGeometryV9Imp1::unpackCellId(unsigned cell, unsigned& cellU, unsigned& cellV) const {
887 }
888 
889 void HGCalTriggerGeometryV9Imp1::unpackWaferId(unsigned wafer, int& waferU, int& waferV) const {
893  : waferUAbs);
895  : waferVAbs);
896 }
897 
898 void HGCalTriggerGeometryV9Imp1::unpackIetaIphi(unsigned ieta_iphi, unsigned& ieta, unsigned& iphi) const {
901 }
902 
903 bool HGCalTriggerGeometryV9Imp1::validCell(unsigned cell_id) const {
904  bool is_valid = false;
905  unsigned det = DetId(cell_id).det();
906  switch (det) {
907  case DetId::HGCalEE:
908  is_valid = eeTopology().valid(cell_id);
909  break;
910  case DetId::HGCalHSi:
911  is_valid = hsiTopology().valid(cell_id);
912  break;
913  case DetId::HGCalHSc:
914  is_valid = hscTopology().valid(cell_id);
915  break;
916  case DetId::Forward:
917  is_valid = noseTopology().valid(cell_id);
918  break;
919  default:
920  is_valid = false;
921  break;
922  }
923  return is_valid;
924 }
925 
926 bool HGCalTriggerGeometryV9Imp1::validTriggerCell(const unsigned trigger_cell_id) const {
927  return invalid_triggercells_.find(trigger_cell_id) == invalid_triggercells_.end();
928 }
929 
930 bool HGCalTriggerGeometryV9Imp1::disconnectedModule(const unsigned module_id) const {
931  bool disconnected = false;
932  if (disconnected_modules_.find(HGCalDetId(module_id).wafer()) != disconnected_modules_.end())
933  disconnected = true;
934  if (disconnected_layers_.find(layerWithOffset(module_id)) != disconnected_layers_.end())
935  disconnected = true;
936  return disconnected;
937 }
938 
939 unsigned HGCalTriggerGeometryV9Imp1::triggerLayer(const unsigned id) const {
940  unsigned layer = layerWithOffset(id);
941  if (layer >= trigger_layers_.size())
942  return 0;
943  return trigger_layers_[layer];
944 }
945 
946 bool HGCalTriggerGeometryV9Imp1::validTriggerCellFromCells(const unsigned trigger_cell_id) const {
947  // Check the validity of a trigger cell with the
948  // validity of the cells. One valid cell in the
949  // trigger cell is enough to make the trigger cell
950  // valid.
951  HGCalDetId trigger_cell_det_id(trigger_cell_id);
952  unsigned subdet = trigger_cell_det_id.subdetId();
953  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
954  bool is_valid = false;
955  for (const auto cell_id : cells) {
956  is_valid |= validCellId(subdet, cell_id);
957  if (is_valid)
958  break;
959  }
960  return is_valid;
961 }
962 
963 bool HGCalTriggerGeometryV9Imp1::validCellId(unsigned subdet, unsigned cell_id) const {
964  bool is_valid = false;
965  switch (subdet) {
967  is_valid = eeTopology().valid(cell_id);
968  break;
970  is_valid = hsiTopology().valid(cell_id);
971  break;
973  is_valid = hscTopology().valid(cell_id);
974  break;
975  default:
976  is_valid = false;
977  break;
978  }
979  return is_valid;
980 }
981 
982 unsigned HGCalTriggerGeometryV9Imp1::packTriggerCell(unsigned module, unsigned trigger_cell) const {
983  unsigned packed_value = 0;
984  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
986  return packed_value;
987 }
988 
990  unsigned module,
991  unsigned trigger_cell) const {
992  unsigned packed_value = 0;
993  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
996  return packed_value;
997 }
998 
999 int HGCalTriggerGeometryV9Imp1::detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const {
1000  int wafer_type = 0;
1001  switch (det) {
1002  case DetId::HGCalEE:
1003  wafer_type = eeTopology().dddConstants().getTypeHex(layer, waferU, waferV);
1004  break;
1005  case DetId::HGCalHSi:
1006  wafer_type = hsiTopology().dddConstants().getTypeHex(layer, waferU, waferV);
1007  break;
1008  default:
1009  break;
1010  };
1011  return wafer_type;
1012 }
1013 
1014 unsigned HGCalTriggerGeometryV9Imp1::layerWithOffset(unsigned id) const {
1015  HGCalDetId detid(id);
1016  unsigned layer = 0;
1017  switch (detid.subdetId()) {
1019  layer = detid.layer();
1020  break;
1022  layer = heOffset_ + detid.layer();
1023  break;
1025  layer = heOffset_ + detid.layer();
1026  break;
1027  };
1028  return layer;
1029 }
1030 
HGCalDetId::kHGCalWaferTypeMask
static const int kHGCalWaferTypeMask
Definition: HGCalDetId.h:15
HGCalTriggerGeometryV9Imp1::getModulePosition
GlobalPoint getModulePosition(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:550
HGCSiliconDetId::kHGCalWaferUMask
static const int kHGCalWaferUMask
Definition: HGCSiliconDetId.h:113
HGCalTriggerGeometryBase::eeTopology
const HGCalTopology & eeTopology() const
Definition: HGCalTriggerGeometryBase.h:65
HGCalTriggerGeometryV9Imp1::getLinksInModule
unsigned getLinksInModule(const unsigned module_id) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:493
HGCalTriggerGeometryBase
Definition: HGCalTriggerGeometryBase.h:19
HGCalTriggerGeometryV9Imp1::validTriggerCell
bool validTriggerCell(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:926
mps_fire.i
i
Definition: mps_fire.py:355
HGCalTriggerGeometryV9Imp1::disconnected_modules_
std::unordered_set< unsigned > disconnected_modules_
Definition: HGCalTriggerGeometryV9Imp1.cc:85
HGCScintillatorDetId::iphi
int iphi() const
get the phi index
Definition: HGCScintillatorDetId.cc:57
HGCalTopology::dddConstants
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
HGCalTriggerGeometryV9Imp1::fillNeighborMap
void fillNeighborMap(const edm::FileInPath &, neighbor_map &, bool)
Definition: HGCalTriggerGeometryV9Imp1.cc:681
HGCalTriggerGeometryBase::hsiGeometry
const HGCalGeometry * hsiGeometry() const
Definition: HGCalTriggerGeometryBase.h:57
HGCalDetId::kHGCalWaferOffset
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
HGCalTriggerGeometryV9Imp1::wafers_old_to_wafers_
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
Definition: HGCalTriggerGeometryV9Imp1.cc:73
HGCalTriggerGeometryV9Imp1::totalLayers_
unsigned totalLayers_
Definition: HGCalTriggerGeometryV9Imp1.cc:92
HGCalTriggerGeometryV9Imp1::l1tCellsMapping_
edm::FileInPath l1tCellsMapping_
Definition: HGCalTriggerGeometryV9Imp1.cc:49
HGCalTriggerGeometryV9Imp1::last_trigger_layer_
unsigned last_trigger_layer_
Definition: HGCalTriggerGeometryV9Imp1.cc:88
HGCalDDDConstants::firstLayer
int firstLayer() const
Definition: HGCalDDDConstants.h:51
HGCSiliconDetId::kHGCalCellVMask
static const int kHGCalCellVMask
Definition: HGCSiliconDetId.h:111
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
edm
HLT enums.
Definition: AlignableModifier.h:19
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
HGCSiliconDetId::kHGCalWaferUOffset
static const int kHGCalWaferUOffset
Definition: HGCSiliconDetId.h:112
HGCalTriggerGeometryV9Imp1::getTriggerCellFromCell
unsigned getTriggerCellFromCell(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:190
HGCalDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCalDetId.h:49
HGCSiliconDetId::kHGCalWaferUSignMask
static const int kHGCalWaferUSignMask
Definition: HGCSiliconDetId.h:115
HGCalTriggerGeometryV9Imp1::l1tLinksMapping_
edm::FileInPath l1tLinksMapping_
Definition: HGCalTriggerGeometryV9Imp1.cc:53
HGCalTriggerGeometryV9Imp1::packWaferId
unsigned packWaferId(int waferU, int waferV) const
Definition: HGCalTriggerGeometryV9Imp1.cc:851
HGCalTriggerGeometryV9Imp1::triggerLayer
unsigned triggerLayer(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:939
HGCalTriggerGeometryV9Imp1::hSc_wafers_per_module_
unsigned hSc_wafers_per_module_
Definition: HGCalTriggerGeometryV9Imp1.cc:58
HGCalTriggerGeometryV9Imp1::wafer_to_module_
std::unordered_map< unsigned, unsigned > wafer_to_module_
Definition: HGCalTriggerGeometryV9Imp1.cc:61
HGCalTriggerGeometryV9Imp1::packLayerWaferId
unsigned packLayerWaferId(unsigned layer, unsigned wafer) const
Definition: HGCalTriggerGeometryV9Imp1.cc:823
HGCSiliconDetId::kHGCalCellUMask
static const int kHGCalCellUMask
Definition: HGCSiliconDetId.h:109
HGCalTriggerGeometryV9Imp1
Definition: HGCalTriggerGeometryV9Imp1.cc:13
HGCSiliconDetId::kHGCalTypeMask
static const int kHGCalTypeMask
Definition: HGCSiliconDetId.h:125
HGCalTriggerGeometryV9Imp1::invalid_triggercells_
std::unordered_set< unsigned > invalid_triggercells_
Definition: HGCalTriggerGeometryV9Imp1.cc:74
HGCalTriggerGeometryV9Imp1::packIetaIphi
unsigned packIetaIphi(unsigned ieta, unsigned iphi) const
Definition: HGCalTriggerGeometryV9Imp1.cc:864
HGCalDDDConstants::getTypeHex
int getTypeHex(int layer, int waferU, int waferV) const
Definition: HGCalDDDConstants.cc:436
HGCalTriggerGeometryV9Imp1::trigger_layers_
std::vector< unsigned > trigger_layers_
Definition: HGCalTriggerGeometryV9Imp1.cc:87
HGCalTriggerGeometryBase::setEEGeometry
void setEEGeometry(const HGCalGeometry *geom)
Definition: HGCalTriggerGeometryBase.h:107
HGCalTriggerGeometryV9Imp1::fillInvalidTriggerCells
void fillInvalidTriggerCells()
Definition: HGCalTriggerGeometryV9Imp1.cc:751
watchdog.const
const
Definition: watchdog.py:83
HGCalTriggerGeometryV9Imp1::validCellId
bool validCellId(unsigned det, unsigned cell_id) const
Definition: HGCalTriggerGeometryV9Imp1.cc:963
HGCalDetId::layer
int layer() const
get the layer #
Definition: HGCalDetId.h:46
HGCalTriggerGeometryV9Imp1::l1tWafersMapping_
edm::FileInPath l1tWafersMapping_
Definition: HGCalTriggerGeometryV9Imp1.cc:51
DetId::kSubdetMask
static const int kSubdetMask
Definition: DetId.h:20
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
HGCalTriggerGeometryV9Imp1::initialize
void initialize(const CaloGeometry *) final
Definition: HGCalTriggerGeometryV9Imp1.cc:150
end
#define end
Definition: vmac.h:39
HGCalTriggerGeometryV9Imp1::l1tCellNeighborsSciMapping_
edm::FileInPath l1tCellNeighborsSciMapping_
Definition: HGCalTriggerGeometryV9Imp1.cc:55
ForwardSubdetector.h
FileInPath.h
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
HGCalTriggerGeometryV9Imp1::links_per_module_
std::unordered_map< unsigned, unsigned > links_per_module_
Definition: HGCalTriggerGeometryV9Imp1.cc:63
DetId::kSubdetOffset
static const int kSubdetOffset
Definition: DetId.h:22
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
HGCScintillatorDetId::layer
int layer() const
get the layer #
Definition: HGCScintillatorDetId.h:47
HGCalDetId::kHGCalWaferMask
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
DetId
Definition: DetId.h:17
edm::FileInPath
Definition: FileInPath.h:64
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
HGCSiliconDetId::kHGCalWaferVMask
static const int kHGCalWaferVMask
Definition: HGCSiliconDetId.h:117
CaloGeometry
Definition: CaloGeometry.h:21
HGCalTriggerGeometryV9Imp1::getTriggerCellsFromModule
geom_set getTriggerCellsFromModule(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:352
HGCalTriggerGeometryBase.h
HGCalTriggerGeometryV9Imp1::packTriggerCell
unsigned packTriggerCell(unsigned, unsigned) const
Definition: HGCalTriggerGeometryV9Imp1.cc:982
HGCalTriggerGeometryV9Imp1::heOffset_
unsigned heOffset_
Definition: HGCalTriggerGeometryV9Imp1.cc:91
HGCScintillatorDetId::ietaAbs
int ietaAbs() const
Definition: HGCScintillatorDetId.h:52
HGCalTriggerGeometryV9Imp1::getNeighborsFromTriggerCell
geom_set getNeighborsFromTriggerCell(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:452
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
HGCalTriggerGeometryV9Imp1::detIdWaferType
int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const
Definition: HGCalTriggerGeometryV9Imp1.cc:999
HGCalGeometry
Definition: HGCalGeometry.h:30
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
HGCScintillatorDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCScintillatorDetId.h:44
HGCSiliconDetId::kHGCalWaferVSignOffset
static const int kHGCalWaferVSignOffset
Definition: HGCSiliconDetId.h:118
HGCalTriggerGeometryV9Imp1::fillMaps
void fillMaps()
Definition: HGCalTriggerGeometryV9Imp1.cc:573
HGCalTriggerGeometryBase::setHSiGeometry
void setHSiGeometry(const HGCalGeometry *geom)
Definition: HGCalTriggerGeometryBase.h:108
HGCalTriggerGeometryV9Imp1::unpackWaferCellId
void unpackWaferCellId(unsigned wafer_cell, unsigned &wafer, unsigned &cell) const
Definition: HGCalTriggerGeometryV9Imp1.cc:871
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
HGCalTriggerGeometryV9Imp1::packCellId
unsigned packCellId(unsigned type, unsigned cellU, unsigned cellV) const
Definition: HGCalTriggerGeometryV9Imp1.cc:843
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalTriggerGeometryV9Imp1::neighbor_map
std::unordered_map< int, std::set< std::pair< short, short > > > neighbor_map
Definition: HGCalTriggerGeometryV9Imp1.cc:80
HGCSiliconDetId::kHGCalWaferVSignMask
static const int kHGCalWaferVSignMask
Definition: HGCSiliconDetId.h:119
HGCEE
Definition: ForwardSubdetector.h:8
HGCalTriggerGeometryV9Imp1::l1tCellNeighborsMapping_
edm::FileInPath l1tCellNeighborsMapping_
Definition: HGCalTriggerGeometryV9Imp1.cc:54
HGCalDetId::waferType
int waferType() const
get the wafer type
Definition: HGCalDetId.h:43
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
HGCalTriggerGeometryV9Imp1::cells_to_trigger_cells_
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
Definition: HGCalTriggerGeometryV9Imp1.cc:66
HGCalDetId::kHGCalLayerOffset
static const int kHGCalLayerOffset
Definition: HGCalDetId.h:16
edm::ParameterSet
Definition: ParameterSet.h:36
HGCalTriggerGeometryV9Imp1::getCellsFromModule
geom_set getCellsFromModule(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:331
HGCalTriggerGeometryV9Imp1::unpackCellId
void unpackCellId(unsigned cell, unsigned &cellU, unsigned &cellV) const
Definition: HGCalTriggerGeometryV9Imp1.cc:884
HGCalTriggerGeometryV9Imp1::wafers_to_wafers_old_
std::unordered_map< unsigned, unsigned > wafers_to_wafers_old_
Definition: HGCalTriggerGeometryV9Imp1.cc:72
HGCalTriggerGeometryV9Imp1::unpackIetaIphi
void unpackIetaIphi(unsigned ieta_iphi, unsigned &ieta, unsigned &iphi) const
Definition: HGCalTriggerGeometryV9Imp1.cc:898
HGCalTriggerGeometryV9Imp1::l1tCellsSciMapping_
edm::FileInPath l1tCellsSciMapping_
Definition: HGCalTriggerGeometryV9Imp1.cc:50
HGCScintillatorDetId::kHGCalRadiusOffset
static const int kHGCalRadiusOffset
Definition: HGCScintillatorDetId.h:75
edmplugin::PluginFactory
Definition: PluginFactory.h:34
HcalDetId.h
HGCalTriggerGeometryBase::geom_ordered_set
std::set< unsigned > geom_ordered_set
Definition: HGCalTriggerGeometryBase.h:23
HGCalDDDConstants::layers
unsigned int layers(bool reco) const
Definition: HGCalDDDConstants.cc:558
HGCScintillatorDetId::kHGCalPhiOffset
static const int kHGCalPhiOffset
Definition: HGCScintillatorDetId.h:73
HGCScintillatorDetId::kHGCalRadiusMask
static const int kHGCalRadiusMask
Definition: HGCScintillatorDetId.h:76
HGCalTriggerGeometryV9Imp1::getTriggerCellPosition
GlobalPoint getTriggerCellPosition(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:527
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
HGCScintillatorDetId::type
int type() const
get the type
Definition: HGCScintillatorDetId.h:41
HGCalDDDConstants::getTypeTrap
int getTypeTrap(int layer) const
Definition: HGCalDDDConstants.cc:427
HGCalTriggerGeometryV9Imp1::disconnectedModule
bool disconnectedModule(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:930
HGCalTriggerGeometryV9Imp1::getModuleFromTriggerCell
unsigned getModuleFromTriggerCell(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:252
HGCalTriggerGeometryV9Imp1::packTriggerCellWithType
unsigned packTriggerCellWithType(unsigned, unsigned, unsigned) const
Definition: HGCalTriggerGeometryV9Imp1.cc:989
HGCalTriggerGeometryBase::geom_set
std::unordered_set< unsigned > geom_set
Definition: HGCalTriggerGeometryBase.h:22
DetId::Detector
Detector
Definition: DetId.h:24
HGCalGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Definition: HGCalGeometry.cc:192
HGCalTriggerGeometryV9Imp1::getOrderedTriggerCellsFromModule
geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:402
HGCSiliconDetId::kHGCalWaferVOffset
static const int kHGCalWaferVOffset
Definition: HGCSiliconDetId.h:116
HGCSiliconDetId::kHGCalTypeOffset
static const int kHGCalTypeOffset
Definition: HGCSiliconDetId.h:124
HGCSiliconDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCSiliconDetId.h:54
HGCScintillatorDetId::kHGCalPhiMask
static const int kHGCalPhiMask
Definition: HGCScintillatorDetId.h:74
module
Definition: vlib.h:198
HGCalTriggerGeometryBase::setHScGeometry
void setHScGeometry(const HGCalGeometry *geom)
Definition: HGCalTriggerGeometryBase.h:109
HGCalTriggerGeometryV9Imp1::module_to_wafers_
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
Definition: HGCalTriggerGeometryV9Imp1.cc:62
HGCalDetId::kHGCalWaferTypeOffset
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:14
PV3DBase::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
HGCalTriggerGeometryV9Imp1::HGCalTriggerGeometryV9Imp1
HGCalTriggerGeometryV9Imp1(const edm::ParameterSet &conf)
Definition: HGCalTriggerGeometryV9Imp1.cc:118
HGCalTriggerGeometryV9Imp1::getModuleFromCell
unsigned getModuleFromCell(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:248
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HGCalTriggerGeometryV9Imp1::trigger_cells_to_cells_sci_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_sci_
Definition: HGCalTriggerGeometryV9Imp1.cc:69
HGCalDetId::wafer
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
HGCalDetId
Definition: HGCalDetId.h:8
HGCalTriggerGeometryBase::eeGeometry
const HGCalGeometry * eeGeometry() const
Definition: HGCalTriggerGeometryBase.h:41
HGCSiliconDetId::cellV
int cellV() const
Definition: HGCSiliconDetId.h:61
HGCalDetId::kHGCalCellMask
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
HGCalTriggerGeometryV9Imp1::lastTriggerLayer
unsigned lastTriggerLayer() const final
Definition: HGCalTriggerGeometryV9Imp1.cc:45
type
type
Definition: HCALResponse.h:21
HGCalTriggerGeometryV9Imp1::l1tModulesMapping_
edm::FileInPath l1tModulesMapping_
Definition: HGCalTriggerGeometryV9Imp1.cc:52
HGCalDetId.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
HGCalTriggerGeometryV9Imp1::trigger_cell_neighbors_
neighbor_map trigger_cell_neighbors_
Definition: HGCalTriggerGeometryV9Imp1.cc:81
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HGCSiliconDetId::cellU
int cellU() const
get the cell #'s in u,v or in x,y
Definition: HGCSiliconDetId.h:60
HGCalTriggerGeometryV9Imp1::validCell
bool validCell(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:903
HGCalDetId::kHGCalLayerMask
static const int kHGCalLayerMask
Definition: HGCalDetId.h:17
HGCalTriggerGeometryBase::hsiTopology
const HGCalTopology & hsiTopology() const
Definition: HGCalTriggerGeometryBase.h:68
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:21
DetId::HGCalHSc
Definition: DetId.h:34
Exception
Definition: hltDiff.cc:246
postprocess-scan-build.cells
cells
Definition: postprocess-scan-build.py:13
HGCalTriggerGeometryV9Imp1::getCellsFromTriggerCell
geom_set getCellsFromTriggerCell(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:282
electronStore.links
links
Definition: electronStore.py:149
HGCalTriggerGeometryV9Imp1::unpackLayerWaferId
void unpackLayerWaferId(unsigned layer_wafer, unsigned &layer, unsigned &wafer) const
Definition: HGCalTriggerGeometryV9Imp1.cc:876
HGCalTriggerGeometryV9Imp1::disconnected_layers_
std::unordered_set< unsigned > disconnected_layers_
Definition: HGCalTriggerGeometryV9Imp1.cc:86
HGCalDetId::kHGCalCellOffset
static const int kHGCalCellOffset
Definition: HGCalDetId.h:10
HGCSiliconDetId::type
int type() const
get the type
Definition: HGCSiliconDetId.h:51
HGCSiliconDetId::waferU
int waferU() const
Definition: HGCSiliconDetId.h:76
HGCalTriggerGeometryV9Imp1::validTriggerCellFromCells
bool validTriggerCellFromCells(const unsigned) const
Definition: HGCalTriggerGeometryV9Imp1.cc:946
HGCalTriggerGeometryV9Imp1::trigger_cell_neighbors_sci_
neighbor_map trigger_cell_neighbors_sci_
Definition: HGCalTriggerGeometryV9Imp1.cc:82
HGCalTriggerGeometryV9Imp1::getModuleSize
unsigned getModuleSize(const unsigned module_id) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:511
HGCalTriggerGeometryV9Imp1::reset
void reset() final
Definition: HGCalTriggerGeometryV9Imp1.cc:135
HGCalTopology::valid
bool valid(const DetId &id) const override
Is this a valid cell id.
Definition: HGCalTopology.cc:464
HGCalTriggerGeometryBase::hscGeometry
const HGCalGeometry * hscGeometry() const
Definition: HGCalTriggerGeometryBase.h:58
HGCSiliconDetId::kHGCalWaferUSignOffset
static const int kHGCalWaferUSignOffset
Definition: HGCSiliconDetId.h:114
HGCHEF
Definition: ForwardSubdetector.h:9
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HGCalTriggerGeometryV9Imp1::trigger_cells_to_cells_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
Definition: HGCalTriggerGeometryV9Imp1.cc:67
HGCSiliconDetId::kHGCalCellVOffset
static const int kHGCalCellVOffset
Definition: HGCSiliconDetId.h:110
HGCalTriggerGeometryV9Imp1::layerWithOffset
unsigned layerWithOffset(unsigned) const
Definition: HGCalTriggerGeometryV9Imp1.cc:1014
HGCalTriggerGeometryV9Imp1::packWaferCellId
unsigned packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const
Definition: HGCalTriggerGeometryV9Imp1.cc:814
DetId::Forward
Definition: DetId.h:30
HGCalTriggerGeometryV9Imp1::getOrderedCellsFromModule
geom_ordered_set getOrderedCellsFromModule(const unsigned) const final
Definition: HGCalTriggerGeometryV9Imp1.cc:341
HGCalTriggerGeometryV9Imp1::unpackWaferId
void unpackWaferId(unsigned wafer, int &waferU, int &waferV) const
Definition: HGCalTriggerGeometryV9Imp1.cc:889
mps_splice.line
line
Definition: mps_splice.py:76
HGCalTriggerGeometryV9Imp1::hSc_links_per_module_
unsigned hSc_links_per_module_
Definition: HGCalTriggerGeometryV9Imp1.cc:57
HGCalTriggerGeometryV9Imp1::cells_to_trigger_cells_sci_
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_sci_
Definition: HGCalTriggerGeometryV9Imp1.cc:68
HGCalTriggerGeometryV9Imp1::number_trigger_cells_in_wafers_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
Definition: HGCalTriggerGeometryV9Imp1.cc:70
HGCalTriggerGeometryV9Imp1::number_trigger_cells_in_wafers_sci_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_sci_
Definition: HGCalTriggerGeometryV9Imp1.cc:71
begin
#define begin
Definition: vmac.h:32
HGCalDetId::cell
int cell() const
get the absolute value of the cell #'s in x and y
Definition: HGCalDetId.h:37
Basic3DVector< float >
HGCalTriggerGeometryBase::noseTopology
const HGCalTopology & noseTopology() const
Definition: HGCalTriggerGeometryBase.h:64
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
HGCSiliconDetId::waferV
int waferV() const
Definition: HGCSiliconDetId.h:77
HGCHEB
Definition: ForwardSubdetector.h:10
HGCSiliconDetId::kHGCalCellUOffset
static const int kHGCalCellUOffset
Definition: HGCSiliconDetId.h:108
HGCSiliconDetId::layer
int layer() const
get the layer #
Definition: HGCSiliconDetId.h:57
HGCalTriggerGeometryBase::hscTopology
const HGCalTopology & hscTopology() const
Definition: HGCalTriggerGeometryBase.h:69