CMS 3D CMS Logo

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

Public Member Functions

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

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

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

Detailed Description

Definition at line 14 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Constructor & Destructor Documentation

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

Definition at line 101 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

Member Function Documentation

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

Definition at line 799 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell(), and packTriggerCell().

800 {
801  int wafer_type = 0;
802  switch(subdet)
803  {
804  // HGCalDDDConstants::waferTypeT() returns 2=coarse, 1=fine
805  // HGCalDetId::waferType() returns -1=coarse, 1=fine
806  // Convert to HGCalDetId waferType
808  wafer_type = (eeTopology().dddConstants().waferTypeT(wafer)==2?-1:1);
809  break;
811  wafer_type = (fhTopology().dddConstants().waferTypeT(wafer)==2?-1:1);
812  break;
813  default:
814  break;
815  };
816  return wafer_type;
817 }
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 726 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by validTriggerCell().

727 {
728  bool disconnected = false;
729  if(disconnected_modules_.find(HGCalDetId(module_id).wafer())!=disconnected_modules_.end()) disconnected = true;
730  if(disconnected_layers_.find(layerWithOffset(module_id))!=disconnected_layers_.end()) disconnected = true;
731  return disconnected;
732 }
void HGCalTriggerGeometryHexLayerBasedImp1::fillInvalidTriggerCells ( )
private

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

649 {
650  unsigned n_layers_ee = eeTopology().dddConstants().layers(true);
651  for(unsigned layer=1; layer<=n_layers_ee; layer++)
652  {
653  for(const auto& wafer_module : wafer_to_module_)
654  {
655  unsigned wafer = wafer_module.first;
656  // loop on the trigger cells in each wafer
657  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_.at(wafer); trigger_cell++)
658  {
659  std::set<unsigned> trigger_cell_ids;
660  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, -1, layer, 1, wafer, trigger_cell));
661  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, 1, layer, 1, wafer, trigger_cell));
662  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, -1, layer, 1, wafer, trigger_cell));
663  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, 1, layer, 1, wafer, trigger_cell));
664  for(unsigned trigger_cell : trigger_cell_ids)
665  {
666  if(!validTriggerCellFromCells(trigger_cell)) invalid_triggercells_.emplace(trigger_cell);
667  for(unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell))
668  {
669  if(!validTriggerCellFromCells(neighbor)) invalid_triggercells_.emplace(neighbor);
670  }
671  }
672  }
673  }
674  }
675 }
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 500 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().

