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

virtual bool disconnectedModule (const unsigned) const override final
 
virtual geom_set getCellsFromModule (const unsigned) const override final
 
virtual geom_set getCellsFromTriggerCell (const unsigned) const override final
 
virtual unsigned getModuleFromCell (const unsigned) const override final
 
virtual unsigned getModuleFromTriggerCell (const unsigned) const override final
 
virtual GlobalPoint getModulePosition (const unsigned) const override final
 
virtual geom_set getNeighborsFromTriggerCell (const unsigned) const override final
 
virtual geom_ordered_set getOrderedCellsFromModule (const unsigned) const override final
 
virtual geom_ordered_set getOrderedTriggerCellsFromModule (const unsigned) const override final
 
virtual unsigned getTriggerCellFromCell (const unsigned) const override final
 
virtual GlobalPoint getTriggerCellPosition (const unsigned) const override final
 
virtual geom_set getTriggerCellsFromModule (const unsigned) const override final
 
 HGCalTriggerGeometryHexLayerBasedImp1 (const edm::ParameterSet &conf)
 
virtual void initialize (const edm::ESHandle< CaloGeometry > &) override final
 
virtual void reset () override final
 
virtual bool validTriggerCell (const unsigned) const override 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 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

std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
 
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_bh_
 
std::unordered_set< unsigned > disconnected_modules_
 
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_
 
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::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 88 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

88  :
90  l1tCellsMapping_(conf.getParameter<edm::FileInPath>("L1TCellsMapping")),
91  l1tCellsBHMapping_(conf.getParameter<edm::FileInPath>("L1TCellsBHMapping")),
92  l1tModulesMapping_(conf.getParameter<edm::FileInPath>("L1TModulesMapping")),
93  l1tCellNeighborsMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsMapping")),
94  l1tCellNeighborsBHMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsBHMapping"))
95 {
96  std::vector<unsigned> tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedModules");
97  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_modules_, disconnected_modules_.end()));
98 }
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 743 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell(), and packTriggerCell().

744 {
745  int wafer_type = 0;
746  switch(subdet)
747  {
748  // HGCalDDDConstants::waferTypeT() returns 2=coarse, 1=fine
749  // HGCalDetId::waferType() returns -1=coarse, 1=fine
750  // Convert to HGCalDetId waferType
752  wafer_type = (eeTopology().dddConstants().waferTypeT(wafer)==2?-1:1);
753  break;
755  wafer_type = (fhTopology().dddConstants().waferTypeT(wafer)==2?-1:1);
756  break;
757  default:
758  break;
759  };
760  return wafer_type;
761 }
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
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

Definition at line 682 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References disconnected_modules_, and validTriggerCellFromCells().

Referenced by validTriggerCell().

683 {
684  return disconnected_modules_.find(HGCalDetId(module_id).wafer())!=disconnected_modules_.end();
685 }
void HGCalTriggerGeometryHexLayerBasedImp1::fillInvalidTriggerCells ( )
private

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

605 {
606  unsigned n_layers_ee = eeTopology().dddConstants().layers(true);
607  for(unsigned layer=1; layer<=n_layers_ee; layer++)
608  {
609  for(const auto& wafer_module : wafer_to_module_)
610  {
611  unsigned wafer = wafer_module.first;
612  // loop on the trigger cells in each wafer
613  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_.at(wafer); trigger_cell++)
614  {
615  std::set<unsigned> trigger_cell_ids;
616  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, -1, layer, 1, wafer, trigger_cell));
617  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCEE, 1, layer, 1, wafer, trigger_cell));
618  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, -1, layer, 1, wafer, trigger_cell));
619  trigger_cell_ids.emplace(HGCalDetId(ForwardSubdetector::HGCHEF, 1, layer, 1, wafer, trigger_cell));
620  for(unsigned trigger_cell : trigger_cell_ids)
621  {
622  if(!validTriggerCellFromCells(trigger_cell)) invalid_triggercells_.emplace(trigger_cell);
623  for(unsigned neighbor : getNeighborsFromTriggerCell(trigger_cell))
624  {
625  if(!validTriggerCellFromCells(neighbor)) invalid_triggercells_.emplace(neighbor);
626  }
627  }
628  }
629  }
630  }
631 }
const HGCalTopology & eeTopology() const
virtual geom_set getNeighborsFromTriggerCell(const unsigned) const override final
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
void HGCalTriggerGeometryHexLayerBasedImp1::fillMaps ( )
private

