61 if (!l1tCellsMappingStream.is_open())
62 edm::LogError(
"HGCalTriggerGeometry") <<
"Cannot open L1TCellsMapping file\n";
67 short triggercell = 0;
68 for (; l1tCellsMappingStream >> layer >> subsector >> cell >> module >> triggercell;) {
69 if (layer > 30 || layer <= 0) {
70 edm::LogWarning(
"HGCalTriggerGeometry") <<
"Bad layer index in L1TCellsMapping\n";
75 for (
unsigned z = 0;
z <= 1;
z++) {
76 int zside = (
z == 0 ? -1 : 1);
77 for (
unsigned sector = 1; sector <= 18; sector++) {
84 edm::LogWarning(
"HGCalTriggerGeometry") <<
"Duplicate cell in L1TCellsMapping\n";
88 std::make_pair(triggerDetid, moduleDetid));
92 if (!l1tCellsMappingStream.eof())
94 <<
"Error reading L1TCellsMapping'" << layer <<
" " << cell <<
" " << triggercell <<
" " << subsector <<
"' \n";
95 l1tCellsMappingStream.close();
100 std::map<unsigned, list_cells> trigger_cells_to_cells;
102 unsigned cell = cell_triggercell.first;
103 unsigned triggercell = cell_triggercell.second;
104 trigger_cells_to_cells.insert(std::make_pair(triggercell, list_cells()));
105 trigger_cells_to_cells.at(triggercell).insert(cell);
107 for (
const auto& triggercell_cells : trigger_cells_to_cells) {
108 unsigned triggercellId = triggercell_cells.first;
109 list_cells cellIds = triggercell_cells.second;
112 for (
const auto& cell : cellIds) {
116 GlobalPoint triggercellPoint(triggercellVector / cellIds.size());
123 std::unique_ptr<const HGCalTriggerGeometry::TriggerCell> triggercellPtr(
132 std::map<unsigned, list_triggercells> modules_to_trigger_cells;
134 unsigned triggercell = triggercell_module.first;
135 unsigned module = triggercell_module.second;
136 modules_to_trigger_cells.insert(std::make_pair(module, list_triggercells()));
137 modules_to_trigger_cells.at(module).insert(triggercell);
139 for (
const auto& module_triggercell : modules_to_trigger_cells) {
140 unsigned moduleId = module_triggercell.first;
141 list_triggercells triggercellIds = module_triggercell.second;
142 tc_map_to_cells cellsInTriggerCells;
145 for (
const auto& triggercell : triggercellIds) {
146 const auto& cells_in_tc = trigger_cells_to_cells[triggercell];
147 for (
const unsigned cell : cells_in_tc) {
148 cellsInTriggerCells.emplace(triggercell, cell);
150 moduleVector +=
trigger_cells_.at(triggercell)->position().basicVector();
152 GlobalPoint modulePoint(moduleVector / triggercellIds.size());
155 moduleId, modulePoint, list_triggercells(), triggercellIds, cellsInTriggerCells));
std::unordered_set< unsigned > list_type
std::unordered_multimap< unsigned, unsigned > tc_map_type
const HGCalGeometry * eeGeometry() const
GlobalPoint getPosition(const DetId &id) const
geom_map cells_to_trigger_cells_
static const uint32_t UndefinedCell()
geom_map trigger_cells_to_modules_
edm::FileInPath l1tCellsMapping_
trigger_cell_map trigger_cells_
std::string fullPath() const
const BasicVectorType & basicVector() const
std::unordered_set< unsigned > list_type