42 edm::LogWarning(
"HGCalTriggerGeometry") <<
"WARNING: This HGCal trigger geometry is incomplete.\n"\
43 <<
"WARNING: Only the EE part is covered.\n"\
44 <<
"WARNING: There is no neighbor information.\n";
56 <<
"HGCalTriggerGeometryImp1 geometry cannot be initialized with the V9 HGCAL geometry";
67 if(!l1tCellsMappingStream.is_open())
edm::LogError(
"HGCalTriggerGeometry") <<
"Cannot open L1TCellsMapping file\n";
72 short triggercell = 0;
73 for(; l1tCellsMappingStream>>layer>>subsector>>cell>>module>>triggercell; )
75 if(layer>30 || layer<=0)
77 edm::LogWarning(
"HGCalTriggerGeometry") <<
"Bad layer index in L1TCellsMapping\n";
82 for(
unsigned z=0;
z<=1;
z++)
84 int zside = (
z==0 ? -1 : 1);
85 for(
unsigned sector=1; sector<=18; sector++)
92 if(!ret.second)
edm::LogWarning(
"HGCalTriggerGeometry") <<
"Duplicate cell in L1TCellsMapping\n";
99 if(!l1tCellsMappingStream.eof())
edm::LogWarning(
"HGCalTriggerGeometry") <<
"Error reading L1TCellsMapping'"<<layer<<
" "<<cell<<
" "<<triggercell<<
" "<<subsector<<
"' \n";
100 l1tCellsMappingStream.close();
105 std::map<unsigned, list_cells> trigger_cells_to_cells;
108 unsigned cell = cell_triggercell.first;
109 unsigned triggercell = cell_triggercell.second;
110 trigger_cells_to_cells.insert( std::make_pair(triggercell, list_cells()) );
111 trigger_cells_to_cells.at(triggercell).insert(cell);
113 for(
const auto& triggercell_cells : trigger_cells_to_cells)
115 unsigned triggercellId = triggercell_cells.first;
116 list_cells cellIds = triggercell_cells.second;
119 for(
const auto& cell : cellIds)
124 GlobalPoint triggercellPoint( triggercellVector/cellIds.size() );
129 std::unique_ptr<const HGCalTriggerGeometry::TriggerCell> triggercellPtr(
new HGCalTriggerGeometry::TriggerCell(triggercellId, moduleId, triggercellPoint, list_cells(), cellIds));
137 std::map<unsigned, list_triggercells> modules_to_trigger_cells;
140 unsigned triggercell = triggercell_module.first;
141 unsigned module = triggercell_module.second;
142 modules_to_trigger_cells.insert( std::make_pair(module, list_triggercells()) );
143 modules_to_trigger_cells.at(module).insert(triggercell);
145 for(
const auto& module_triggercell : modules_to_trigger_cells)
147 unsigned moduleId = module_triggercell.first;
148 list_triggercells triggercellIds = module_triggercell.second;
149 tc_map_to_cells cellsInTriggerCells;
152 for(
const auto& triggercell : triggercellIds)
154 const auto& cells_in_tc = trigger_cells_to_cells[triggercell];
155 for(
const unsigned cell : cells_in_tc ) {
156 cellsInTriggerCells.emplace(triggercell,cell);
158 moduleVector +=
trigger_cells_.at(triggercell)->position().basicVector();
160 GlobalPoint modulePoint( moduleVector/triggercellIds.size() );
162 std::unique_ptr<const HGCalTriggerGeometry::Module> modulePtr(
new HGCalTriggerGeometry::Module(moduleId, modulePoint, list_triggercells(), triggercellIds, cellsInTriggerCells));
170 "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