CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCalTriggerGeometryHexImp2 Class Reference
Inheritance diagram for HGCalTriggerGeometryHexImp2:
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
 
 HGCalTriggerGeometryHexImp2 (const edm::ParameterSet &conf)
 
void initialize (const CaloGeometry *) final
 
void initialize (const HGCalGeometry *, const HGCalGeometry *, const HGCalGeometry *) final
 
void initialize (const HGCalGeometry *, const HGCalGeometry *, const HGCalGeometry *, const HGCalGeometry *) final
 
unsigned lastTriggerLayer () const final
 
void reset () final
 
unsigned triggerLayer (const unsigned) const final
 
bool validCell (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
 
bool isWithNoseGeometry () const
 
const std::string & name () const
 
const HGCalGeometrynoseGeometry () const
 
const HGCalTopologynoseTopology () const
 
void setWithNoseGeometry (const bool isNose)
 
virtual ~HGCalTriggerGeometryBase ()
 

Private Member Functions

int detIdWaferType (unsigned subdet, short wafer) const
 
void fillInvalidTriggerCells ()
 
void fillMaps ()
 
void fillNeighborMaps ()
 
unsigned packTriggerCell (unsigned, const std::vector< int > &) const
 
bool validCellId (unsigned subdet, unsigned cell_id) const
 
bool validTriggerCellFromCells (const unsigned) const
 

Private Attributes

std::map< std::pair< short, short >, short > cells_to_trigger_cells_
 
std::unordered_set< unsigned > invalid_triggercells_
 
edm::FileInPath l1tCellNeighborsMapping_
 
edm::FileInPath l1tCellsMapping_
 
edm::FileInPath l1tModulesMapping_
 
edm::FileInPath l1tWaferNeighborsMapping_
 
std::unordered_multimap< short, short > module_to_wafers_ee_
 
std::unordered_multimap< short, short > module_to_wafers_fh_
 
std::unordered_map< short, short > number_cells_in_wafers_
 
std::unordered_map< short, short > number_trigger_cells_in_wafers_
 
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_
 
std::multimap< std::pair< short, short >, short > trigger_cells_to_cells_
 
std::unordered_map< short, std::vector< short > > wafer_neighbors_ee_
 
std::unordered_map< short, std::vector< short > > wafer_neighbors_fh_
 
std::unordered_map< short, short > wafer_to_module_ee_
 
std::unordered_map< short, short > wafer_to_module_fh_
 

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)
 
void setNoseGeometry (const HGCalGeometry *geom)
 

Detailed Description

Definition at line 12 of file HGCalTriggerGeometryHexImp2.cc.

Constructor & Destructor Documentation

◆ HGCalTriggerGeometryHexImp2()

HGCalTriggerGeometryHexImp2::HGCalTriggerGeometryHexImp2 ( const edm::ParameterSet conf)

Definition at line 90 of file HGCalTriggerGeometryHexImp2.cc.

92  l1tCellsMapping_(conf.getParameter<edm::FileInPath>("L1TCellsMapping")),
93  l1tCellNeighborsMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsMapping")),
94  l1tWaferNeighborsMapping_(conf.getParameter<edm::FileInPath>("L1TWaferNeighborsMapping")),
95  l1tModulesMapping_(conf.getParameter<edm::FileInPath>("L1TModulesMapping")) {}

Member Function Documentation

◆ detIdWaferType()

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

Definition at line 738 of file HGCalTriggerGeometryHexImp2.cc.

738  {
739  int wafer_type = 0;
740  switch (subdet) {
741  // HGCalDDDConstants::waferTypeT() returns 2=coarse, 1=fine
742  // HGCalDetId::waferType() returns -1=coarse, 1=fine
743  // Convert to HGCalDetId waferType
745  wafer_type = (eeTopology().dddConstants().waferTypeT(wafer) == 2 ? -1 : 1);
746  break;
748  wafer_type = (fhTopology().dddConstants().waferTypeT(wafer) == 2 ? -1 : 1);
749  break;
750  default:
751  break;
752  };
753  return wafer_type;
754 }

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

Referenced by fillInvalidTriggerCells(), fillMaps(), getCellsFromModule(), getNeighborsFromTriggerCell(), getOrderedCellsFromModule(), getOrderedTriggerCellsFromModule(), and getTriggerCellsFromModule().

◆ disconnectedModule()

bool HGCalTriggerGeometryHexImp2::disconnectedModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 786 of file HGCalTriggerGeometryHexImp2.cc.

786 { return false; }

◆ fillInvalidTriggerCells()

void HGCalTriggerGeometryHexImp2::fillInvalidTriggerCells ( )
private

Definition at line 691 of file HGCalTriggerGeometryHexImp2.cc.

691  {
692  unsigned n_layers_ee = eeTopology().dddConstants().layers(true);
693  for (unsigned layer = 1; layer <= n_layers_ee; layer++) {
694  for (const auto& wafer_module : wafer_to_module_ee_) {
695  unsigned wafer = wafer_module.first;
696  int wafer_type = detIdWaferType(ForwardSubdetector::HGCEE, wafer);
697  // loop on the trigger cells in each wafer
698  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++) {
699  HGCalDetId trigger_cell_id_neg(ForwardSubdetector::HGCEE, -1, layer, wafer_type, wafer, trigger_cell);
700  HGCalDetId trigger_cell_id_pos(ForwardSubdetector::HGCEE, 1, layer, wafer_type, wafer, trigger_cell);
701  if (!validTriggerCellFromCells(trigger_cell_id_neg))
702  invalid_triggercells_.emplace(trigger_cell_id_neg.rawId());
703  if (!validTriggerCellFromCells(trigger_cell_id_pos))
704  invalid_triggercells_.emplace(trigger_cell_id_pos.rawId());
705  }
706  }
707  }
708  unsigned n_layers_fh = fhTopology().dddConstants().layers(true);
709  for (unsigned layer = 1; layer <= n_layers_fh; layer++) {
710  for (const auto& wafer_module : wafer_to_module_fh_) {
711  unsigned wafer = wafer_module.first;
712  int wafer_type = detIdWaferType(ForwardSubdetector::HGCHEF, wafer);
713  // loop on the trigger cells in each wafer
714  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++) {
715  HGCalDetId trigger_cell_id_neg(ForwardSubdetector::HGCHEF, -1, layer, wafer_type, wafer, trigger_cell);
716  HGCalDetId trigger_cell_id_pos(ForwardSubdetector::HGCHEF, 1, layer, wafer_type, wafer, trigger_cell);
717  if (!validTriggerCellFromCells(trigger_cell_id_neg))
718  invalid_triggercells_.emplace(trigger_cell_id_neg.rawId());
719  if (!validTriggerCellFromCells(trigger_cell_id_pos))
720  invalid_triggercells_.emplace(trigger_cell_id_pos.rawId());
721  }
722  }
723  }
724 }

References HGCalTopology::dddConstants(), detIdWaferType(), HGCalTriggerGeometryBase::eeTopology(), HGCalTriggerGeometryBase::fhTopology(), HGCEE, HGCHEF, invalid_triggercells_, HGCalDDDConstants::layers(), number_trigger_cells_in_wafers_, DetId::rawId(), validTriggerCellFromCells(), wafer_to_module_ee_, and wafer_to_module_fh_.