Definition at line 456 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References cells_to_trigger_cells_, cells_to_trigger_cells_bh_, Exception, fillNeighborMaps(), edm::FileInPath::fullPath(), HGCHEB, l1tCellsBHMapping_, l1tCellsMapping_, l1tModulesMapping_, python.rootplot.argparse::module, 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().

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

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

Implements HGCalTriggerGeometryBase.

Definition at line 258 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell(), and getModulePosition().

259 {
260  geom_set cell_det_ids;
261  geom_set trigger_cells = getTriggerCellsFromModule(module_id);
262  for(auto trigger_cell_id : trigger_cells)
263  {
264  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
265  cell_det_ids.insert(cells.begin(), cells.end());
266  }
267  return cell_det_ids;
268 }
virtual geom_set getTriggerCellsFromModule(const unsigned) const override final
virtual geom_set getCellsFromTriggerCell(const unsigned) const override final
std::unordered_set< unsigned > geom_set
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getCellsFromTriggerCell ( const unsigned  trigger_cell_id) const
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

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

217 {
218  HGCalDetId trigger_cell_det_id(trigger_cell_id);
219  geom_set cell_det_ids;
220  // BH
221  if(trigger_cell_det_id.subdetId()==ForwardSubdetector::HGCHEB)
222  {
223  unsigned subdet = trigger_cell_det_id.subdetId();
224  unsigned trigger_wafer = trigger_cell_det_id.wafer();
225  unsigned trigger_cell = trigger_cell_det_id.cell();
226  const auto& cell_range = trigger_cells_to_cells_bh_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell));
227  for(auto tc_c_itr=cell_range.first; tc_c_itr!=cell_range.second; tc_c_itr++)
228  {
229  unsigned ieta = 0;
230  unsigned iphi = 0;
231  unpackIetaIphi(tc_c_itr->second, ieta, iphi);
232  unsigned cell_det_id = HcalDetId(HcalEndcap, trigger_cell_det_id.zside()*ieta, iphi, trigger_cell_det_id.layer()).rawId();
233  if(validCellId(subdet, cell_det_id)) cell_det_ids.emplace(cell_det_id);
234  }
235  }
236  // EE or FH
237  else
238  {
239  unsigned subdet = trigger_cell_det_id.subdetId();
240  unsigned trigger_wafer = trigger_cell_det_id.wafer();
241  unsigned trigger_cell = trigger_cell_det_id.cell();
242  const auto& cell_range = trigger_cells_to_cells_.equal_range(packWaferCellId(subdet, trigger_wafer, trigger_cell));
243  for(auto tc_c_itr=cell_range.first; tc_c_itr!=cell_range.second; tc_c_itr++)
244  {
245  unsigned wafer = 0;
246  unsigned cell = 0;
247  unpackWaferCellId(tc_c_itr->second, wafer, cell);
248  unsigned wafer_type = detIdWaferType(subdet, wafer);
249  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();
250  if(validCellId(subdet, cell_det_id)) cell_det_ids.emplace(cell_det_id);
251  }
252  }
253  return cell_det_ids;
254 }
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
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

Definition at line 182 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References getModuleFromTriggerCell(), and getTriggerCellFromCell().

Referenced by getTriggerCellFromCell().

183 {
185 }
virtual unsigned getTriggerCellFromCell(const unsigned) const override final
virtual unsigned getModuleFromTriggerCell(const unsigned) const override final
unsigned HGCalTriggerGeometryHexLayerBasedImp1::getModuleFromTriggerCell ( const unsigned  trigger_cell_id) const
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

Definition at line 189 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getModuleFromCell().

