CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
HGCalTriggerGeometryV9Imp1 Class Reference
Inheritance diagram for HGCalTriggerGeometryV9Imp1:
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
 
 HGCalTriggerGeometryV9Imp1 (const edm::ParameterSet &conf)
 
void initialize (const CaloGeometry *) final
 
void initialize (const HGCalGeometry *, const HGCalGeometry *, const HGCalGeometry *) final
 
unsigned lastTriggerLayer () const final
 
void reset () final
 
unsigned triggerLayer (const unsigned) const final
 
bool validTriggerCell (const unsigned) const final
 
- Public Member Functions inherited from HGCalTriggerGeometryBase
const HcalGeometrybhGeometry () const
 
const HcalTopologybhTopology () const
 
const CaloGeometrycaloGeometry () const
 
const HGCalGeometryeeGeometry () const
 
const HGCalTopologyeeTopology () const
 
const HGCalGeometryfhGeometry () const
 
const HGCalTopologyfhTopology () const
 
 HGCalTriggerGeometryBase (const edm::ParameterSet &conf)
 
const HGCalGeometryhscGeometry () const
 
const HGCalTopologyhscTopology () const
 
const HGCalGeometryhsiGeometry () const
 
const HGCalTopologyhsiTopology () const
 
bool isV9Geometry () const
 
const std::string & name () const
 
virtual ~HGCalTriggerGeometryBase ()
 

Private Types

typedef std::unordered_map< int, std::set< std::pair< short, short > > > neighbor_map
 

Private Member Functions

int detIdWaferType (unsigned det, unsigned layer, short waferU, short waferV) const
 
void fillInvalidTriggerCells ()
 
void fillMaps ()
 
void fillNeighborMap (const edm::FileInPath &, neighbor_map &, bool)
 
unsigned layerWithOffset (unsigned) const
 
unsigned packCellId (unsigned type, unsigned cellU, unsigned cellV) const
 
unsigned packCellId (unsigned type, unsigned cell) const
 
unsigned packIetaIphi (unsigned ieta, unsigned iphi) const
 
unsigned packLayerWaferId (unsigned layer, unsigned wafer) const
 
unsigned packTriggerCell (unsigned, unsigned) const
 
unsigned packTriggerCellWithType (unsigned, unsigned, unsigned) const
 
unsigned packWaferCellId (unsigned subdet, unsigned wafer, unsigned cell) const
 
unsigned packWaferId (int waferU, int waferV) const
 
void unpackCellId (unsigned cell, unsigned &cellU, unsigned &cellV) const
 
void unpackIetaIphi (unsigned ieta_iphi, unsigned &ieta, unsigned &iphi) const
 
void unpackLayerWaferId (unsigned layer_wafer, unsigned &layer, unsigned &wafer) const
 
void unpackWaferCellId (unsigned wafer_cell, unsigned &wafer, unsigned &cell) const
 
void unpackWaferId (unsigned wafer, int &waferU, int &waferV) const
 
bool validCellId (unsigned det, unsigned cell_id) const
 
bool validTriggerCellFromCells (const unsigned) const
 

Private Attributes

std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
 
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_sci_
 
std::unordered_set< unsigned > disconnected_layers_
 
std::unordered_set< unsigned > disconnected_modules_
 
unsigned heOffset_ = 0
 
unsigned hSc_links_per_module_ = 1
 
unsigned hSc_wafers_per_module_ = 3
 
std::unordered_set< unsigned > invalid_triggercells_
 
edm::FileInPath l1tCellNeighborsMapping_
 
edm::FileInPath l1tCellNeighborsSciMapping_
 
edm::FileInPath l1tCellsMapping_
 
edm::FileInPath l1tCellsSciMapping_
 
edm::FileInPath l1tLinksMapping_
 
edm::FileInPath l1tModulesMapping_
 
edm::FileInPath l1tWafersMapping_
 
unsigned last_trigger_layer_ = 0
 
std::unordered_map< unsigned, unsigned > links_per_module_
 
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_sci_
 
unsigned totalLayers_ = 0
 
neighbor_map trigger_cell_neighbors_
 
neighbor_map trigger_cell_neighbors_sci_
 
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
 
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_sci_
 
std::vector< unsigned > trigger_layers_
 
std::unordered_map< unsigned, unsigned > wafer_to_module_
 
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
 
std::unordered_map< unsigned, unsigned > wafers_to_wafers_old_
 

Additional Inherited Members

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

Detailed Description

Definition at line 13 of file HGCalTriggerGeometryV9Imp1.cc.

Member Typedef Documentation

typedef std::unordered_map<int, std::set<std::pair<short, short> > > HGCalTriggerGeometryV9Imp1::neighbor_map
private

Definition at line 77 of file HGCalTriggerGeometryV9Imp1.cc.

Constructor & Destructor Documentation

HGCalTriggerGeometryV9Imp1::HGCalTriggerGeometryV9Imp1 ( const edm::ParameterSet conf)

Definition at line 115 of file HGCalTriggerGeometryV9Imp1.cc.

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

116  : HGCalTriggerGeometryBase(conf),
117  l1tCellsMapping_(conf.getParameter<edm::FileInPath>("L1TCellsMapping")),
118  l1tCellsSciMapping_(conf.getParameter<edm::FileInPath>("L1TCellsSciMapping")),
119  l1tWafersMapping_(conf.getParameter<edm::FileInPath>("L1TWafersMapping")),
120  l1tModulesMapping_(conf.getParameter<edm::FileInPath>("L1TModulesMapping")),
121  l1tLinksMapping_(conf.getParameter<edm::FileInPath>("L1TLinksMapping")),
122  l1tCellNeighborsMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsMapping")),
123  l1tCellNeighborsSciMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsSciMapping")),
124  hSc_links_per_module_(conf.getParameter<unsigned>("ScintillatorLinksPerModule")),
125  hSc_wafers_per_module_(conf.getParameter<unsigned>("ScintillatorWafersPerModule")) {
126  std::vector<unsigned> tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedModules");
127  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_modules_, disconnected_modules_.end()));
128  tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedLayers");
129  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end()));
130 }
HGCalTriggerGeometryBase(const edm::ParameterSet &conf)
T getParameter(std::string const &) const
std::unordered_set< unsigned > disconnected_layers_
std::unordered_set< unsigned > disconnected_modules_
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

int HGCalTriggerGeometryV9Imp1::detIdWaferType ( unsigned  det,
unsigned  layer,
short  waferU,
short  waferV 
) const
private

Definition at line 965 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCalTopology::dddConstants(), HGCalTriggerGeometryBase::eeTopology(), HGCalDDDConstants::getTypeHex(), DetId::HGCalEE, DetId::HGCalHSi, and HGCalTriggerGeometryBase::hsiTopology().

Referenced by fillInvalidTriggerCells(), getCellsFromTriggerCell(), getOrderedTriggerCellsFromModule(), and getTriggerCellsFromModule().

965  {
966  int wafer_type = 0;
967  switch (det) {
968  case DetId::HGCalEE:
969  wafer_type = eeTopology().dddConstants().getTypeHex(layer, waferU, waferV);
970  break;
971  case DetId::HGCalHSi:
972  wafer_type = hsiTopology().dddConstants().getTypeHex(layer, waferU, waferV);
973  break;
974  default:
975  break;
976  };
977  return wafer_type;
978 }
const HGCalTopology & eeTopology() const
int getTypeHex(int layer, int waferU, int waferV) const
const HGCalTopology & hsiTopology() const
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:96
bool HGCalTriggerGeometryV9Imp1::disconnectedModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 896 of file HGCalTriggerGeometryV9Imp1.cc.

References disconnected_layers_, disconnected_modules_, and layerWithOffset().

896  {
897  bool disconnected = false;
898  if (disconnected_modules_.find(HGCalDetId(module_id).wafer()) != disconnected_modules_.end())
899  disconnected = true;
900  if (disconnected_layers_.find(layerWithOffset(module_id)) != disconnected_layers_.end())
901  disconnected = true;
902  return disconnected;
903 }
std::unordered_set< unsigned > disconnected_layers_
std::unordered_set< unsigned > disconnected_modules_
unsigned layerWithOffset(unsigned) const
void HGCalTriggerGeometryV9Imp1::fillInvalidTriggerCells ( )
private

Definition at line 740 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCalTopology::dddConstants(), detIdWaferType(), HGCalTriggerGeometryBase::eeTopology(), HGCalDDDConstants::firstLayer(), getNeighborsFromTriggerCell(), HGCalDDDConstants::getTypeTrap(), DetId::HGCalEE, DetId::HGCalHSi, HGCEE, HGCHEB, HGCHEF, HGCalTriggerGeometryBase::hscTopology(), invalid_triggercells_, HGCalDDDConstants::layers(), number_trigger_cells_in_wafers_, number_trigger_cells_in_wafers_sci_, unpackWaferId(), validTriggerCellFromCells(), wafers_old_to_wafers_, wafers_to_wafers_old_, and ecaldqm::zside().

