CMS 3D CMS Logo

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

Public Member Functions

bool disconnectedModule (const unsigned) const final
 
geom_set getCellsFromModule (const unsigned) const final
 
geom_set getCellsFromTriggerCell (const unsigned) const final
 
unsigned getModuleFromCell (const unsigned) const final
 
unsigned getModuleFromTriggerCell (const unsigned) const final
 
GlobalPoint getModulePosition (const unsigned) const final
 
geom_set getNeighborsFromTriggerCell (const unsigned) const final
 
geom_ordered_set getOrderedCellsFromModule (const unsigned) const final
 
geom_ordered_set getOrderedTriggerCellsFromModule (const unsigned) const final
 
unsigned getTriggerCellFromCell (const unsigned) const final
 
GlobalPoint getTriggerCellPosition (const unsigned) const final
 
geom_set getTriggerCellsFromModule (const unsigned) const final
 
 HGCalTriggerGeometryHexLayerBasedImp1 (const edm::ParameterSet &conf)
 
void initialize (const edm::ESHandle< CaloGeometry > &) final
 
void reset () final
 
unsigned triggerLayer (const unsigned) const final
 
bool validTriggerCell (const unsigned) const final
 
- Public Member Functions inherited from HGCalTriggerGeometryBase
const HcalGeometrybhGeometry () const
 
const HcalTopologybhTopology () const
 
const edm::ESHandle< CaloGeometry > & caloGeometry () const
 
const HGCalGeometryeeGeometry () const
 
const HGCalTopologyeeTopology () const
 
const HGCalGeometryfhGeometry () const
 
const HGCalTopologyfhTopology () const
 
 HGCalTriggerGeometryBase (const edm::ParameterSet &conf)
 
const std::string & name () const
 
virtual ~HGCalTriggerGeometryBase ()
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from HGCalTriggerGeometryBase
typedef std::unordered_map< unsigned, unsigned > geom_map
 
typedef std::set< unsigned > geom_ordered_set
 
typedef std::unordered_set< unsigned > geom_set
 
- Protected Member Functions inherited from HGCalTriggerGeometryBase
void setCaloGeometry (const edm::ESHandle< CaloGeometry > &geom)
 

Detailed Description

Definition at line 14 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Constructor & Destructor Documentation

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

Definition at line 98 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

Member Function Documentation

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

Definition at line 785 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell(), and packTriggerCell().

786 {
787  int wafer_type = 0;
788  switch(subdet)
789  {
790  // HGCalDDDConstants::waferTypeT() returns 2=coarse, 1=fine
791  // HGCalDetId::waferType() returns -1=coarse, 1=fine
792  // Convert to HGCalDetId waferType
794  wafer_type = (eeTopology().dddConstants().waferTypeT(wafer)==2?-1:1);
795  break;
797  wafer_type = (fhTopology().dddConstants().waferTypeT(wafer)==2?-1:1);
798  break;
799  default:
800  break;
801  };
802  return wafer_type;
803 }
const HGCalTopology & eeTopology() const
const HGCalDDDConstants & dddConstants() const
int waferTypeT(int wafer) const
const HGCalTopology & fhTopology() const
bool HGCalTriggerGeometryHexLayerBasedImp1::disconnectedModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 712 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References disconnected_layers_, disconnected_modules_, layerWithOffset(), and triggerLayer().

Referenced by validTriggerCell().

713 {
714  bool disconnected = false;
715  if(disconnected_modules_.find(HGCalDetId(module_id).wafer())!=disconnected_modules_.end()) disconnected = true;
716  if(disconnected_layers_.find(layerWithOffset(module_id))!=disconnected_layers_.end()) disconnected = true;
717  return disconnected;
718 }
void HGCalTriggerGeometryHexLayerBasedImp1::fillInvalidTriggerCells ( )
private

Definition at line 634 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by fillNeighborMaps(), and initialize().