501 {
502  //
503  // read module mapping file
504  std::ifstream l1tModulesMappingStream(l1tModulesMapping_.fullPath());
505  if(!l1tModulesMappingStream.is_open())
506  {
507  throw cms::Exception("MissingDataFile")
508  << "Cannot open HGCalTriggerGeometry L1TModulesMapping file\n";
509  }
510  short trigger_wafer = 0;
511  short module = 0;
512  for(; l1tModulesMappingStream>>trigger_wafer>>module; )
513  {
514  wafer_to_module_.emplace(trigger_wafer,module);
515  module_to_wafers_.emplace(module, trigger_wafer);
516  // Default number of trigger cell in wafer is 0
517  number_trigger_cells_in_wafers_.emplace(trigger_wafer, 0);
518  }
519  if(!l1tModulesMappingStream.eof()) edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TModulesMapping '"<<trigger_wafer<<" "<<module<<"' \n";
520  l1tModulesMappingStream.close();
521  // read trigger cell mapping file
522  std::ifstream l1tCellsMappingStream(l1tCellsMapping_.fullPath());
523  if(!l1tCellsMappingStream.is_open())
524  {
525  throw cms::Exception("MissingDataFile")
526  << "Cannot open HGCalTriggerGeometry L1TCellsMapping file\n";
527  }
528  short subdet = 0;
529  short wafer = 0;
530  short cell = 0;
531  trigger_wafer = 0;
532  short trigger_cell = 0;
533  for(; l1tCellsMappingStream>>subdet>>wafer>>cell>>trigger_wafer>>trigger_cell; )
534  {
535  unsigned cell_key = packWaferCellId(subdet,wafer,cell);
536  unsigned trigger_cell_key = packWaferCellId(subdet,trigger_wafer,trigger_cell);
537  // fill cell <-> trigger cell mappings
538  cells_to_trigger_cells_.emplace(cell_key, trigger_cell_key);
539  trigger_cells_to_cells_.emplace(trigger_cell_key, cell_key);
540  // fill number of trigger cells in wafers
541  auto itr_insert = number_trigger_cells_in_wafers_.emplace(trigger_wafer, 0);
542  if(trigger_cell+1 > itr_insert.first->second) itr_insert.first->second = trigger_cell+1;
543  }
544  if(!l1tCellsMappingStream.eof()) edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellsMapping '"<<subdet<<" "<<wafer<<" "<<cell<<" "<<trigger_wafer<<" "<<trigger_cell<<"' \n";
545  l1tCellsMappingStream.close();
546  // read BH trigger cell mapping file
547  std::ifstream l1tCellsBHMappingStream(l1tCellsBHMapping_.fullPath());
548  if(!l1tCellsBHMappingStream.is_open())
549  {
550  throw cms::Exception("MissingDataFile")
551  << "Cannot open HGCalTriggerGeometry L1TCellsBHMapping file\n";
552  }
553  short ieta = 0;
554  short iphi = 0;
555  trigger_wafer = 0;
556  trigger_cell = 0;
557  for(; l1tCellsBHMappingStream>>ieta>>iphi>>trigger_wafer>>trigger_cell; )
558  {
559  unsigned cell_key = packIetaIphi(ieta,iphi);
560  unsigned trigger_cell_key = packWaferCellId(ForwardSubdetector::HGCHEB,trigger_wafer,trigger_cell);
561  // fill cell <-> trigger cell mappings
562  cells_to_trigger_cells_bh_.emplace(cell_key, trigger_cell_key);
563  trigger_cells_to_cells_bh_.emplace(trigger_cell_key, cell_key);
564  // fill number of trigger cells in wafers
565  auto itr_insert = number_trigger_cells_in_wafers_bh_.emplace(trigger_wafer, 0);
566  if(trigger_cell+1 > itr_insert.first->second) itr_insert.first->second = trigger_cell+1;
567  }
568  if(!l1tCellsBHMappingStream.eof()) edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellsBHMapping '"<<ieta<<" "<<iphi<<" "<<trigger_wafer<<" "<<trigger_cell<<"' \n";
569  l1tCellsBHMappingStream.close();
570 }
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 575 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by fillMaps(), and initialize().

576 {
577  // Fill trigger neighbor map
578  std::ifstream l1tCellNeighborsMappingStream(file.fullPath());
579  if(!l1tCellNeighborsMappingStream.is_open())
580  {
581  throw cms::Exception("MissingDataFile")
582  << "Cannot open HGCalTriggerGeometry L1TCellNeighborsMapping file\n";
583  }
584  for(std::array<char,512> buffer; l1tCellNeighborsMappingStream.getline(&buffer[0], 512); )
585  {
586  std::string line(&buffer[0]);
587  // Extract keys consisting of the module id
588  // and of the trigger cell id
589  // Match patterns (X,Y)
590  // where X is a number with less than 4 digis
591  // and Y is a number with less than 4 digits
592  std::regex key_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)");
593  std::vector<std::string> key_tokens {
594  std::sregex_token_iterator(line.begin(), line.end(), key_regex), {}
595  };
596  if(key_tokens.empty())
597  {
598  throw cms::Exception("BadGeometry")
599  << "Syntax error in the L1TCellNeighborsMapping:\n"
600  << " Cannot find the trigger cell key in line:\n"
601  << " '"<<&buffer[0]<<"'\n";
602  }
603  std::regex digits_regex("\\d{1,3}");
604  std::vector<std::string> module_tc {
605  std::sregex_token_iterator(key_tokens[0].begin(), key_tokens[0].end(), digits_regex), {}
606  };
607  // get module and cell id
608  int module = std::stoi(module_tc[0]);
609  int trigger_cell = std::stoi(module_tc[1]);
610  unsigned map_key = packTriggerCell(module, trigger_cell);
611  // Extract neighbors
612  // Match patterns (X,Y)
613  // where X is a number with less than 4 digits
614  // and Y is a number with less than 4 digits
615  std::regex neighbors_regex("\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)");
616  std::vector<std::string> neighbors_tokens {
617  std::sregex_token_iterator(line.begin(), line.end(), neighbors_regex), {}
618  };
619  if(neighbors_tokens.size()<2)
620  {
621  throw cms::Exception("BadGeometry")
622  << "Syntax error in the L1TCellNeighborsMapping:\n"
623  << " Cannot find any neighbor in line:\n"
624  << " '"<<&buffer[0]<<"'\n";
625  }
626  auto itr_insert = neighbors_map.emplace(map_key, std::set<std::pair<short,short>>());
627  // The first element is the key, so start at index 1
628  for(unsigned i=1; i<neighbors_tokens.size(); i++)
629  {
630  const auto& neighbor = neighbors_tokens[i];
631  std::vector<std::string> pair_neighbor {
632  std::sregex_token_iterator(neighbor.begin(), neighbor.end(), digits_regex), {}
633  };
634  short neighbor_module(std::stoi(pair_neighbor[0]));
635  short neighbor_cell(std::stoi(pair_neighbor[1]));
636  itr_insert.first->second.emplace(neighbor_module, neighbor_cell);
637  }
638  }
639  if(!l1tCellNeighborsMappingStream.eof()) edm::LogWarning("HGCalTriggerGeometry") << "Error reading L1TCellNeighborsMapping'\n";
640  l1tCellNeighborsMappingStream.close();
641 
642 }
#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 302 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell(), and getModulePosition().