Referenced by initialize().

740  {
741  unsigned n_layers_ee = eeTopology().dddConstants().layers(true);
742  for (unsigned layer = 1; layer <= n_layers_ee; layer++) {
743  for (const auto& waferuv_wafer : wafers_to_wafers_old_) {
744  int waferu = 0;
745  int waferv = 0;
746  unpackWaferId(waferuv_wafer.first, waferu, waferv);
747  unsigned waferee_type = detIdWaferType(DetId::HGCalEE, layer, waferu, waferv);
748  unsigned waferfh_type = detIdWaferType(DetId::HGCalHSi, layer, waferu, waferv);
749  unsigned trigger_wafer = waferuv_wafer.second;
750  // loop on the trigger cells in each wafer
751  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(waferee_type); trigger_cell++) {
752  for (int zside : {-1, 1}) {
753  HGCalDetId trigger_cell_id(ForwardSubdetector::HGCEE, zside, layer, 1, trigger_wafer, trigger_cell);
754  if (!validTriggerCellFromCells(trigger_cell_id))
755  invalid_triggercells_.emplace(trigger_cell_id);
756  for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell_id)) {
757  auto wafer_itr = wafers_old_to_wafers_.find(HGCalDetId(neighbor).wafer());
758  if (wafer_itr == wafers_old_to_wafers_.end())
759  invalid_triggercells_.emplace(neighbor);
760  else if (!validTriggerCellFromCells(neighbor))
761  invalid_triggercells_.emplace(neighbor);
762  }
763  }
764  }
765  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(waferfh_type); trigger_cell++) {
766  for (int zside : {-1, 1}) {
767  HGCalDetId trigger_cell_id(ForwardSubdetector::HGCHEF, zside, layer, 1, trigger_wafer, trigger_cell);
768  if (!validTriggerCellFromCells(trigger_cell_id))
769  invalid_triggercells_.emplace(trigger_cell_id);
770  for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell_id)) {
771  auto wafer_itr = wafers_old_to_wafers_.find(HGCalDetId(neighbor).wafer());
772  if (wafer_itr == wafers_old_to_wafers_.end())
773  invalid_triggercells_.emplace(neighbor);
774  else if (!validTriggerCellFromCells(neighbor))
775  invalid_triggercells_.emplace(neighbor);
776  }
777  }
778  }
779  }
780  }
781  unsigned n_layers_hsc = hscTopology().dddConstants().layers(true);
782  unsigned first_layer_hsc = hscTopology().dddConstants().firstLayer();
783  for (unsigned layer = first_layer_hsc; layer <= first_layer_hsc + n_layers_hsc; layer++) {
784  int type = hscTopology().dddConstants().getTypeTrap(layer);
785  for (const auto& module_ncells : number_trigger_cells_in_wafers_sci_) {
786  unsigned trigger_wafer = module_ncells.first;
787  // loop on the trigger cells in each wafer
788  for (int trigger_cell = 1; trigger_cell < module_ncells.second; trigger_cell++) {
789  for (int zside : {-1, 1}) {
790  HGCalDetId trigger_cell_id(ForwardSubdetector::HGCHEB, zside, layer, type, trigger_wafer, trigger_cell);
791  if (!validTriggerCellFromCells(trigger_cell_id))
792  invalid_triggercells_.emplace(trigger_cell_id);
793  for (unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell_id)) {
794  if (!validTriggerCellFromCells(neighbor))
795  invalid_triggercells_.emplace(neighbor);
796  }
797  }
798  }
799  }
800  }
801 }
int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const
type
Definition: HCALResponse.h:21
int getTypeTrap(int layer) const
const HGCalTopology & eeTopology() const
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
int zside(DetId const &)
unsigned int layers(bool reco) const
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:96
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_sci_
const HGCalTopology & hscTopology() const
void unpackWaferId(unsigned wafer, int &waferU, int &waferV) const
bool validTriggerCellFromCells(const unsigned) const
std::unordered_map< unsigned, unsigned > wafers_to_wafers_old_
int firstLayer() const
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
geom_set getNeighborsFromTriggerCell(const unsigned) const final
std::unordered_set< unsigned > invalid_triggercells_
void HGCalTriggerGeometryV9Imp1::fillMaps ( )
private

Definition at line 562 of file HGCalTriggerGeometryV9Imp1.cc.

References cells_to_trigger_cells_, cells_to_trigger_cells_sci_, Exception, edm::FileInPath::fullPath(), HGCHEB, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, l1tCellsMapping_, l1tCellsSciMapping_, l1tLinksMapping_, l1tModulesMapping_, l1tWafersMapping_, electronStore::links, links_per_module_, module_to_wafers_, number_trigger_cells_in_wafers_, number_trigger_cells_in_wafers_sci_, packCellId(), packIetaIphi(), packLayerWaferId(), packWaferCellId(), packWaferId(), trigger_cells_to_cells_, trigger_cells_to_cells_sci_, wafer_to_module_, wafers_old_to_wafers_, and wafers_to_wafers_old_.

Referenced by initialize().

562  {
563  //
564  // read module mapping file
565  std::ifstream l1tModulesMappingStream(l1tModulesMapping_.fullPath());
566  if (!l1tModulesMappingStream.is_open()) {
567  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TModulesMapping file\n";
568  }
569  short trigger_wafer = 0;
570  short module = 0;
571  short layer = 0;
572  for (; l1tModulesMappingStream >> layer >> trigger_wafer >> module;) {
573  wafer_to_module_.emplace(packLayerWaferId(layer, trigger_wafer), module);
574  module_to_wafers_.emplace(packLayerWaferId(layer, module), trigger_wafer);
575  }
576  if (!l1tModulesMappingStream.eof()) {
577  throw cms::Exception("BadGeometryFile")
578  << "Error reading L1TModulesMapping '" << layer << " " << trigger_wafer << " " << module << "' \n";
579  }
580  l1tModulesMappingStream.close();
581  // read links mapping file
582  std::ifstream l1tLinksMappingStream(l1tLinksMapping_.fullPath());
583  if (!l1tLinksMappingStream.is_open()) {
584  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TLinksMapping file\n";
585  }
586  short links = 0;
587  for (; l1tLinksMappingStream >> layer >> module >> links;) {
588  if (module_to_wafers_.find(packLayerWaferId(layer, module)) == module_to_wafers_.end()) {
589  throw cms::Exception("BadGeometryFile")
590  << "Error reading L1TLinksMapping: (" << layer << "," << module << ") is not defined in the module file \n";
591  }
592  links_per_module_.emplace(packLayerWaferId(layer, module), links);
593  }
594  if (!l1tLinksMappingStream.eof()) {
595  throw cms::Exception("BadGeometryFile")
596  << "Error reading L1TLinksMapping '" << layer << " " << module << " " << links << "' \n";
597  }
598  l1tLinksMappingStream.close();
599  // read trigger cell mapping file
600  std::ifstream l1tCellsMappingStream(l1tCellsMapping_.fullPath());
601  if (!l1tCellsMappingStream.is_open()) {
602  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsMapping file\n";
603  }
604  short type = 0;
605  short cellu = 0;
606  short cellv = 0;
607  short trigger_cell = 0;
608  for (; l1tCellsMappingStream >> type >> cellu >> cellv >> trigger_cell;) {
609  unsigned cell_key = packCellId(type, cellu, cellv);
610  unsigned trigger_cell_key = packCellId(type, trigger_cell);
611  // fill cell <-> trigger cell mappings
612  cells_to_trigger_cells_.emplace(cell_key, trigger_cell);
613  trigger_cells_to_cells_.emplace(trigger_cell_key, cell_key);
614  // fill number of trigger cells in wafers
615  auto itr_insert = number_trigger_cells_in_wafers_.emplace(type, 0);
616  if (trigger_cell + 1 > itr_insert.first->second)
617  itr_insert.first->second = trigger_cell + 1;
618  }
619  if (!l1tCellsMappingStream.eof()) {
620  throw cms::Exception("BadGeometryFile")
621  << "Error reading L1TCellsMapping '" << type << " " << cellu << " " << cellv << " " << trigger_cell << "' \n";
622  }
623  l1tCellsMappingStream.close();
624  // read scintillator trigger cell mapping file
625  std::ifstream l1tCellsSciMappingStream(l1tCellsSciMapping_.fullPath());
626  if (!l1tCellsSciMappingStream.is_open()) {
627  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellsSciMapping file\n";
628  }
629  short ieta = 0;
630  short iphi = 0;
631  trigger_wafer = 0;
632  trigger_cell = 0;
633  for (; l1tCellsSciMappingStream >> ieta >> iphi >> trigger_wafer >> trigger_cell;) {
634  unsigned cell_key = packIetaIphi(ieta, iphi);
635  unsigned trigger_cell_key = packWaferCellId(ForwardSubdetector::HGCHEB, trigger_wafer, trigger_cell);
636  // fill cell <-> trigger cell mappings
637  cells_to_trigger_cells_sci_.emplace(cell_key, trigger_cell_key);
638  trigger_cells_to_cells_sci_.emplace(trigger_cell_key, cell_key);
639  // fill number of trigger cells in wafers
640  auto itr_insert = number_trigger_cells_in_wafers_sci_.emplace(trigger_wafer, 0);
641  if (trigger_cell + 1 > itr_insert.first->second)
642  itr_insert.first->second = trigger_cell + 1;
643  }
644  if (!l1tCellsSciMappingStream.eof()) {
645  throw cms::Exception("BadGeometryFile") << "Error reading L1TCellsSciMapping '" << ieta << " " << iphi << " "
646  << trigger_wafer << " " << trigger_cell << "' \n";
647  }
648  l1tCellsSciMappingStream.close();
649  // read wafer mapping file
650  std::ifstream l1tWafersMappingStream(l1tWafersMapping_.fullPath());
651  if (!l1tWafersMappingStream.is_open()) {
652  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TWafersMapping file\n";
653  }
654  short waferu = 0;
655  short waferv = 0;
656  trigger_wafer = 0;
657  for (; l1tWafersMappingStream >> waferu >> waferv >> trigger_wafer;) {
658  unsigned wafer_key = packWaferId(waferu, waferv);
659  // fill wafer u,v <-> old wafer ID mappings
660  wafers_to_wafers_old_.emplace(wafer_key, trigger_wafer);
661  wafers_old_to_wafers_.emplace(trigger_wafer, wafer_key);
662  }
663  if (!l1tWafersMappingStream.eof()) {
664  throw cms::Exception("BadGeometryFile")
665  << "Error reading L1TWafersMapping '" << waferu << " " << waferv << " " << trigger_wafer << "' \n";
666  }
667  l1tWafersMappingStream.close();
668 }
type
Definition: HCALResponse.h:21
unsigned packCellId(unsigned type, unsigned cellU, unsigned cellV) const
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_sci_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
unsigned packWaferId(int waferU, int waferV) const
std::unordered_map< unsigned, unsigned > wafer_to_module_
unsigned packLayerWaferId(unsigned layer, unsigned wafer) const
std::unordered_map< unsigned, unsigned > links_per_module_
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
unsigned packIetaIphi(unsigned ieta, unsigned iphi) const
unsigned packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_sci_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_sci_
std::unordered_map< unsigned, unsigned > wafers_to_wafers_old_
std::string fullPath() const
Definition: FileInPath.cc:163
Definition: vlib.h:198
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
void HGCalTriggerGeometryV9Imp1::fillNeighborMap ( const edm::FileInPath file,
neighbor_map neighbors_map,
bool  scintillator 
)
private