190 {
191  HGCalDetId trigger_cell_det_id(trigger_cell_id);
192  unsigned module = 0;
193  // BH
194  if(trigger_cell_det_id.subdetId()==ForwardSubdetector::HGCHEB)
195  {
196  // For BH, the module ID is currently encoded as the wafer in HGCalDetId
197  module = trigger_cell_det_id.wafer();
198  }
199  // EE or FH
200  else
201  {
202  auto module_itr = wafer_to_module_.find(trigger_cell_det_id.wafer());
203  if(module_itr==wafer_to_module_.end())
204  {
205  throw cms::Exception("BadGeometry")
206  <<trigger_cell_det_id
207  << "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";
208  }
209  module = module_itr->second;
210  }
211  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();
212 }
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
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

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

427 {
428  unsigned subdet = HGCalDetId(module_det_id).subdetId();
429  // Position: barycenter of the module.
430  Basic3DVector<float> moduleVector(0.,0.,0.);
431  const auto cell_ids = getCellsFromModule(module_det_id);
432  // BH
433  if(subdet==ForwardSubdetector::HGCHEB)
434  {
435  for(const auto& cell : cell_ids)
436  {
437  HcalDetId cellDetId(cell);
438  moduleVector += 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  moduleVector += (cellDetId.subdetId()==ForwardSubdetector::HGCEE ? eeGeometry().getPosition(cellDetId) : fhGeometry().getPosition(cellDetId)).basicVector();
448  }
449  }
450  return GlobalPoint( moduleVector/cell_ids.size() );
451 }
const HGCalGeometry & eeGeometry() const
const HGCalGeometry & fhGeometry() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPosition(const DetId &id) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
GlobalPoint getPosition(const DetId &id) const
virtual geom_set getCellsFromModule(const unsigned) const override final
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
const HcalGeometry & bhGeometry() const
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getNeighborsFromTriggerCell ( const unsigned  trigger_cell_id) const
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

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

363 {
364  HGCalDetId trigger_cell_det_id(trigger_cell_id);
365  // Choose scintillator or silicon map
366  const auto& neighbors_map = (trigger_cell_det_id.subdetId()==ForwardSubdetector::HGCHEB ? trigger_cell_neighbors_bh_ : trigger_cell_neighbors_);
367  unsigned module = trigger_cell_det_id.wafer();
368  unsigned trigger_cell = trigger_cell_det_id.cell();
369  // retrieve neighbors
370  unsigned trigger_cell_key = packTriggerCell(module, trigger_cell);
371  geom_set neighbor_detids;
372  auto neighbors_itr = neighbors_map.find(trigger_cell_key);
373  if(neighbors_itr==neighbors_map.end())
374  {
375  throw cms::Exception("BadGeometry")
376  << "HGCalTriggerGeometry: Neighbors are not defined for trigger cell " << trigger_cell << " in module "
377  << module << ". The trigger cell neighbor mapping should be modified. \n";
378  }
379  const auto& neighbors = neighbors_itr->second;
380  // create HGCalDetId of neighbors and check their validity
381  neighbor_detids.reserve(neighbors.size());
382  for(const auto& module_tc : neighbors)
383  {
384  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);
385  if(validTriggerCell(neighbor_det_id.rawId()))
386  {
387  neighbor_detids.emplace(neighbor_det_id.rawId());
388  }
389  }
390  return neighbor_detids;
391 }
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
virtual bool validTriggerCell(const unsigned) const override final
std::unordered_set< unsigned > geom_set
Definition: vlib.h:208
HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryHexLayerBasedImp1::getOrderedCellsFromModule ( const unsigned  module_id) const
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

Definition at line 272 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromModule().

273 {
274  geom_ordered_set cell_det_ids;
275  geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id);
276  for(auto trigger_cell_id : trigger_cells)
277  {
278  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
279  cell_det_ids.insert(cells.begin(), cells.end());
280  }
281  return cell_det_ids;
282 }
virtual geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const override final
virtual geom_set getCellsFromTriggerCell(const unsigned) const override final
std::set< unsigned > geom_ordered_set
std::unordered_set< unsigned > geom_set
HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryHexLayerBasedImp1::getOrderedTriggerCellsFromModule ( const unsigned  module_id) const
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

Definition at line 323 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References getNeighborsFromTriggerCell(), HGCHEB, HGCalDetId::layer(), python.rootplot.argparse::module, 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().

