37 edm::LogWarning(
"HGCalTriggerGeometry") <<
"WARNING: This HGCal trigger geometry is incomplete.\n"\
38 <<
"WARNING: Only the EE part is covered.\n"\
39 <<
"WARNING: There is no neighbor information.\n";
44 if(!l1tCellsMappingStream.is_open())
edm::LogError(
"HGCalTriggerGeometry") <<
"Cannot open L1TCellsMapping file\n";
49 short triggercell = 0;
50 for(; l1tCellsMappingStream>>layer>>subsector>>cell>>module>>triggercell; )
52 if(layer>30 || layer<=0)
54 edm::LogWarning(
"HGCalTriggerGeometry") <<
"Bad layer index in L1TCellsMapping\n";
59 for(
unsigned z=0;
z<=1;
z++)
61 int zside = (
z==0 ? -1 : 1);
62 for(
unsigned sector=1; sector<=18; sector++)
69 if(!ret.second)
edm::LogWarning(
"HGCalTriggerGeometry") <<
"Duplicate cell in L1TCellsMapping\n";
76 if(!l1tCellsMappingStream.eof())
edm::LogWarning(
"HGCalTriggerGeometry") <<
"Error reading L1TCellsMapping'"<<layer<<
" "<<cell<<
" "<<triggercell<<
" "<<subsector<<
"' \n";
77 l1tCellsMappingStream.close();
82 std::map<unsigned, list_cells> trigger_cells_to_cells;
85 unsigned cell = cell_triggercell.first;
86 unsigned triggercell = cell_triggercell.second;
87 trigger_cells_to_cells.insert( std::make_pair(triggercell, list_cells()) );
88 trigger_cells_to_cells.at(triggercell).insert(cell);
90 for(
const auto& triggercell_cells : trigger_cells_to_cells)
92 unsigned triggercellId = triggercell_cells.first;
93 list_cells cellIds = triggercell_cells.second;
96 for(
const auto& cell : cellIds)
101 GlobalPoint triggercellPoint( triggercellVector/cellIds.size() );
106 std::unique_ptr<const HGCalTriggerGeometry::TriggerCell> triggercellPtr(
new HGCalTriggerGeometry::TriggerCell(triggercellId, moduleId, triggercellPoint, list_cells(), cellIds));
114 std::map<unsigned, list_triggercells> modules_to_trigger_cells;
117 unsigned triggercell = triggercell_module.first;
118 unsigned module = triggercell_module.second;
119 modules_to_trigger_cells.insert( std::make_pair(module, list_triggercells()) );
120 modules_to_trigger_cells.at(module).insert(triggercell);
122 for(
const auto& module_triggercell : modules_to_trigger_cells)
124 unsigned moduleId = module_triggercell.first;
125 list_triggercells triggercellIds = module_triggercell.second;
126 tc_map_to_cells cellsInTriggerCells;
129 for(
const auto& triggercell : triggercellIds)
131 const auto& cells_in_tc = trigger_cells_to_cells[triggercell];
132 for(
const unsigned cell : cells_in_tc ) {
133 cellsInTriggerCells.emplace(triggercell,cell);
135 moduleVector +=
trigger_cells_.at(triggercell)->position().basicVector();
137 GlobalPoint modulePoint( moduleVector/triggercellIds.size() );
139 std::unique_ptr<const HGCalTriggerGeometry::Module> modulePtr(
new HGCalTriggerGeometry::Module(moduleId, modulePoint, list_triggercells(), triggercellIds, cellsInTriggerCells));
147 "HGCalTriggerGeometryImp1");
std::unordered_set< unsigned > list_type
const HGCalGeometry * eeGeometry() const
GlobalPoint getPosition(const DetId &id) const
void initialize(const edm::ESHandle< CaloGeometry > &) final
HGCalTriggerGeometryImp1(const edm::ParameterSet &conf)
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
#define DEFINE_EDM_PLUGIN(factory, type, name)
const BasicVectorType & basicVector() const
std::unordered_set< unsigned > list_type