Definition at line 670 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by initialize().

672  {
673  // Fill trigger neighbor map
674  std::ifstream l1tCellNeighborsMappingStream(file.fullPath());
675  if (!l1tCellNeighborsMappingStream.is_open()) {
676  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TCellNeighborsMapping file\n";
677  }
678  const unsigned line_size = 512;
679  for (std::array<char, line_size> buffer; l1tCellNeighborsMappingStream.getline(&buffer[0], line_size);) {
680  std::string line(&buffer[0]);
681  // Extract keys consisting of the module id
682  // and of the trigger cell id
683  // Match patterns (X,Y)
684  // where X is a number with less than 4 digis
685  // and Y is a number with less than 4 digits
686  // For the scintillator case, match instead (X,Y,Z) patterns
687  std::regex key_regex(scintillator ? "\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)"
688  : "\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)");
689  std::vector<std::string> key_tokens{std::sregex_token_iterator(line.begin(), line.end(), key_regex), {}};
690  if (key_tokens.empty()) {
691  throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n"
692  << " Cannot find the trigger cell key in line:\n"
693  << " '" << &buffer[0] << "'\n";
694  }
695  std::regex digits_regex("\\d{1,3}");
696  std::vector<std::string> module_tc{
697  std::sregex_token_iterator(key_tokens[0].begin(), key_tokens[0].end(), digits_regex), {}};
698  // get module and cell id
699  unsigned map_key = 0;
700  if (scintillator) {
701  int type = std::stoi(module_tc[0]);
702  int module = std::stoi(module_tc[1]);
703  int trigger_cell = std::stoi(module_tc[2]);
704  map_key = packTriggerCellWithType(type, module, trigger_cell);
705  } else {
706  int module = std::stoi(module_tc[0]);
707  int trigger_cell = std::stoi(module_tc[1]);
708  map_key = packTriggerCell(module, trigger_cell);
709  }
710  // Extract neighbors
711  // Match patterns (X,Y)
712  // where X is a number with less than 4 digits
713  // and Y is a number with less than 4 digits
714  std::regex neighbors_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)");
715  std::vector<std::string> neighbors_tokens{std::sregex_token_iterator(line.begin(), line.end(), neighbors_regex),
716  {}};
717  if ((scintillator && neighbors_tokens.empty()) || (!scintillator && neighbors_tokens.size() < 2)) {
718  throw cms::Exception("BadGeometry") << "Syntax error in the L1TCellNeighborsMapping:\n"
719  << " Cannot find any neighbor in line:\n"
720  << " '" << &buffer[0] << "'\n";
721  }
722  auto itr_insert = neighbors_map.emplace(map_key, std::set<std::pair<short, short>>());
723  // The first element for silicon neighbors is the key, so start at index 1
724  unsigned first_element = (scintillator ? 0 : 1);
725  for (unsigned i = first_element; i < neighbors_tokens.size(); i++) {
726  const auto& neighbor = neighbors_tokens[i];
727  std::vector<std::string> pair_neighbor{std::sregex_token_iterator(neighbor.begin(), neighbor.end(), digits_regex),
728  {}};
729  short neighbor_module(std::stoi(pair_neighbor[0]));
730  short neighbor_cell(std::stoi(pair_neighbor[1]));
731  itr_insert.first->second.emplace(neighbor_module, neighbor_cell);
732  }
733  }
734  if (!l1tCellNeighborsMappingStream.eof()) {
735  throw cms::Exception("BadGeometryFile") << "Error reading L1TCellNeighborsMapping'\n";
736  }
737  l1tCellNeighborsMappingStream.close();
738 }
type
Definition: HCALResponse.h:21
unsigned packTriggerCellWithType(unsigned, unsigned, unsigned) const
#define end
Definition: vmac.h:39
unsigned packTriggerCell(unsigned, unsigned) const
#define begin
Definition: vmac.h:32
std::string fullPath() const
Definition: FileInPath.cc:163
Definition: vlib.h:198
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 320 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getModulePosition().

320  {
321  geom_set cell_det_ids;
322  geom_set trigger_cells = getTriggerCellsFromModule(module_id);
323  for (auto trigger_cell_id : trigger_cells) {
324  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
325  cell_det_ids.insert(cells.begin(), cells.end());
326  }
327  return cell_det_ids;
328 }
std::unordered_set< unsigned > geom_set
geom_set getTriggerCellsFromModule(const unsigned) const final
geom_set getCellsFromTriggerCell(const unsigned) const final
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getCellsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 271 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCalDetId::cell(), HGCalTopology::dddConstants(), detIdWaferType(), Exception, HGCalDDDConstants::getTypeTrap(), DetId::HGCalEE, DetId::HGCalHSi, HGCEE, HGCHEB, HGCalTriggerGeometryBase::hscTopology(), LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, HGCalDetId::layer(), packCellId(), packWaferCellId(), DetId::subdetId(), trigger_cells_to_cells_, trigger_cells_to_cells_sci_, unpackCellId(), unpackIetaIphi(), unpackWaferId(), validCellId(), HGCalDetId::wafer(), wafers_old_to_wafers_, and HGCalDetId::zside().

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

