CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCalTriggerGeometryHexLayerBasedImp1 Class Reference
Inheritance diagram for HGCalTriggerGeometryHexLayerBasedImp1:
HGCalTriggerGeometryBase

Public Member Functions

bool disconnectedModule (const unsigned) const final
 
geom_set getCellsFromModule (const unsigned) const final
 
geom_set getCellsFromTriggerCell (const unsigned) const final
 
unsigned getLinksInModule (const unsigned module_id) const final
 
unsigned getModuleFromCell (const unsigned) const final
 
unsigned getModuleFromTriggerCell (const unsigned) const final
 
GlobalPoint getModulePosition (const unsigned) const final
 
unsigned getModuleSize (const unsigned module_id) const final
 
geom_set getNeighborsFromTriggerCell (const unsigned) const final
 
geom_ordered_set getOrderedCellsFromModule (const unsigned) const final
 
geom_ordered_set getOrderedTriggerCellsFromModule (const unsigned) const final
 
unsigned getTriggerCellFromCell (const unsigned) const final
 
GlobalPoint getTriggerCellPosition (const unsigned) const final
 
geom_set getTriggerCellsFromModule (const unsigned) const final
 
 HGCalTriggerGeometryHexLayerBasedImp1 (const edm::ParameterSet &conf)
 
void initialize (const CaloGeometry *) final
 
void initialize (const HGCalGeometry *, const HGCalGeometry *, const HGCalGeometry *) final
 
unsigned lastTriggerLayer () const final
 
void reset () final
 
unsigned triggerLayer (const unsigned) const final
 
bool validTriggerCell (const unsigned) const final
 
- Public Member Functions inherited from HGCalTriggerGeometryBase
const HcalGeometrybhGeometry () const
 
const HcalTopologybhTopology () const
 
const CaloGeometrycaloGeometry () const
 
const HGCalGeometryeeGeometry () const
 
const HGCalTopologyeeTopology () const
 
const HGCalGeometryfhGeometry () const
 
const HGCalTopologyfhTopology () const
 
 HGCalTriggerGeometryBase (const edm::ParameterSet &conf)
 
const HGCalGeometryhscGeometry () const
 
const HGCalTopologyhscTopology () const
 
const HGCalGeometryhsiGeometry () const
 
const HGCalTopologyhsiTopology () const
 
bool isV9Geometry () const
 
const std::string & name () const
 
virtual ~HGCalTriggerGeometryBase ()
 

Private Member Functions

int detIdWaferType (unsigned subdet, short wafer) const
 
void fillInvalidTriggerCells ()
 
void fillMaps ()
 
void fillNeighborMaps (const edm::FileInPath &, std::unordered_map< int, std::set< std::pair< short, short >>> &)
 
unsigned layerWithOffset (unsigned) const
 
unsigned packIetaIphi (unsigned ieta, unsigned iphi) const
 
unsigned packTriggerCell (unsigned, unsigned) const
 
unsigned packWaferCellId (unsigned subdet, unsigned wafer, unsigned cell) const
 
void unpackIetaIphi (unsigned ieta_iphi, unsigned &ieta, unsigned &iphi) const
 
void unpackWaferCellId (unsigned wafer_cell, unsigned &wafer, unsigned &cell) const
 
bool validCellId (unsigned subdet, unsigned cell_id) const
 
bool validTriggerCellFromCells (const unsigned) const
 

Private Attributes

unsigned bhOffset_ = 0
 
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
 
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_bh_
 
std::unordered_set< unsigned > disconnected_layers_
 
std::unordered_set< unsigned > disconnected_modules_
 
unsigned fhOffset_ = 0
 
std::unordered_set< unsigned > invalid_triggercells_
 
edm::FileInPath l1tCellNeighborsBHMapping_
 
edm::FileInPath l1tCellNeighborsMapping_
 
edm::FileInPath l1tCellsBHMapping_
 
edm::FileInPath l1tCellsMapping_
 
edm::FileInPath l1tModulesMapping_
 
unsigned last_trigger_layer_ = 0
 
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
 
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
 
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_bh_
 
unsigned totalLayers_ = 0
 
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_
 
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_bh_
 
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
 
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_bh_
 
std::vector< unsigned > trigger_layers_
 
std::unordered_map< unsigned, unsigned > wafer_to_module_
 

Additional Inherited Members

- Public Types inherited from HGCalTriggerGeometryBase
typedef std::unordered_map< unsigned, unsigned > geom_map
 
typedef std::set< unsigned > geom_ordered_set
 
typedef std::unordered_set< unsigned > geom_set
 
- Protected Member Functions inherited from HGCalTriggerGeometryBase
void setCaloGeometry (const CaloGeometry *geom)
 
void setEEGeometry (const HGCalGeometry *geom)
 
void setHScGeometry (const HGCalGeometry *geom)
 
void setHSiGeometry (const HGCalGeometry *geom)
 

Detailed Description

Definition at line 13 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Constructor & Destructor Documentation

HGCalTriggerGeometryHexLayerBasedImp1::HGCalTriggerGeometryHexLayerBasedImp1 ( const edm::ParameterSet conf)

Definition at line 100 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References disconnected_layers_, disconnected_modules_, edm::ParameterSet::getParameter(), and eostools::move().

101  : HGCalTriggerGeometryBase(conf),
102  l1tCellsMapping_(conf.getParameter<edm::FileInPath>("L1TCellsMapping")),
103  l1tCellsBHMapping_(conf.getParameter<edm::FileInPath>("L1TCellsBHMapping")),
104  l1tModulesMapping_(conf.getParameter<edm::FileInPath>("L1TModulesMapping")),
105  l1tCellNeighborsMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsMapping")),
106  l1tCellNeighborsBHMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsBHMapping")) {
107  std::vector<unsigned> tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedModules");
108  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_modules_, disconnected_modules_.end()));
109  tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedLayers");
110  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end()));
111 }
HGCalTriggerGeometryBase(const edm::ParameterSet &conf)
T getParameter(std::string const &) const
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

