12 #include "tbb/concurrent_unordered_set.h"
46 bool validCell(
const unsigned)
const final;
83 bool validCellId(
unsigned det,
unsigned cell_id)
const;
97 hSc_triggercell_size_(conf.getParameter<unsigned>(
"ScintillatorTriggerCellSize")),
98 hSc_module_size_(conf.getParameter<unsigned>(
"ScintillatorModuleSize")),
99 hSc_links_per_module_(conf.getParameter<unsigned>(
"ScintillatorLinksPerModule")),
100 l1tModulesMapping_(conf.getParameter<
edm::FileInPath>(
"L1TModulesMapping")),
101 l1tLinksMapping_(conf.getParameter<
edm::FileInPath>(
"L1TLinksMapping")) {
102 const unsigned ntc_per_wafer = 48;
107 std::vector<unsigned> tmp_vector = conf.
getParameter<std::vector<unsigned>>(
"DisconnectedModules");
109 tmp_vector = conf.
getParameter<std::vector<unsigned>>(
"DisconnectedLayers");
121 <<
"HGCalTriggerGeometryV9Imp2 geometry cannot be initialized with the V7/V8 HGCAL geometry";
134 unsigned trigger_layer = 1;
162 unsigned trigger_layer = 1;
179 unsigned trigger_nose_layer = 1;
182 trigger_nose_layer++;
187 unsigned det =
DetId(cell_id).
det();
188 unsigned trigger_cell_id = 0;
201 cell_nose_id.
zside(),
203 cell_nose_id.
layer(),
222 return trigger_cell_id;
230 unsigned det =
DetId(trigger_cell_id).
det();
232 unsigned subdet_old = 0;
234 unsigned tc_type = 1;
236 unsigned module_id = 0;
240 tc_type = trigger_cell_sc_id.
type();
253 tc_type = trigger_cell_trig_id.
type();
256 int waferu = trigger_cell_trig_id.
waferU();
257 int waferv = trigger_cell_trig_id.
waferV();
265 unsigned subdet = trigger_cell_trig_id.
subdet();
271 int waferu = trigger_cell_trig_id.
waferU();
272 int waferv = trigger_cell_trig_id.
waferV();
274 unsigned packed_wafer =
packLayerWaferId(layer_with_offset, waferu, waferv);
280 if (insert_itr.second) {
282 <<
"Found missing wafer (layer=" << layer_with_offset <<
" u=" << waferu <<
" v=" << waferv
283 <<
") in trigger modules mapping";
286 module = module_itr->second;
296 const unsigned trigger_cell_id)
const {
297 DetId trigger_cell_det_id(trigger_cell_id);
298 unsigned det = trigger_cell_det_id.
det();
306 int ieta = ietaAbs * trigger_cell_sc_id.
zside();
310 cell_det_ids.emplace(cell_id);
320 int type = trigger_cell_nose_id.
type();
321 int waferu = trigger_cell_nose_id.
waferU();
322 int waferv = trigger_cell_nose_id.
waferV();
323 std::vector<int> cellus = trigger_cell_nose_id.
cellU();
324 std::vector<int> cellvs = trigger_cell_nose_id.
cellV();
325 for (
unsigned ic = 0; ic < cellus.size(); ic++) {
327 cell_det_ids.emplace(cell_det_id);
333 unsigned subdet = trigger_cell_trig_id.
subdet();
338 int type = trigger_cell_trig_id.
type();
339 int waferu = trigger_cell_trig_id.
waferU();
340 int waferv = trigger_cell_trig_id.
waferV();
341 std::vector<int> cellus = trigger_cell_trig_id.
cellU();
342 std::vector<int> cellvs = trigger_cell_trig_id.
cellV();
343 for (
unsigned ic = 0; ic < cellus.size(); ic++) {
345 cell_det_ids.emplace(cell_det_id);
355 for (
auto trigger_cell_id : trigger_cells) {
357 cell_det_ids.insert(
cells.begin(),
cells.end());
363 const unsigned module_id)
const {
366 for (
auto trigger_cell_id : trigger_cells) {
368 cell_det_ids.insert(
cells.begin(),
cells.end());
374 const unsigned module_id)
const {
375 DetId module_det_id(module_id);
376 unsigned det = module_det_id.
det();
386 int ieta = ietaAbs * module_sc_id.
zside();
390 trigger_cell_det_ids.emplace(trigger_cell_id);
399 for (
auto const&
idx : ids) {
401 trigger_cell_det_ids.emplace(
idx);
411 for (
auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
426 for (
const auto& tc_uv : tc_uvs) {
428 subdet, module_si_id.
zside(), wafer_type,
layer, waferu, waferv, tc_uv.first, tc_uv.second);
430 trigger_cell_det_ids.emplace(trigger_cell_id);
436 return trigger_cell_det_ids;
440 const unsigned module_id)
const {
441 DetId module_det_id(module_id);
442 unsigned det = module_det_id.
det();
450 int ieta = ietaAbs * module_sc_id.
zside();
454 trigger_cell_det_ids.emplace(trigger_cell_id);
463 for (
auto const&
idx : ids) {
465 trigger_cell_det_ids.emplace(
idx);
475 for (
auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
490 for (
const auto& tc_uv : tc_uvs) {
492 subdet, module_si_id.
zside(), wafer_type,
layer, waferu, waferv, tc_uv.first, tc_uv.second);
493 trigger_cell_det_ids.emplace(trigger_cell_id);
498 return trigger_cell_det_ids;
502 const unsigned trigger_cell_id)
const {
503 throw cms::Exception(
"FeatureNotImplemented") <<
"Neighbor search is not implemented in HGCalTriggerGeometryV9Imp2";
507 DetId module_det_id(module_id);
528 DetId module_det_id(module_id);
529 unsigned nWafers = 1;
546 unsigned det =
DetId(trigger_cell_det_id).
det();
552 for (
const auto& cell : cell_ids) {
559 for (
const auto& cell : cell_ids) {
566 for (
const auto& cell : cell_ids) {
573 return GlobalPoint(triggerCellVector / cell_ids.size());
577 unsigned det =
DetId(module_det_id).
det();
583 for (
const auto& cell : cell_ids) {
589 for (
const auto& cell : cell_ids) {
595 for (
const auto& cell : cell_ids) {
603 return GlobalPoint(moduleVector / cell_ids.size());
609 if (!l1tModulesMappingStream.is_open()) {
610 throw cms::Exception(
"MissingDataFile") <<
"Cannot open HGCalTriggerGeometry L1TModulesMapping file\n";
617 for (; l1tModulesMappingStream >>
layer >> waferu >> waferv >>
module;) {
621 if (!l1tModulesMappingStream.eof()) {
623 <<
"Error reading L1TModulesMapping '" <<
layer <<
" " << waferu <<
" " << waferv <<
" " <<
module <<
"' \n";
625 l1tModulesMappingStream.close();
628 if (!l1tLinksMappingStream.is_open()) {
629 throw cms::Exception(
"MissingDataFile") <<
"Cannot open HGCalTriggerGeometry L1TLinksMapping file\n";
632 const short max_modules_60deg_sector = 127;
637 if (
module > max_modules_60deg_sector)
641 if (!l1tLinksMappingStream.eof()) {
643 <<
"Error reading L1TLinksMapping '" <<
layer <<
" " <<
module <<
" " <<
links <<
"' \n";
645 l1tLinksMappingStream.close();
649 unsigned packed_value = 0;
650 unsigned waferUsign = (
waferU >= 0) ? 0 : 1;
651 unsigned waferVsign = (
waferV >= 0) ? 0 : 1;
660 unsigned packed_value = 0;
666 unsigned waferUsign = (
waferU >= 0) ? 0 : 1;
667 unsigned waferVsign = (
waferV >= 0) ? 0 : 1;
678 unsigned packed_value = 0;
704 bool disconnected =
false;
727 bool is_valid =
false;
728 unsigned det =
DetId(cell_id).
det();
755 bool is_valid =
false;
756 for (
const auto cell_id :
cells) {
757 unsigned det =
DetId(cell_id).
det();
766 bool is_valid =
false;