CMS 3D CMS Logo

HGCalTriggerGeometryGenericMapping.cc
Go to the documentation of this file.
2 
3 using namespace HGCalTriggerGeometry;
4 
5 namespace {
6  std::unique_ptr<const TriggerCell> null_tc;
7  std::unique_ptr<const Module> null_mod;
8 } // namespace
9 
11  : HGCalTriggerGeometryBase(conf) {}
12 
16  module_map().swap(modules_);
18 }
19 
20 unsigned HGCalTriggerGeometryGenericMapping::getTriggerCellFromCell(const unsigned cell_det_id) const {
21  auto found_tc = cells_to_trigger_cells_.find(cell_det_id);
22  if (found_tc == cells_to_trigger_cells_.end()) {
23  return 0;
24  }
25  return trigger_cells_.find(found_tc->second)->second->triggerCellId();
26 }
27 
28 unsigned HGCalTriggerGeometryGenericMapping::getModuleFromCell(const unsigned cell_det_id) const {
29  auto found_tc = cells_to_trigger_cells_.find(cell_det_id);
30  if (found_tc == cells_to_trigger_cells_.end()) {
31  return 0;
32  }
33  auto found_mod = trigger_cells_to_modules_.find(found_tc->second);
34  if (found_mod == trigger_cells_to_modules_.end()) {
35  return 0;
36  }
37  return modules_.find(found_mod->second)->second->moduleId();
38 }
39 
40 unsigned HGCalTriggerGeometryGenericMapping::getModuleFromTriggerCell(const unsigned trigger_cell_det_id) const {
41  auto found_mod = trigger_cells_to_modules_.find(trigger_cell_det_id);
42  if (found_mod == trigger_cells_to_modules_.end()) {
43  return 0;
44  }
45  return modules_.find(found_mod->second)->second->moduleId();
46 }
47 
49  const unsigned trigger_cell_det_id) const {
50  return trigger_cells_.find(trigger_cell_det_id)->second->components();
51 }
52 
54  const unsigned module_det_id) const {
55  const auto& triggercell_cells = modules_.find(module_det_id)->second->triggerCellComponents();
57  for (const auto& tc_c : triggercell_cells) {
58  cells.emplace(tc_c.second);
59  }
60  return cells;
61 }
62 
64  const unsigned module_det_id) const {
65  const auto& triggercell_cells = modules_.find(module_det_id)->second->triggerCellComponents();
67  for (const auto& tc_c : triggercell_cells) {
68  cells.emplace(tc_c.second);
69  }
70  return cells;
71 }
72 
74  const unsigned module_det_id) const {
75  return modules_.find(module_det_id)->second->components();
76 }
77 
79  const unsigned module_det_id) const {
80  // Build set from unordered_set. Maybe a more efficient to do it
82  for (const auto& tc : modules_.find(module_det_id)->second->components()) {
83  trigger_cells.emplace(tc);
84  }
85  return trigger_cells;
86 }
87 
89  const unsigned trigger_cell_id) const {
90  // empty neighbors
91  return geom_set();
92 }
93 
95  return trigger_cells_.find(trigger_cell_det_id)->second->position();
96 }
97 
99  return modules_.find(module_det_id)->second->position();
100 }
101 
102 bool HGCalTriggerGeometryGenericMapping::validTriggerCell(const unsigned trigger_cell_det_id) const {
103  return (trigger_cells_.find(trigger_cell_det_id) != trigger_cells_.end());
104 }
105 
106 bool HGCalTriggerGeometryGenericMapping::disconnectedModule(const unsigned module_id) const { return false; }
107 
108 unsigned HGCalTriggerGeometryGenericMapping::triggerLayer(const unsigned id) const { return HGCalDetId(id).layer(); }
GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const final
unsigned getModuleFromTriggerCell(const unsigned trigger_cell_det_id) const final
unsigned getTriggerCellFromCell(const unsigned cell_det_id) const final
unsigned getModuleFromCell(const unsigned cell_det_id) const final
geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned trigger_cell_det_id) const final
geom_set getCellsFromTriggerCell(const unsigned cell_det_id) const final
HGCalTriggerGeometryGenericMapping(const edm::ParameterSet &conf)
unsigned triggerLayer(const unsigned id) const final
std::unordered_map< unsigned, std::unique_ptr< const HGCalTriggerGeometry::Module > > module_map
geom_ordered_set getOrderedCellsFromModule(const unsigned cell_det_id) const final
GlobalPoint getModulePosition(const unsigned module_det_id) const final
geom_set getCellsFromModule(const unsigned cell_det_id) const final
bool validTriggerCell(const unsigned trigger_cell_det_id) const final
std::unordered_map< unsigned, std::unique_ptr< const HGCalTriggerGeometry::TriggerCell > > trigger_cell_map
std::unordered_map< unsigned, unsigned > geom_map
geom_set getTriggerCellsFromModule(const unsigned trigger_cell_det_id) const final
std::set< unsigned > geom_ordered_set
std::unordered_set< unsigned > geom_set
bool disconnectedModule(const unsigned module_id) const final
geom_set getNeighborsFromTriggerCell(const unsigned trigger_cell_det_id) const final
int layer() const
get the layer #
Definition: HGCalDetId.h:48