272  {
273  HGCalDetId trigger_cell_det_id(trigger_cell_id);
274  geom_set cell_det_ids;
275  unsigned subdet = trigger_cell_det_id.subdetId();
276  unsigned trigger_wafer = trigger_cell_det_id.wafer();
277  unsigned trigger_cell = trigger_cell_det_id.cell();
278  unsigned layer = trigger_cell_det_id.layer();
279  // Scintillator
280  if (subdet == ForwardSubdetector::HGCHEB) {
281  int type = hscTopology().dddConstants().getTypeTrap(layer);
282  const auto& cell_range =
283  trigger_cells_to_cells_sci_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell));
284  for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) {
285  unsigned ieta = 0;
286  unsigned iphi = 0;
287  unpackIetaIphi(tc_c_itr->second, ieta, iphi);
288  unsigned cell_det_id = HGCScintillatorDetId(type, layer, trigger_cell_det_id.zside() * ieta, iphi).rawId();
289  if (validCellId(subdet, cell_det_id))
290  cell_det_ids.emplace(cell_det_id);
291  }
292  }
293  // Silicon
294  else {
295  int waferu = 0;
296  int waferv = 0;
297  auto wafer_itr = wafers_old_to_wafers_.find(trigger_wafer);
298  if (wafer_itr == wafers_old_to_wafers_.end()) {
299  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Trigger wafer ID " << trigger_wafer
300  << " is not mapped to any wafer. The wafer mapping should be modified.\n";
301  }
302  unpackWaferId(wafer_itr->second, waferu, waferv);
303  DetId::Detector det =
304  (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCEE ? DetId::HGCalEE : DetId::HGCalHSi);
305  unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv);
306  const auto& cell_range = trigger_cells_to_cells_.equal_range(packCellId(wafer_type, trigger_cell));
307  for (auto tc_c_itr = cell_range.first; tc_c_itr != cell_range.second; tc_c_itr++) {
308  unsigned cellu = 0;
309  unsigned cellv = 0;
310  unpackCellId(tc_c_itr->second, cellu, cellv);
311  unsigned cell_det_id =
312  HGCSiliconDetId(det, trigger_cell_det_id.zside(), wafer_type, layer, waferu, waferv, cellu, cellv).rawId();
313  if (validCellId(subdet, cell_det_id))
314  cell_det_ids.emplace(cell_det_id);
315  }
316  }
317  return cell_det_ids;
318 }
int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const
type
Definition: HCALResponse.h:21
unsigned packCellId(unsigned type, unsigned cellU, unsigned cellV) const
int getTypeTrap(int layer) const
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
bool validCellId(unsigned det, unsigned cell_id) const
void unpackIetaIphi(unsigned ieta_iphi, unsigned &ieta, unsigned &iphi) const
void unpackCellId(unsigned cell, unsigned &cellU, unsigned &cellV) const
unsigned packWaferCellId(unsigned subdet, unsigned wafer, unsigned cell) const
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_sci_
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:96
const HGCalTopology & hscTopology() const
Detector
Definition: DetId.h:24
void unpackWaferId(unsigned wafer, int &waferU, int &waferV) const
std::unordered_set< unsigned > geom_set
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
unsigned HGCalTriggerGeometryV9Imp1::getLinksInModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 482 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCHEB, hSc_links_per_module_, layerWithOffset(), electronStore::links, links_per_module_, packLayerWaferId(), DetId::subdetId(), and HGCalDetId::wafer().