324 {
325  HGCalDetId module_det_id(module_id);
326  geom_ordered_set trigger_cell_det_ids;
327  // BH
328  if(module_det_id.subdetId()==ForwardSubdetector::HGCHEB)
329  {
330  unsigned module = module_det_id.wafer();
331  // loop on the trigger cells in each module
332  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_bh_.at(module); trigger_cell++)
333  {
334  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), module_det_id.zside(), module_det_id.layer(), 1, module, trigger_cell);
335  if(validTriggerCell(trigger_cell_id)) trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
336  }
337  }
338  // EE or FH
339  else
340  {
341  unsigned module = module_det_id.wafer();
342  auto wafer_itrs = module_to_wafers_.equal_range(module);
343  // loop on the wafers included in the module
344  for(auto wafer_itr=wafer_itrs.first; wafer_itr!=wafer_itrs.second; wafer_itr++)
345  {
346  unsigned wafer = wafer_itr->second;
347  // loop on the trigger cells in each wafer
348  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_.at(wafer); trigger_cell++)
349  {
350  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), module_det_id.zside(), module_det_id.layer(), 1, wafer, trigger_cell);
351  if(validTriggerCell(trigger_cell_id)) trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
352  }
353  }
354  }
355  return trigger_cell_det_ids;
356 }
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
virtual bool validTriggerCell(const unsigned) const override final
std::set< unsigned > geom_ordered_set
Definition: vlib.h:208
unsigned HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellFromCell ( const unsigned  cell_id) const
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

Definition at line 130 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(), HcalDigiParam_cfi::zside, HGCalDetId::zside(), and HcalDetId::zside().

Referenced by getModuleFromCell(), and initialize().

131 {
132  unsigned subdet = 0;
133  int zside = 0;
134  unsigned layer = 0;
135  unsigned wafer_trigger_cell = 0;
136  unsigned trigger_cell = 0;
137  // BH
138  if(DetId(cell_id).det() == DetId::Hcal)
139  {
140  HcalDetId cell_det_id(cell_id);
141  if(cell_det_id.subdetId()!=HcalEndcap) return 0;
142  unsigned ieta = cell_det_id.ietaAbs();
143  unsigned iphi = cell_det_id.iphi();
144  layer = cell_det_id.depth();
146  zside = cell_det_id.zside();
147  auto trigger_cell_itr = cells_to_trigger_cells_bh_.find(packIetaIphi(ieta, iphi));
148  if(trigger_cell_itr==cells_to_trigger_cells_bh_.end())
149  {
150  throw cms::Exception("BadGeometry")
151  << "HGCalTriggerGeometry: Hcal cell ieta=" << ieta << ", iphi="<<iphi<<" is not mapped to any trigger cell. The trigger cell mapping should be modified.\n";
152  }
153  trigger_cell = 0;
154  wafer_trigger_cell = 0;
155  unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell);
156  }
157  // EE or FH
158  else if(DetId(cell_id).det() == DetId::Forward)
159  {
160  HGCalDetId cell_det_id(cell_id);
161  subdet = cell_det_id.subdetId();
162  layer = cell_det_id.layer();
163  zside = cell_det_id.zside();
164  unsigned wafer = cell_det_id.wafer();
165  unsigned cell = cell_det_id.cell();
166  auto trigger_cell_itr = cells_to_trigger_cells_.find(packWaferCellId(subdet, wafer, cell));
167  if(trigger_cell_itr==cells_to_trigger_cells_.end())
168  {
169  throw cms::Exception("BadGeometry")
170  << "HGCalTriggerGeometry: HGCal cell " << cell << " in wafer "<<wafer<<" is not mapped to any trigger cell. The trigger cell mapping should be modified.\n";
171  }
172  trigger_cell = 0;
173  wafer_trigger_cell = 0;
174  unpackWaferCellId(trigger_cell_itr->second, wafer_trigger_cell, trigger_cell);
175  }
176  return HGCalDetId((ForwardSubdetector)subdet, zside, layer, 1, wafer_trigger_cell, trigger_cell).rawId();
177 
178 }
unsigned packIetaIphi(unsigned ieta, unsigned iphi) const
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
ForwardSubdetector
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

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

