CMS 3D CMS Logo

HGCalTriggerGeometryGenericMapping.cc
Go to the documentation of this file.
2 
3 
4 using namespace HGCalTriggerGeometry;
5 
6 namespace {
7  std::unique_ptr<const TriggerCell> null_tc;
8  std::unique_ptr<const Module> null_mod;
9 }
10 
14 }
15 
19  module_map().swap(modules_);
21 }
22 
23 unsigned
25 getTriggerCellFromCell( const unsigned cell_det_id ) const {
26  auto found_tc = cells_to_trigger_cells_.find(cell_det_id);
27  if( found_tc == cells_to_trigger_cells_.end() ) {
28  return 0;
29  }
30  return trigger_cells_.find(found_tc->second)->second->triggerCellId();
31 }
32 
33 unsigned
35 getModuleFromCell( const unsigned cell_det_id ) const {
36  auto found_tc = cells_to_trigger_cells_.find(cell_det_id);
37  if( found_tc == cells_to_trigger_cells_.end() ) {
38  return 0;
39  }
40  auto found_mod = trigger_cells_to_modules_.find(found_tc->second);
41  if( found_mod == trigger_cells_to_modules_.end() ) {
42  return 0;
43  }
44  return modules_.find(found_mod->second)->second->moduleId();
45 }
46 
47 unsigned
49 getModuleFromTriggerCell( const unsigned trigger_cell_det_id ) const {
50  auto found_mod = trigger_cells_to_modules_.find(trigger_cell_det_id);
51  if( found_mod == trigger_cells_to_modules_.end() ) {
52  return 0;
53  }
54  return modules_.find(found_mod->second)->second->moduleId();
55 }
56 
59 getCellsFromTriggerCell( const unsigned trigger_cell_det_id ) const {
60  return trigger_cells_.find(trigger_cell_det_id)->second->components();
61 }
62 
65 getCellsFromModule( const unsigned module_det_id ) const {
66  const auto& triggercell_cells = modules_.find(module_det_id)->second->triggerCellComponents();
68  for(const auto& tc_c : triggercell_cells) {
69  cells.emplace(tc_c.second);
70  }
71  return cells;
72 }
73 
76 getOrderedCellsFromModule( const unsigned module_det_id ) const {
77  const auto& triggercell_cells = modules_.find(module_det_id)->second->triggerCellComponents();
79  for(const auto& tc_c : triggercell_cells) {
80  cells.emplace(tc_c.second);
81  }
82  return cells;
83 }
84 
87 getTriggerCellsFromModule( const unsigned module_det_id ) const {
88  return modules_.find(module_det_id)->second->components();
89 }
90 
93 getOrderedTriggerCellsFromModule( const unsigned module_det_id ) const {
94  // Build set from unordered_set. Maybe a more efficient to do it
96  for(const auto& tc : modules_.find(module_det_id)->second->components()) {
97  trigger_cells.emplace(tc);
98  }
99  return trigger_cells;
100 }
101 
104 getNeighborsFromTriggerCell( const unsigned trigger_cell_id ) const
105 {
106  // empty neighbors
107  return geom_set();
108 }
109 
112 getTriggerCellPosition(const unsigned trigger_cell_det_id) const {
113  return trigger_cells_.find(trigger_cell_det_id)->second->position();
114 }
115 
118 getModulePosition(const unsigned module_det_id) const {
119  return modules_.find(module_det_id)->second->position();
120 }
121 
122 
123 bool
125 validTriggerCell(const unsigned trigger_cell_det_id) const {
126  return (trigger_cells_.find(trigger_cell_det_id)!=trigger_cells_.end());
127 }
128 
129 bool
131 disconnectedModule(const unsigned module_id) const {
132  return false;
133 }
134 
135 
136 unsigned
138 triggerLayer(const unsigned id) const {
139  return HGCalDetId(id).layer();
140 }
141 
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
std::unordered_map< unsigned, unsigned > geom_map
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
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, std::unique_ptr< const HGCalTriggerGeometry::Module > > module_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