303 {
304  geom_set cell_det_ids;
305  geom_set trigger_cells = getTriggerCellsFromModule(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 }
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 260 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().

261 {
262  HGCalDetId trigger_cell_det_id(trigger_cell_id);
263  geom_set cell_det_ids;
264  // BH
265  if(trigger_cell_det_id.subdetId()==ForwardSubdetector::HGCHEB)
266  {
267  unsigned subdet = trigger_cell_det_id.subdetId();
268  unsigned trigger_wafer = trigger_cell_det_id.wafer();
269  unsigned trigger_cell = trigger_cell_det_id.cell();
270  const auto& cell_range = trigger_cells_to_cells_bh_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell));
271  for(auto tc_c_itr=cell_range.first; tc_c_itr!=cell_range.second; tc_c_itr++)
272  {
273  unsigned ieta = 0;
274  unsigned iphi = 0;
275  unpackIetaIphi(tc_c_itr->second, ieta, iphi);
276  unsigned cell_det_id = HcalDetId(HcalEndcap, trigger_cell_det_id.zside()*ieta, iphi, trigger_cell_det_id.layer()).rawId();
277  if(validCellId(subdet, cell_det_id)) cell_det_ids.emplace(cell_det_id);
278  }
279  }
280  // EE or FH
281  else
282  {
283  unsigned subdet = trigger_cell_det_id.subdetId();
284  unsigned trigger_wafer = trigger_cell_det_id.wafer();
285  unsigned trigger_cell = trigger_cell_det_id.cell();
286  const auto& cell_range = trigger_cells_to_cells_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell));
287  for(auto tc_c_itr=cell_range.first; tc_c_itr!=cell_range.second; tc_c_itr++)
288  {
289  unsigned wafer = 0;
290  unsigned cell = 0;
291  unpackWaferCellId(tc_c_itr->second, wafer, cell);
292  unsigned wafer_type = (detIdWaferType(subdet, wafer)==1 ? 1 : 0);
293  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();
294  if(validCellId(subdet, cell_det_id)) cell_det_ids.emplace(cell_det_id);
295  }
296  }
297  return cell_det_ids;
298 }
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 233 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getModuleFromCell().