Referenced by initialize().

◆ fillMaps()

void HGCalTriggerGeometryHexImp2::fillMaps ( )
private

Definition at line 535 of file HGCalTriggerGeometryHexImp2.cc.

535  {
536  //
537  // read module mapping file
538  std::ifstream l1tModulesMappingStream(l1tModulesMapping_.fullPath());
539  if (!l1tModulesMappingStream.is_open()) {
540  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TModulesMapping file\n";
541  }
542  short subdet = 0;
543  short wafer = 0;
544  short module = 0;
545  for (; l1tModulesMappingStream >> subdet >> wafer >> module;) {
546  int wafer_type = detIdWaferType(subdet, wafer);
547  switch (subdet) {
549  // fill module <-> wafers mappings
550  wafer_to_module_ee_.emplace(wafer, module);
551  module_to_wafers_ee_.emplace(module, wafer);
552  // fill number of cells for a given wafer type
553  number_cells_in_wafers_.emplace(wafer_type, eeTopology().dddConstants().numberCellsHexagon(wafer));
554  break;
555  }
557  // fill module <-> wafers mappings
558  wafer_to_module_fh_.emplace(wafer, module);
559  module_to_wafers_fh_.emplace(module, wafer);
560  // fill number of cells for a given wafer type
561  number_cells_in_wafers_.emplace(wafer_type, fhTopology().dddConstants().numberCellsHexagon(wafer));
562  break;
563  }
564  default:
565  edm::LogWarning("HGCalTriggerGeometry")
566  << "Unsupported subdetector number (" << subdet << ") in L1TModulesMapping file\n";
567  break;
568  }
569  }
570  if (!l1tModulesMappingStream.eof())
571  edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TModulesMapping '" << wafer << " " << module << "' \n";
572  l1tModulesMappingStream.close();
573  // read trigger cell mapping file
574  std::ifstream l1tCellsMappingStream(l1tCellsMapping_.fullPath());
575  if (!l1tCellsMappingStream.is_open()) {
576  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsMapping file\n";
577  }
578  short waferType = 0;
579  short cell = 0;
580  short triggerCell = 0;
581  for (; l1tCellsMappingStream >> waferType >> cell >> triggerCell;) {
582  // fill cell <-> trigger cell mappings
583  cells_to_trigger_cells_.emplace(std::make_pair((waferType ? 1 : -1), cell), triggerCell);
584  trigger_cells_to_cells_.emplace(std::make_pair((waferType ? 1 : -1), triggerCell), cell);
585  // fill number of cells for a given wafer type
586  auto itr_insert = number_trigger_cells_in_wafers_.emplace((waferType ? 1 : -1), 0);
587  if (triggerCell + 1 > itr_insert.first->second)
588  itr_insert.first->second = triggerCell + 1;
589  }
590  if (!l1tCellsMappingStream.eof())
591  edm::LogWarning("HGCalTriggerGeometry")
592  << "Error reading L1TCellsMapping'" << waferType << " " << cell << " " << triggerCell << "' \n";
593  l1tCellsMappingStream.close();
594 }

References cells_to_trigger_cells_, detIdWaferType(), HGCalTriggerGeometryBase::eeTopology(), Exception, HGCalTriggerGeometryBase::fhTopology(), edm::FileInPath::fullPath(), HGCEE, HGCHEF, l1tCellsMapping_, l1tModulesMapping_, module_to_wafers_ee_, module_to_wafers_fh_, number_cells_in_wafers_, number_trigger_cells_in_wafers_, trigger_cells_to_cells_, wafer_to_module_ee_, and wafer_to_module_fh_.

Referenced by initialize().

◆ fillNeighborMaps()

void HGCalTriggerGeometryHexImp2::fillNeighborMaps ( )
private

Definition at line 596 of file HGCalTriggerGeometryHexImp2.cc.

596  {
597  // Fill trigger neighbor map
598  std::ifstream l1tCellNeighborsMappingStream(l1tCellNeighborsMapping_.fullPath());
599  if (!l1tCellNeighborsMappingStream.is_open()) {
600  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellNeighborsMapping file\n";
601  }
602  for (std::array<char, 512> buffer; l1tCellNeighborsMappingStream.getline(&buffer[0], 512);) {
603  std::string line(&buffer[0]);
604  // Extract keys consisting of the wafer configuration
605  // and of the trigger cell id
606  // Match patterns (X,Y)
607  // where X is a set of 7 bits
608  // and Y is a number with less than 4 digits
609  std::regex key_regex("\\(\\s*[01]{7}\\s*,\\s*\\d{1,3}\\s*\\)");
610  std::vector<std::string> key_tokens{std::sregex_token_iterator(line.begin(), line.end(), key_regex), {}};
611  if (key_tokens.size() != 1) {
612  throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n"
613  << " Cannot find the trigger cell key in line:\n"
614  << " '" << &buffer[0] << "'\n";
615  }
616  std::regex digits_regex("([01]{7})|(\\d{1,3})");
617  std::vector<std::string> type_tc{
618  std::sregex_token_iterator(key_tokens[0].begin(), key_tokens[0].end(), digits_regex), {}};
619  // get cell id and wafer configuration
620  int trigger_cell = std::stoi(type_tc[1]);
621  std::vector<int> wafer_types;
622  wafer_types.reserve(type_tc[0].size());
623  // Convert waferType coarse=0, fine=1 to coarse=-1, fine=1
624  for (const char c : type_tc[0])
625  wafer_types.emplace_back((std::stoi(std::string(&c)) ? 1 : -1));
626  unsigned map_key = packTriggerCell(trigger_cell, wafer_types);
627  // Extract neighbors
628  // Match patterns (X,Y)
629  // where X is a number with less than 4 digits
630  // and Y is one single digit (the neighbor wafer, between 0 and 6)
631  std::regex neighbors_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d\\s*\\)");
632  std::vector<std::string> neighbors_tokens{std::sregex_token_iterator(line.begin(), line.end(), neighbors_regex),
633  {}};
634  if (neighbors_tokens.empty()) {
635  throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n"
636  << " Cannot find any neighbor in line:\n"
637  << " '" << &buffer[0] << "'\n";
638  }
639  auto itr_insert = trigger_cell_neighbors_.emplace(map_key, std::set<std::pair<short, short>>());
640  for (const auto& neighbor : neighbors_tokens) {
641  std::vector<std::string> pair_neighbor{std::sregex_token_iterator(neighbor.begin(), neighbor.end(), digits_regex),
642  {}};
643  short neighbor_wafer(std::stoi(pair_neighbor[1]));
644  short neighbor_cell(std::stoi(pair_neighbor[0]));
645  itr_insert.first->second.emplace(neighbor_wafer, neighbor_cell);
646  }
647  }
648  if (!l1tCellNeighborsMappingStream.eof())
649  edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellNeighborsMapping'\n";
650  l1tCellNeighborsMappingStream.close();
651 
652  // Fill wafer neighbor map
653  std::ifstream l1tWaferNeighborsMappingStream(l1tWaferNeighborsMapping_.fullPath());
654  if (!l1tWaferNeighborsMappingStream.is_open()) {
655  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TWaferNeighborsMapping file\n";
656  }
657  for (std::array<char, 512> buffer; l1tWaferNeighborsMappingStream.getline(&buffer[0], 512);) {
658  std::string line(&buffer[0]);
659  // split line using spaces as delimiter
660  std::regex delimiter("\\s+");
661  std::vector<std::string> tokens{std::sregex_token_iterator(line.begin(), line.end(), delimiter, -1), {}};
662  if (tokens.size() != 8) {
663  throw cms::Exception("BadGeometry")
664  << "Syntax error in the L1TWaferNeighborsMapping in line:\n"
665  << " '" << &buffer[0] << "'\n"
666  << " A line should be composed of 8 integers separated by spaces:\n"
667  << " subdet waferid neighbor1 neighbor2 neighbor3 neighbor4 neighbor5 neighbor6\n";
668  }
669  short subdet(std::stoi(tokens[0]));
670  short wafer(std::stoi(tokens[1]));
671 
672  std::unordered_map<short, std::vector<short>>* wafer_neighbors;
673  switch (subdet) {
675  wafer_neighbors = &wafer_neighbors_ee_;
676  break;
678  wafer_neighbors = &wafer_neighbors_fh_;
679  break;
680  default:
681  throw cms::Exception("BadGeometry") << "Unknown subdet " << subdet << " in L1TWaferNeighborsMapping:\n"
682  << " '" << &buffer[0] << "'\n";
683  };
684  auto wafer_itr = wafer_neighbors->emplace(wafer, std::vector<short>());
685  for (auto neighbor_itr = tokens.cbegin() + 2; neighbor_itr != tokens.cend(); ++neighbor_itr) {
686  wafer_itr.first->second.emplace_back(std::stoi(*neighbor_itr));
687  }
688  }
689 }

