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 }
9 
13 }
14 
18  module_map().swap(modules_);
20 }
21 
22 unsigned
24 getTriggerCellFromCell( const unsigned cell_det_id ) const {
25  auto found_tc = cells_to_trigger_cells_.find(cell_det_id);
26  if( found_tc == cells_to_trigger_cells_.end() ) {
27  return 0;
28  }
29  return trigger_cells_.find(found_tc->second)->second->triggerCellId();
30 }
31 
32 unsigned
34 getModuleFromCell( const unsigned cell_det_id ) const {
35  auto found_tc = cells_to_trigger_cells_.find(cell_det_id);
36  if( found_tc == cells_to_trigger_cells_.end() ) {
37  return 0;
38  }
39  auto found_mod = trigger_cells_to_modules_.find(found_tc->second);
40  if( found_mod == trigger_cells_to_modules_.end() ) {
41  return 0;
42  }
43  return modules_.find(found_mod->second)->second->moduleId();
44 }
45 
46 unsigned
48 getModuleFromTriggerCell( const unsigned trigger_cell_det_id ) const {
49  auto found_mod = trigger_cells_to_modules_.find(trigger_cell_det_id);
50  if( found_mod == trigger_cells_to_modules_.end() ) {
51  return 0;
52  }
53  return modules_.find(found_mod->second)->second->moduleId();
54 }
55 
58 getCellsFromTriggerCell( const unsigned trigger_cell_det_id ) const {
59  return trigger_cells_.find(trigger_cell_det_id)->second->components();
60 }
61 
64 getCellsFromModule( 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 
75 getOrderedCellsFromModule( const unsigned module_det_id ) const {
76  const auto& triggercell_cells = modules_.find(module_det_id)->second->triggerCellComponents();
78  for(const auto& tc_c : triggercell_cells) {
79  cells.emplace(tc_c.second);
80  }
81  return cells;
82 }
83 
86 getTriggerCellsFromModule( const unsigned module_det_id ) const {
87  return modules_.find(module_det_id)->second->components();
88 }
89 
92 getOrderedTriggerCellsFromModule( const unsigned module_det_id ) const {
93  // Build set from unordered_set. Maybe a more efficient to do it
95  for(const auto& tc : modules_.find(module_det_id)->second->components()) {
96  trigger_cells.emplace(tc);
97  }
98  return trigger_cells;
99 }
100 
103 getNeighborsFromTriggerCell( const unsigned trigger_cell_id ) const
104 {
105  // empty neighbors
106  return geom_set();
107 }
108 
111 getTriggerCellPosition(const unsigned trigger_cell_det_id) const {
112  return trigger_cells_.find(trigger_cell_det_id)->second->position();
113 }
114 
117 getModulePosition(const unsigned module_det_id) const {
118  return modules_.find(module_det_id)->second->position();
119 }
120 
121 
122 bool
124 validTriggerCell(const unsigned trigger_cell_det_id) const {
125  return (trigger_cells_.find(trigger_cell_det_id)!=trigger_cells_.end());
126 }
virtual geom_set getNeighborsFromTriggerCell(const unsigned trigger_cell_det_id) const override final
std::unordered_map< unsigned, unsigned > geom_map
virtual unsigned getModuleFromTriggerCell(const unsigned trigger_cell_det_id) const override final
virtual unsigned getTriggerCellFromCell(const unsigned cell_det_id) const override final
HGCalTriggerGeometryGenericMapping(const edm::ParameterSet &conf)
virtual geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned trigger_cell_det_id) const override final
virtual geom_set getCellsFromModule(const unsigned cell_det_id) const override final
virtual GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const override final
virtual geom_ordered_set getOrderedCellsFromModule(const unsigned cell_det_id) const override final
virtual geom_set getCellsFromTriggerCell(const unsigned cell_det_id) const override 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
std::set< unsigned > geom_ordered_set
std::unordered_set< unsigned > geom_set
virtual geom_set getTriggerCellsFromModule(const unsigned trigger_cell_det_id) const override final
virtual bool validTriggerCell(const unsigned trigger_cell_det_id) const override final
virtual unsigned getModuleFromCell(const unsigned cell_det_id) const override final
virtual GlobalPoint getModulePosition(const unsigned module_det_id) const override final