635 {
636  unsigned n_layers_ee = eeTopology().dddConstants().layers(true);
637  for(unsigned layer=1; layer<=n_layers_ee; layer++)
638  {
639  for(const auto& wafer_module : wafer_to_module_)
640  {
641  unsigned wafer = wafer_module.first;
642  // loop on the trigger cells in each wafer
643  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_.at(wafer); trigger_cell++)
644  {
645  std::set<unsigned> trigger_cell_ids;
646  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, -1, layer, 1, wafer, trigger_cell));
647  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, 1, layer, 1, wafer, trigger_cell));
648  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, -1, layer, 1, wafer, trigger_cell));
649  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, 1, layer, 1, wafer, trigger_cell));
650  for(unsigned trigger_cell : trigger_cell_ids)
651  {
652  if(!validTriggerCellFromCells(trigger_cell)) invalid_triggercells_.emplace(trigger_cell);
653  for(unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell))
654  {
655  if(!validTriggerCellFromCells(neighbor)) invalid_triggercells_.emplace(neighbor);
656  }
657  }
658  }
659  }
660  }
661 }
const HGCalTopology & eeTopology() const
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
unsigned int layers(bool reco) const
std::unordered_map< unsigned, unsigned > wafer_to_module_
const HGCalDDDConstants & dddConstants() const
geom_set getNeighborsFromTriggerCell(const unsigned) const final
void HGCalTriggerGeometryHexLayerBasedImp1::fillMaps ( )
private

Definition at line 486 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getModulePosition(), and initialize().

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

Definition at line 561 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by fillMaps(), and initialize().

562 {
563  // Fill trigger neighbor map
564  std::ifstream l1tCellNeighborsMappingStream(file.fullPath());
565  if(!l1tCellNeighborsMappingStream.is_open())
566  {
567  throw cms::Exception("MissingDataFile")
568  << "Cannot open HGCalTriggerGeometry L1TCellNeighborsMapping file\n";
569  }
570  for(std::array<char,512> buffer; l1tCellNeighborsMappingStream.getline(&buffer[0], 512); )
571  {
572  std::string line(&buffer[0]);
573  // Extract keys consisting of the module id
574  // and of the trigger cell id
575  // Match patterns (X,Y)
576  // where X is a number with less than 4 digis
577  // and Y is a number with less than 4 digits
578  std::regex key_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)");
579  std::vector<std::string> key_tokens {
580  std::sregex_token_iterator(line.begin(), line.end(), key_regex), {}
581  };
582  if(key_tokens.empty())
583  {
584  throw cms::Exception("BadGeometry")
585  << "Syntax error in the L1TCellNeighborsMapping:\n"
586  << " Cannot find the trigger cell key in line:\n"
587  << " '"<<&buffer[0]<<"'\n";
588  }
589  std::regex digits_regex("\\d{1,3}");
590  std::vector<std::string> module_tc {
591  std::sregex_token_iterator(key_tokens[0].begin(), key_tokens[0].end(), digits_regex), {}
592  };
593  // get module and cell id
594  int module = std::stoi(module_tc[0]);
595  int trigger_cell = std::stoi(module_tc[1]);
596  unsigned map_key = packTriggerCell(module, trigger_cell);
597  // Extract neighbors
598  // Match patterns (X,Y)
599  // where X is a number with less than 4 digits
600  // and Y is a number with less than 4 digits
601  std::regex neighbors_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)");
602  std::vector<std::string> neighbors_tokens {
603  std::sregex_token_iterator(line.begin(), line.end(), neighbors_regex), {}
604  };
605  if(neighbors_tokens.size()<2)
606  {
607  throw cms::Exception("BadGeometry")
608  << "Syntax error in the L1TCellNeighborsMapping:\n"
609  << " Cannot find any neighbor in line:\n"
610  << " '"<<&buffer[0]<<"'\n";
611  }
612  auto itr_insert = neighbors_map.emplace(map_key, std::set<std::pair<short,short>>());
613  // The first element is the key, so start at index 1
614  for(unsigned i=1; i<neighbors_tokens.size(); i++)
615  {
616  const auto& neighbor = neighbors_tokens[i];
617  std::vector<std::string> pair_neighbor {
618  std::sregex_token_iterator(neighbor.begin(), neighbor.end(), digits_regex), {}
619  };
620  short neighbor_module(std::stoi(pair_neighbor[0]));
621  short neighbor_cell(std::stoi(pair_neighbor[1]));
622  itr_insert.first->second.emplace(neighbor_module, neighbor_cell);
623  }
624  }
625  if(!l1tCellNeighborsMappingStream.eof()) edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellNeighborsMapping'\n";
626  l1tCellNeighborsMappingStream.close();
627 
628 }
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
std::string fullPath() const
Definition: FileInPath.cc:197
Definition: vlib.h:208
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 288 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References getCellsFromTriggerCell(), getOrderedCellsFromModule(), and getTriggerCellsFromModule().