References begin, edmScanValgrind::buffer, HltBtagPostValidation_cff::c, makeHLTPrescaleTable::delimiter, end, Exception, edm::FileInPath::fullPath(), HGCEE, HGCHEF, l1tCellNeighborsMapping_, l1tWaferNeighborsMapping_, mps_splice::line, packTriggerCell(), findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, trigger_cell_neighbors_, wafer_neighbors_ee_, and wafer_neighbors_fh_.

Referenced by initialize().

◆ getCellsFromModule()

HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexImp2::getCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 256 of file HGCalTriggerGeometryHexImp2.cc.

256  {
257  HGCalDetId module_det_id(module_id);
258  unsigned subdet = module_det_id.subdetId();
259  if (subdet == ForwardSubdetector::HGCHEB)
260  return geom_set();
261  unsigned module = module_det_id.wafer();
262  std::pair<std::unordered_multimap<short, short>::const_iterator, std::unordered_multimap<short, short>::const_iterator>
263  wafer_itrs;
264  switch (subdet) {
266  wafer_itrs = module_to_wafers_ee_.equal_range(module);
267  break;
269  wafer_itrs = module_to_wafers_fh_.equal_range(module);
270  break;
271  default:
272  edm::LogError("HGCalTriggerGeometry") << "Unknown module->wafers mapping for subdet " << subdet << "\n";
273  return geom_set();
274  };
275  geom_set cell_det_ids;
276  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
277  int wafer_type = detIdWaferType(subdet, wafer_itr->second);
278  if (wafer_type == 0)
279  wafer_type = module_det_id.waferType();
280  // loop on the cells in each wafer and return valid ones
281  for (int cell = 0; cell < number_cells_in_wafers_.at(wafer_type); cell++) {
282  HGCalDetId cell_id((ForwardSubdetector)module_det_id.subdetId(),
283  module_det_id.zside(),
284  module_det_id.layer(),
285  wafer_type,
286  wafer_itr->second,
287  cell);
288  if (validCellId(subdet, cell_id))
289  cell_det_ids.emplace(cell_id.rawId());
290  }
291  }
292  return cell_det_ids;
293 }

References detIdWaferType(), HGCEE, HGCHEB, HGCHEF, HGCalDetId::layer(), module_to_wafers_ee_, module_to_wafers_fh_, number_cells_in_wafers_, DetId::subdetId(), validCellId(), HGCalDetId::wafer(), HGCalDetId::waferType(), and HGCalDetId::zside().

Referenced by getModulePosition().

◆ getCellsFromTriggerCell()

HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexImp2::getCellsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 233 of file HGCalTriggerGeometryHexImp2.cc.

234  {
235  HGCalDetId trigger_cell_det_id(trigger_cell_id);
236  unsigned subdet = trigger_cell_det_id.subdetId();
237  if (subdet == ForwardSubdetector::HGCHEB)
238  return geom_set();
239  int wafer_type = trigger_cell_det_id.waferType();
240  unsigned trigger_cell = trigger_cell_det_id.cell();
241  // FIXME: better way to do this TC->cell mapping?
242  const auto& cell_range = trigger_cells_to_cells_.equal_range(std::make_pair(wafer_type, trigger_cell));
243  geom_set cell_det_ids;
244  for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) {
245  cell_det_ids.emplace(HGCalDetId((ForwardSubdetector)trigger_cell_det_id.subdetId(),
246  trigger_cell_det_id.zside(),
247  trigger_cell_det_id.layer(),
248  trigger_cell_det_id.waferType(),
249  trigger_cell_det_id.wafer(),
250  tc_c_itr->second)
251  .rawId());
252  }
253  return cell_det_ids;
254 }

References HGCalDetId::cell(), HGCHEB, HGCalDetId::layer(), DetId::subdetId(), trigger_cells_to_cells_, HGCalDetId::wafer(), HGCalDetId::waferType(), and HGCalDetId::zside().

Referenced by getTriggerCellPosition(), and validTriggerCellFromCells().

◆ getLinksInModule()

unsigned HGCalTriggerGeometryHexImp2::getLinksInModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 501 of file HGCalTriggerGeometryHexImp2.cc.

501 { return 1; }

◆ getModuleFromCell()