482  {
483  HGCalDetId module_det_id(module_id);
484  unsigned links = 0;
485  unsigned module = module_det_id.wafer();
486  unsigned layer = layerWithOffset(module_det_id);
487  // Scintillator
488  if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
489  links = hSc_links_per_module_;
490  }
491  // Silicon
492  else {
493  const unsigned sector0_mask = 0x7F;
494  module = (module & sector0_mask);
495  links = links_per_module_.at(packLayerWaferId(layer, module));
496  }
497  return links;
498 }
unsigned packLayerWaferId(unsigned layer, unsigned wafer) const
std::unordered_map< unsigned, unsigned > links_per_module_
unsigned layerWithOffset(unsigned) const
Definition: vlib.h:198
unsigned HGCalTriggerGeometryV9Imp1::getModuleFromCell ( const unsigned  cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 237 of file HGCalTriggerGeometryV9Imp1.cc.

References getModuleFromTriggerCell(), and getTriggerCellFromCell().

237  {
239 }
unsigned getModuleFromTriggerCell(const unsigned) const final
unsigned getTriggerCellFromCell(const unsigned) const final
unsigned HGCalTriggerGeometryV9Imp1::getModuleFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 241 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getModuleFromCell().

241  {
242  HGCalDetId trigger_cell_det_id(trigger_cell_id);
243  unsigned module = 0;
244  // Scintillator
245  if (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
246  // For scintillator, the module ID is currently encoded as the wafer in HGCalDetId
247  module = trigger_cell_det_id.wafer();
248  }
249  // Silicon
250  else {
251  unsigned layer_with_offset = layerWithOffset(trigger_cell_id);
252  auto module_itr = wafer_to_module_.find(packLayerWaferId(layer_with_offset, trigger_cell_det_id.wafer()));
253  if (module_itr == wafer_to_module_.end()) {
254  throw cms::Exception("BadGeometry")
255  << trigger_cell_det_id << "HGCalTriggerGeometry: Wafer " << trigger_cell_det_id.wafer()
256  << " is not mapped to any trigger module. The module mapping should be modified. See "
257  "https://twiki.cern.ch/twiki/bin/viewauth/CMS/HGCALTriggerPrimitivesSimulation#Trigger_geometry for "
258  "details.\n";
259  }
260  module = module_itr->second;
261  }
262  return HGCalDetId((ForwardSubdetector)trigger_cell_det_id.subdetId(),
263  trigger_cell_det_id.zside(),
264  trigger_cell_det_id.layer(),
265  trigger_cell_det_id.waferType(),
266  module,
268  .rawId();
269 }
std::unordered_map< unsigned, unsigned > wafer_to_module_
ForwardSubdetector
unsigned packLayerWaferId(unsigned layer, unsigned wafer) const
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
unsigned layerWithOffset(unsigned) const
Definition: vlib.h:198
GlobalPoint HGCalTriggerGeometryV9Imp1::getModulePosition ( const unsigned  module_det_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 539 of file HGCalTriggerGeometryV9Imp1.cc.

References PV3DBase< T, PVType, FrameType >::basicVector(), DetId::det(), HGCalTriggerGeometryBase::eeGeometry(), getCellsFromModule(), HGCalGeometry::getPosition(), DetId::HGCalEE, HGCHEB, HGCalTriggerGeometryBase::hscGeometry(), HGCalTriggerGeometryBase::hsiGeometry(), and DetId::subdetId().

539  {
540  unsigned subdet = HGCalDetId(module_det_id).subdetId();
541  // Position: barycenter of the module.
542  Basic3DVector<float> moduleVector(0., 0., 0.);
543  const auto cell_ids = getCellsFromModule(module_det_id);
544  // Scintillator
545  if (subdet == ForwardSubdetector::HGCHEB) {
546  for (const auto& cell : cell_ids) {
547  moduleVector += hscGeometry()->getPosition(cell).basicVector();
548  }
549  }
550  // Silicon
551  else {
552  for (const auto& cell : cell_ids) {
553  HGCSiliconDetId cellDetId(cell);
554  moduleVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId)
555  : hsiGeometry()->getPosition(cellDetId))
556  .basicVector();
557  }
558  }
559  return GlobalPoint(moduleVector / cell_ids.size());
560 }
const HGCalGeometry * eeGeometry() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
geom_set getCellsFromModule(const unsigned) const final
GlobalPoint getPosition(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
const HGCalGeometry * hsiGeometry() const
const HGCalGeometry * hscGeometry() const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
unsigned HGCalTriggerGeometryV9Imp1::getModuleSize ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 500 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCHEB, hSc_wafers_per_module_, layerWithOffset(), module_to_wafers_, packLayerWaferId(), DetId::subdetId(), and HGCalDetId::wafer().

500  {
501  HGCalDetId module_det_id(module_id);
502  unsigned module = module_det_id.wafer();
503  unsigned layer = layerWithOffset(module_det_id);
504  unsigned nWafers = 1;
505  // Scintillator
506  if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
507  nWafers = hSc_wafers_per_module_;
508  }
509  // Silicon
510  else {
511  nWafers = module_to_wafers_.count(packLayerWaferId(layer, module));
512  }
513  return nWafers;
514 }
unsigned packLayerWaferId(unsigned layer, unsigned wafer) const
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
unsigned layerWithOffset(unsigned) const
Definition: vlib.h:198
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getNeighborsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 441 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCalDetId::cell(), HGCalTopology::dddConstants(), Exception, HGCalDDDConstants::getTypeTrap(), HGCHEB, HGCalTriggerGeometryBase::hscTopology(), HGCalDetId::layer(), packTriggerCell(), packTriggerCellWithType(), DetId::subdetId(), trigger_cell_neighbors_, trigger_cell_neighbors_sci_, validTriggerCell(), HGCalDetId::wafer(), and HGCalDetId::zside().

Referenced by fillInvalidTriggerCells().

442  {
443  HGCalDetId trigger_cell_det_id(trigger_cell_id);
444  // Choose scintillator or silicon map
445  const auto& neighbors_map =
446  (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB ? trigger_cell_neighbors_sci_
448  unsigned layer = trigger_cell_det_id.layer();
449  unsigned type =
450  (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB ? hscTopology().dddConstants().getTypeTrap(layer)
451  : 1);
452  unsigned module = trigger_cell_det_id.wafer();
453  unsigned trigger_cell = trigger_cell_det_id.cell();
454  // retrieve neighbors
455  unsigned trigger_cell_key = (trigger_cell_det_id.subdetId() == ForwardSubdetector::HGCHEB
456  ? packTriggerCellWithType(type, module, trigger_cell)
457  : packTriggerCell(module, trigger_cell));
458  geom_set neighbor_detids;
459  auto neighbors_itr = neighbors_map.find(trigger_cell_key);
460  if (neighbors_itr == neighbors_map.end()) {
461  throw cms::Exception("BadGeometry") << "HGCalTriggerGeometry: Neighbors are not defined for trigger cell "
462  << trigger_cell << " in module " << module
463  << ". The trigger cell neighbor mapping should be modified. \n";
464  }
465  const auto& neighbors = neighbors_itr->second;
466  // create HGCalDetId of neighbors and check their validity
467  neighbor_detids.reserve(neighbors.size());
468  for (const auto& module_tc : neighbors) {
469  HGCalDetId neighbor_det_id((ForwardSubdetector)trigger_cell_det_id.subdetId(),
470  trigger_cell_det_id.zside(),
471  layer,
472  type,
473  module_tc.first,
474  module_tc.second);
475  if (validTriggerCell(neighbor_det_id.rawId())) {
476  neighbor_detids.emplace(neighbor_det_id.rawId());
477  }
478  }
479  return neighbor_detids;
480 }
type
Definition: HCALResponse.h:21
int getTypeTrap(int layer) const
bool validTriggerCell(const unsigned) const final
ForwardSubdetector
unsigned packTriggerCellWithType(unsigned, unsigned, unsigned) const
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:96
const HGCalTopology & hscTopology() const
unsigned packTriggerCell(unsigned, unsigned) const
std::unordered_set< unsigned > geom_set
Definition: vlib.h:198
HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp1::getOrderedCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 330 of file HGCalTriggerGeometryV9Imp1.cc.

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

331  {
332  geom_ordered_set cell_det_ids;
333  geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id);
334  for (auto trigger_cell_id : trigger_cells) {
335  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
336  cell_det_ids.insert(cells.begin(), cells.end());
337  }
338  return cell_det_ids;
339 }
geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final
std::set< unsigned > geom_ordered_set
std::unordered_set< unsigned > geom_set
geom_set getCellsFromTriggerCell(const unsigned) const final
HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp1::getOrderedTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 391 of file HGCalTriggerGeometryV9Imp1.cc.

References detIdWaferType(), DetId::HGCalEE, DetId::HGCalHSi, HGCEE, HGCHEB, HGCalDetId::layer(), layerWithOffset(), module_to_wafers_, number_trigger_cells_in_wafers_, number_trigger_cells_in_wafers_sci_, packLayerWaferId(), DetId::subdetId(), unpackWaferId(), validTriggerCell(), HGCalDetId::wafer(), wafers_old_to_wafers_, HGCalDetId::waferType(), and HGCalDetId::zside().

Referenced by getOrderedCellsFromModule().

392  {
393  HGCalDetId module_det_id(module_id);
394  geom_ordered_set trigger_cell_det_ids;
395  unsigned module = module_det_id.wafer();
396  unsigned layer = module_det_id.layer();
397  // Scintillator
398  if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
399  // loop on the trigger cells in each module
400  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_sci_.at(module); trigger_cell++) {
401  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
402  module_det_id.zside(),
403  layer,
404  module_det_id.waferType(),
405  module,
406  trigger_cell);
407  if (validTriggerCell(trigger_cell_id))
408  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
409  }
410  }
411  // EE or FH
412  else {
413  auto wafer_itrs = module_to_wafers_.equal_range(packLayerWaferId(layerWithOffset(module_id), module));
414  // loop on the wafers included in the module
415  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
416  unsigned wafer = wafer_itr->second;
417  auto waferuv_itr = wafers_old_to_wafers_.find(wafer);
418  if (waferuv_itr == wafers_old_to_wafers_.end())
419  continue;
420  int waferu = 0;
421  int waferv = 0;
422  unpackWaferId(waferuv_itr->second, waferu, waferv);
423  DetId::Detector det = (module_det_id.subdetId() == ForwardSubdetector::HGCEE ? DetId::HGCalEE : DetId::HGCalHSi);
424  unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv);
425  // loop on the trigger cells in each wafer
426  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++) {
427  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
428  module_det_id.zside(),
429  layer,
430  module_det_id.waferType(),
431  wafer,
432  trigger_cell);
433  if (validTriggerCell(trigger_cell_id))
434  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
435  }
436  }
437  }
438  return trigger_cell_det_ids;
439 }
int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const
bool validTriggerCell(const unsigned) const final
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
ForwardSubdetector
unsigned packLayerWaferId(unsigned layer, unsigned wafer) const
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
unsigned layerWithOffset(unsigned) const
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_sci_
Detector
Definition: DetId.h:24
void unpackWaferId(unsigned wafer, int &waferU, int &waferV) const
std::set< unsigned > geom_ordered_set
Definition: vlib.h:198
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
unsigned HGCalTriggerGeometryV9Imp1::getTriggerCellFromCell ( const unsigned  cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 179 of file HGCalTriggerGeometryV9Imp1.cc.

References cells_to_trigger_cells_, cells_to_trigger_cells_sci_, HGCSiliconDetId::cellU(), HGCSiliconDetId::cellV(), DetId::det(), Exception, DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, HGCEE, HGCHEB, HGCHEF, LEDCalibrationChannels::ieta, HGCScintillatorDetId::ietaAbs(), HGCScintillatorDetId::iphi(), LEDCalibrationChannels::iphi, HGCScintillatorDetId::layer(), HGCSiliconDetId::layer(), packCellId(), packIetaIphi(), packWaferId(), DetId::rawId(), HGCScintillatorDetId::type(), HGCSiliconDetId::type(), unpackWaferCellId(), wafers_to_wafers_old_, HGCSiliconDetId::waferU(), HGCSiliconDetId::waferV(), HGCScintillatorDetId::zside(), HGCSiliconDetId::zside(), and ecaldqm::zside().

Referenced by getModuleFromCell().

179  {
180  unsigned det = DetId(cell_id).det();
181  unsigned subdet = 0;
182  int zside = 0;
183  unsigned tc_type = 1;
184  unsigned layer = 0;
185  unsigned wafer_trigger_cell = 0;
186  unsigned trigger_cell = 0;
187  // Scintillator
188  if (det == DetId::HGCalHSc) {
189  HGCScintillatorDetId cell_det_id(cell_id);
190  unsigned ieta = cell_det_id.ietaAbs();
191  unsigned iphi = cell_det_id.iphi();
192  tc_type = cell_det_id.type();
193  layer = cell_det_id.layer();
195  zside = cell_det_id.zside();
196  auto trigger_cell_itr = cells_to_trigger_cells_sci_.find(packIetaIphi(ieta, iphi));
197  if (trigger_cell_itr == cells_to_trigger_cells_sci_.end()) {
198  throw cms::Exception("BadGeometry")
199  << "HGCalTriggerGeometry: scintillator cell ieta=" << ieta << ", iphi=" << iphi
200  << " is not mapped to any trigger cell. The trigger cell mapping should be modified.\n";
201  }
202  trigger_cell = 0;
203  wafer_trigger_cell = 0;
204  unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell);
205  }
206  // Silicon
207  else if (det == DetId::HGCalEE || det == DetId::HGCalHSi) {
208  HGCSiliconDetId cell_det_id(cell_id);
210  layer = cell_det_id.layer();
211  zside = cell_det_id.zside();
212  int type = cell_det_id.type();
213  int waferu = cell_det_id.waferU();
214  int waferv = cell_det_id.waferV();
215  unsigned cellu = cell_det_id.cellU();
216  unsigned cellv = cell_det_id.cellV();
217  auto trigger_cell_itr = cells_to_trigger_cells_.find(packCellId(type, cellu, cellv));
218  if (trigger_cell_itr == cells_to_trigger_cells_.end()) {
219  throw cms::Exception("BadGeometry")
220  << "HGCalTriggerGeometry: HGCal cell " << cellu << "," << cellv << " in wafer type " << type
221  << " is not mapped to any trigger cell. The trigger cell mapping should be modified.\n";
222  }
223  auto wafer_trigger_cell_itr = wafers_to_wafers_old_.find(packWaferId(waferu, waferv));
224  if (wafer_trigger_cell_itr == wafers_to_wafers_old_.end()) {
225  throw cms::Exception("BadGeometry")
226  << "HGCalTriggerGeometry: Wafer " << waferu << "," << waferv
227  << " is not mapped to any trigger wafer ID. The wafer mapping should be modified.\n";
228  }
229  trigger_cell = trigger_cell_itr->second;
230  wafer_trigger_cell = wafer_trigger_cell_itr->second;
231  }
232  // Using the old HGCalDetId for trigger cells is temporary
233  // For easy switch between V8 and V9 geometries
234  return HGCalDetId((ForwardSubdetector)subdet, zside, layer, tc_type, wafer_trigger_cell, trigger_cell).rawId();
235 }
type
Definition: HCALResponse.h:21
unsigned packCellId(unsigned type, unsigned cellU, unsigned cellV) const
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_sci_
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
unsigned packWaferId(int waferU, int waferV) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int zside(DetId const &)
ForwardSubdetector
void unpackWaferCellId(unsigned wafer_cell, unsigned &wafer, unsigned &cell) const
unsigned packIetaIphi(unsigned ieta, unsigned iphi) const
Definition: DetId.h:17
std::unordered_map< unsigned, unsigned > wafers_to_wafers_old_
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
GlobalPoint HGCalTriggerGeometryV9Imp1::getTriggerCellPosition ( const unsigned  trigger_cell_det_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 516 of file HGCalTriggerGeometryV9Imp1.cc.

References PV3DBase< T, PVType, FrameType >::basicVector(), DetId::det(), HGCalTriggerGeometryBase::eeGeometry(), getCellsFromTriggerCell(), HGCalGeometry::getPosition(), DetId::HGCalEE, HGCHEB, HGCalTriggerGeometryBase::hscGeometry(), HGCalTriggerGeometryBase::hsiGeometry(), and DetId::subdetId().

516  {
517  unsigned subdet = HGCalDetId(trigger_cell_det_id).subdetId();
518  // Position: barycenter of the trigger cell.
519  Basic3DVector<float> triggerCellVector(0., 0., 0.);
520  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
521  // Scintillator
522  if (subdet == ForwardSubdetector::HGCHEB) {
523  for (const auto& cell : cell_ids) {
524  triggerCellVector += hscGeometry()->getPosition(cell).basicVector();
525  }
526  }
527  // Silicon
528  else {
529  for (const auto& cell : cell_ids) {
530  HGCSiliconDetId cellDetId(cell);
531  triggerCellVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId)
532  : hsiGeometry()->getPosition(cellDetId))
533  .basicVector();
534  }
535  }
536  return GlobalPoint(triggerCellVector / cell_ids.size());
537 }
const HGCalGeometry * eeGeometry() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPosition(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
const HGCalGeometry * hsiGeometry() const
const HGCalGeometry * hscGeometry() const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
geom_set getCellsFromTriggerCell(const unsigned) const final
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 341 of file HGCalTriggerGeometryV9Imp1.cc.

References detIdWaferType(), DetId::HGCalEE, DetId::HGCalHSi, HGCEE, HGCHEB, HGCalDetId::layer(), layerWithOffset(), module_to_wafers_, number_trigger_cells_in_wafers_, number_trigger_cells_in_wafers_sci_, packLayerWaferId(), DetId::subdetId(), unpackWaferId(), validTriggerCell(), HGCalDetId::wafer(), wafers_old_to_wafers_, HGCalDetId::waferType(), and HGCalDetId::zside().

Referenced by getCellsFromModule().

342  {
343  HGCalDetId module_det_id(module_id);
344  geom_set trigger_cell_det_ids;
345  unsigned module = module_det_id.wafer();
346  unsigned layer = module_det_id.layer();
347  // Scintillator
348  if (module_det_id.subdetId() == ForwardSubdetector::HGCHEB) {
349  // loop on the trigger cells in each module
350  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_sci_.at(module); trigger_cell++) {
351  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
352  module_det_id.zside(),
353  layer,
354  module_det_id.waferType(),
355  module,
356  trigger_cell);
357  if (validTriggerCell(trigger_cell_id))
358  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
359  }
360  }
361  // Silicon
362  else {
363  auto wafer_itrs = module_to_wafers_.equal_range(packLayerWaferId(layerWithOffset(module_id), module));
364  // loop on the wafers included in the module
365  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
366  unsigned wafer = wafer_itr->second;
367  auto waferuv_itr = wafers_old_to_wafers_.find(wafer);
368  if (waferuv_itr == wafers_old_to_wafers_.end())
369  continue;
370  int waferu = 0;
371  int waferv = 0;
372  unpackWaferId(waferuv_itr->second, waferu, waferv);
373  DetId::Detector det = (module_det_id.subdetId() == ForwardSubdetector::HGCEE ? DetId::HGCalEE : DetId::HGCalHSi);
374  unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv);
375  // loop on the trigger cells in each wafer
376  for (int trigger_cell = 0; trigger_cell < number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++) {
377  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(),
378  module_det_id.zside(),
379  layer,
380  module_det_id.waferType(),
381  wafer,
382  trigger_cell);
383  if (validTriggerCell(trigger_cell_id))
384  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
385  }
386  }
387  }
388  return trigger_cell_det_ids;
389 }
int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const
bool validTriggerCell(const unsigned) const final
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
ForwardSubdetector
unsigned packLayerWaferId(unsigned layer, unsigned wafer) const
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
unsigned layerWithOffset(unsigned) const
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_sci_
Detector
Definition: DetId.h:24
void unpackWaferId(unsigned wafer, int &waferU, int &waferV) const
std::unordered_set< unsigned > geom_set
Definition: vlib.h:198
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
void HGCalTriggerGeometryV9Imp1::initialize ( const CaloGeometry calo_geometry)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 147 of file HGCalTriggerGeometryV9Imp1.cc.