int HGCalTriggerGeometryHexLayerBasedImp1::detIdWaferType ( unsigned  subdet,
short  wafer 
) const
private

Definition at line 717 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalTopology::dddConstants(), HGCalTriggerGeometryBase::eeTopology(), HGCalTriggerGeometryBase::fhTopology(), HGCEE, HGCHEF, and HGCalDDDConstants::waferTypeT().

Referenced by getCellsFromTriggerCell().

717  {
718  int wafer_type = 0;
719  switch (subdet) {
720  // HGCalDDDConstants::waferTypeT() returns 2=coarse, 1=fine
721  // HGCalDetId::waferType() returns -1=coarse, 1=fine
722  // Convert to HGCalDetId waferType
724  wafer_type = (eeTopology().dddConstants().waferTypeT(wafer) == 2 ? -1 : 1);
725  break;
727  wafer_type = (fhTopology().dddConstants().waferTypeT(wafer) == 2 ? -1 : 1);
728  break;
729  default:
730  break;
731  };
732  return wafer_type;
733 }
const HGCalTopology & eeTopology() const
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:96
int waferTypeT(int wafer) const
const HGCalTopology & fhTopology() const
bool HGCalTriggerGeometryHexLayerBasedImp1::disconnectedModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 658 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References disconnected_layers_, disconnected_modules_, and layerWithOffset().

658  {
659  bool disconnected = false;
660  if (disconnected_modules_.find(HGCalDetId(module_id).wafer()) != disconnected_modules_.end())
661  disconnected = true;
662  if (disconnected_layers_.find(layerWithOffset(module_id)) != disconnected_layers_.end())
663  disconnected = true;
664  return disconnected;
665 }
void HGCalTriggerGeometryHexLayerBasedImp1::fillInvalidTriggerCells ( )
private

Definition at line 601 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalTopology::dddConstants(), HGCalTriggerGeometryBase::eeTopology(), getNeighborsFromTriggerCell(), HGCEE, HGCHEF, invalid_triggercells_, HGCalDDDConstants::layers(), number_trigger_cells_in_wafers_, validTriggerCellFromCells(), and wafer_to_module_.

Referenced by initialize().

601  {
602  unsigned n_layers_ee = eeTopology().dddConstants().layers(true);
603  for (unsigned layer = 1; layer <= n_layers_ee; layer++) {
604  for (const auto& wafer_module : wafer_to_module_) {
605  unsigned wafer = wafer_module.first;
606  // loop on the trigger cells in each wafer
607  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer); trigger_cell++) {
608  std::set<unsigned> trigger_cell_ids;
609  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, -1, layer, 1, wafer, trigger_cell));
610  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, 1, layer, 1, wafer, trigger_cell));
611  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, -1, layer, 1, wafer, trigger_cell));
612  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, 1, layer, 1, wafer, trigger_cell));
613  for (unsigned trigger_cell : trigger_cell_ids) {
614  if (!validTriggerCellFromCells(trigger_cell))
615  invalid_triggercells_.emplace(trigger_cell);
616  for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell)) {
617  if (!validTriggerCellFromCells(neighbor))
618  invalid_triggercells_.emplace(neighbor);
619  }
620  }
621  }
622  }
623  }
624 }
const HGCalTopology & eeTopology() const
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
unsigned int layers(bool reco) const
std::unordered_map< unsigned, unsigned > wafer_to_module_
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:96
geom_set getNeighborsFromTriggerCell(const unsigned) const final
void HGCalTriggerGeometryHexLayerBasedImp1::fillMaps ( )
private

Definition at line 475 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References cells_to_trigger_cells_, cells_to_trigger_cells_bh_, Exception, edm::FileInPath::fullPath(), HGCHEB, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, l1tCellsBHMapping_, l1tCellsMapping_, l1tModulesMapping_, module_to_wafers_, number_trigger_cells_in_wafers_, number_trigger_cells_in_wafers_bh_, packIetaIphi(), packWaferCellId(), trigger_cells_to_cells_, trigger_cells_to_cells_bh_, and wafer_to_module_.

Referenced by initialize().