Referenced by getCellsFromTriggerCell(), and getModulePosition().

289 {
290  geom_set cell_det_ids;
291  geom_set trigger_cells = getTriggerCellsFromModule(module_id);
292  for(auto trigger_cell_id : trigger_cells)
293  {
294  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
295  cell_det_ids.insert(cells.begin(), cells.end());
296  }
297  return cell_det_ids;
298 }
geom_set getCellsFromTriggerCell(const unsigned) const final
std::unordered_set< unsigned > geom_set
geom_set getTriggerCellsFromModule(const unsigned) const final
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getCellsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 246 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

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

Implements HGCalTriggerGeometryBase.

Definition at line 219 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getModuleFromCell().

220 {
221  HGCalDetId trigger_cell_det_id(trigger_cell_id);
222  unsigned module = 0;
223  // BH
224  if(trigger_cell_det_id.subdetId()==ForwardSubdetector::HGCHEB)
225  {
226  // For BH, the module ID is currently encoded as the wafer in HGCalDetId
227  module = trigger_cell_det_id.wafer();
228  }
229  // EE or FH
230  else
231  {
232  auto module_itr = wafer_to_module_.find(trigger_cell_det_id.wafer());
233  if(module_itr==wafer_to_module_.end())
234  {
235  throw cms::Exception("BadGeometry")
236  <<trigger_cell_det_id
237  << "HGCalTriggerGeometry: Wafer " << trigger_cell_det_id.wafer() << " is not mapped to any trigger module. The module mapping should be modified. See https://twiki.cern.ch/twiki/bin/viewauth/CMS/HGCALTriggerPrimitivesSimulation#Trigger_geometry for details.\n";
238  }
239  module = module_itr->second;
240  }
241  return HGCalDetId((ForwardSubdetector)trigger_cell_det_id.subdetId(), trigger_cell_det_id.zside(), trigger_cell_det_id.layer(), trigger_cell_det_id.waferType(), module, HGCalDetId::kHGCalCellMask).rawId();
242 }
ForwardSubdetector
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
std::unordered_map< unsigned, unsigned > wafer_to_module_
Definition: vlib.h:208
GlobalPoint HGCalTriggerGeometryHexLayerBasedImp1::getModulePosition ( const unsigned  module_det_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 456 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getTriggerCellPosition().

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

Implements HGCalTriggerGeometryBase.

Definition at line 392 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by fillInvalidTriggerCells(), and getOrderedTriggerCellsFromModule().

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

Implements HGCalTriggerGeometryBase.

Definition at line 302 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References getCellsFromTriggerCell(), getOrderedTriggerCellsFromModule(), and getTriggerCellsFromModule().

Referenced by getCellsFromModule().

303 {
304  geom_ordered_set cell_det_ids;
305  geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id);
306  for(auto trigger_cell_id : trigger_cells)
307  {
308  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
309  cell_det_ids.insert(cells.begin(), cells.end());
310  }
311  return cell_det_ids;
312 }
std::set< unsigned > geom_ordered_set
geom_set getCellsFromTriggerCell(const unsigned) const final
std::unordered_set< unsigned > geom_set
geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final
HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryHexLayerBasedImp1::getOrderedTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 353 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getOrderedCellsFromModule(), and getTriggerCellsFromModule().

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

Implements HGCalTriggerGeometryBase.

Definition at line 160 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getModuleFromCell(), and initialize().

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

Implements HGCalTriggerGeometryBase.

Definition at line 426 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getNeighborsFromTriggerCell().

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

Implements HGCalTriggerGeometryBase.

Definition at line 316 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromModule(), and getOrderedCellsFromModule().

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

Implements HGCalTriggerGeometryBase.

Definition at line 130 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by reset().