234 {
235  HGCalDetId trigger_cell_det_id(trigger_cell_id);
236  unsigned module = 0;
237  // BH
238  if(trigger_cell_det_id.subdetId()==ForwardSubdetector::HGCHEB)
239  {
240  // For BH, the module ID is currently encoded as the wafer in HGCalDetId
241  module = trigger_cell_det_id.wafer();
242  }
243  // EE or FH
244  else
245  {
246  auto module_itr = wafer_to_module_.find(trigger_cell_det_id.wafer());
247  if(module_itr==wafer_to_module_.end())
248  {
249  throw cms::Exception("BadGeometry")
250  <<trigger_cell_det_id
251  << "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";
252  }
253  module = module_itr->second;
254  }
255  return HGCalDetId((ForwardSubdetector)trigger_cell_det_id.subdetId(), trigger_cell_det_id.zside(), trigger_cell_det_id.layer(), (trigger_cell_det_id.waferType()==1 ? 1:0), module, HGCalDetId::kHGCalCellMask).rawId();
256 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
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 470 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().

471 {
472  unsigned subdet = HGCalDetId(module_det_id).subdetId();
473  // Position: barycenter of the module.
474  Basic3DVector<float> moduleVector(0.,0.,0.);
475  const auto cell_ids = getCellsFromModule(module_det_id);
476  // BH
477  if(subdet==ForwardSubdetector::HGCHEB)
478  {
479  for(const auto& cell : cell_ids)
480  {
481  HcalDetId cellDetId(cell);
482  moduleVector += bhGeometry()->getPosition(cellDetId).basicVector();
483  }
484  }
485  // EE or FH
486  else
487  {
488  for(const auto& cell : cell_ids)
489  {
490  HGCalDetId cellDetId(cell);
491  moduleVector += (cellDetId.subdetId()==ForwardSubdetector::HGCEE ? eeGeometry()->getPosition(cellDetId) : fhGeometry()->getPosition(cellDetId)).basicVector();
492  }
493  }
494  return GlobalPoint( moduleVector/cell_ids.size() );
495 }
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 406 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().

407 {
408  HGCalDetId trigger_cell_det_id(trigger_cell_id);
409  // Choose scintillator or silicon map
410  const auto& neighbors_map = (trigger_cell_det_id.subdetId()==ForwardSubdetector::HGCHEB ? trigger_cell_neighbors_bh_ : trigger_cell_neighbors_);
411  unsigned module = trigger_cell_det_id.wafer();
412  unsigned trigger_cell = trigger_cell_det_id.cell();
413  // retrieve neighbors
414  unsigned trigger_cell_key = packTriggerCell(module, trigger_cell);
415  geom_set neighbor_detids;
416  auto neighbors_itr = neighbors_map.find(trigger_cell_key);
417  if(neighbors_itr==neighbors_map.end())
418  {
419  throw cms::Exception("BadGeometry")
420  << "HGCalTriggerGeometry: Neighbors are not defined for trigger cell " << trigger_cell << " in module "
421  << module << ". The trigger cell neighbor mapping should be modified. \n";
422  }
423  const auto& neighbors = neighbors_itr->second;
424  // create HGCalDetId of neighbors and check their validity
425  neighbor_detids.reserve(neighbors.size());
426  for(const auto& module_tc : neighbors)
427  {
428  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);
429  if(validTriggerCell(neighbor_det_id.rawId()))
430  {
431  neighbor_detids.emplace(neighbor_det_id.rawId());
432  }
433  }
434  return neighbor_detids;
435 }
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 316 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromModule().

317 {
318  geom_ordered_set cell_det_ids;
319  geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id);
320  for(auto trigger_cell_id : trigger_cells)
321  {
322  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
323  cell_det_ids.insert(cells.begin(), cells.end());
324  }
325  return cell_det_ids;
326 }
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 367 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().

368 {
369  HGCalDetId module_det_id(module_id);
370  geom_ordered_set trigger_cell_det_ids;
371  // BH
372  if(module_det_id.subdetId()==ForwardSubdetector::HGCHEB)
373  {
374  unsigned module = module_det_id.wafer();
375  // loop on the trigger cells in each module
376  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_bh_.at(module); trigger_cell++)
377  {
378  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), module_det_id.zside(), module_det_id.layer(), 1, module, trigger_cell);
379  if(validTriggerCell(trigger_cell_id)) trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
380  }
381  }
382  // EE or FH
383  else
384  {
385  unsigned module = module_det_id.wafer();
386  auto wafer_itrs = module_to_wafers_.equal_range(module);
387  // loop on the wafers included in the module
388  for(auto wafer_itr=wafer_itrs.first; wafer_itr!=wafer_itrs.second; wafer_itr++)
389  {
390  unsigned wafer = wafer_itr->second;
391  // loop on the trigger cells in each wafer
392  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_.at(wafer); trigger_cell++)
393  {
394  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), module_det_id.zside(), module_det_id.layer(), 1, wafer, trigger_cell);
395  if(validTriggerCell(trigger_cell_id)) trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
396  }
397  }
398  }
399  return trigger_cell_det_ids;
400 }
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 174 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().