475  {
476  //
477  // read module mapping file
478  std::ifstream l1tModulesMappingStream(l1tModulesMapping_.fullPath());
479  if (!l1tModulesMappingStream.is_open()) {
480  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TModulesMapping file\n";
481  }
482  short trigger_wafer = 0;
483  short module = 0;
484  for (; l1tModulesMappingStream >> trigger_wafer >> module;) {
485  wafer_to_module_.emplace(trigger_wafer, module);
486  module_to_wafers_.emplace(module, trigger_wafer);
487  // Default number of trigger cell in wafer is 0
488  number_trigger_cells_in_wafers_.emplace(trigger_wafer, 0);
489  }
490  if (!l1tModulesMappingStream.eof())
491  edm::LogWarning("HGCalTriggerGeometry")
492  << "Error reading L1TModulesMapping '" << trigger_wafer << " " << module << "' \n";
493  l1tModulesMappingStream.close();
494  // read trigger cell mapping file
495  std::ifstream l1tCellsMappingStream(l1tCellsMapping_.fullPath());
496  if (!l1tCellsMappingStream.is_open()) {
497  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsMapping file\n";
498  }
499  short subdet = 0;
500  short wafer = 0;
501  short cell = 0;
502  trigger_wafer = 0;
503  short trigger_cell = 0;
504  for (; l1tCellsMappingStream >> subdet >> wafer >> cell >> trigger_wafer >> trigger_cell;) {
505  unsigned cell_key = packWaferCellId(subdet, wafer, cell);
506  unsigned trigger_cell_key = packWaferCellId(subdet, trigger_wafer, trigger_cell);
507  // fill cell <-> trigger cell mappings
508  cells_to_trigger_cells_.emplace(cell_key, trigger_cell_key);
509  trigger_cells_to_cells_.emplace(trigger_cell_key, cell_key);
510  // fill number of trigger cells in wafers
511  auto itr_insert = number_trigger_cells_in_wafers_.emplace(trigger_wafer, 0);
512  if (trigger_cell + 1 > itr_insert.first->second)
513  itr_insert.first->second = trigger_cell + 1;
514  }
515  if (!l1tCellsMappingStream.eof())
516  edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellsMapping '" << subdet << " " << wafer << " "
517  << cell << " " << trigger_wafer << " " << trigger_cell << "' \n";
518  l1tCellsMappingStream.close();
519  // read BH trigger cell mapping file
520  std::ifstream l1tCellsBHMappingStream(l1tCellsBHMapping_.fullPath());
521  if (!l1tCellsBHMappingStream.is_open()) {
522  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsBHMapping file\n";
523  }
524  short ieta = 0;
525  short iphi = 0;
526  trigger_wafer = 0;
527  trigger_cell = 0;
528  for (; l1tCellsBHMappingStream >> ieta >> iphi >> trigger_wafer >> trigger_cell;) {
529  unsigned cell_key = packIetaIphi(ieta, iphi);
530  unsigned trigger_cell_key = packWaferCellId(ForwardSubdetector::HGCHEB, trigger_wafer, trigger_cell);
531  // fill cell <-> trigger cell mappings
532  cells_to_trigger_cells_bh_.emplace(cell_key, trigger_cell_key);
533  trigger_cells_to_cells_bh_.emplace(trigger_cell_key, cell_key);
534  // fill number of trigger cells in wafers
535  auto itr_insert = number_trigger_cells_in_wafers_bh_.emplace(trigger_wafer, 0);
536  if (trigger_cell + 1 > itr_insert.first->second)
537  itr_insert.first->second = trigger_cell + 1;
538  }
539  if (!l1tCellsBHMappingStream.eof())
540  edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellsBHMapping '" << ieta << " " << iphi << " "
541  << trigger_wafer << " " << trigger_cell << "' \n";
542  l1tCellsBHMappingStream.close();
543 }
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_bh_
unsigned packIetaIphi(unsigned ieta, unsigned iphi) const
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
unsigned packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_bh_
std::unordered_map< unsigned, unsigned > wafer_to_module_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_bh_
std::string fullPath() const
Definition: FileInPath.cc:163
Definition: vlib.h:198
void HGCalTriggerGeometryHexLayerBasedImp1::fillNeighborMaps ( const edm::FileInPath file,
std::unordered_map< int, std::set< std::pair< short, short >>> &  neighbors_map 
)
private

Definition at line 545 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References begin, edmScanValgrind::buffer, end, Exception, edm::FileInPath::fullPath(), mps_fire::i, mps_splice::line, packTriggerCell(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by initialize().

546  {
547  // Fill trigger neighbor map
548  std::ifstream l1tCellNeighborsMappingStream(file.fullPath());
549  if (!l1tCellNeighborsMappingStream.is_open()) {
550  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellNeighborsMapping file\n";
551  }
552  for (std::array<char, 512> buffer; l1tCellNeighborsMappingStream.getline(&buffer[0], 512);) {
553  std::string line(&buffer[0]);
554  // Extract keys consisting of the module id
555  // and of the trigger cell id
556  // Match patterns (X,Y)
557  // where X is a number with less than 4 digis
558  // and Y is a number with less than 4 digits
559  std::regex key_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)");
560  std::vector<std::string> key_tokens{std::sregex_token_iterator(line.begin(), line.end(), key_regex), {}};
561  if (key_tokens.empty()) {
562  throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n"
563  << " Cannot find the trigger cell key in line:\n"
564  << " '" << &buffer[0] << "'\n";
565  }
566  std::regex digits_regex("\\d{1,3}");
567  std::vector<std::string> module_tc{
568  std::sregex_token_iterator(key_tokens[0].begin(), key_tokens[0].end(), digits_regex), {}};
569  // get module and cell id
570  int module = std::stoi(module_tc[0]);
571  int trigger_cell = std::stoi(module_tc[1]);
572  unsigned map_key = packTriggerCell(module, trigger_cell);
573  // Extract neighbors
574  // Match patterns (X,Y)
575  // where X is a number with less than 4 digits
576  // and Y is a number with less than 4 digits
577  std::regex neighbors_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)");
578  std::vector<std::string> neighbors_tokens{std::sregex_token_iterator(line.begin(), line.end(), neighbors_regex),
579  {}};
580  if (neighbors_tokens.size() < 2) {
581  throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n"
582  << " Cannot find any neighbor in line:\n"
583  << " '" << &buffer[0] << "'\n";
584  }
585  auto itr_insert = neighbors_map.emplace(map_key, std::set<std::pair<short, short>>());
586  // The first element is the key, so start at index 1
587  for (unsigned i = 1; i < neighbors_tokens.size(); i++) {
588  const auto& neighbor = neighbors_tokens[i];
589  std::vector<std::string> pair_neighbor{std::sregex_token_iterator(neighbor.begin(), neighbor.end(), digits_regex),
590  {}};
591  short neighbor_module(std::stoi(pair_neighbor[0]));
592  short neighbor_cell(std::stoi(pair_neighbor[1]));
593  itr_insert.first->second.emplace(neighbor_module, neighbor_cell);
594  }
595  }
596  if (!l1tCellNeighborsMappingStream.eof())
597  edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellNeighborsMapping'\n";
598  l1tCellNeighborsMappingStream.close();
599 }
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
std::string fullPath() const
Definition: FileInPath.cc:163
Definition: vlib.h:198
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 283 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References postprocess-scan-build::cells, getCellsFromTriggerCell(), and getTriggerCellsFromModule().

Referenced by getModulePosition().

284  {
285  geom_set cell_det_ids;
286  geom_set trigger_cells = getTriggerCellsFromModule(module_id);
287  for (auto trigger_cell_id : trigger_cells) {
288  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
289  cell_det_ids.insert(cells.begin(), cells.end());
290  }
291  return cell_det_ids;
292 }
geom_set getCellsFromTriggerCell(const unsigned) const final
std::unordered_set< unsigned > geom_set
geom_set getTriggerCellsFromModule(const unsigned) const final
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getCellsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 237 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalDetId::cell(), detIdWaferType(), HcalEndcap, HGCHEB, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, HGCalDetId::layer(), packWaferCellId(), DetId::subdetId(), trigger_cells_to_cells_, trigger_cells_to_cells_bh_, unpackIetaIphi(), unpackWaferCellId(), validCellId(), HGCalDetId::wafer(), and HGCalDetId::zside().

