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 getModuleFromCell (const unsigned) const final
 
unsigned getModuleFromTriggerCell (const unsigned) const final
 
GlobalPoint getModulePosition (const unsigned) 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 edm::ESHandle< CaloGeometry > &) final
 
void initialize (const edm::ESHandle< HGCalGeometry > &, const edm::ESHandle< HGCalGeometry > &, const edm::ESHandle< HGCalGeometry > &) 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 edm::ESHandle< CaloGeometry > & caloGeometry () 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_
 
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_
 
std::unordered_set< unsigned > invalid_triggercells_
 
edm::FileInPath l1tCellNeighborsBHMapping_
 
edm::FileInPath l1tCellNeighborsMapping_
 
edm::FileInPath l1tCellsBHMapping_
 
edm::FileInPath l1tCellsMapping_
 
edm::FileInPath l1tModulesMapping_
 
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_
 
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 edm::ESHandle< CaloGeometry > &geom)
 
void setEEGeometry (const edm::ESHandle< HGCalGeometry > &geom)
 
void setHScGeometry (const edm::ESHandle< HGCalGeometry > &geom)
 
void setHSiGeometry (const edm::ESHandle< HGCalGeometry > &geom)
 

Detailed Description

Definition at line 13 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Constructor & Destructor Documentation

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

Definition at line 97 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

99  l1tCellsMapping_(conf.getParameter<edm::FileInPath>("L1TCellsMapping")),
100  l1tCellsBHMapping_(conf.getParameter<edm::FileInPath>("L1TCellsBHMapping")),
101  l1tModulesMapping_(conf.getParameter<edm::FileInPath>("L1TModulesMapping")),
102  l1tCellNeighborsMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsMapping")),
103  l1tCellNeighborsBHMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsBHMapping")) {
104  std::vector<unsigned> tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedModules");
105  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_modules_, disconnected_modules_.end()));
106  tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedLayers");
107  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end()));
108 }
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 709 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell().

709  {
710  int wafer_type = 0;
711  switch (subdet) {
712  // HGCalDDDConstants::waferTypeT() returns 2=coarse, 1=fine
713  // HGCalDetId::waferType() returns -1=coarse, 1=fine
714  // Convert to HGCalDetId waferType
716  wafer_type = (eeTopology().dddConstants().waferTypeT(wafer) == 2 ? -1 : 1);
717  break;
719  wafer_type = (fhTopology().dddConstants().waferTypeT(wafer) == 2 ? -1 : 1);
720  break;
721  default:
722  break;
723  };
724  return wafer_type;
725 }
const HGCalTopology & eeTopology() const
const HGCalDDDConstants & dddConstants() const
int waferTypeT(int wafer) const
const HGCalTopology & fhTopology() const
bool HGCalTriggerGeometryHexLayerBasedImp1::disconnectedModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 650 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References disconnected_layers_, disconnected_modules_, and layerWithOffset().

650  {
651  bool disconnected = false;
652  if (disconnected_modules_.find(HGCalDetId(module_id).wafer()) != disconnected_modules_.end())
653  disconnected = true;
654  if (disconnected_layers_.find(layerWithOffset(module_id)) != disconnected_layers_.end())
655  disconnected = true;
656  return disconnected;
657 }
void HGCalTriggerGeometryHexLayerBasedImp1::fillInvalidTriggerCells ( )
private

Definition at line 593 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().

