CMS 3D CMS Logo

HGCalTriggerGeometryGenericMapping.h
Go to the documentation of this file.
1 #ifndef __L1Trigger_L1THGCal_HGCalTriggerGeometryGenericMapping_h__
2 #define __L1Trigger_L1THGCal_HGCalTriggerGeometryGenericMapping_h__
3 
5 
6 /*******
7  *
8  * class: HGCalTriggerGeometryGenericMapping
9  * author: L.Gray (FNAL)
10  * date: 26 July, 2015
11  *
12  * This class is the base class for all HGCal trigger geometry definitions.
13  * Typically this is just a ganging of cells and nearest-neighbour relationships.
14  *
15  * Classes for TriggerCells and Modules are defined. They are containers for
16  * maps relating modules to modules and trigger cells to trigger cells and
17  * raw HGC cells.
18  *
19  * It is up to the user of the class to define what these mappings are through the
20  * initialize() function. This function takes the full HGC geometry as input and
21  * creates all the necessary maps for navigating the trigger system. All of the
22  * containers for parts of the map are available through protected members of the base
23  * class.
24  *
25  * All unsigned ints used here are DetIds, or will become them once we sort out the
26  * full nature of the trigger detids.
27  *******/
28 
30 
32  class TriggerCell {
33  public:
34  typedef std::unordered_set<unsigned> list_type;
35 
37  unsigned tc_id, unsigned mod_id, const GlobalPoint& pos, const list_type& neighbs, const list_type& comps)
38  : trigger_cell_id_(tc_id), module_id_(mod_id), position_(pos), neighbours_(neighbs), components_(comps) {}
39  ~TriggerCell() {}
40 
41  unsigned triggerCellId() const { return trigger_cell_id_; }
42  unsigned moduleId() const { return module_id_; }
43 
44  bool containsCell(const unsigned cell) const { return (components_.find(cell) != components_.end()); }
45 
46  const GlobalPoint& position() const { return position_; }
47 
48  const std::unordered_set<unsigned>& neighbours() const { return neighbours_; }
49  const std::unordered_set<unsigned>& components() const { return components_; }
50 
51  private:
52  unsigned trigger_cell_id_; // the ID of this trigger cell
53  unsigned module_id_; // module this TC belongs to
55  list_type neighbours_; // neighbouring trigger cells
56  list_type components_; // contained HGC cells
57  };
58 
59  class Module {
60  public:
61  typedef std::unordered_set<unsigned> list_type;
62  typedef std::unordered_multimap<unsigned, unsigned> tc_map_type;
63 
64  Module(unsigned mod_id,
65  const GlobalPoint& pos,
66  const list_type& neighbs,
67  const list_type& comps,
68  const tc_map_type& tc_comps)
69  : module_id_(mod_id), position_(pos), neighbours_(neighbs), components_(comps), tc_components_(tc_comps) {}
70  ~Module() {}
71 
72  unsigned moduleId() const { return module_id_; }
73 
74  bool containsTriggerCell(const unsigned trig_cell) const {
75  return (components_.find(trig_cell) != components_.end());
76  }
77 
78  bool containsCell(const unsigned cell) const {
79  for (const auto& value : tc_components_) {
80  if (value.second == cell)
81  return true;
82  }
83  return false;
84  }
85 
86  const GlobalPoint& position() const { return position_; }
87 
88  const list_type& neighbours() const { return neighbours_; }
89  const list_type& components() const { return components_; }
90 
91  const tc_map_type& triggerCellComponents() const { return tc_components_; }
92 
93  private:
94  unsigned module_id_; // module this TC belongs to
96  list_type neighbours_; // neighbouring Modules
97  list_type components_; // contained HGC trigger cells
98  tc_map_type tc_components_; // cells contained by trigger cells
99  };
100 } // namespace HGCalTriggerGeometry
101 
103 public:
104  typedef std::unordered_map<unsigned, std::unique_ptr<const HGCalTriggerGeometry::Module> > module_map;
105  typedef std::unordered_map<unsigned, std::unique_ptr<const HGCalTriggerGeometry::TriggerCell> > trigger_cell_map;
106 
109 
110  // non-const access to the geometry class
111  void reset() final;
112 
113  unsigned getTriggerCellFromCell(const unsigned cell_det_id) const final;
114  unsigned getModuleFromCell(const unsigned cell_det_id) const final;
115  unsigned getModuleFromTriggerCell(const unsigned trigger_cell_det_id) const final;
116 
117  geom_set getCellsFromTriggerCell(const unsigned cell_det_id) const final;
118  geom_set getCellsFromModule(const unsigned cell_det_id) const final;
119  geom_set getTriggerCellsFromModule(const unsigned trigger_cell_det_id) const final;
120 
121  geom_ordered_set getOrderedCellsFromModule(const unsigned cell_det_id) const final;
122  geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned trigger_cell_det_id) const final;
123 
124  geom_set getNeighborsFromTriggerCell(const unsigned trigger_cell_det_id) const final;
125 
126  unsigned getLinksInModule(const unsigned module_id) const final;
127  unsigned getModuleSize(const unsigned module_id) const final;
128 
129  GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const final;
130  GlobalPoint getModulePosition(const unsigned module_det_id) const final;
131 
132  bool validCell(const unsigned cell_det_id) const final { return true; }
133  bool validTriggerCell(const unsigned trigger_cell_det_id) const final;
134  bool disconnectedModule(const unsigned module_id) const final;
135  unsigned lastTriggerLayer() const final;
136  unsigned triggerLayer(const unsigned id) const final;
137 
138 protected:
141 
144 };
145 
146 #endif
HGCalTriggerGeometry::TriggerCell::components
const std::unordered_set< unsigned > & components() const
Definition: HGCalTriggerGeometryGenericMapping.h:48
HGCalTriggerGeometryBase
Definition: HGCalTriggerGeometryBase.h:19
HGCalTriggerGeometry::TriggerCell::trigger_cell_id_
unsigned trigger_cell_id_
Definition: HGCalTriggerGeometryGenericMapping.h:51
HGCalTriggerGeometry::TriggerCell::moduleId
unsigned moduleId() const
Definition: HGCalTriggerGeometryGenericMapping.h:41
HGCalTriggerGeometry::TriggerCell
Definition: HGCalTriggerGeometryGenericMapping.h:31
HGCalTriggerGeometryGenericMapping::getNeighborsFromTriggerCell
geom_set getNeighborsFromTriggerCell(const unsigned trigger_cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:88
HGCalTriggerGeometryGenericMapping::trigger_cell_map
std::unordered_map< unsigned, std::unique_ptr< const HGCalTriggerGeometry::TriggerCell > > trigger_cell_map
Definition: HGCalTriggerGeometryGenericMapping.h:104
HGCalTriggerGeometryGenericMapping::validCell
bool validCell(const unsigned cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.h:131
HGCalTriggerGeometry::Module::moduleId
unsigned moduleId() const
Definition: HGCalTriggerGeometryGenericMapping.h:71
pos
Definition: PixelAliasList.h:18
HGCalTriggerGeometry::TriggerCell::position_
GlobalPoint position_
Definition: HGCalTriggerGeometryGenericMapping.h:53
HGCalTriggerGeometry::Module::position_
GlobalPoint position_
Definition: HGCalTriggerGeometryGenericMapping.h:94
HGCalTriggerGeometry::Module::containsCell
bool containsCell(const unsigned cell) const
Definition: HGCalTriggerGeometryGenericMapping.h:77
HGCalTriggerGeometry::Module::module_id_
unsigned module_id_
Definition: HGCalTriggerGeometryGenericMapping.h:93
HGCalTriggerGeometryGenericMapping::trigger_cells_to_modules_
geom_map trigger_cells_to_modules_
Definition: HGCalTriggerGeometryGenericMapping.h:139
watchdog.const
const
Definition: watchdog.py:83
HGCalTriggerGeometry::Module::tc_components_
tc_map_type tc_components_
Definition: HGCalTriggerGeometryGenericMapping.h:97
HGCalTriggerGeometry::Module
Definition: HGCalTriggerGeometryGenericMapping.h:58
HGCalTriggerGeometry::TriggerCell::containsCell
bool containsCell(const unsigned cell) const
Definition: HGCalTriggerGeometryGenericMapping.h:43
HGCalTriggerGeometryGenericMapping::validTriggerCell
bool validTriggerCell(const unsigned trigger_cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:106
HGCalTriggerGeometry::Module::tc_map_type
std::unordered_multimap< unsigned, unsigned > tc_map_type
Definition: HGCalTriggerGeometryGenericMapping.h:61
HGCalTriggerGeometryGenericMapping::reset
void reset() final
Definition: HGCalTriggerGeometryGenericMapping.cc:13
HGCalTriggerGeometryGenericMapping::lastTriggerLayer
unsigned lastTriggerLayer() const final
Definition: HGCalTriggerGeometryGenericMapping.cc:112
HGCalTriggerGeometry::Module::~Module
~Module()
Definition: HGCalTriggerGeometryGenericMapping.h:69
HGCalTriggerGeometryGenericMapping::getModuleFromCell
unsigned getModuleFromCell(const unsigned cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:28
HGCalTriggerGeometryBase.h
HGCalTriggerGeometry::TriggerCell::neighbours
const std::unordered_set< unsigned > & neighbours() const
Definition: HGCalTriggerGeometryGenericMapping.h:47
HGCalTriggerGeometry::TriggerCell::position
const GlobalPoint & position() const
Definition: HGCalTriggerGeometryGenericMapping.h:45
HGCalTriggerGeometry::Module::neighbours_
list_type neighbours_
Definition: HGCalTriggerGeometryGenericMapping.h:95
HGCalTriggerGeometryGenericMapping::getModuleFromTriggerCell
unsigned getModuleFromTriggerCell(const unsigned trigger_cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:40
Point3DBase< float, GlobalTag >
HGCalTriggerGeometryGenericMapping
Definition: HGCalTriggerGeometryGenericMapping.h:101
HGCalTriggerGeometryGenericMapping::getCellsFromModule
geom_set getCellsFromModule(const unsigned cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:53
HGCalTriggerGeometryGenericMapping::HGCalTriggerGeometryGenericMapping
HGCalTriggerGeometryGenericMapping(const edm::ParameterSet &conf)
Definition: HGCalTriggerGeometryGenericMapping.cc:10
HGCalTriggerGeometry::Module::triggerCellComponents
const tc_map_type & triggerCellComponents() const
Definition: HGCalTriggerGeometryGenericMapping.h:90
HGCalTriggerGeometry::Module::list_type
std::unordered_set< unsigned > list_type
Definition: HGCalTriggerGeometryGenericMapping.h:60
HGCalTriggerGeometryGenericMapping::disconnectedModule
bool disconnectedModule(const unsigned module_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:110
HGCalTriggerGeometry::Module::position
const GlobalPoint & position() const
Definition: HGCalTriggerGeometryGenericMapping.h:85
HGCalTriggerGeometry::TriggerCell::TriggerCell
TriggerCell(unsigned tc_id, unsigned mod_id, const GlobalPoint &pos, const list_type &neighbs, const list_type &comps)
Definition: HGCalTriggerGeometryGenericMapping.h:35
HGCalTriggerGeometryGenericMapping::getOrderedTriggerCellsFromModule
geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned trigger_cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:78
HGCalTriggerGeometryGenericMapping::getTriggerCellsFromModule
geom_set getTriggerCellsFromModule(const unsigned trigger_cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:73
edm::ParameterSet
Definition: ParameterSet.h:36
HGCalTriggerGeometryGenericMapping::getCellsFromTriggerCell
geom_set getCellsFromTriggerCell(const unsigned cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:48
HGCalTriggerGeometry::TriggerCell::module_id_
unsigned module_id_
Definition: HGCalTriggerGeometryGenericMapping.h:52
HGCalTriggerGeometryGenericMapping::getModuleSize
unsigned getModuleSize(const unsigned module_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:96
HGCalTriggerGeometryBase::geom_ordered_set
std::set< unsigned > geom_ordered_set
Definition: HGCalTriggerGeometryBase.h:23
HGCalTriggerGeometry::TriggerCell::~TriggerCell
~TriggerCell()
Definition: HGCalTriggerGeometryGenericMapping.h:38
HGCalTriggerGeometry::TriggerCell::triggerCellId
unsigned triggerCellId() const
Definition: HGCalTriggerGeometryGenericMapping.h:40
HGCalTriggerGeometryGenericMapping::getTriggerCellFromCell
unsigned getTriggerCellFromCell(const unsigned cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:20
HGCalTriggerGeometryGenericMapping::cells_to_trigger_cells_
geom_map cells_to_trigger_cells_
Definition: HGCalTriggerGeometryGenericMapping.h:138
HGCalTriggerGeometryGenericMapping::~HGCalTriggerGeometryGenericMapping
~HGCalTriggerGeometryGenericMapping() override
Definition: HGCalTriggerGeometryGenericMapping.h:107
value
Definition: value.py:1
HGCalTriggerGeometryGenericMapping::module_map
std::unordered_map< unsigned, std::unique_ptr< const HGCalTriggerGeometry::Module > > module_map
Definition: HGCalTriggerGeometryGenericMapping.h:103
HGCalTriggerGeometryBase::geom_set
std::unordered_set< unsigned > geom_set
Definition: HGCalTriggerGeometryBase.h:22
HGCalTriggerGeometryGenericMapping::trigger_cells_
trigger_cell_map trigger_cells_
Definition: HGCalTriggerGeometryGenericMapping.h:142
HGCalTriggerGeometry::Module::containsTriggerCell
bool containsTriggerCell(const unsigned trig_cell) const
Definition: HGCalTriggerGeometryGenericMapping.h:73
HGCalTriggerGeometry
Definition: HGCalTriggerGeometryGenericMapping.h:30
HGCalTriggerGeometry::Module::neighbours
const list_type & neighbours() const
Definition: HGCalTriggerGeometryGenericMapping.h:87
HGCalTriggerGeometry::TriggerCell::neighbours_
list_type neighbours_
Definition: HGCalTriggerGeometryGenericMapping.h:54
HGCalTriggerGeometryGenericMapping::getLinksInModule
unsigned getLinksInModule(const unsigned module_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:94
HGCalTriggerGeometry::Module::components_
list_type components_
Definition: HGCalTriggerGeometryGenericMapping.h:96
HGCalTriggerGeometryGenericMapping::getOrderedCellsFromModule
geom_ordered_set getOrderedCellsFromModule(const unsigned cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:63
HGCalTriggerGeometryGenericMapping::getTriggerCellPosition
GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:98
HGCalTriggerGeometry::Module::components
const list_type & components() const
Definition: HGCalTriggerGeometryGenericMapping.h:88
HGCalTriggerGeometryBase::geom_map
std::unordered_map< unsigned, unsigned > geom_map
Definition: HGCalTriggerGeometryBase.h:21
HGCalTriggerGeometry::TriggerCell::list_type
std::unordered_set< unsigned > list_type
Definition: HGCalTriggerGeometryGenericMapping.h:33
HGCalTriggerGeometryGenericMapping::getModulePosition
GlobalPoint getModulePosition(const unsigned module_det_id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:102
HGCalTriggerGeometryGenericMapping::triggerLayer
unsigned triggerLayer(const unsigned id) const final
Definition: HGCalTriggerGeometryGenericMapping.cc:116
HGCalTriggerGeometryGenericMapping::modules_
module_map modules_
Definition: HGCalTriggerGeometryGenericMapping.h:141
HGCalTriggerGeometry::Module::Module
Module(unsigned mod_id, const GlobalPoint &pos, const list_type &neighbs, const list_type &comps, const tc_map_type &tc_comps)
Definition: HGCalTriggerGeometryGenericMapping.h:63
HGCalTriggerGeometry::TriggerCell::components_
list_type components_
Definition: HGCalTriggerGeometryGenericMapping.h:55