References Exception.

147  {
148  throw cms::Exception("BadGeometry")
149  << "HGCalTriggerGeometryV9Imp1 geometry cannot be initialized with the V7/V8 HGCAL geometry";
150 }
void HGCalTriggerGeometryV9Imp1::initialize ( const HGCalGeometry hgc_ee_geometry,
const HGCalGeometry hgc_hsi_geometry,
const HGCalGeometry hgc_hsc_geometry 
)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 152 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCalTopology::dddConstants(), disconnected_layers_, HGCalTriggerGeometryBase::eeTopology(), fillInvalidTriggerCells(), fillMaps(), fillNeighborMap(), heOffset_, HGCalTriggerGeometryBase::hsiTopology(), l1tCellNeighborsMapping_, l1tCellNeighborsSciMapping_, last_trigger_layer_, HGCalDDDConstants::layers(), HGCalTriggerGeometryBase::setEEGeometry(), HGCalTriggerGeometryBase::setHScGeometry(), HGCalTriggerGeometryBase::setHSiGeometry(), totalLayers_, trigger_cell_neighbors_, trigger_cell_neighbors_sci_, and trigger_layers_.

154  {
155  setEEGeometry(hgc_ee_geometry);
156  setHSiGeometry(hgc_hsi_geometry);
157  setHScGeometry(hgc_hsc_geometry);
160  trigger_layers_.resize(totalLayers_ + 1);
161  trigger_layers_[0] = 0; // layer number 0 doesn't exist
162  unsigned trigger_layer = 1;
163  for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) {
164  if (disconnected_layers_.find(layer) == disconnected_layers_.end()) {
165  // Increase trigger layer number if the layer is not disconnected
166  trigger_layers_[layer] = trigger_layer;
167  trigger_layer++;
168  } else {
169  trigger_layers_[layer] = 0;
170  }
171  }
172  last_trigger_layer_ = trigger_layer - 1;
173  fillMaps();
177 }
std::unordered_set< unsigned > disconnected_layers_
void setEEGeometry(const HGCalGeometry *geom)
const HGCalTopology & eeTopology() const
std::vector< unsigned > trigger_layers_
const HGCalTopology & hsiTopology() const
void setHSiGeometry(const HGCalGeometry *geom)
unsigned int layers(bool reco) const
void setHScGeometry(const HGCalGeometry *geom)
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:96
void fillNeighborMap(const edm::FileInPath &, neighbor_map &, bool)
unsigned HGCalTriggerGeometryV9Imp1::lastTriggerLayer ( ) const
inlinefinalvirtual
unsigned HGCalTriggerGeometryV9Imp1::layerWithOffset ( unsigned  id) const
private

Definition at line 980 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by disconnectedModule(), getLinksInModule(), getModuleFromTriggerCell(), getModuleSize(), getOrderedTriggerCellsFromModule(), getTriggerCellsFromModule(), and triggerLayer().

