38 edm::LogWarning(
"HGCalTriggerGeometry") <<
"WARNING: This HGCal trigger geometry is incomplete.\n"\
39 <<
"WARNING: Only the EE part is covered.\n"\
40 <<
"WARNING: There is no neighbor information.\n";
45 if(!l1tCellsMappingStream.is_open())
edm::LogError(
"HGCalTriggerGeometry") <<
"Cannot open L1TCellsMapping file\n";
50 short triggercell = 0;
51 for(; l1tCellsMappingStream>>layer>>subsector>>cell>>module>>triggercell; )
53 if(layer>30 || layer<=0)
55 edm::LogWarning(
"HGCalTriggerGeometry") <<
"Bad layer index in L1TCellsMapping\n";
60 for(
unsigned z=0;
z<=1;
z++)
62 int zside = (
z==0 ? -1 : 1);
63 for(
unsigned sector=1; sector<=18; sector++)
70 if(!ret.second)
edm::LogWarning(
"HGCalTriggerGeometry") <<
"Duplicate cell in L1TCellsMapping\n";
77 if(!l1tCellsMappingStream.eof())
edm::LogWarning(
"HGCalTriggerGeometry") <<
"Error reading L1TCellsMapping'"<<layer<<
" "<<cell<<
" "<<triggercell<<
" "<<subsector<<
"' \n";
78 l1tCellsMappingStream.close();
83 std::map<unsigned, list_cells> trigger_cells_to_cells;
86 unsigned cell = cell_triggercell.first;
87 unsigned triggercell = cell_triggercell.second;
88 trigger_cells_to_cells.insert( std::make_pair(triggercell, list_cells()) );
89 trigger_cells_to_cells.at(triggercell).insert(cell);
91 for(
const auto& triggercell_cells : trigger_cells_to_cells)
93 unsigned triggercellId = triggercell_cells.first;
94 list_cells cellIds = triggercell_cells.second;
97 for(
const auto& cell : cellIds)
102 GlobalPoint triggercellPoint( triggercellVector/cellIds.size() );
107 std::unique_ptr<const HGCalTriggerGeometry::TriggerCell> triggercellPtr(
new HGCalTriggerGeometry::TriggerCell(triggercellId, moduleId, triggercellPoint, list_cells(), cellIds));
115 std::map<unsigned, list_triggercells> modules_to_trigger_cells;
118 unsigned triggercell = triggercell_module.first;
119 unsigned module = triggercell_module.second;
120 modules_to_trigger_cells.insert( std::make_pair(module, list_triggercells()) );
121 modules_to_trigger_cells.at(module).insert(triggercell);
123 for(
const auto& module_triggercell : modules_to_trigger_cells)
125 unsigned moduleId = module_triggercell.first;
126 list_triggercells triggercellIds = module_triggercell.second;
127 tc_map_to_cells cellsInTriggerCells;
130 for(
const auto& triggercell : triggercellIds)
132 const auto& cells_in_tc = trigger_cells_to_cells[triggercell];
133 for(
const unsigned cell : cells_in_tc ) {
134 cellsInTriggerCells.emplace(triggercell,cell);
136 moduleVector +=
trigger_cells_.at(triggercell)->position().basicVector();
138 GlobalPoint modulePoint( moduleVector/triggercellIds.size() );
140 std::unique_ptr<const HGCalTriggerGeometry::Module> modulePtr(
new HGCalTriggerGeometry::Module(moduleId, modulePoint, list_triggercells(), triggercellIds, cellsInTriggerCells));
std::unordered_set< unsigned > list_type
const HGCalGeometry * eeGeometry() const
GlobalPoint getPosition(const DetId &id) const
geom_map cells_to_trigger_cells_
std::unordered_multimap< unsigned, unsigned > tc_map_type
void setCaloGeometry(const edm::ESHandle< CaloGeometry > &geom)
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