Referenced by getCellsFromModule(), getOrderedCellsFromModule(), getTriggerCellPosition(), and validTriggerCellFromCells().

238  {
239  HGCalDetId trigger_cell_det_id(trigger_cell_id);
240  geom_set cell_det_ids;
241  // BH
242  if (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
243  unsigned subdet = trigger_cell_det_id.subdetId();
244  unsigned trigger_wafer = trigger_cell_det_id.wafer();
245  unsigned trigger_cell = trigger_cell_det_id.cell();
246  const auto& cell_range =
247  trigger_cells_to_cells_bh_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell));
248  for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) {
249  unsigned ieta = 0;
250  unsigned iphi = 0;
251  unpackIetaIphi(tc_c_itr->second, ieta, iphi);
252  unsigned cell_det_id =
253  HcalDetId(HcalEndcap, trigger_cell_det_id.zside() * ieta, iphi, trigger_cell_det_id.layer()).rawId();
254  if (validCellId(subdet, cell_det_id))
255  cell_det_ids.emplace(cell_det_id);
256  }
257  }
258  // EE or FH
259  else {
260  unsigned subdet = trigger_cell_det_id.subdetId();
261  unsigned trigger_wafer = trigger_cell_det_id.wafer();
262  unsigned trigger_cell = trigger_cell_det_id.cell();
263  const auto& cell_range = trigger_cells_to_cells_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell));
264  for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) {
265  unsigned wafer = 0;
266  unsigned cell = 0;
267  unpackWaferCellId(tc_c_itr->second, wafer, cell);
268  unsigned wafer_type = (detIdWaferType(subdet, wafer) == 1 ? 1 : 0);
269  unsigned cell_det_id = HGCalDetId((ForwardSubdetector)trigger_cell_det_id.subdetId(),
270  trigger_cell_det_id.zside(),
271  trigger_cell_det_id.layer(),
272  wafer_type,
273  wafer,
274  cell)
275  .rawId();
276  if (validCellId(subdet, cell_det_id))
277  cell_det_ids.emplace(cell_det_id);
278  }
279  }
280  return cell_det_ids;
281 }
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
int detIdWaferType(unsigned subdet, short wafer) const
ForwardSubdetector
bool validCellId(unsigned subdet, unsigned cell_id) const
void unpackWaferCellId(unsigned wafer_cell, unsigned &wafer, unsigned &cell) const
void unpackIetaIphi(unsigned ieta_iphi, unsigned &ieta, unsigned &iphi) const
unsigned packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_bh_
std::unordered_set< unsigned > geom_set
unsigned HGCalTriggerGeometryHexLayerBasedImp1::getLinksInModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 423 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

423 { return 1; }
unsigned HGCalTriggerGeometryHexLayerBasedImp1::getModuleFromCell ( const unsigned  cell_id) const
finalvirtual
unsigned HGCalTriggerGeometryHexLayerBasedImp1::getModuleFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 208 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References Exception, HGCHEB, HGCalDetId::kHGCalCellMask, HGCalDetId::layer(), DetId::rawId(), DetId::subdetId(), HGCalDetId::wafer(), wafer_to_module_, HGCalDetId::waferType(), and HGCalDetId::zside().

Referenced by getModuleFromCell().