unsigned HGCalTriggerGeometryHexImp2::getModuleFromCell ( const unsigned  cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 153 of file HGCalTriggerGeometryHexImp2.cc.

153  {
154  if (DetId(cell_id).det() == DetId::Hcal)
155  return 0;
156  HGCalDetId cell_det_id(cell_id);
157  unsigned wafer = cell_det_id.wafer();
158  unsigned subdet = cell_det_id.subdetId();
159  std::unordered_map<short, short>::const_iterator module_itr;
160  bool out_of_range_error = false;
161  switch (subdet) {
163  module_itr = wafer_to_module_ee_.find(wafer);
164  if (module_itr == wafer_to_module_ee_.end())
165  out_of_range_error = true;
166  break;
168  module_itr = wafer_to_module_fh_.find(wafer);
169  if (module_itr == wafer_to_module_fh_.end())
170  out_of_range_error = true;
171  break;
172  default:
173  edm::LogError("HGCalTriggerGeometry") << "Unknown wafer->module mapping for subdet " << subdet << "\n";
174  return 0;
175  };
176  if (out_of_range_error) {
177  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Wafer " << wafer
178  << " is not mapped to any trigger module for subdetector " << subdet
179  << ". The module mapping should be modified. See "
180  "https://twiki.cern.ch/twiki/bin/viewauth/CMS/"
181  "HGCALTriggerPrimitivesSimulation#Trigger_geometry for details.\n";
182  }
183  unsigned module = module_itr->second;
184  return HGCalDetId((ForwardSubdetector)cell_det_id.subdetId(),
185  cell_det_id.zside(),
186  cell_det_id.layer(),
187  cell_det_id.waferType(),
188  module,
190  .rawId();
191 }

References Exception, DetId::Hcal, HGCEE, HGCHEF, HGCalDetId::kHGCalCellMask, HGCalDetId::layer(), DetId::subdetId(), HGCalDetId::wafer(), wafer_to_module_ee_, wafer_to_module_fh_, HGCalDetId::waferType(), and HGCalDetId::zside().

◆ getModuleFromTriggerCell()

unsigned HGCalTriggerGeometryHexImp2::getModuleFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 193 of file HGCalTriggerGeometryHexImp2.cc.

193  {
194  HGCalDetId trigger_cell_det_id(trigger_cell_id);
195  unsigned wafer = trigger_cell_det_id.wafer();
196  unsigned subdet = trigger_cell_det_id.subdetId();
197  if (subdet == ForwardSubdetector::HGCHEB)
198  return 0;
199  std::unordered_map<short, short>::const_iterator module_itr;
200  bool out_of_range_error = false;
201  switch (subdet) {
203  module_itr = wafer_to_module_ee_.find(wafer);
204  if (module_itr == wafer_to_module_ee_.end())
205  out_of_range_error = true;
206  break;
208  module_itr = wafer_to_module_fh_.find(wafer);
209  if (module_itr == wafer_to_module_fh_.end())
210  out_of_range_error = true;
211  break;
212  default:
213  edm::LogError("HGCalTriggerGeometry") << "Unknown wafer->module mapping for subdet " << subdet << "\n";
214  return 0;
215  };
216  if (out_of_range_error) {
217  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Wafer " << wafer
218  << " is not mapped to any trigger module for subdetector " << subdet
219  << ". The module mapping should be modified. See "
220  "https://twiki.cern.ch/twiki/bin/viewauth/CMS/"
221  "HGCALTriggerPrimitivesSimulation#Trigger_geometry for details.\n";
222  }
223  unsigned module = module_itr->second;
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(),
228  module,
230  .rawId();
231 }

References Exception, HGCEE, HGCHEB, HGCHEF, HGCalDetId::kHGCalCellMask, HGCalDetId::layer(), DetId::subdetId(), HGCalDetId::wafer(), wafer_to_module_ee_, wafer_to_module_fh_, HGCalDetId::waferType(), and HGCalDetId::zside().

◆ getModulePosition()

GlobalPoint HGCalTriggerGeometryHexImp2::getModulePosition ( const unsigned  module_det_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 520 of file HGCalTriggerGeometryHexImp2.cc.

520  {
521  // Position: barycenter of the module.
522  Basic3DVector<float> moduleVector(0., 0., 0.);
523  const auto cell_ids = getCellsFromModule(module_det_id);
524  if (cell_ids.empty())
525  return GlobalPoint(0, 0, 0);
526  for (const auto& cell : cell_ids) {
527  HGCalDetId cellDetId(cell);
528  moduleVector += (cellDetId.subdetId() == ForwardSubdetector::HGCEE ? eeGeometry()->getPosition(cellDetId)
529  : fhGeometry()->getPosition(cellDetId))
530  .basicVector();
531  }
532  return GlobalPoint(moduleVector / cell_ids.size());
533 }

References HGCalTriggerGeometryBase::eeGeometry(), HGCalTriggerGeometryBase::fhGeometry(), getCellsFromModule(), HGCalGeometry::getPosition(), HGCEE, and DetId::subdetId().

◆ getModuleSize()

unsigned HGCalTriggerGeometryHexImp2::getModuleSize ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 503 of file HGCalTriggerGeometryHexImp2.cc.

503 { return 1; }

◆ getNeighborsFromTriggerCell()

HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexImp2::getNeighborsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 417 of file HGCalTriggerGeometryHexImp2.cc.

418  {
419  HGCalDetId trigger_cell_det_id(trigger_cell_id);
420  unsigned wafer = trigger_cell_det_id.wafer();
421  int wafer_type = trigger_cell_det_id.waferType();
422  unsigned subdet = trigger_cell_det_id.subdetId();
423  unsigned trigger_cell = trigger_cell_det_id.cell();
424  if (subdet == ForwardSubdetector::HGCHEB)
425  return geom_set();
426  // Retrieve surrounding wafers (around the wafer containing
427  // the trigger cell)
428  std::unordered_map<short, std::vector<short>>::const_iterator surrounding_wafers_itr;
429  bool out_of_range_error = false;
430  switch (subdet) {
432  surrounding_wafers_itr = wafer_neighbors_ee_.find(wafer);
433  if (surrounding_wafers_itr == wafer_neighbors_ee_.end())
434  out_of_range_error = true;
435  break;
437  surrounding_wafers_itr = wafer_neighbors_fh_.find(wafer);
438  if (surrounding_wafers_itr == wafer_neighbors_fh_.end())
439  out_of_range_error = true;
440  break;
441  default:
442  edm::LogError("HGCalTriggerGeometry") << "Unknown wafer neighbours for subdet " << subdet << "\n";
443  return geom_set();
444  }
445  if (out_of_range_error) {
446  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Neighbors are not defined for wafer " << wafer
447  << " in subdetector " << subdet
448  << ". The wafer neighbor mapping should be modified. \n";
449  };
450  const std::vector<short>& surrounding_wafers = surrounding_wafers_itr->second;
451  // Find the types of the surrounding wafers
452  std::vector<int> types;
453  types.reserve(surrounding_wafers.size() + 1); // includes the central wafer -> +1
454  types.emplace_back(wafer_type);
455  for (const auto w : surrounding_wafers) {
456  // if no neighbor, use the same type as the central one
457  // to create the wafer configuration
458  int wt = wafer_type;
459  if (w != -1)
460  wt = detIdWaferType(subdet, w);
461  if (wt == 0)
462  return geom_set(); // invalid wafer type
463  types.emplace_back(wt);
464  }
465  // retrieve neighbors
466  unsigned trigger_cell_key = packTriggerCell(trigger_cell, types);
467  geom_set neighbor_detids;
468  auto neighbors_itr = trigger_cell_neighbors_.find(trigger_cell_key);
469  if (neighbors_itr == trigger_cell_neighbors_.end()) {
470  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Neighbors are not defined for trigger cell "
471  << trigger_cell << " with wafer configuration "
472  << std::bitset<7>(trigger_cell_key >> 8)
473  << ". The trigger cell neighbor mapping should be modified. \n";
474  }
475  const auto& neighbors = neighbors_itr->second;
476  // create HGCalDetId of neighbors and check their validity
477  neighbor_detids.reserve(neighbors.size());
478  for (const auto& wafer_tc : neighbors) {
479  if (wafer_tc.first - 1 >= (int)surrounding_wafers.size()) {
480  throw cms::Exception("BadGeometry")
481  << "HGCalTriggerGeometry: Undefined wafer neighbor number " << wafer_tc.first << " for wafer " << wafer
482  << " and trigger cell " << trigger_cell << ". The neighbor mapping files should be modified.";
483  }
484  int neighbor_wafer = (wafer_tc.first == 0 ? wafer : surrounding_wafers.at(wafer_tc.first - 1));
485  if (neighbor_wafer == -1)
486  continue; // non-existing wafer
487  int type = types.at(wafer_tc.first);
488  HGCalDetId neighbor_det_id((ForwardSubdetector)trigger_cell_det_id.subdetId(),
489  trigger_cell_det_id.zside(),
490  trigger_cell_det_id.layer(),
491  type,
492  neighbor_wafer,
493  wafer_tc.second);
494  if (validTriggerCell(neighbor_det_id.rawId())) {
495  neighbor_detids.emplace(neighbor_det_id.rawId());
496  }
497  }
498  return neighbor_detids;
499 }

References HGCalDetId::cell(), detIdWaferType(), Exception, HGCEE, HGCHEB, HGCHEF, HGCalDetId::layer(), packTriggerCell(), DetId::subdetId(), trigger_cell_neighbors_, validTriggerCell(), w, HGCalDetId::wafer(), wafer_neighbors_ee_, wafer_neighbors_fh_, HGCalDetId::waferType(), and HGCalDetId::zside().

◆ getOrderedCellsFromModule()

HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryHexImp2::getOrderedCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 295 of file HGCalTriggerGeometryHexImp2.cc.

296  {
297  HGCalDetId module_det_id(module_id);
298  unsigned subdet = module_det_id.subdetId();
299  if (subdet == ForwardSubdetector::HGCHEB)
300  return geom_ordered_set();
301  unsigned module = module_det_id.wafer();
302  std::pair<std::unordered_multimap<short, short>::const_iterator, std::unordered_multimap<short, short>::const_iterator>
303  wafer_itrs;
304  switch (subdet) {
306  wafer_itrs = module_to_wafers_ee_.equal_range(module);
307  break;
309  wafer_itrs = module_to_wafers_fh_.equal_range(module);
310  break;
311  default:
312  edm::LogError("HGCalTriggerGeometry") << "Unknown module->wafers mapping for subdet " << subdet << "\n";
313  return geom_ordered_set();
314  };
315  geom_ordered_set cell_det_ids;
316  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
317  int wafer_type = detIdWaferType(subdet, wafer_itr->second);
318  if (wafer_type == 0)
319  wafer_type = module_det_id.waferType();
320  // loop on the cells in each wafer
321  for (int cell = 0; cell < number_cells_in_wafers_.at(wafer_type); cell++) {
322  HGCalDetId cell_id((ForwardSubdetector)module_det_id.subdetId(),
323  module_det_id.zside(),
324  module_det_id.layer(),
325  wafer_type,
326  wafer_itr->second,
327  cell);
328  if (validCellId(subdet, cell_id))
329  cell_det_ids.emplace(cell_id.rawId());
330  }
331  }
332  return cell_det_ids;
333 }

References detIdWaferType(), HGCEE, HGCHEB, HGCHEF, HGCalDetId::layer(), module_to_wafers_ee_, module_to_wafers_fh_, number_cells_in_wafers_, DetId::subdetId(), validCellId(), HGCalDetId::wafer(), HGCalDetId::waferType(), and HGCalDetId::zside().

◆ getOrderedTriggerCellsFromModule()

HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryHexImp2::getOrderedTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 376 of file HGCalTriggerGeometryHexImp2.cc.

377  {
378  HGCalDetId module_det_id(module_id);
379  unsigned subdet = module_det_id.subdetId();
380  if (subdet == ForwardSubdetector::HGCHEB)
381  return geom_ordered_set();
382  unsigned module = module_det_id.wafer();
383  std::pair<std::unordered_multimap<short, short>::const_iterator, std::unordered_multimap<short, short>::const_iterator>
384  wafer_itrs;
385  switch (subdet) {
387  wafer_itrs = module_to_wafers_ee_.equal_range(module);
388  break;
390  wafer_itrs = module_to_wafers_fh_.equal_range(module);
391  break;
392  default:
393  edm::LogError("HGCalTriggerGeometry") << "Unknown module->wafers mapping for subdet " << subdet << "\n";
394  return geom_ordered_set();
395  };
396  geom_ordered_set trigger_cell_det_ids;
397  // loop on the wafers included in the module
398  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
399  int wafer_type = detIdWaferType(subdet, wafer_itr->second);
400  if (wafer_type == 0)
401  wafer_type = module_det_id.waferType();
402  // loop on the trigger cells in each wafer
403  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++) {
404  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
405  module_det_id.zside(),
406  module_det_id.layer(),
407  wafer_type,
408  wafer_itr->second,
409  trigger_cell);
410  if (validTriggerCell(trigger_cell_id))
411  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
412  }
413  }
414  return trigger_cell_det_ids;
415 }