175 {
176  unsigned subdet = 0;
177  int zside = 0;
178  unsigned layer = 0;
179  unsigned wafer_trigger_cell = 0;
180  unsigned trigger_cell = 0;
181  // BH
182  if(DetId(cell_id).det() == DetId::Hcal)
183  {
184  HcalDetId cell_det_id(cell_id);
185  if(cell_det_id.subdetId()!=HcalEndcap) return 0;
186  unsigned ieta = cell_det_id.ietaAbs();
187  unsigned iphi = cell_det_id.iphi();
188  layer = cell_det_id.depth();
190  zside = cell_det_id.zside();
191  auto trigger_cell_itr = cells_to_trigger_cells_bh_.find(packIetaIphi(ieta, iphi));
192  if(trigger_cell_itr==cells_to_trigger_cells_bh_.end())
193  {
194  throw cms::Exception("BadGeometry")
195  << "HGCalTriggerGeometry: Hcal cell ieta=" << ieta << ", iphi="<<iphi<<" is not mapped to any trigger cell. The trigger cell mapping should be modified.\n";
196  }
197  trigger_cell = 0;
198  wafer_trigger_cell = 0;
199  unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell);
200  }
201  // EE or FH
202  else if(DetId(cell_id).det() == DetId::Forward)
203  {
204  HGCalDetId cell_det_id(cell_id);
205  subdet = cell_det_id.subdetId();
206  layer = cell_det_id.layer();
207  zside = cell_det_id.zside();
208  unsigned wafer = cell_det_id.wafer();
209  unsigned cell = cell_det_id.cell();
210  auto trigger_cell_itr = cells_to_trigger_cells_.find(packWaferCellId(subdet, wafer, cell));
211  if(trigger_cell_itr==cells_to_trigger_cells_.end())
212  {
213  throw cms::Exception("BadGeometry")
214  << "HGCalTriggerGeometry: HGCal cell " << cell << " in wafer "<<wafer<<" is not mapped to any trigger cell. The trigger cell mapping should be modified.\n";
215  }
216  trigger_cell = 0;
217  wafer_trigger_cell = 0;
218  unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell);
219  }
220  return HGCalDetId((ForwardSubdetector)subdet, zside, layer, 1, wafer_trigger_cell, trigger_cell).rawId();
221 
222 }
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 440 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().

441 {
442  unsigned subdet = HGCalDetId(trigger_cell_det_id).subdetId();
443  // Position: barycenter of the trigger cell.
444  Basic3DVector<float> triggerCellVector(0.,0.,0.);
445  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
446  // BH
447  if(subdet==ForwardSubdetector::HGCHEB)
448  {
449  for(const auto& cell : cell_ids)
450  {
451  HcalDetId cellDetId(cell);
452  triggerCellVector += bhGeometry()->getPosition(cellDetId).basicVector();
453  }
454  }
455  // EE or FH
456  else
457  {
458  for(const auto& cell : cell_ids)
459  {
460  HGCalDetId cellDetId(cell);
461  triggerCellVector += (cellDetId.subdetId()==ForwardSubdetector::HGCEE ? eeGeometry()->getPosition(cellDetId) : fhGeometry()->getPosition(cellDetId)).basicVector();
462  }
463  }
464  return GlobalPoint( triggerCellVector/cell_ids.size() );
465 
466 }
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 330 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().

331 {
332  HGCalDetId module_det_id(module_id);
333  geom_set trigger_cell_det_ids;
334  // BH
335  if(module_det_id.subdetId()==ForwardSubdetector::HGCHEB)
336  {
337  unsigned module = module_det_id.wafer();
338  // loop on the trigger cells in each module
339  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_bh_.at(module); trigger_cell++)
340  {
341  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), module_det_id.zside(), module_det_id.layer(), 1, module, trigger_cell);
342  if(validTriggerCell(trigger_cell_id)) trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
343  }
344  }
345  // EE or FH
346  else
347  {
348  unsigned module = module_det_id.wafer();
349  auto wafer_itrs = module_to_wafers_.equal_range(module);
350  // loop on the wafers included in the module
351  for(auto wafer_itr=wafer_itrs.first; wafer_itr!=wafer_itrs.second; wafer_itr++)
352  {
353  unsigned wafer = wafer_itr->second;
354  // loop on the trigger cells in each wafer
355  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_.at(wafer); trigger_cell++)
356  {
357  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), module_det_id.zside(), module_det_id.layer(), 1, wafer, trigger_cell);
358  if(validTriggerCell(trigger_cell_id)) trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
359  }
360  }
361  }
362  return trigger_cell_det_ids;
363 }
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 133 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by reset().