208  {
209  HGCalDetId trigger_cell_det_id(trigger_cell_id);
210  unsigned module = 0;
211  // BH
212  if (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
213  // For BH, the module ID is currently encoded as the wafer in HGCalDetId
214  module = trigger_cell_det_id.wafer();
215  }
216  // EE or FH
217  else {
218  auto module_itr = wafer_to_module_.find(trigger_cell_det_id.wafer());
219  if (module_itr == wafer_to_module_.end()) {
220  throw cms::Exception("BadGeometry")
221  << trigger_cell_det_id << "HGCalTriggerGeometry: Wafer " << trigger_cell_det_id.wafer()
222  << " is not mapped to any trigger module. The module mapping should be modified. See "
223  "https://twiki.cern.ch/twiki/bin/viewauth/CMS/HGCALTriggerPrimitivesSimulation#Trigger_geometry for "
224  "details.\n";
225  }
226  module = module_itr->second;
227  }
228  return HGCalDetId((ForwardSubdetector)trigger_cell_det_id.subdetId(),
229  trigger_cell_det_id.zside(),
230  trigger_cell_det_id.layer(),
231  (trigger_cell_det_id.waferType() == 1 ? 1 : 0),
232  module,
234  .rawId();
235 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
ForwardSubdetector
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
std::unordered_map< unsigned, unsigned > wafer_to_module_
Definition: vlib.h:198
GlobalPoint HGCalTriggerGeometryHexLayerBasedImp1::getModulePosition ( const unsigned  module_det_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 451 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References PV3DBase< T, PVType, FrameType >::basicVector(), HGCalTriggerGeometryBase::bhGeometry(), HGCalTriggerGeometryBase::eeGeometry(), HGCalTriggerGeometryBase::fhGeometry(), getCellsFromModule(), HcalGeometry::getPosition(), HGCalGeometry::getPosition(), HGCEE, HGCHEB, and DetId::subdetId().

451  {
452  unsigned subdet = HGCalDetId(module_det_id).subdetId();
453  // Position: barycenter of the module.
454  Basic3DVector<float> moduleVector(0., 0., 0.);
455  const auto cell_ids = getCellsFromModule(module_det_id);
456  // BH
457  if (subdet == ForwardSubdetector::HGCHEB) {
458  for (const auto& cell : cell_ids) {
459  HcalDetId cellDetId(cell);
460  moduleVector += bhGeometry()->getPosition(cellDetId).basicVector();
461  }
462  }
463  // EE or FH
464  else {
465  for (const auto& cell : cell_ids) {
466  HGCalDetId cellDetId(cell);
467  moduleVector += (cellDetId.subdetId() == ForwardSubdetector::HGCEE ? eeGeometry()->getPosition(cellDetId)
468  : fhGeometry()->getPosition(cellDetId))
469  .basicVector();
470  }
471  }
472  return GlobalPoint(moduleVector / cell_ids.size());
473 }
const HGCalGeometry * eeGeometry() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPosition(const DetId &id) const
const HGCalGeometry * fhGeometry() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
GlobalPoint getPosition(const DetId &id) const
const HcalGeometry * bhGeometry() const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
unsigned HGCalTriggerGeometryHexLayerBasedImp1::getModuleSize ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 425 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

425 { return 1; }
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getNeighborsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 389 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalDetId::cell(), Exception, HGCHEB, HGCalDetId::layer(), packTriggerCell(), DetId::subdetId(), trigger_cell_neighbors_, trigger_cell_neighbors_bh_, validTriggerCell(), HGCalDetId::wafer(), and HGCalDetId::zside().

Referenced by fillInvalidTriggerCells().

390  {
391  HGCalDetId trigger_cell_det_id(trigger_cell_id);
392  // Choose scintillator or silicon map
393  const auto& neighbors_map = (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB ? trigger_cell_neighbors_bh_
395  unsigned module = trigger_cell_det_id.wafer();
396  unsigned trigger_cell = trigger_cell_det_id.cell();
397  // retrieve neighbors
398  unsigned trigger_cell_key = packTriggerCell(module, trigger_cell);
399  geom_set neighbor_detids;
400  auto neighbors_itr = neighbors_map.find(trigger_cell_key);
401  if (neighbors_itr == neighbors_map.end()) {
402  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Neighbors are not defined for trigger cell "
403  << trigger_cell << " in module " << module
404  << ". The trigger cell neighbor mapping should be modified. \n";
405  }
406  const auto& neighbors = neighbors_itr->second;
407  // create HGCalDetId of neighbors and check their validity
408  neighbor_detids.reserve(neighbors.size());
409  for (const auto& module_tc : neighbors) {
410  HGCalDetId neighbor_det_id((ForwardSubdetector)trigger_cell_det_id.subdetId(),
411  trigger_cell_det_id.zside(),
412  trigger_cell_det_id.layer(),
413  1,
414  module_tc.first,
415  module_tc.second);
416  if (validTriggerCell(neighbor_det_id.rawId())) {
417  neighbor_detids.emplace(neighbor_det_id.rawId());
418  }
419  }
420  return neighbor_detids;
421 }
ForwardSubdetector
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_bh_
std::unordered_set< unsigned > geom_set
Definition: vlib.h:198
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_
HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryHexLayerBasedImp1::getOrderedCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 294 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References postprocess-scan-build::cells, getCellsFromTriggerCell(), and getOrderedTriggerCellsFromModule().

295  {
296  geom_ordered_set cell_det_ids;
297  geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id);
298  for (auto trigger_cell_id : trigger_cells) {
299  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
300  cell_det_ids.insert(cells.begin(), cells.end());
301  }
302  return cell_det_ids;
303 }
std::set< unsigned > geom_ordered_set
geom_set getCellsFromTriggerCell(const unsigned) const final
std::unordered_set< unsigned > geom_set
geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final
HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryHexLayerBasedImp1::getOrderedTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 347 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCHEB, HGCalDetId::layer(), module_to_wafers_, number_trigger_cells_in_wafers_, number_trigger_cells_in_wafers_bh_, DetId::subdetId(), validTriggerCell(), HGCalDetId::wafer(), and HGCalDetId::zside().

Referenced by getOrderedCellsFromModule().

348  {
349  HGCalDetId module_det_id(module_id);
350  geom_ordered_set trigger_cell_det_ids;
351  // BH
352  if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
353  unsigned module = module_det_id.wafer();
354  // loop on the trigger cells in each module
355  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_bh_.at(module); trigger_cell++) {
356  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
357  module_det_id.zside(),
358  module_det_id.layer(),
359  1,
360  module,
361  trigger_cell);
362  if (validTriggerCell(trigger_cell_id))
363  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
364  }
365  }
366  // EE or FH
367  else {
368  unsigned module = module_det_id.wafer();
369  auto wafer_itrs = module_to_wafers_.equal_range(module);
370  // loop on the wafers included in the module
371  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
372  unsigned wafer = wafer_itr->second;
373  // loop on the trigger cells in each wafer
374  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer); trigger_cell++) {
375  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
376  module_det_id.zside(),
377  module_det_id.layer(),
378  1,
379  wafer,
380  trigger_cell);
381  if (validTriggerCell(trigger_cell_id))
382  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
383  }
384  }
385  }
386  return trigger_cell_det_ids;
387 }
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_bh_
ForwardSubdetector
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
std::set< unsigned > geom_ordered_set
Definition: vlib.h:198
unsigned HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellFromCell ( const unsigned  cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 157 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalDetId::cell(), cells_to_trigger_cells_, cells_to_trigger_cells_bh_, HcalDetId::depth(), Exception, DetId::Forward, DetId::Hcal, HcalEndcap, HGCHEB, LEDCalibrationChannels::ieta, HcalDetId::ietaAbs(), LEDCalibrationChannels::iphi, HcalDetId::iphi(), HGCalDetId::layer(), packIetaIphi(), packWaferCellId(), DetId::rawId(), DetId::subdetId(), unpackWaferCellId(), HGCalDetId::wafer(), HGCalDetId::zside(), HcalDetId::zside(), and ecaldqm::zside().

Referenced by getModuleFromCell().

157  {
158  unsigned subdet = 0;
159  int zside = 0;
160  unsigned layer = 0;
161  unsigned wafer_trigger_cell = 0;
162  unsigned trigger_cell = 0;
163  // BH
164  if (DetId(cell_id).det() == DetId::Hcal) {
165  HcalDetId cell_det_id(cell_id);
166  if (cell_det_id.subdetId() != HcalEndcap)
167  return 0;
168  unsigned ieta = cell_det_id.ietaAbs();
169  unsigned iphi = cell_det_id.iphi();
170  layer = cell_det_id.depth();
172  zside = cell_det_id.zside();
173  auto trigger_cell_itr = cells_to_trigger_cells_bh_.find(packIetaIphi(ieta, iphi));
174  if (trigger_cell_itr == cells_to_trigger_cells_bh_.end()) {
175  throw cms::Exception("BadGeometry")
176  << "HGCalTriggerGeometry: Hcal cell ieta=" << ieta << ", iphi=" << iphi
177  << " is not mapped to any trigger cell. The trigger cell mapping should be modified.\n";
178  }
179  trigger_cell = 0;
180  wafer_trigger_cell = 0;
181  unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell);
182  }
183  // EE or FH
184  else if (DetId(cell_id).det() == DetId::Forward) {
185  HGCalDetId cell_det_id(cell_id);
186  subdet = cell_det_id.subdetId();
187  layer = cell_det_id.layer();
188  zside = cell_det_id.zside();
189  unsigned wafer = cell_det_id.wafer();
190  unsigned cell = cell_det_id.cell();
191  auto trigger_cell_itr = cells_to_trigger_cells_.find(packWaferCellId(subdet, wafer, cell));
192  if (trigger_cell_itr == cells_to_trigger_cells_.end()) {
193  throw cms::Exception("BadGeometry")
194  << "HGCalTriggerGeometry: HGCal cell " << cell << " in wafer " << wafer
195  << " is not mapped to any trigger cell. The trigger cell mapping should be modified.\n";
196  }
197  trigger_cell = 0;
198  wafer_trigger_cell = 0;
199  unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell);
200  }
201  return HGCalDetId((ForwardSubdetector)subdet, zside, layer, 1, wafer_trigger_cell, trigger_cell).rawId();
202 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
unsigned packIetaIphi(unsigned ieta, unsigned iphi) const
int zside(DetId const &)
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
ForwardSubdetector
void unpackWaferCellId(unsigned wafer_cell, unsigned &wafer, unsigned &cell) const
unsigned packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_bh_
Definition: DetId.h:17
GlobalPoint HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellPosition ( const unsigned  trigger_cell_det_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 427 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References PV3DBase< T, PVType, FrameType >::basicVector(), HGCalTriggerGeometryBase::bhGeometry(), HGCalTriggerGeometryBase::eeGeometry(), HGCalTriggerGeometryBase::fhGeometry(), getCellsFromTriggerCell(), HcalGeometry::getPosition(), HGCalGeometry::getPosition(), HGCEE, HGCHEB, and DetId::subdetId().

427  {
428  unsigned subdet = HGCalDetId(trigger_cell_det_id).subdetId();
429  // Position: barycenter of the trigger cell.
430  Basic3DVector<float> triggerCellVector(0., 0., 0.);
431  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
432  // BH
433  if (subdet == ForwardSubdetector::HGCHEB) {
434  for (const auto& cell : cell_ids) {
435  HcalDetId cellDetId(cell);
436  triggerCellVector += bhGeometry()->getPosition(cellDetId).basicVector();
437  }
438  }
439  // EE or FH
440  else {
441  for (const auto& cell : cell_ids) {
442  HGCalDetId cellDetId(cell);
443  triggerCellVector += (cellDetId.subdetId() == ForwardSubdetector::HGCEE ? eeGeometry()->getPosition(cellDetId)
444  : fhGeometry()->getPosition(cellDetId))
445  .basicVector();
446  }
447  }
448  return GlobalPoint(triggerCellVector / cell_ids.size());
449 }
const HGCalGeometry * eeGeometry() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPosition(const DetId &id) const
const HGCalGeometry * fhGeometry() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
GlobalPoint getPosition(const DetId &id) const
const HcalGeometry * bhGeometry() const
geom_set getCellsFromTriggerCell(const unsigned) const final
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 305 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCHEB, HGCalDetId::layer(), module_to_wafers_, number_trigger_cells_in_wafers_, number_trigger_cells_in_wafers_bh_, DetId::subdetId(), validTriggerCell(), HGCalDetId::wafer(), and HGCalDetId::zside().

Referenced by getCellsFromModule().

306  {
307  HGCalDetId module_det_id(module_id);
308  geom_set trigger_cell_det_ids;
309  // BH
310  if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
311  unsigned module = module_det_id.wafer();
312  // loop on the trigger cells in each module
313  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_bh_.at(module); trigger_cell++) {
314  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
315  module_det_id.zside(),
316  module_det_id.layer(),
317  1,
318  module,
319  trigger_cell);
320  if (validTriggerCell(trigger_cell_id))
321  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
322  }
323  }
324  // EE or FH
325  else {
326  unsigned module = module_det_id.wafer();
327  auto wafer_itrs = module_to_wafers_.equal_range(module);
328  // loop on the wafers included in the module
329  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
330  unsigned wafer = wafer_itr->second;
331  // loop on the trigger cells in each wafer
332  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer); trigger_cell++) {
333  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
334  module_det_id.zside(),
335  module_det_id.layer(),
336  1,
337  wafer,
338  trigger_cell);
339  if (validTriggerCell(trigger_cell_id))
340  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
341  }
342  }
343  }
344  return trigger_cell_det_ids;
345 }
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_bh_
ForwardSubdetector
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
std::unordered_set< unsigned > geom_set
Definition: vlib.h:198
void HGCalTriggerGeometryHexLayerBasedImp1::initialize ( const CaloGeometry calo_geometry)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 126 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References bhOffset_, HGCalTriggerGeometryBase::bhTopology(), HGCalTopology::dddConstants(), HcalTopology::dddConstants(), disconnected_layers_, HGCalTriggerGeometryBase::eeTopology(), fhOffset_, HGCalTriggerGeometryBase::fhTopology(), fillInvalidTriggerCells(), fillMaps(), fillNeighborMaps(), HcalDDDRecConstants::getMaxDepth(), l1tCellNeighborsBHMapping_, l1tCellNeighborsMapping_, last_trigger_layer_, HGCalDDDConstants::layers(), HGCalTriggerGeometryBase::setCaloGeometry(), totalLayers_, trigger_cell_neighbors_, trigger_cell_neighbors_bh_, and trigger_layers_.