References detIdWaferType(), HGCEE, HGCHEB, HGCHEF, HGCalDetId::layer(), module_to_wafers_ee_, module_to_wafers_fh_, number_trigger_cells_in_wafers_, DetId::subdetId(), validTriggerCell(), HGCalDetId::wafer(), HGCalDetId::waferType(), and HGCalDetId::zside().

◆ getTriggerCellFromCell()

unsigned HGCalTriggerGeometryHexImp2::getTriggerCellFromCell ( const unsigned  cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 130 of file HGCalTriggerGeometryHexImp2.cc.

130  {
131  if (DetId(cell_id).det() == DetId::Hcal)
132  return 0;
133  HGCalDetId cell_det_id(cell_id);
134  int wafer_type = cell_det_id.waferType();
135  unsigned cell = cell_det_id.cell();
136  // FIXME: better way to do this cell->TC mapping?
137  auto trigger_cell_itr = cells_to_trigger_cells_.find(std::make_pair(wafer_type, cell));
138  if (trigger_cell_itr == cells_to_trigger_cells_.end()) {
139  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: HGCal cell " << cell
140  << " is not mapped to any trigger cell for the wafer type " << wafer_type
141  << ". The trigger cell mapping should be modified.\n";
142  }
143  unsigned trigger_cell = trigger_cell_itr->second;
144  return HGCalDetId((ForwardSubdetector)cell_det_id.subdetId(),
145  cell_det_id.zside(),
146  cell_det_id.layer(),
147  cell_det_id.waferType(),
148  cell_det_id.wafer(),
149  trigger_cell)
150  .rawId();
151 }

References HGCalDetId::cell(), cells_to_trigger_cells_, Exception, DetId::Hcal, HGCalDetId::layer(), DetId::subdetId(), HGCalDetId::wafer(), HGCalDetId::waferType(), and HGCalDetId::zside().

◆ getTriggerCellPosition()

GlobalPoint HGCalTriggerGeometryHexImp2::getTriggerCellPosition ( const unsigned  trigger_cell_det_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 505 of file HGCalTriggerGeometryHexImp2.cc.

505  {
506  // Position: barycenter of the trigger cell.
507  Basic3DVector<float> triggerCellVector(0., 0., 0.);
508  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
509  if (cell_ids.empty())
510  return GlobalPoint(0, 0, 0);
511  for (const auto& cell : cell_ids) {
512  HGCalDetId cellDetId(cell);
513  triggerCellVector += (cellDetId.subdetId() == ForwardSubdetector::HGCEE ? eeGeometry()->getPosition(cellDetId)
514  : fhGeometry()->getPosition(cellDetId))
515  .basicVector();
516  }
517  return GlobalPoint(triggerCellVector / cell_ids.size());
518 }

References HGCalTriggerGeometryBase::eeGeometry(), HGCalTriggerGeometryBase::fhGeometry(), getCellsFromTriggerCell(), HGCalGeometry::getPosition(), HGCEE, and DetId::subdetId().

◆ getTriggerCellsFromModule()

HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexImp2::getTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 335 of file HGCalTriggerGeometryHexImp2.cc.

336  {
337  HGCalDetId module_det_id(module_id);
338  unsigned subdet = module_det_id.subdetId();
339  if (subdet == ForwardSubdetector::HGCHEB)
340  return geom_set();
341  unsigned module = module_det_id.wafer();
342  std::pair<std::unordered_multimap<short, short>::const_iterator, std::unordered_multimap<short, short>::const_iterator>
343  wafer_itrs;
344  switch (subdet) {
346  wafer_itrs = module_to_wafers_ee_.equal_range(module);
347  break;
349  wafer_itrs = module_to_wafers_fh_.equal_range(module);
350  break;
351  default:
352  edm::LogError("HGCalTriggerGeometry") << "Unknown module->wafers mapping for subdet " << subdet << "\n";
353  return geom_set();
354  };
355  geom_set trigger_cell_det_ids;
356  // loop on the wafers included in the module
357  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
358  int wafer_type = detIdWaferType(subdet, wafer_itr->second);
359  if (wafer_type == 0)
360  wafer_type = module_det_id.waferType();
361  // loop on the trigger cells in each wafer
362  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++) {
363  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
364  module_det_id.zside(),
365  module_det_id.layer(),
366  wafer_type,
367  wafer_itr->second,
368  trigger_cell);
369  if (validTriggerCell(trigger_cell_id))
370  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
371  }
372  }
373  return trigger_cell_det_ids;
374 }