980  {
981  HGCalDetId detid(id);
982  unsigned layer = 0;
983  switch (detid.subdetId()) {
985  layer = detid.layer();
986  break;
988  layer = heOffset_ + detid.layer();
989  break;
991  layer = heOffset_ + detid.layer();
992  break;
993  };
994  return layer;
995 }
unsigned HGCalTriggerGeometryV9Imp1::packCellId ( unsigned  type,
unsigned  cellU,
unsigned  cellV 
) const
private

Definition at line 832 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCSiliconDetId::kHGCalCellUMask, HGCSiliconDetId::kHGCalCellUOffset, HGCSiliconDetId::kHGCalCellVMask, HGCSiliconDetId::kHGCalCellVOffset, HGCSiliconDetId::kHGCalTypeMask, and HGCSiliconDetId::kHGCalTypeOffset.

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

832  {
833  unsigned packed_value = 0;
837  return packed_value;
838 }
type
Definition: HCALResponse.h:21
static const int kHGCalTypeMask
static const int kHGCalCellUMask
static const int kHGCalCellVOffset
static const int kHGCalTypeOffset
static const int kHGCalCellVMask
static const int kHGCalCellUOffset
unsigned HGCalTriggerGeometryV9Imp1::packCellId ( unsigned  type,
unsigned  cell 
) const
private

Definition at line 825 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCalDetId::kHGCalCellMask, HGCalDetId::kHGCalCellOffset, HGCSiliconDetId::kHGCalTypeMask, and HGCSiliconDetId::kHGCalTypeOffset.

825  {
826  unsigned packed_value = 0;
827  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
829  return packed_value;
830 }
type
Definition: HCALResponse.h:21
static const int kHGCalTypeMask
static const int kHGCalTypeOffset
static const int kHGCalCellOffset
Definition: HGCalDetId.h:10
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
unsigned HGCalTriggerGeometryV9Imp1::packIetaIphi ( unsigned  ieta,
unsigned  iphi 
) const
private
unsigned HGCalTriggerGeometryV9Imp1::packLayerWaferId ( unsigned  layer,
unsigned  wafer 
) const
private

Definition at line 812 of file HGCalTriggerGeometryV9Imp1.cc.

References heOffset_, HGCEE, HGCHEF, HGCalDetId::kHGCalLayerMask, HGCalDetId::kHGCalLayerOffset, HGCalDetId::kHGCalWaferMask, HGCalDetId::kHGCalWaferOffset, DetId::kSubdetMask, and DetId::kSubdetOffset.

Referenced by fillMaps(), getLinksInModule(), getModuleFromTriggerCell(), getModuleSize(), getOrderedTriggerCellsFromModule(), and getTriggerCellsFromModule().

812  {
813  unsigned packed_value = 0;
814  unsigned subdet = ForwardSubdetector::HGCEE;
815  if (layer > heOffset_) {
816  layer -= heOffset_;
818  }
819  packed_value |= ((layer & HGCalDetId::kHGCalLayerMask) << HGCalDetId::kHGCalLayerOffset);
820  packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset);
821  packed_value |= ((subdet & DetId::kSubdetMask) << DetId::kSubdetOffset);
822  return packed_value;
823 }
static const int kHGCalLayerOffset
Definition: HGCalDetId.h:16
static const int kHGCalLayerMask
Definition: HGCalDetId.h:17
static const int kSubdetOffset
Definition: DetId.h:22
static const int kSubdetMask
Definition: DetId.h:20
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
unsigned HGCalTriggerGeometryV9Imp1::packTriggerCell ( unsigned  module,
unsigned  trigger_cell 
) const
private

Definition at line 948 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by fillNeighborMap(), and getNeighborsFromTriggerCell().

948  {
949  unsigned packed_value = 0;
950  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
952  return packed_value;
953 }
static const int kHGCalCellOffset
Definition: HGCalDetId.h:10
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
Definition: vlib.h:198
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
unsigned HGCalTriggerGeometryV9Imp1::packTriggerCellWithType ( unsigned  type,
unsigned  module,
unsigned  trigger_cell 
) const
private

Definition at line 955 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by fillNeighborMap(), and getNeighborsFromTriggerCell().

957  {
958  unsigned packed_value = 0;
959  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
962  return packed_value;
963 }
type
Definition: HCALResponse.h:21
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:14
static const int kHGCalCellOffset
Definition: HGCalDetId.h:10
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
static const int kHGCalWaferTypeMask
Definition: HGCalDetId.h:15
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
Definition: vlib.h:198
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
unsigned HGCalTriggerGeometryV9Imp1::packWaferCellId ( unsigned  subdet,
unsigned  wafer,
unsigned  cell 
) const
private

Definition at line 803 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by fillMaps(), and getCellsFromTriggerCell().

803  {
804  unsigned packed_value = 0;
805  const int kSubdetMask = 0x7;
806  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
807  packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset);
808  packed_value |= ((subdet & kSubdetMask) << (HGCalDetId::kHGCalWaferTypeOffset));
809  return packed_value;
810 }
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:14
static const int kHGCalCellOffset
Definition: HGCalDetId.h:10
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
unsigned HGCalTriggerGeometryV9Imp1::packWaferId ( int  waferU,
int  waferV 
) const
private

Definition at line 840 of file HGCalTriggerGeometryV9Imp1.cc.

References funct::abs(), HGCSiliconDetId::kHGCalWaferUMask, HGCSiliconDetId::kHGCalWaferUOffset, HGCSiliconDetId::kHGCalWaferUSignMask, HGCSiliconDetId::kHGCalWaferUSignOffset, HGCSiliconDetId::kHGCalWaferVMask, HGCSiliconDetId::kHGCalWaferVOffset, HGCSiliconDetId::kHGCalWaferVSignMask, and HGCSiliconDetId::kHGCalWaferVSignOffset.

Referenced by fillMaps(), and getTriggerCellFromCell().

840  {
841  unsigned packed_value = 0;
842  unsigned waferUabs = std::abs(waferU);
843  unsigned waferVabs = std::abs(waferV);
844  unsigned waferUsign = (waferU >= 0) ? 0 : 1;
845  unsigned waferVsign = (waferV >= 0) ? 0 : 1;
850  return packed_value;
851 }
static const int kHGCalWaferVOffset
static const int kHGCalWaferVSignOffset
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int kHGCalWaferVMask
static const int kHGCalWaferUSignMask
static const int kHGCalWaferUMask
static const int kHGCalWaferVSignMask
static const int kHGCalWaferUOffset
static const int kHGCalWaferUSignOffset
void HGCalTriggerGeometryV9Imp1::reset ( void  )
finalvirtual

Reimplemented from HGCalTriggerGeometryBase.

Definition at line 132 of file HGCalTriggerGeometryV9Imp1.cc.

References cells_to_trigger_cells_, cells_to_trigger_cells_sci_, module_to_wafers_, number_trigger_cells_in_wafers_, number_trigger_cells_in_wafers_sci_, trigger_cell_neighbors_, trigger_cell_neighbors_sci_, trigger_cells_to_cells_, trigger_cells_to_cells_sci_, wafer_to_module_, wafers_old_to_wafers_, and wafers_to_wafers_old_.