126  {
127  setCaloGeometry(calo_geometry);
131  trigger_layers_.resize(totalLayers_ + 1);
132  trigger_layers_[0] = 0; // layer number 0 doesn't exist
133  unsigned trigger_layer = 1;
134  for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) {
135  if (disconnected_layers_.find(layer) == disconnected_layers_.end()) {
136  // Increase trigger layer number if the layer is not disconnected
137  trigger_layers_[layer] = trigger_layer;
138  trigger_layer++;
139  } else {
140  trigger_layers_[layer] = 0;
141  }
142  }
143  last_trigger_layer_ = trigger_layer - 1;
144  fillMaps();
148 }
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:164
const HGCalTopology & eeTopology() const
void fillNeighborMaps(const edm::FileInPath &, std::unordered_map< int, std::set< std::pair< short, short >>> &)
unsigned int layers(bool reco) const
const HcalTopology & bhTopology() const
void setCaloGeometry(const CaloGeometry *geom)
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:96
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_bh_
int getMaxDepth(const int &type) const
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_
const HGCalTopology & fhTopology() const
void HGCalTriggerGeometryHexLayerBasedImp1::initialize ( const HGCalGeometry hgc_ee_geometry,
const HGCalGeometry hgc_hsi_geometry,
const HGCalGeometry hgc_hsc_geometry 
)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 150 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References Exception.