134 {
135  setCaloGeometry(calo_geometry);
139  trigger_layers_.resize(totalLayers_+1);
140  unsigned trigger_layer = 0;
141  for(unsigned layer=0; layer<trigger_layers_.size(); layer++)
142  {
143  if(disconnected_layers_.find(layer)==disconnected_layers_.end())
144  {
145  // Increase trigger layer number if the layer is not disconnected
146  trigger_layers_[layer] = trigger_layer;
147  trigger_layer++;
148  }
149  else
150  {
151  trigger_layers_[layer] = 0;
152  }
153  }
154  fillMaps();
158 
159 }
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
void HGCalTriggerGeometryHexLayerBasedImp1::initialize ( const edm::ESHandle< HGCalGeometry > &  hgc_ee_geometry,
const edm::ESHandle< HGCalGeometry > &  hgc_hsi_geometry,
const edm::ESHandle< HGCalGeometry > &  hgc_hsc_geometry 
)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 163 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References Exception, and getTriggerCellFromCell().

167 {
168  throw cms::Exception("BadGeometry")
169  << "HGCalTriggerGeometryHexLayerBasedImp1 geometry cannot be initialized with the V9 HGCAL geometry";
170 }
unsigned HGCalTriggerGeometryHexLayerBasedImp1::layerWithOffset ( unsigned  id) const
private

Definition at line 822 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

823 {
824  HGCalDetId detid(id);
825  unsigned layer = 0;
826  switch(detid.subdetId())
827  {
829  layer = detid.layer();
830  break;
832  layer = fhOffset_ + detid.layer();
833  break;
835  layer = bhOffset_ + detid.layer();
836  break;
837  };
838  return layer;
839 }
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packIetaIphi ( unsigned  ieta,
unsigned  iphi 
) const
private

Definition at line 692 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

693 {
694  unsigned packed_value = 0;
695  packed_value |= (iphi & HcalDetId::kHcalPhiMask2);
696  packed_value |= ((ieta & HcalDetId::kHcalEtaMask2) << HcalDetId::kHcalEtaOffset2);
697  return packed_value;
698 }
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 789 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

790 {
791  unsigned packed_value = 0;
792  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
794  return packed_value;
795 }
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 679 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

680 {
681  unsigned packed_value = 0;
682  const int kSubdetMask = 0x7;
683  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
684  packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset);
685  packed_value |= ((subdet & kSubdetMask) << (HGCalDetId::kHGCalWaferTypeOffset));
686  return packed_value;
687 }
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 117 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().

118 {
119  cells_to_trigger_cells_.clear();
120  trigger_cells_to_cells_.clear();
123  wafer_to_module_.clear();
124  module_to_wafers_.clear();
127  trigger_cell_neighbors_.clear();
129 }
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 736 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by disconnectedModule().

737 {
738  unsigned layer = layerWithOffset(id);
739  if(layer>=trigger_layers_.size()) return 0;
740  return trigger_layers_[layer];
741 }
void HGCalTriggerGeometryHexLayerBasedImp1::unpackIetaIphi ( unsigned  ieta_iphi,
unsigned &  ieta,
unsigned &  iphi 
) const
private

Definition at line 711 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell(), and unpackWaferCellId().

712 {
713  iphi = ieta_iphi & HcalDetId::kHcalPhiMask2;
715 }
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 702 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

703 {
704  cell = wafer_cell & HGCalDetId::kHGCalCellMask;
706 }
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 765 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().

766 {
767  bool is_valid = false;
768  switch(subdet)
769  {
771  is_valid = eeTopology().valid(cell_id);
772  break;
774  is_valid = fhTopology().valid(cell_id);
775  break;
777  is_valid = bhTopology().valid(cell_id);
778  break;
779  default:
780  is_valid = false;
781  break;
782  }
783  return is_valid;
784 }
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 745 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by fillInvalidTriggerCells(), and triggerLayer().

746 {
747  // Check the validity of a trigger cell with the
748  // validity of the cells. One valid cell in the
749  // trigger cell is enough to make the trigger cell
750  // valid.
751  HGCalDetId trigger_cell_det_id(trigger_cell_id);
752  unsigned subdet = trigger_cell_det_id.subdetId();
753  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
754  bool is_valid = false;
755  for(const auto cell_id : cells)
756  {
757  is_valid |= validCellId(subdet, cell_id);
758  if(is_valid) break;
759  }
760  return is_valid;
761 }
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 79 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 78 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize(), and layerWithOffset().

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

Definition at line 50 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellNeighborsMapping_
private

Definition at line 49 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellsBHMapping_
private

Definition at line 47 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellsMapping_
private

Definition at line 46 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tModulesMapping_
private

Definition at line 48 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

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 80 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

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

Definition at line 75 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize(), and triggerLayer().

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