132  {
133  cells_to_trigger_cells_.clear();
134  trigger_cells_to_cells_.clear();
137  wafers_to_wafers_old_.clear();
138  wafers_old_to_wafers_.clear();
139  wafer_to_module_.clear();
140  module_to_wafers_.clear();
143  trigger_cell_neighbors_.clear();
145 }
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_sci_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
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 > wafer_to_module_
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_sci_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_sci_
std::unordered_map< unsigned, unsigned > wafers_to_wafers_old_
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
unsigned HGCalTriggerGeometryV9Imp1::triggerLayer ( const unsigned  id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 905 of file HGCalTriggerGeometryV9Imp1.cc.

References layerWithOffset(), and trigger_layers_.

Referenced by lastTriggerLayer().

905  {
906  unsigned layer = layerWithOffset(id);
907  if (layer >= trigger_layers_.size())
908  return 0;
909  return trigger_layers_[layer];
910 }
std::vector< unsigned > trigger_layers_
unsigned layerWithOffset(unsigned) const
void HGCalTriggerGeometryV9Imp1::unpackCellId ( unsigned  cell,
unsigned &  cellU,
unsigned &  cellV 
) const
private
void HGCalTriggerGeometryV9Imp1::unpackIetaIphi ( unsigned  ieta_iphi,
unsigned &  ieta,
unsigned &  iphi 
) const
private
void HGCalTriggerGeometryV9Imp1::unpackLayerWaferId ( unsigned  layer_wafer,
unsigned &  layer,
unsigned &  wafer 
) const
private

Definition at line 865 of file HGCalTriggerGeometryV9Imp1.cc.

References heOffset_, HGCHEF, HGCalDetId::kHGCalLayerMask, HGCalDetId::kHGCalLayerOffset, HGCalDetId::kHGCalWaferMask, HGCalDetId::kHGCalWaferOffset, DetId::kSubdetMask, and DetId::kSubdetOffset.

865  {
868  unsigned subdet = (layer_wafer >> DetId::kSubdetOffset) & DetId::kSubdetMask;
869  if (subdet == ForwardSubdetector::HGCHEF)
870  layer += heOffset_;
871 }
static const int kHGCalLayerOffset
Definition: HGCalDetId.h:16
static const int kHGCalLayerMask
Definition: HGCalDetId.h:17
static const int kSubdetOffset
Definition: DetId.h:22
static const int kSubdetMask
Definition: DetId.h:20
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
void HGCalTriggerGeometryV9Imp1::unpackWaferCellId ( unsigned  wafer_cell,
unsigned &  wafer,
unsigned &  cell 
) const
private

Definition at line 860 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getTriggerCellFromCell().

860  {
861  cell = wafer_cell & HGCalDetId::kHGCalCellMask;
863 }
static const int kHGCalCellMask
Definition: HGCalDetId.h:11
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:12
static const int kHGCalWaferMask
Definition: HGCalDetId.h:13
void HGCalTriggerGeometryV9Imp1::unpackWaferId ( unsigned  wafer,
int &  waferU,
int &  waferV 
) const
private

Definition at line 878 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCSiliconDetId::kHGCalWaferUMask, HGCSiliconDetId::kHGCalWaferUOffset, HGCSiliconDetId::kHGCalWaferUSignMask, HGCSiliconDetId::kHGCalWaferUSignOffset, HGCSiliconDetId::kHGCalWaferVMask, HGCSiliconDetId::kHGCalWaferVOffset, HGCSiliconDetId::kHGCalWaferVSignMask, and HGCSiliconDetId::kHGCalWaferVSignOffset.

Referenced by fillInvalidTriggerCells(), getCellsFromTriggerCell(), getOrderedTriggerCellsFromModule(), and getTriggerCellsFromModule().

878  {
882  : waferUAbs);
884  : waferVAbs);
885 }
static const int kHGCalWaferVOffset
static const int kHGCalWaferVSignOffset
static const int kHGCalWaferVMask
static const int kHGCalWaferUSignMask
static const int kHGCalWaferUMask
static const int kHGCalWaferVSignMask
static const int kHGCalWaferUOffset
static const int kHGCalWaferUSignOffset
bool HGCalTriggerGeometryV9Imp1::validCellId ( unsigned  det,
unsigned  cell_id 
) const
private

Definition at line 929 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCalTriggerGeometryBase::eeTopology(), HGCEE, HGCHEB, HGCHEF, HGCalTriggerGeometryBase::hscTopology(), HGCalTriggerGeometryBase::hsiTopology(), matching::is_valid(), and HGCalTopology::valid().

Referenced by getCellsFromTriggerCell(), and validTriggerCellFromCells().

929  {
930  bool is_valid = false;
931  switch (subdet) {
933  is_valid = eeTopology().valid(cell_id);
934  break;
936  is_valid = hsiTopology().valid(cell_id);
937  break;
939  is_valid = hscTopology().valid(cell_id);
940  break;
941  default:
942  is_valid = false;
943  break;
944  }
945  return is_valid;
946 }
bool is_valid(const Digi &d)
Definition: GenericDigi.h:64
const HGCalTopology & eeTopology() const
const HGCalTopology & hsiTopology() const
const HGCalTopology & hscTopology() const
bool valid(const DetId &id) const override
Is this a valid cell id.
bool HGCalTriggerGeometryV9Imp1::validTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 892 of file HGCalTriggerGeometryV9Imp1.cc.

References invalid_triggercells_.

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

892  {
893  return invalid_triggercells_.find(trigger_cell_id) == invalid_triggercells_.end();
894 }
std::unordered_set< unsigned > invalid_triggercells_
bool HGCalTriggerGeometryV9Imp1::validTriggerCellFromCells ( const unsigned  trigger_cell_id) const
private

Definition at line 912 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by fillInvalidTriggerCells().

912  {
913  // Check the validity of a trigger cell with the
914  // validity of the cells. One valid cell in the
915  // trigger cell is enough to make the trigger cell
916  // valid.
917  HGCalDetId trigger_cell_det_id(trigger_cell_id);
918  unsigned subdet = trigger_cell_det_id.subdetId();
919  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
920  bool is_valid = false;
921  for (const auto cell_id : cells) {
922  is_valid |= validCellId(subdet, cell_id);
923  if (is_valid)
924  break;
925  }
926  return is_valid;
927 }
bool is_valid(const Digi &d)
Definition: GenericDigi.h:64
bool validCellId(unsigned det, unsigned cell_id) const
std::unordered_set< unsigned > geom_set
geom_set getCellsFromTriggerCell(const unsigned) const final

Member Data Documentation

std::unordered_map<unsigned, unsigned> HGCalTriggerGeometryV9Imp1::cells_to_trigger_cells_
private

Definition at line 63 of file HGCalTriggerGeometryV9Imp1.cc.

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

std::unordered_map<unsigned, unsigned> HGCalTriggerGeometryV9Imp1::cells_to_trigger_cells_sci_
private

Definition at line 65 of file HGCalTriggerGeometryV9Imp1.cc.

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

std::unordered_set<unsigned> HGCalTriggerGeometryV9Imp1::disconnected_layers_
private
std::unordered_set<unsigned> HGCalTriggerGeometryV9Imp1::disconnected_modules_
private

Definition at line 82 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by disconnectedModule(), and HGCalTriggerGeometryV9Imp1().

unsigned HGCalTriggerGeometryV9Imp1::heOffset_ = 0
private
unsigned HGCalTriggerGeometryV9Imp1::hSc_links_per_module_ = 1
private

Definition at line 54 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by getLinksInModule().

unsigned HGCalTriggerGeometryV9Imp1::hSc_wafers_per_module_ = 3
private

Definition at line 55 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by getModuleSize().

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

Definition at line 71 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillInvalidTriggerCells(), and validTriggerCell().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tCellNeighborsMapping_
private

Definition at line 51 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tCellNeighborsSciMapping_
private

Definition at line 52 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tCellsMapping_
private

Definition at line 46 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tCellsSciMapping_
private

Definition at line 47 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tLinksMapping_
private

Definition at line 50 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tModulesMapping_
private

Definition at line 49 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tWafersMapping_
private

Definition at line 48 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillMaps().

unsigned HGCalTriggerGeometryV9Imp1::last_trigger_layer_ = 0
private

Definition at line 85 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by initialize(), and lastTriggerLayer().

std::unordered_map<unsigned, unsigned> HGCalTriggerGeometryV9Imp1::links_per_module_
private

Definition at line 60 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillMaps(), and getLinksInModule().

std::unordered_multimap<unsigned, unsigned> HGCalTriggerGeometryV9Imp1::module_to_wafers_
private
std::unordered_map<unsigned, unsigned short> HGCalTriggerGeometryV9Imp1::number_trigger_cells_in_wafers_
private
std::unordered_map<unsigned, unsigned short> HGCalTriggerGeometryV9Imp1::number_trigger_cells_in_wafers_sci_
private
unsigned HGCalTriggerGeometryV9Imp1::totalLayers_ = 0
private

Definition at line 89 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by initialize().

neighbor_map HGCalTriggerGeometryV9Imp1::trigger_cell_neighbors_
private

Definition at line 78 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by getNeighborsFromTriggerCell(), initialize(), and reset().

neighbor_map HGCalTriggerGeometryV9Imp1::trigger_cell_neighbors_sci_
private

Definition at line 79 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by getNeighborsFromTriggerCell(), initialize(), and reset().

std::unordered_multimap<unsigned, unsigned> HGCalTriggerGeometryV9Imp1::trigger_cells_to_cells_
private

Definition at line 64 of file HGCalTriggerGeometryV9Imp1.cc.

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

std::unordered_multimap<unsigned, unsigned> HGCalTriggerGeometryV9Imp1::trigger_cells_to_cells_sci_
private

Definition at line 66 of file HGCalTriggerGeometryV9Imp1.cc.

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

std::vector<unsigned> HGCalTriggerGeometryV9Imp1::trigger_layers_
private

Definition at line 84 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by initialize(), and triggerLayer().

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

Definition at line 58 of file HGCalTriggerGeometryV9Imp1.cc.

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

std::unordered_map<unsigned, unsigned> HGCalTriggerGeometryV9Imp1::wafers_old_to_wafers_
private
std::unordered_map<unsigned, unsigned> HGCalTriggerGeometryV9Imp1::wafers_to_wafers_old_
private