131 {
132  setCaloGeometry(calo_geometry);
136  trigger_layers_.resize(totalLayers_+1);
137  unsigned trigger_layer = 0;
138  for(unsigned layer=0; layer<trigger_layers_.size(); layer++)
139  {
140  if(disconnected_layers_.find(layer)==disconnected_layers_.end())
141  {
142  // Increase trigger layer number if the layer is not disconnected
143  trigger_layers_[layer] = trigger_layer;
144  trigger_layer++;
145  }
146  else
147  {
148  trigger_layers_[layer] = 0;
149  }
150  }
151  fillMaps();
155 
156 }
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:167
const HGCalTopology & eeTopology() const
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_bh_
void fillNeighborMaps(const edm::FileInPath &, std::unordered_map< int, std::set< std::pair< short, short >>> &)
unsigned int layers(bool reco) const
const HcalTopology & bhTopology() const
void setCaloGeometry(const edm::ESHandle< CaloGeometry > &geom)
const HGCalDDDConstants & dddConstants() const
int getMaxDepth(const int &type) const
const HGCalTopology & fhTopology() const
unsigned HGCalTriggerGeometryHexLayerBasedImp1::layerWithOffset ( unsigned  id) const
private

Definition at line 808 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by detIdWaferType(), disconnectedModule(), and triggerLayer().

809 {
810  HGCalDetId detid(id);
811  unsigned layer = 0;
812  switch(detid.subdetId())
813  {
815  layer = detid.layer();
816  break;
818  layer = fhOffset_ + detid.layer();
819  break;
821  layer = bhOffset_ + detid.layer();
822  break;
823  };
824  return layer;
825 }
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packIetaIphi ( unsigned  ieta,
unsigned  iphi 
) const
private

Definition at line 678 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HcalDetId::kHcalEtaMask2, HcalDetId::kHcalEtaOffset2, HcalDetId::kHcalPhiMask2, and unpackWaferCellId().

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

679 {
680  unsigned packed_value = 0;
681  packed_value |= (iphi & HcalDetId::kHcalPhiMask2);
682  packed_value |= ((ieta & HcalDetId::kHcalEtaMask2) << HcalDetId::kHcalEtaOffset2);
683  return packed_value;
684 }
static const int kHcalPhiMask2
Definition: HcalDetId.h:17
static const int kHcalEtaOffset2
Definition: HcalDetId.h:19
static const int kHcalEtaMask2
Definition: HcalDetId.h:21
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packTriggerCell ( unsigned  module,
unsigned  trigger_cell 
) const
private

Definition at line 775 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References detIdWaferType(), HGCalDetId::kHGCalCellMask, HGCalDetId::kHGCalCellOffset, HGCalDetId::kHGCalWaferMask, and HGCalDetId::kHGCalWaferOffset.

Referenced by fillNeighborMaps(), getNeighborsFromTriggerCell(), and validCellId().

776 {
777  unsigned packed_value = 0;
778  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
780  return packed_value;
781 }
static const int kHGCalCellOffset
Definition: HGCalDetId.h:12
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:14
Definition: vlib.h:208
static const int kHGCalWaferMask
Definition: HGCalDetId.h:15
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packWaferCellId ( unsigned  subdet,
unsigned  wafer,
unsigned  cell 
) const
private

Definition at line 665 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalDetId::kHGCalCellMask, HGCalDetId::kHGCalCellOffset, HGCalDetId::kHGCalWaferMask, HGCalDetId::kHGCalWaferOffset, HGCalDetId::kHGCalWaferTypeOffset, and packIetaIphi().

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

666 {
667  unsigned packed_value = 0;
668  const int kSubdetMask = 0x7;
669  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
670  packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset);
671  packed_value |= ((subdet & kSubdetMask) << (HGCalDetId::kHGCalWaferTypeOffset));
672  return packed_value;
673 }
static const int kHGCalWaferTypeOffset
Definition: HGCalDetId.h:16
static const int kHGCalCellOffset
Definition: HGCalDetId.h:12
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:14
static const int kHGCalWaferMask
Definition: HGCalDetId.h:15
void HGCalTriggerGeometryHexLayerBasedImp1::reset ( void  )
finalvirtual

Reimplemented from HGCalTriggerGeometryBase.

Definition at line 114 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by HGCalTriggerGeometryHexLayerBasedImp1().