593  {
594  unsigned n_layers_ee = eeTopology().dddConstants().layers(true);
595  for (unsigned layer = 1; layer <= n_layers_ee; layer++) {
596  for (const auto& wafer_module : wafer_to_module_) {
597  unsigned wafer = wafer_module.first;
598  // loop on the trigger cells in each wafer
599  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer); trigger_cell++) {
600  std::set<unsigned> trigger_cell_ids;
601  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, -1, layer, 1, wafer, trigger_cell));
602  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, 1, layer, 1, wafer, trigger_cell));
603  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, -1, layer, 1, wafer, trigger_cell));
604  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, 1, layer, 1, wafer, trigger_cell));
605  for (unsigned trigger_cell : trigger_cell_ids) {
606  if (!validTriggerCellFromCells(trigger_cell))
607  invalid_triggercells_.emplace(trigger_cell);
608  for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell)) {
609  if (!validTriggerCellFromCells(neighbor))
610  invalid_triggercells_.emplace(neighbor);
611  }
612  }
613  }
614  }
615  }
616 }
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
geom_set getNeighborsFromTriggerCell(const unsigned) const final
void HGCalTriggerGeometryHexLayerBasedImp1::fillMaps ( )
private

Definition at line 467 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References cells_to_trigger_cells_, cells_to_trigger_cells_bh_, Exception, edm::FileInPath::fullPath(), HGCHEB, 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().

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

Definition at line 537 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().

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

Implements HGCalTriggerGeometryBase.

Definition at line 279 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getModulePosition().

280  {
281  geom_set cell_det_ids;
282  geom_set trigger_cells = getTriggerCellsFromModule(module_id);
283  for (auto trigger_cell_id : trigger_cells) {
284  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
285  cell_det_ids.insert(cells.begin(), cells.end());
286  }
287  return cell_det_ids;
288 }
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 233 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalDetId::cell(), detIdWaferType(), HcalEndcap, HGCHEB, 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().

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

Implements HGCalTriggerGeometryBase.

Definition at line 204 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().

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

Implements HGCalTriggerGeometryBase.

Definition at line 443 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().

443  {
444  unsigned subdet = HGCalDetId(module_det_id).subdetId();
445  // Position: barycenter of the module.
446  Basic3DVector<float> moduleVector(0., 0., 0.);
447  const auto cell_ids = getCellsFromModule(module_det_id);
448  // BH
449  if (subdet == ForwardSubdetector::HGCHEB) {
450  for (const auto& cell : cell_ids) {
451  HcalDetId cellDetId(cell);
452  moduleVector += bhGeometry()->getPosition(cellDetId).basicVector();
453  }
454  }
455  // EE or FH
456  else {
457  for (const auto& cell : cell_ids) {
458  HGCalDetId cellDetId(cell);
459  moduleVector += (cellDetId.subdetId() == ForwardSubdetector::HGCEE ? eeGeometry()->getPosition(cellDetId)
460  : fhGeometry()->getPosition(cellDetId))
461  .basicVector();
462  }
463  }
464  return GlobalPoint(moduleVector / cell_ids.size());
465 }
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:41
GlobalPoint getPosition(const DetId &id) const
const HcalGeometry * bhGeometry() const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getNeighborsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 385 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().

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

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

291  {
292  geom_ordered_set cell_det_ids;
293  geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id);
294  for (auto trigger_cell_id : trigger_cells) {
295  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
296  cell_det_ids.insert(cells.begin(), cells.end());
297  }
298  return cell_det_ids;
299 }
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 343 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().

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

Implements HGCalTriggerGeometryBase.

Definition at line 153 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, HcalDetId::ietaAbs(), HcalDetId::iphi(), HGCalDetId::layer(), packIetaIphi(), packWaferCellId(), DetId::rawId(), DetId::subdetId(), unpackWaferCellId(), HGCalDetId::wafer(), HGCalDetId::zside(), HcalDetId::zside(), and ecaldqm::zside().

Referenced by getModuleFromCell().

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

Implements HGCalTriggerGeometryBase.

Definition at line 419 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().