References detIdWaferType(), HGCEE, HGCHEB, HGCHEF, HGCalDetId::layer(), module_to_wafers_ee_, module_to_wafers_fh_, number_trigger_cells_in_wafers_, DetId::subdetId(), validTriggerCell(), HGCalDetId::wafer(), HGCalDetId::waferType(), and HGCalDetId::zside().

◆ initialize() [1/3]

void HGCalTriggerGeometryHexImp2::initialize ( const CaloGeometry calo_geometry)
finalvirtual

◆ initialize() [2/3]

void HGCalTriggerGeometryHexImp2::initialize ( const HGCalGeometry hgc_ee_geometry,
const HGCalGeometry hgc_hsi_geometry,
const HGCalGeometry hgc_hsc_geometry 
)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 115 of file HGCalTriggerGeometryHexImp2.cc.

117  {
118  throw cms::Exception("BadGeometry")
119  << "HGCalTriggerGeometryHexImp2 geometry cannot be initialized with the V9 HGCAL geometry";
120 }

References Exception.

◆ initialize() [3/3]

void HGCalTriggerGeometryHexImp2::initialize ( const HGCalGeometry hgc_ee_geometry,
const HGCalGeometry hgc_hsi_geometry,
const HGCalGeometry hgc_hsc_geometry,
const HGCalGeometry hgc_nose_geometry 
)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 122 of file HGCalTriggerGeometryHexImp2.cc.

125  {
126  throw cms::Exception("BadGeometry")
127  << "HGCalTriggerGeometryHexImp2 geometry cannot be initialized with the V9 HGCAL+Nose geometry";
128 }

References Exception.

◆ lastTriggerLayer()

unsigned HGCalTriggerGeometryHexImp2::lastTriggerLayer ( ) const
finalvirtual

◆ packTriggerCell()

unsigned HGCalTriggerGeometryHexImp2::packTriggerCell ( unsigned  trigger_cell,
const std::vector< int > &  wafer_types 
) const
private

Definition at line 726 of file HGCalTriggerGeometryHexImp2.cc.

727  {
728  unsigned packed_value = trigger_cell;
729  for (unsigned i = 0; i < wafer_types.size(); i++) {
730  // trigger cell id on 8 bits
731  // wafer configuration bits: 0=coarse, 1=fine
732  if (wafer_types.at(i) == 1)
733  packed_value += (0x1 << (8 + i));
734  }
735  return packed_value;
736 }

References mps_fire::i, and testProducerWithPsetDescEmpty_cfi::x1.

Referenced by fillNeighborMaps(), and getNeighborsFromTriggerCell().

◆ reset()

void HGCalTriggerGeometryHexImp2::reset ( void  )
finalvirtual

◆ triggerLayer()