115 {
116  cells_to_trigger_cells_.clear();
117  trigger_cells_to_cells_.clear();
120  wafer_to_module_.clear();
121  module_to_wafers_.clear();
124  trigger_cell_neighbors_.clear();
126 }
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_bh_
std::unordered_map< int, std::set< std::pair< short, short > > > trigger_cell_neighbors_bh_
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_bh_
std::unordered_map< unsigned, unsigned > wafer_to_module_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_bh_
unsigned HGCalTriggerGeometryHexLayerBasedImp1::triggerLayer ( const unsigned  id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 722 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References layerWithOffset(), trigger_layers_, and validTriggerCellFromCells().

Referenced by disconnectedModule().

723 {
724  unsigned layer = layerWithOffset(id);
725  if(layer>=trigger_layers_.size()) return 0;
726  return trigger_layers_[layer];
727 }
void HGCalTriggerGeometryHexLayerBasedImp1::unpackIetaIphi ( unsigned  ieta_iphi,
unsigned &  ieta,
unsigned &  iphi 
) const
private

Definition at line 697 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HcalDetId::kHcalEtaMask2, HcalDetId::kHcalEtaOffset2, HcalDetId::kHcalPhiMask2, and validTriggerCell().

Referenced by getCellsFromTriggerCell(), and unpackWaferCellId().

698 {
699  iphi = ieta_iphi & HcalDetId::kHcalPhiMask2;
701 }
static const int kHcalPhiMask2
Definition: HcalDetId.h:17
static const int kHcalEtaOffset2
Definition: HcalDetId.h:19
static const int kHcalEtaMask2
Definition: HcalDetId.h:21
void HGCalTriggerGeometryHexLayerBasedImp1::unpackWaferCellId ( unsigned  wafer_cell,
unsigned &  wafer,
unsigned &  cell 
) const
private

Definition at line 688 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References HGCalDetId::kHGCalCellMask, HGCalDetId::kHGCalWaferMask, HGCalDetId::kHGCalWaferOffset, and unpackIetaIphi().

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

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

Definition at line 751 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell(), and validTriggerCellFromCells().

752 {
753  bool is_valid = false;
754  switch(subdet)
755  {
757  is_valid = eeTopology().valid(cell_id);
758  break;
760  is_valid = fhTopology().valid(cell_id);
761  break;
763  is_valid = bhTopology().valid(cell_id);
764  break;
765  default:
766  is_valid = false;
767  break;
768  }
769  return is_valid;
770 }
bool valid(const DetId &id) const override
bool is_valid(const Digi &d)
Definition: GenericDigi.h:44
const HGCalTopology & eeTopology() const
const HcalTopology & bhTopology() const
bool valid(const DetId &id) const override
Is this a valid cell id.
const HGCalTopology & fhTopology() const
bool HGCalTriggerGeometryHexLayerBasedImp1::validTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual
bool HGCalTriggerGeometryHexLayerBasedImp1::validTriggerCellFromCells ( const unsigned  trigger_cell_id) const
private

Definition at line 731 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References getCellsFromTriggerCell(), matching::is_valid(), DetId::subdetId(), and validCellId().

Referenced by fillInvalidTriggerCells(), and triggerLayer().

732 {
733  // Check the validity of a trigger cell with the
734  // validity of the cells. One valid cell in the
735  // trigger cell is enough to make the trigger cell
736  // valid.
737  HGCalDetId trigger_cell_det_id(trigger_cell_id);
738  unsigned subdet = trigger_cell_det_id.subdetId();
739  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
740  bool is_valid = false;
741  for(const auto cell_id : cells)
742  {
743  is_valid |= validCellId(subdet, cell_id);
744  if(is_valid) break;
745  }
746  return is_valid;
747 }
bool is_valid(const Digi &d)
Definition: GenericDigi.h:44
bool validCellId(unsigned subdet, unsigned cell_id) const
geom_set getCellsFromTriggerCell(const unsigned) const final
std::unordered_set< unsigned > geom_set

Member Data Documentation

unsigned HGCalTriggerGeometryHexLayerBasedImp1::bhOffset_
private

Definition at line 76 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize(), and layerWithOffset().

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

Definition at line 75 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize(), and layerWithOffset().

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

Definition at line 47 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellNeighborsMapping_
private

Definition at line 46 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellsBHMapping_
private

Definition at line 44 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellsMapping_
private

Definition at line 43 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tModulesMapping_
private

Definition at line 45 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

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

Definition at line 77 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

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

Definition at line 72 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize(), and triggerLayer().

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