152  {
153  throw cms::Exception("BadGeometry")
154  << "HGCalTriggerGeometryHexLayerBasedImp1 geometry cannot be initialized with the V9 HGCAL geometry";
155 }
unsigned HGCalTriggerGeometryHexLayerBasedImp1::lastTriggerLayer ( ) const
inlinefinalvirtual
unsigned HGCalTriggerGeometryHexLayerBasedImp1::layerWithOffset ( unsigned  id) const
private

Definition at line 735 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References bhOffset_, DEFINE_EDM_PLUGIN, fhOffset_, HGCEE, HGCHEB, HGCHEF, HGCalDetId::layer(), and DetId::subdetId().

Referenced by disconnectedModule(), and triggerLayer().

735  {
736  HGCalDetId detid(id);
737  unsigned layer = 0;
738  switch (detid.subdetId()) {
740  layer = detid.layer();
741  break;
743  layer = fhOffset_ + detid.layer();
744  break;
746  layer = bhOffset_ + detid.layer();
747  break;
748  };
749  return layer;
750 }
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packIetaIphi ( unsigned  ieta,
unsigned  iphi 
) const
private

Definition at line 635 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HcalDetId::kHcalEtaMask2, HcalDetId::kHcalEtaOffset2, and HcalDetId::kHcalPhiMask2.

Referenced by fillMaps(), and getTriggerCellFromCell().

635  {
636  unsigned packed_value = 0;
637  packed_value |= (iphi & HcalDetId::kHcalPhiMask2);
639  return packed_value;
640 }
static uint32_t kHcalEtaMask2
Definition: HcalDetId.h:19
static uint32_t kHcalPhiMask2
Definition: HcalDetId.h:15
static uint32_t kHcalEtaOffset2
Definition: HcalDetId.h:17
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packTriggerCell ( unsigned  module,
unsigned  trigger_cell 
) const
private

Definition at line 710 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalDetId::kHGCalCellMask, HGCalDetId::kHGCalCellOffset, HGCalDetId::kHGCalWaferMask, and HGCalDetId::kHGCalWaferOffset.

Referenced by fillNeighborMaps(), and getNeighborsFromTriggerCell().

710  {
711  unsigned packed_value = 0;
712  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
714  return packed_value;
715 }
static const int kHGCalCellOffset
Definition: HGCalDetId.h:10
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
Definition: vlib.h:198
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packWaferCellId ( unsigned  subdet,
unsigned  wafer,
unsigned  cell 
) const
private

Definition at line 626 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalDetId::kHGCalCellMask, HGCalDetId::kHGCalCellOffset, HGCalDetId::kHGCalWaferMask, HGCalDetId::kHGCalWaferOffset, and HGCalDetId::kHGCalWaferTypeOffset.

Referenced by fillMaps(), getCellsFromTriggerCell(), and getTriggerCellFromCell().

626  {
627  unsigned packed_value = 0;
628  const int kSubdetMask = 0x7;
629  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
630  packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset);
631  packed_value |= ((subdet & kSubdetMask) << (HGCalDetId::kHGCalWaferTypeOffset));
632  return packed_value;
633 }
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:14
static const int kHGCalCellOffset
Definition: HGCalDetId.h:10
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
void HGCalTriggerGeometryHexLayerBasedImp1::reset ( void  )
finalvirtual

Reimplemented from HGCalTriggerGeometryBase.

Definition at line 113 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References cells_to_trigger_cells_, cells_to_trigger_cells_bh_, module_to_wafers_, number_trigger_cells_in_wafers_, number_trigger_cells_in_wafers_bh_, trigger_cell_neighbors_, trigger_cell_neighbors_bh_, trigger_cells_to_cells_, trigger_cells_to_cells_bh_, and wafer_to_module_.