397 {
398  unsigned subdet = HGCalDetId(trigger_cell_det_id).subdetId();
399  // Position: barycenter of the trigger cell.
400  Basic3DVector<float> triggerCellVector(0.,0.,0.);
401  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
402  // BH
403  if(subdet==ForwardSubdetector::HGCHEB)
404  {
405  for(const auto& cell : cell_ids)
406  {
407  HcalDetId cellDetId(cell);
408  triggerCellVector += bhGeometry().getPosition(cellDetId).basicVector();
409  }
410  }
411  // EE or FH
412  else
413  {
414  for(const auto& cell : cell_ids)
415  {
416  HGCalDetId cellDetId(cell);
417  triggerCellVector += (cellDetId.subdetId()==ForwardSubdetector::HGCEE ? eeGeometry().getPosition(cellDetId) : fhGeometry().getPosition(cellDetId)).basicVector();
418  }
419  }
420  return GlobalPoint( triggerCellVector/cell_ids.size() );
421 
422 }
const HGCalGeometry & eeGeometry() const
const HGCalGeometry & fhGeometry() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPosition(const DetId &id) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
GlobalPoint getPosition(const DetId &id) const
virtual geom_set getCellsFromTriggerCell(const unsigned) const override final
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
const HcalGeometry & bhGeometry() const
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryHexLayerBasedImp1::getTriggerCellsFromModule ( const unsigned  module_id) const
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

Definition at line 286 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References getOrderedTriggerCellsFromModule(), HGCHEB, HGCalDetId::layer(), python.rootplot.argparse::module, 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().

287 {
288  HGCalDetId module_det_id(module_id);
289  geom_set trigger_cell_det_ids;
290  // BH
291  if(module_det_id.subdetId()==ForwardSubdetector::HGCHEB)
292  {
293  unsigned module = module_det_id.wafer();
294  // loop on the trigger cells in each module
295  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_bh_.at(module); trigger_cell++)
296  {
297  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), module_det_id.zside(), module_det_id.layer(), 1, module, trigger_cell);
298  if(validTriggerCell(trigger_cell_id)) trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
299  }
300  }
301  // EE or FH
302  else
303  {
304  unsigned module = module_det_id.wafer();
305  auto wafer_itrs = module_to_wafers_.equal_range(module);
306  // loop on the wafers included in the module
307  for(auto wafer_itr=wafer_itrs.first; wafer_itr!=wafer_itrs.second; wafer_itr++)
308  {
309  unsigned wafer = wafer_itr->second;
310  // loop on the trigger cells in each wafer
311  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_.at(wafer); trigger_cell++)
312  {
313  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), module_det_id.zside(), module_det_id.layer(), 1, wafer, trigger_cell);
314  if(validTriggerCell(trigger_cell_id)) trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
315  }
316  }
317  }
318  return trigger_cell_det_ids;
319 }
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
virtual bool validTriggerCell(const unsigned) const override final
std::unordered_set< unsigned > geom_set
Definition: vlib.h:208
void HGCalTriggerGeometryHexLayerBasedImp1::initialize ( const edm::ESHandle< CaloGeometry > &  calo_geometry)
finaloverridevirtual

Implements HGCalTriggerGeometryBase.

Definition at line 118 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

References fillInvalidTriggerCells(), fillMaps(), fillNeighborMaps(), getTriggerCellFromCell(), l1tCellNeighborsBHMapping_, l1tCellNeighborsMapping_, HGCalTriggerGeometryBase::setCaloGeometry(), trigger_cell_neighbors_, and trigger_cell_neighbors_bh_.

Referenced by reset().

119 {
120  setCaloGeometry(calo_geometry);
121  fillMaps();
125 
126 }
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_
void fillNeighborMaps(const edm::FileInPath &, std::unordered_map< int, std::set< std::pair< short, short >>> &)
void setCaloGeometry(const edm::ESHandle< CaloGeometry > &geom)
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packIetaIphi ( unsigned  ieta,
unsigned  iphi 
) const
private

Definition at line 648 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