unsigned HGCalTriggerGeometryHexImp2::triggerLayer ( const unsigned  id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 790 of file HGCalTriggerGeometryHexImp2.cc.

790 { return HGCalDetId(id).layer(); }

References HGCalDetId::layer().

◆ validCell()

bool HGCalTriggerGeometryHexImp2::validCell ( const unsigned  cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 756 of file HGCalTriggerGeometryHexImp2.cc.

756  {
757  bool is_valid = false;
758  if (DetId(cell_id).det() == DetId::Hcal) {
759  HcalDetId cell_det_id(cell_id);
760  if (cell_det_id.subdetId() != HcalEndcap)
761  is_valid = false;
762  else
763  is_valid = bhTopology().valid(cell_id);
764  } else if (DetId(cell_id).det() == DetId::Forward) {
765  HGCalDetId cell_det_id(cell_id);
766  unsigned subdet = cell_det_id.subdetId();
767  switch (subdet) {
769  is_valid = eeTopology().valid(cell_id);
770  break;
772  is_valid = fhTopology().valid(cell_id);
773  break;
774  default:
775  is_valid = false;
776  break;
777  }
778  }
779  return is_valid;
780 }

References HGCalTriggerGeometryBase::bhTopology(), HGCalTriggerGeometryBase::eeTopology(), HGCalTriggerGeometryBase::fhTopology(), DetId::Forward, DetId::Hcal, HcalEndcap, HGCEE, HGCHEF, DetId::subdetId(), HcalTopology::valid(), and HGCalTopology::valid().

◆ validCellId()

bool HGCalTriggerGeometryHexImp2::validCellId ( unsigned  subdet,
unsigned  cell_id 
) const
private

Definition at line 809 of file HGCalTriggerGeometryHexImp2.cc.

809  {
810  bool is_valid = false;
811  switch (subdet) {
813  is_valid = eeTopology().valid(cell_id);
814  break;
816  is_valid = fhTopology().valid(cell_id);
817  break;
818  default:
819  is_valid = false;
820  break;
821  }
822  return is_valid;
823 }

References HGCalTriggerGeometryBase::eeTopology(), HGCalTriggerGeometryBase::fhTopology(), HGCEE, HGCHEF, and HGCalTopology::valid().

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

◆ validTriggerCell()

bool HGCalTriggerGeometryHexImp2::validTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 782 of file HGCalTriggerGeometryHexImp2.cc.

782  {
783  return invalid_triggercells_.find(trigger_cell_id) == invalid_triggercells_.end();
784 }

References invalid_triggercells_.

Referenced by getNeighborsFromTriggerCell(), getOrderedTriggerCellsFromModule(), and getTriggerCellsFromModule().

◆ validTriggerCellFromCells()

bool HGCalTriggerGeometryHexImp2::validTriggerCellFromCells ( const unsigned  trigger_cell_id) const
private

Definition at line 792 of file HGCalTriggerGeometryHexImp2.cc.

792  {
793  // Check the validity of a trigger cell with the
794  // validity of the cells. One valid cell in the
795  // trigger cell is enough to make the trigger cell
796  // valid.
797  HGCalDetId trigger_cell_det_id(trigger_cell_id);
798  unsigned subdet = trigger_cell_det_id.subdetId();
799  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
800  bool is_valid = false;
801  for (const auto cell_id : cells) {
802  is_valid |= validCellId(subdet, cell_id);
803  if (is_valid)
804  break;
805  }
806  return is_valid;
807 }

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

Referenced by fillInvalidTriggerCells().

Member Data Documentation

◆ cells_to_trigger_cells_

std::map<std::pair<short, short>, short> HGCalTriggerGeometryHexImp2::cells_to_trigger_cells_
private

Definition at line 59 of file HGCalTriggerGeometryHexImp2.cc.

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

◆ invalid_triggercells_

std::unordered_set<unsigned> HGCalTriggerGeometryHexImp2::invalid_triggercells_
private

Definition at line 63 of file HGCalTriggerGeometryHexImp2.cc.

Referenced by fillInvalidTriggerCells(), and validTriggerCell().

◆ l1tCellNeighborsMapping_

edm::FileInPath HGCalTriggerGeometryHexImp2::l1tCellNeighborsMapping_
private

Definition at line 48 of file HGCalTriggerGeometryHexImp2.cc.

Referenced by fillNeighborMaps().

◆ l1tCellsMapping_

edm::FileInPath HGCalTriggerGeometryHexImp2::l1tCellsMapping_
private

Definition at line 47 of file HGCalTriggerGeometryHexImp2.cc.

Referenced by fillMaps().

◆ l1tModulesMapping_

edm::FileInPath HGCalTriggerGeometryHexImp2::l1tModulesMapping_
private

Definition at line 50 of file HGCalTriggerGeometryHexImp2.cc.

Referenced by fillMaps().

◆ l1tWaferNeighborsMapping_

edm::FileInPath HGCalTriggerGeometryHexImp2::l1tWaferNeighborsMapping_
private

Definition at line 49 of file HGCalTriggerGeometryHexImp2.cc.

Referenced by fillNeighborMaps().

◆ module_to_wafers_ee_

std::unordered_multimap<short, short> HGCalTriggerGeometryHexImp2::module_to_wafers_ee_
private

◆ module_to_wafers_fh_

std::unordered_multimap<short, short> HGCalTriggerGeometryHexImp2::module_to_wafers_fh_
private

◆ number_cells_in_wafers_

std::unordered_map<short, short> HGCalTriggerGeometryHexImp2::number_cells_in_wafers_
private

◆ number_trigger_cells_in_wafers_

std::unordered_map<short, short> HGCalTriggerGeometryHexImp2::number_trigger_cells_in_wafers_
private

◆ trigger_cell_neighbors_

std::unordered_map<int, std::set<std::pair<short, short> > > HGCalTriggerGeometryHexImp2::trigger_cell_neighbors_
private

Definition at line 74 of file HGCalTriggerGeometryHexImp2.cc.

Referenced by fillNeighborMaps(), and getNeighborsFromTriggerCell().

◆ trigger_cells_to_cells_

std::multimap<std::pair<short, short>, short> HGCalTriggerGeometryHexImp2::trigger_cells_to_cells_
private

Definition at line 60 of file HGCalTriggerGeometryHexImp2.cc.

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

◆ wafer_neighbors_ee_

std::unordered_map<short, std::vector<short> > HGCalTriggerGeometryHexImp2::wafer_neighbors_ee_
private

Definition at line 77 of file HGCalTriggerGeometryHexImp2.cc.

Referenced by fillNeighborMaps(), and getNeighborsFromTriggerCell().

◆ wafer_neighbors_fh_

std::unordered_map<short, std::vector<short> > HGCalTriggerGeometryHexImp2::wafer_neighbors_fh_
private

Definition at line 78 of file HGCalTriggerGeometryHexImp2.cc.

Referenced by fillNeighborMaps(), and getNeighborsFromTriggerCell().

◆ wafer_to_module_ee_

std::unordered_map<short, short> HGCalTriggerGeometryHexImp2::wafer_to_module_ee_
private

◆ wafer_to_module_fh_

std::unordered_map<short, short> HGCalTriggerGeometryHexImp2::wafer_to_module_fh_
private
HGCalTriggerGeometryHexImp2::number_trigger_cells_in_wafers_
std::unordered_map< short, short > number_trigger_cells_in_wafers_
Definition: HGCalTriggerGeometryHexImp2.cc:61
HGCalTriggerGeometryBase::eeTopology
const HGCalTopology & eeTopology() const
Definition: HGCalTriggerGeometryBase.h:65
mps_fire.i
i
Definition: mps_fire.py:355
HGCalTopology::dddConstants
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98
HGCalTriggerGeometryHexImp2::trigger_cell_neighbors_
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_
Definition: HGCalTriggerGeometryHexImp2.cc:74
HGCalTriggerGeometryHexImp2::l1tCellNeighborsMapping_
edm::FileInPath l1tCellNeighborsMapping_
Definition: HGCalTriggerGeometryHexImp2.cc:48
HGCalDDDConstants::waferTypeT
int waferTypeT(int wafer) const
Definition: HGCalDDDConstants.h:169
makeHLTPrescaleTable.delimiter
delimiter
Definition: makeHLTPrescaleTable.py:181
ForwardSubdetector
ForwardSubdetector
Definition: ForwardSubdetector.h:4
HGCalTriggerGeometryHexImp2::wafer_neighbors_fh_
std::unordered_map< short, std::vector< short > > wafer_neighbors_fh_
Definition: HGCalTriggerGeometryHexImp2.cc:78
DetId::Hcal
Definition: DetId.h:28
HGCalTriggerGeometryHexImp2::validTriggerCell
bool validTriggerCell(const unsigned) const final
Definition: HGCalTriggerGeometryHexImp2.cc:782
HGCalTriggerGeometryHexImp2::wafer_neighbors_ee_
std::unordered_map< short, std::vector< short > > wafer_neighbors_ee_
Definition: HGCalTriggerGeometryHexImp2.cc:77
HGCalTriggerGeometryHexImp2::fillMaps
void fillMaps()
Definition: HGCalTriggerGeometryHexImp2.cc:535
HGCalDetId::layer
int layer() const
get the layer #
Definition: HGCalDetId.h:46
end
#define end
Definition: vmac.h:39
edmScanValgrind.buffer
buffer
Definition: edmScanValgrind.py:171
DetId
Definition: DetId.h:17
edm::FileInPath
Definition: FileInPath.h:64
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
HGCalTriggerGeometryHexImp2::invalid_triggercells_
std::unordered_set< unsigned > invalid_triggercells_
Definition: HGCalTriggerGeometryHexImp2.cc:63
w
const double w
Definition: UKUtility.cc:23
HGCalTriggerGeometryHexImp2::module_to_wafers_ee_
std::unordered_multimap< short, short > module_to_wafers_ee_
Definition: HGCalTriggerGeometryHexImp2.cc:55
HGCalTriggerGeometryHexImp2::getCellsFromModule
geom_set getCellsFromModule(const unsigned) const final
Definition: HGCalTriggerGeometryHexImp2.cc:256
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
HGCalTriggerGeometryHexImp2::detIdWaferType
int detIdWaferType(unsigned subdet, short wafer) const
Definition: HGCalTriggerGeometryHexImp2.cc:738
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HGCalTriggerGeometryBase::fhGeometry
const HGCalGeometry * fhGeometry() const
Definition: HGCalTriggerGeometryBase.h:46
HGCalTriggerGeometryHexImp2::packTriggerCell
unsigned packTriggerCell(unsigned, const std::vector< int > &) const
Definition: HGCalTriggerGeometryHexImp2.cc:726
HGCEE
Definition: ForwardSubdetector.h:8
edm::LogWarning
Definition: MessageLogger.h:141
edm::LogError
Definition: MessageLogger.h:183
HGCalTriggerGeometryBase::geom_ordered_set
std::set< unsigned > geom_ordered_set
Definition: HGCalTriggerGeometryBase.h:23
HGCalDDDConstants::layers
unsigned int layers(bool reco) const
Definition: HGCalDDDConstants.cc:558
HcalDetId
Definition: HcalDetId.h:12
HGCalTriggerGeometryHexImp2::validCellId
bool validCellId(unsigned subdet, unsigned cell_id) const
Definition: HGCalTriggerGeometryHexImp2.cc:809
HGCalTriggerGeometryBase::bhTopology
const HcalTopology & bhTopology() const
Definition: HGCalTriggerGeometryBase.h:67
HGCalTriggerGeometryBase::geom_set
std::unordered_set< unsigned > geom_set
Definition: HGCalTriggerGeometryBase.h:22
HGCalGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Definition: HGCalGeometry.cc:192
HGCalTriggerGeometryHexImp2::cells_to_trigger_cells_
std::map< std::pair< short, short >, short > cells_to_trigger_cells_
Definition: HGCalTriggerGeometryHexImp2.cc:59
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
module
Definition: vlib.h:198
types
types
Definition: AlignPCLThresholds_PayloadInspector.cc:30
HGCalTriggerGeometryHexImp2::fillInvalidTriggerCells
void fillInvalidTriggerCells()
Definition: HGCalTriggerGeometryHexImp2.cc:691
HcalTopology::valid
bool valid(const DetId &id) const override
Definition: HcalTopology.cc:225
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HGCalDetId
Definition: HGCalDetId.h:8
HGCalTriggerGeometryHexImp2::fillNeighborMaps
void fillNeighborMaps()
Definition: HGCalTriggerGeometryHexImp2.cc:596
HGCalTriggerGeometryBase::eeGeometry
const HGCalGeometry * eeGeometry() const
Definition: HGCalTriggerGeometryBase.h:41
HGCalDetId::kHGCalCellMask
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
type
type
Definition: HCALResponse.h:21
HGCalTriggerGeometryHexImp2::validTriggerCellFromCells
bool validTriggerCellFromCells(const unsigned) const
Definition: HGCalTriggerGeometryHexImp2.cc:792
HcalEndcap
Definition: HcalAssistant.h:34
HGCalTriggerGeometryHexImp2::l1tWaferNeighborsMapping_
edm::FileInPath l1tWaferNeighborsMapping_
Definition: HGCalTriggerGeometryHexImp2.cc:49
Exception
Definition: hltDiff.cc:246
postprocess-scan-build.cells
cells
Definition: postprocess-scan-build.py:13
HGCalTriggerGeometryHexImp2::wafer_to_module_fh_
std::unordered_map< short, short > wafer_to_module_fh_
Definition: HGCalTriggerGeometryHexImp2.cc:54
HGCalTriggerGeometryBase::setCaloGeometry
void setCaloGeometry(const CaloGeometry *geom)
Definition: HGCalTriggerGeometryBase.h:106
HGCalTriggerGeometryHexImp2::getCellsFromTriggerCell
geom_set getCellsFromTriggerCell(const unsigned) const final
Definition: HGCalTriggerGeometryHexImp2.cc:233
HGCalTriggerGeometryBase::HGCalTriggerGeometryBase
HGCalTriggerGeometryBase(const edm::ParameterSet &conf)
Definition: HGCalTriggerGeometryBase.cc:3
HGCalTopology::valid
bool valid(const DetId &id) const override
Is this a valid cell id.
Definition: HGCalTopology.cc:464
HGCHEF
Definition: ForwardSubdetector.h:9
HGCalTriggerGeometryHexImp2::l1tModulesMapping_
edm::FileInPath l1tModulesMapping_
Definition: HGCalTriggerGeometryHexImp2.cc:50
HGCalTriggerGeometryHexImp2::wafer_to_module_ee_
std::unordered_map< short, short > wafer_to_module_ee_
Definition: HGCalTriggerGeometryHexImp2.cc:53
DetId::Forward
Definition: DetId.h:30
mps_splice.line
line
Definition: mps_splice.py:76
HGCalTriggerGeometryHexImp2::number_cells_in_wafers_
std::unordered_map< short, short > number_cells_in_wafers_
Definition: HGCalTriggerGeometryHexImp2.cc:62
begin
#define begin
Definition: vmac.h:32
HGCalTriggerGeometryHexImp2::module_to_wafers_fh_
std::unordered_multimap< short, short > module_to_wafers_fh_
Definition: HGCalTriggerGeometryHexImp2.cc:56
Basic3DVector< float >
edm::FileInPath::fullPath
std::string fullPath() const
Definition: FileInPath.cc:163
HGCHEB
Definition: ForwardSubdetector.h:10
HGCalTriggerGeometryHexImp2::trigger_cells_to_cells_
std::multimap< std::pair< short, short >, short > trigger_cells_to_cells_
Definition: HGCalTriggerGeometryHexImp2.cc:60
HGCalTriggerGeometryHexImp2::l1tCellsMapping_
edm::FileInPath l1tCellsMapping_
Definition: HGCalTriggerGeometryHexImp2.cc:47
HGCalTriggerGeometryBase::fhTopology
const HGCalTopology & fhTopology() const
Definition: HGCalTriggerGeometryBase.h:66
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443