113  {
114  cells_to_trigger_cells_.clear();
115  trigger_cells_to_cells_.clear();
118  wafer_to_module_.clear();
119  module_to_wafers_.clear();
122  trigger_cell_neighbors_.clear();
124 }
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_bh_
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_bh_
std::unordered_map< unsigned, unsigned > wafer_to_module_
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_bh_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_bh_
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_
unsigned HGCalTriggerGeometryHexLayerBasedImp1::triggerLayer ( const unsigned  id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 667 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References layerWithOffset(), and trigger_layers_.

Referenced by lastTriggerLayer().

667  {
668  unsigned layer = layerWithOffset(id);
669  if (layer >= trigger_layers_.size())
670  return 0;
671  return trigger_layers_[layer];
672 }
void HGCalTriggerGeometryHexLayerBasedImp1::unpackIetaIphi ( unsigned  ieta_iphi,
unsigned &  ieta,
unsigned &  iphi 
) const
private
void HGCalTriggerGeometryHexLayerBasedImp1::unpackWaferCellId ( unsigned  wafer_cell,
unsigned &  wafer,
unsigned &  cell 
) const
private

Definition at line 642 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalDetId::kHGCalCellMask, HGCalDetId::kHGCalWaferMask, and HGCalDetId::kHGCalWaferOffset.

Referenced by getCellsFromTriggerCell(), and getTriggerCellFromCell().

644  {
645  cell = wafer_cell & HGCalDetId::kHGCalCellMask;
647 }
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
bool HGCalTriggerGeometryHexLayerBasedImp1::validCellId ( unsigned  subdet,
unsigned  cell_id 
) const
private

Definition at line 691 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalTriggerGeometryBase::bhTopology(), HGCalTriggerGeometryBase::eeTopology(), HGCalTriggerGeometryBase::fhTopology(), HGCEE, HGCHEB, HGCHEF, matching::is_valid(), HcalTopology::valid(), and HGCalTopology::valid().

Referenced by getCellsFromTriggerCell(), and validTriggerCellFromCells().

691  {
692  bool is_valid = false;
693  switch (subdet) {
695  is_valid = eeTopology().valid(cell_id);
696  break;
698  is_valid = fhTopology().valid(cell_id);
699  break;
701  is_valid = bhTopology().valid(cell_id);
702  break;
703  default:
704  is_valid = false;
705  break;
706  }
707  return is_valid;
708 }
bool valid(const DetId &id) const override
bool is_valid(const Digi &d)
Definition: GenericDigi.h:64
const HGCalTopology & eeTopology() const
const HcalTopology & bhTopology() const
bool valid(const DetId &id) const override
Is this a valid cell id.
const HGCalTopology & fhTopology() const
bool HGCalTriggerGeometryHexLayerBasedImp1::validTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual
bool HGCalTriggerGeometryHexLayerBasedImp1::validTriggerCellFromCells ( const unsigned  trigger_cell_id) const
private

Definition at line 674 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References postprocess-scan-build::cells, getCellsFromTriggerCell(), matching::is_valid(), DetId::subdetId(), and validCellId().

Referenced by fillInvalidTriggerCells().

674  {
675  // Check the validity of a trigger cell with the
676  // validity of the cells. One valid cell in the
677  // trigger cell is enough to make the trigger cell
678  // valid.
679  HGCalDetId trigger_cell_det_id(trigger_cell_id);
680  unsigned subdet = trigger_cell_det_id.subdetId();
681  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
682  bool is_valid = false;
683  for (const auto cell_id : cells) {
684  is_valid |= validCellId(subdet, cell_id);
685  if (is_valid)
686  break;
687  }
688  return is_valid;
689 }
bool is_valid(const Digi &d)
Definition: GenericDigi.h:64
bool validCellId(unsigned subdet, unsigned cell_id) const
geom_set getCellsFromTriggerCell(const unsigned) const final
std::unordered_set< unsigned > geom_set

Member Data Documentation

unsigned HGCalTriggerGeometryHexLayerBasedImp1::bhOffset_ = 0
private

Definition at line 80 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize(), and layerWithOffset().

std::unordered_map<unsigned, unsigned> HGCalTriggerGeometryHexLayerBasedImp1::cells_to_trigger_cells_
private
std::unordered_map<unsigned, unsigned> HGCalTriggerGeometryHexLayerBasedImp1::cells_to_trigger_cells_bh_
private
std::unordered_set<unsigned> HGCalTriggerGeometryHexLayerBasedImp1::disconnected_layers_
private
std::unordered_set<unsigned> HGCalTriggerGeometryHexLayerBasedImp1::disconnected_modules_
private
unsigned HGCalTriggerGeometryHexLayerBasedImp1::fhOffset_ = 0
private

Definition at line 79 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize(), and layerWithOffset().

std::unordered_set<unsigned> HGCalTriggerGeometryHexLayerBasedImp1::invalid_triggercells_
private
edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellNeighborsBHMapping_
private

Definition at line 50 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellNeighborsMapping_
private

Definition at line 49 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellsBHMapping_
private

Definition at line 47 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellsMapping_
private

Definition at line 46 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tModulesMapping_
private

Definition at line 48 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

unsigned HGCalTriggerGeometryHexLayerBasedImp1::last_trigger_layer_ = 0
private

Definition at line 76 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize(), and lastTriggerLayer().

std::unordered_multimap<unsigned, unsigned> HGCalTriggerGeometryHexLayerBasedImp1::module_to_wafers_
private
std::unordered_map<unsigned, unsigned short> HGCalTriggerGeometryHexLayerBasedImp1::number_trigger_cells_in_wafers_
private
std::unordered_map<unsigned, unsigned short> HGCalTriggerGeometryHexLayerBasedImp1::number_trigger_cells_in_wafers_bh_
private
unsigned HGCalTriggerGeometryHexLayerBasedImp1::totalLayers_ = 0
private

Definition at line 81 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

std::unordered_map<int, std::set<std::pair<short, short> > > HGCalTriggerGeometryHexLayerBasedImp1::trigger_cell_neighbors_
private
std::unordered_map<int, std::set<std::pair<short, short> > > HGCalTriggerGeometryHexLayerBasedImp1::trigger_cell_neighbors_bh_
private
std::unordered_multimap<unsigned, unsigned> HGCalTriggerGeometryHexLayerBasedImp1::trigger_cells_to_cells_
private
std::unordered_multimap<unsigned, unsigned> HGCalTriggerGeometryHexLayerBasedImp1::trigger_cells_to_cells_bh_
private
std::vector<unsigned> HGCalTriggerGeometryHexLayerBasedImp1::trigger_layers_
private

Definition at line 75 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize(), and triggerLayer().

std::unordered_map<unsigned, unsigned> HGCalTriggerGeometryHexLayerBasedImp1::wafer_to_module_
private