649 {
650  unsigned packed_value = 0;
651  packed_value |= (iphi & HcalDetId::kHcalPhiMask2);
652  packed_value |= ((ieta & HcalDetId::kHcalEtaMask2) << HcalDetId::kHcalEtaOffset2);
653  return packed_value;
654 }
static const int kHcalPhiMask2
Definition: HcalDetId.h:16
static const int kHcalEtaOffset2
Definition: HcalDetId.h:18
static const int kHcalEtaMask2
Definition: HcalDetId.h:20
unsigned HGCalTriggerGeometryHexLayerBasedImp1::packTriggerCell ( unsigned  module,
unsigned  trigger_cell 
) const
private

Definition at line 733 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

734 {
735  unsigned packed_value = 0;
736  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
738  return packed_value;
739 }
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 635 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

636 {
637  unsigned packed_value = 0;
638  const int kSubdetMask = 0x7;
639  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
640  packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset);
641  packed_value |= ((subdet & kSubdetMask) << (HGCalDetId::kHGCalWaferTypeOffset));
642  return packed_value;
643 }
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  )
finaloverridevirtual

Reimplemented from HGCalTriggerGeometryBase.

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

103 {
104  cells_to_trigger_cells_.clear();
105  trigger_cells_to_cells_.clear();
108  wafer_to_module_.clear();
109  module_to_wafers_.clear();
112  trigger_cell_neighbors_.clear();
114 }
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_
void HGCalTriggerGeometryHexLayerBasedImp1::unpackIetaIphi ( unsigned  ieta_iphi,
unsigned &  ieta,
unsigned &  iphi 
) const
private

Definition at line 667 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by getCellsFromTriggerCell(), and unpackWaferCellId().

668 {
669  iphi = ieta_iphi & HcalDetId::kHcalPhiMask2;
671 }
static const int kHcalPhiMask2
Definition: HcalDetId.h:16
static const int kHcalEtaOffset2
Definition: HcalDetId.h:18
static const int kHcalEtaMask2
Definition: HcalDetId.h:20
void HGCalTriggerGeometryHexLayerBasedImp1::unpackWaferCellId ( unsigned  wafer_cell,
unsigned &  wafer,
unsigned &  cell 
) const
private

Definition at line 658 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

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

659 {
660  cell = wafer_cell & HGCalDetId::kHGCalCellMask;
662 }
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 709 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().

710 {
711  bool is_valid = false;
712  switch(subdet)
713  {
715  is_valid = eeTopology().valid(cell_id);
716  break;
718  is_valid = fhTopology().valid(cell_id);
719  break;
721  is_valid = bhTopology().valid(cell_id);
722  break;
723  default:
724  is_valid = false;
725  break;
726  }
727  return is_valid;
728 }
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
finaloverridevirtual
bool HGCalTriggerGeometryHexLayerBasedImp1::validTriggerCellFromCells ( const unsigned  trigger_cell_id) const
private

Definition at line 689 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

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

Referenced by disconnectedModule(), and fillInvalidTriggerCells().

690 {
691  // Check the validity of a trigger cell with the
692  // validity of the cells. One valid cell in the
693  // trigger cell is enough to make the trigger cell
694  // valid.
695  HGCalDetId trigger_cell_det_id(trigger_cell_id);
696  unsigned subdet = trigger_cell_det_id.subdetId();
697  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
698  bool is_valid = false;
699  for(const auto cell_id : cells)
700  {
701  is_valid |= validCellId(subdet, cell_id);
702  if(is_valid) break;
703  }
704  return is_valid;
705 }
bool is_valid(const Digi &d)
Definition: GenericDigi.h:44
bool validCellId(unsigned subdet, unsigned cell_id) const
virtual geom_set getCellsFromTriggerCell(const unsigned) const override final
std::unordered_set< unsigned > geom_set

Member Data Documentation

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_modules_
private
std::unordered_set<unsigned> HGCalTriggerGeometryHexLayerBasedImp1::invalid_triggercells_
private
edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellNeighborsBHMapping_
private

Definition at line 46 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellNeighborsMapping_
private

Definition at line 45 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellsBHMapping_
private

Definition at line 43 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tCellsMapping_
private

Definition at line 42 of file HGCalTriggerGeometryHexLayerBasedImp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryHexLayerBasedImp1::l1tModulesMapping_
private

Definition at line 44 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
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::unordered_map<unsigned, unsigned> HGCalTriggerGeometryHexLayerBasedImp1::wafer_to_module_
private