419  {
420  unsigned subdet = HGCalDetId(trigger_cell_det_id).subdetId();
421  // Position: barycenter of the trigger cell.
422  Basic3DVector<float> triggerCellVector(0., 0., 0.);
423  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
424  // BH
425  if (subdet == ForwardSubdetector::HGCHEB) {
426  for (const auto& cell : cell_ids) {
427  HcalDetId cellDetId(cell);
428  triggerCellVector += bhGeometry()->getPosition(cellDetId).basicVector();
429  }
430  }
431  // EE or FH
432  else {
433  for (const auto& cell : cell_ids) {
434  HGCalDetId cellDetId(cell);
435  triggerCellVector += (cellDetId.subdetId() == ForwardSubdetector::HGCEE ? eeGeometry()->getPosition(cellDetId)
436  : fhGeometry()->getPosition(cellDetId))
437  .basicVector();
438  }
439  }
440  return GlobalPoint(triggerCellVector / cell_ids.size());
441 }
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:41
GlobalPoint getPosition(const DetId &id) const
const HcalGeometry * bhGeometry() const
geom_set getCellsFromTriggerCell(const unsigned) const final
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 301 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().

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

Implements HGCalTriggerGeometryBase.

Definition at line 123 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_, HGCalDDDConstants::layers(), HGCalTriggerGeometryBase::setCaloGeometry(), totalLayers_, trigger_cell_neighbors_, trigger_cell_neighbors_bh_, and trigger_layers_.

123  {
124  setCaloGeometry(calo_geometry);
128  trigger_layers_.resize(totalLayers_ + 1);
129  trigger_layers_[0] = 0; // layer number 0 doesn't exist
130  unsigned trigger_layer = 1;
131  for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) {
132  if (disconnected_layers_.find(layer) == disconnected_layers_.end()) {
133  // Increase trigger layer number if the layer is not disconnected
134  trigger_layers_[layer] = trigger_layer;
135  trigger_layer++;
136  } else {
137  trigger_layers_[layer] = 0;
138  }
139  }
140  fillMaps();
144 }
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:168
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 edm::ESHandle< CaloGeometry > &geom)
const HGCalDDDConstants & dddConstants() const
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 edm::ESHandle< HGCalGeometry > &  hgc_ee_geometry,
const edm::ESHandle< HGCalGeometry > &  hgc_hsi_geometry,
const edm::ESHandle< HGCalGeometry > &  hgc_hsc_geometry 
)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 146 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References Exception.

148  {
149  throw cms::Exception("BadGeometry")
150  << "HGCalTriggerGeometryHexLayerBasedImp1 geometry cannot be initialized with the V9 HGCAL geometry";
151 }
unsigned HGCalTriggerGeometryHexLayerBasedImp1::layerWithOffset ( unsigned  id) const
private

Definition at line 727 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by disconnectedModule(), and triggerLayer().

727  {
728  HGCalDetId detid(id);
729  unsigned layer = 0;
730  switch (detid.subdetId()) {
732  layer = detid.layer();
733  break;
735  layer = fhOffset_ + detid.layer();
736  break;
738  layer = bhOffset_ + detid.layer();
739  break;
740  };
741  return layer;
742 }
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packIetaIphi ( unsigned  ieta,
unsigned  iphi 
) const
private

Definition at line 627 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by fillMaps(), and getTriggerCellFromCell().

627  {
628  unsigned packed_value = 0;
629  packed_value |= (iphi & HcalDetId::kHcalPhiMask2);
630  packed_value |= ((ieta & HcalDetId::kHcalEtaMask2) << HcalDetId::kHcalEtaOffset2);
631  return packed_value;
632 }
static uint32_t kHcalEtaMask2
Definition: HcalDetId.h:21
static uint32_t kHcalPhiMask2
Definition: HcalDetId.h:17
static uint32_t kHcalEtaOffset2
Definition: HcalDetId.h:19
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packTriggerCell ( unsigned  module,
unsigned  trigger_cell 
) const
private

Definition at line 702 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by fillNeighborMaps(), and getNeighborsFromTriggerCell().

702  {
703  unsigned packed_value = 0;
704  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
706  return packed_value;
707 }
static const int kHGCalCellOffset
Definition: HGCalDetId.h:12
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:14
Definition: vlib.h:208
static const int kHGCalWaferMask
Definition: HGCalDetId.h:15
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packWaferCellId ( unsigned  subdet,
unsigned  wafer,
unsigned  cell 
) const
private

Definition at line 618 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

618  {
619  unsigned packed_value = 0;
620  const int kSubdetMask = 0x7;
621  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
622  packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset);
623  packed_value |= ((subdet & kSubdetMask) << (HGCalDetId::kHGCalWaferTypeOffset));
624  return packed_value;
625 }
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:16
static const int kHGCalCellOffset
Definition: HGCalDetId.h:12
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:14
static const int kHGCalWaferMask
Definition: HGCalDetId.h:15
void HGCalTriggerGeometryHexLayerBasedImp1::reset ( void  )
finalvirtual

Reimplemented from HGCalTriggerGeometryBase.

Definition at line 110 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_.

110  {
111  cells_to_trigger_cells_.clear();
112  trigger_cells_to_cells_.clear();
115  wafer_to_module_.clear();
116  module_to_wafers_.clear();
119  trigger_cell_neighbors_.clear();
121 }
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 659 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References layerWithOffset(), and trigger_layers_.

659  {
660  unsigned layer = layerWithOffset(id);
661  if (layer >= trigger_layers_.size())
662  return 0;
663  return trigger_layers_[layer];
664 }
void HGCalTriggerGeometryHexLayerBasedImp1::unpackIetaIphi ( unsigned  ieta_iphi,
unsigned &  ieta,
unsigned &  iphi 
) const
private

Definition at line 641 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell().

641  {
642  iphi = ieta_iphi & HcalDetId::kHcalPhiMask2;
644 }
static uint32_t kHcalEtaMask2
Definition: HcalDetId.h:21
static uint32_t kHcalPhiMask2
Definition: HcalDetId.h:17
static uint32_t kHcalEtaOffset2
Definition: HcalDetId.h:19
void HGCalTriggerGeometryHexLayerBasedImp1::unpackWaferCellId ( unsigned  wafer_cell,
unsigned &  wafer,
unsigned &  cell 
) const
private

Definition at line 634 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell(), and getTriggerCellFromCell().

636  {
637  cell = wafer_cell & HGCalDetId::kHGCalCellMask;
639 }
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:14
static const int kHGCalWaferMask
Definition: HGCalDetId.h:15
bool HGCalTriggerGeometryHexLayerBasedImp1::validCellId ( unsigned  subdet,
unsigned  cell_id 
) const
private

Definition at line 683 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().

683  {
684  bool is_valid = false;
685  switch (subdet) {
687  is_valid = eeTopology().valid(cell_id);
688  break;
690  is_valid = fhTopology().valid(cell_id);
691  break;
693  is_valid = bhTopology().valid(cell_id);
694  break;
695  default:
696  is_valid = false;
697  break;
698  }
699  return is_valid;
700 }
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 666 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by fillInvalidTriggerCells().

666  {
667  // Check the validity of a trigger cell with the
668  // validity of the cells. One valid cell in the
669  // trigger cell is enough to make the trigger cell
670  // valid.
671  HGCalDetId trigger_cell_det_id(trigger_cell_id);
672  unsigned subdet = trigger_cell_det_id.subdetId();
673  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
674  bool is_valid = false;
675  for (const auto cell_id : cells) {
676  is_valid |= validCellId(subdet, cell_id);
677  if (is_valid)
678  break;
679  }
680  return is_valid;
681 }
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_
private

Definition at line 77 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_
private

Definition at line 76 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 48 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellNeighborsMapping_
private

Definition at line 47 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellsBHMapping_
private

Definition at line 45 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellsMapping_
private

Definition at line 44 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tModulesMapping_
private

Definition at line 46 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

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_
private

Definition at line 78 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 73 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize(), and triggerLayer().

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