CMS 3D CMS Logo

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

Public Member Functions

bool disconnectedModule (const unsigned) const final
 
geom_set getCellsFromModule (const unsigned) const final
 
geom_set getCellsFromTriggerCell (const unsigned) const final
 
unsigned 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
 
 HGCalTriggerGeometryV9Imp1 (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 Types

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

Private Member Functions

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

Private Attributes

std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
 
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_sci_
 
std::unordered_set< unsigned > disconnected_layers_
 
std::unordered_set< unsigned > disconnected_modules_
 
unsigned heOffset_
 
std::unordered_set< unsigned > invalid_triggercells_
 
edm::FileInPath l1tCellNeighborsMapping_
 
edm::FileInPath l1tCellNeighborsSciMapping_
 
edm::FileInPath l1tCellsMapping_
 
edm::FileInPath l1tCellsSciMapping_
 
edm::FileInPath l1tModulesMapping_
 
edm::FileInPath l1tWafersMapping_
 
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
 
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
 
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_sci_
 
unsigned totalLayers_
 
neighbor_map trigger_cell_neighbors_
 
neighbor_map trigger_cell_neighbors_sci_
 
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
 
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_sci_
 
std::vector< unsigned > trigger_layers_
 
std::unordered_map< unsigned, unsigned > wafer_to_module_
 
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
 
std::unordered_map< unsigned, unsigned > wafers_to_wafers_old_
 

Additional Inherited Members

- Public Types inherited from HGCalTriggerGeometryBase
typedef std::unordered_map< unsigned, unsigned > geom_map
 
typedef std::set< unsigned > geom_ordered_set
 
typedef std::unordered_set< unsigned > geom_set
 
- Protected Member Functions inherited from HGCalTriggerGeometryBase
void setCaloGeometry (const 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 HGCalTriggerGeometryV9Imp1.cc.

Member Typedef Documentation

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

Definition at line 72 of file HGCalTriggerGeometryV9Imp1.cc.

Constructor & Destructor Documentation

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

Definition at line 109 of file HGCalTriggerGeometryV9Imp1.cc.

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

109  :
111  l1tCellsMapping_(conf.getParameter<edm::FileInPath>("L1TCellsMapping")),
112  l1tCellsSciMapping_(conf.getParameter<edm::FileInPath>("L1TCellsSciMapping")),
113  l1tWafersMapping_(conf.getParameter<edm::FileInPath>("L1TWafersMapping")),
114  l1tModulesMapping_(conf.getParameter<edm::FileInPath>("L1TModulesMapping")),
115  l1tCellNeighborsMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsMapping")),
116  l1tCellNeighborsSciMapping_(conf.getParameter<edm::FileInPath>("L1TCellNeighborsSciMapping"))
117 {
118  std::vector<unsigned> tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedModules");
119  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_modules_, disconnected_modules_.end()));
120  tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedLayers");
121  std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end()));
122 }
HGCalTriggerGeometryBase(const edm::ParameterSet &conf)
T getParameter(std::string const &) const
std::unordered_set< unsigned > disconnected_layers_
std::unordered_set< unsigned > disconnected_modules_
def move(src, dest)
Definition: eostools.py:511

Member Function Documentation

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

Definition at line 1005 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

1006 {
1007  int wafer_type = 0;
1008  switch(det)
1009  {
1010  case DetId::HGCalEE:
1011  wafer_type = eeTopology().dddConstants().getTypeHex(layer, waferU, waferV);
1012  break;
1013  case DetId::HGCalHSi:
1014  wafer_type = hsiTopology().dddConstants().getTypeHex(layer, waferU, waferV);
1015  break;
1016  default:
1017  break;
1018  };
1019  return wafer_type;
1020 }
const HGCalTopology & eeTopology() const
int getTypeHex(int layer, int waferU, int waferV) const
const HGCalTopology & hsiTopology() const
const HGCalDDDConstants & dddConstants() const
bool HGCalTriggerGeometryV9Imp1::disconnectedModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 921 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by validTriggerCell().

922 {
923  bool disconnected = false;
924  if(disconnected_modules_.find(HGCalDetId(module_id).wafer())!=disconnected_modules_.end()) disconnected = true;
925  if(disconnected_layers_.find(layerWithOffset(module_id))!=disconnected_layers_.end()) disconnected = true;
926  return disconnected;
927 }
std::unordered_set< unsigned > disconnected_layers_
std::unordered_set< unsigned > disconnected_modules_
unsigned layerWithOffset(unsigned) const
void HGCalTriggerGeometryV9Imp1::fillInvalidTriggerCells ( )
private

Definition at line 748 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by fillNeighborMap(), and initialize().

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

Definition at line 549 of file HGCalTriggerGeometryV9Imp1.cc.

References cells_to_trigger_cells_, cells_to_trigger_cells_sci_, Exception, fillNeighborMap(), edm::FileInPath::fullPath(), HGCHEB, l1tCellsMapping_, l1tCellsSciMapping_, l1tModulesMapping_, l1tWafersMapping_, module_to_wafers_, number_trigger_cells_in_wafers_, number_trigger_cells_in_wafers_sci_, packCellId(), packIetaIphi(), packWaferCellId(), packWaferId(), trigger_cells_to_cells_, trigger_cells_to_cells_sci_, wafer_to_module_, wafers_old_to_wafers_, and wafers_to_wafers_old_.

Referenced by getModulePosition(), and initialize().

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

Definition at line 656 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by fillMaps(), and initialize().

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

Implements HGCalTriggerGeometryBase.

Definition at line 335 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getCellsFromTriggerCell(), and getModulePosition().

336 {
337  geom_set cell_det_ids;
338  geom_set trigger_cells = getTriggerCellsFromModule(module_id);
339  for(auto trigger_cell_id : trigger_cells)
340  {
341  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
342  cell_det_ids.insert(cells.begin(), cells.end());
343  }
344  return cell_det_ids;
345 }
std::unordered_set< unsigned > geom_set
geom_set getTriggerCellsFromModule(const unsigned) const final
geom_set getCellsFromTriggerCell(const unsigned) const final
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getCellsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 284 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

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

Implements HGCalTriggerGeometryBase.

Definition at line 250 of file HGCalTriggerGeometryV9Imp1.cc.

References getModuleFromTriggerCell(), and getTriggerCellFromCell().

Referenced by getTriggerCellFromCell().

251 {
253 }
unsigned getModuleFromTriggerCell(const unsigned) const final
unsigned getTriggerCellFromCell(const unsigned) const final
unsigned HGCalTriggerGeometryV9Imp1::getModuleFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 257 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getModuleFromCell().

258 {
259  HGCalDetId trigger_cell_det_id(trigger_cell_id);
260  unsigned module = 0;
261  // Scintillator
262  if(trigger_cell_det_id.subdetId()==ForwardSubdetector::HGCHEB)
263  {
264  // For scintillator, the module ID is currently encoded as the wafer in HGCalDetId
265  module = trigger_cell_det_id.wafer();
266  }
267  // Silicon
268  else
269  {
270  auto module_itr = wafer_to_module_.find(trigger_cell_det_id.wafer());
271  if(module_itr==wafer_to_module_.end())
272  {
273  throw cms::Exception("BadGeometry")
274  <<trigger_cell_det_id
275  << "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";
276  }
277  module = module_itr->second;
278  }
279  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();
280 }
std::unordered_map< unsigned, unsigned > wafer_to_module_
ForwardSubdetector
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
Definition: vlib.h:208
GlobalPoint HGCalTriggerGeometryV9Imp1::getModulePosition ( const unsigned  module_det_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 519 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getTriggerCellPosition().

520 {
521  unsigned subdet = HGCalDetId(module_det_id).subdetId();
522  // Position: barycenter of the module.
523  Basic3DVector<float> moduleVector(0.,0.,0.);
524  const auto cell_ids = getCellsFromModule(module_det_id);
525  // Scintillator
526  if(subdet==ForwardSubdetector::HGCHEB)
527  {
528  for(const auto& cell : cell_ids)
529  {
530  HGCScintillatorDetId cellDetId(cell);
531  moduleVector += hscGeometry()->getPosition(cellDetId).basicVector();
532  }
533  }
534  // Silicon
535  else
536  {
537  for(const auto& cell : cell_ids)
538  {
539  HGCSiliconDetId cellDetId(cell);
540  moduleVector += (cellDetId.det()==DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId) : hsiGeometry()->getPosition(cellDetId)).basicVector();
541  }
542  }
543  return GlobalPoint( moduleVector/cell_ids.size() );
544 }
const HGCalGeometry * eeGeometry() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
geom_set getCellsFromModule(const unsigned) const final
GlobalPoint getPosition(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
const HGCalGeometry * hsiGeometry() const
const HGCalGeometry * hscGeometry() const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getNeighborsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 453 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by fillInvalidTriggerCells(), and getOrderedTriggerCellsFromModule().

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

Implements HGCalTriggerGeometryBase.

Definition at line 349 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getCellsFromModule().

350 {
351  geom_ordered_set cell_det_ids;
352  geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id);
353  for(auto trigger_cell_id : trigger_cells)
354  {
355  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
356  cell_det_ids.insert(cells.begin(), cells.end());
357  }
358  return cell_det_ids;
359 }
geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final
std::set< unsigned > geom_ordered_set
std::unordered_set< unsigned > geom_set
geom_set getCellsFromTriggerCell(const unsigned) const final
HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp1::getOrderedTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 407 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getOrderedCellsFromModule(), and getTriggerCellsFromModule().

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

Implements HGCalTriggerGeometryBase.

Definition at line 186 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getModuleFromCell(), and initialize().

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

Implements HGCalTriggerGeometryBase.

Definition at line 489 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getNeighborsFromTriggerCell().

490 {
491  unsigned subdet = HGCalDetId(trigger_cell_det_id).subdetId();
492  // Position: barycenter of the trigger cell.
493  Basic3DVector<float> triggerCellVector(0.,0.,0.);
494  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
495  // Scintillator
496  if(subdet==ForwardSubdetector::HGCHEB)
497  {
498  for(const auto& cell : cell_ids)
499  {
500  HcalDetId cellDetId(cell);
501  triggerCellVector += hscGeometry()->getPosition(cellDetId).basicVector();
502  }
503  }
504  // Silicon
505  else
506  {
507  for(const auto& cell : cell_ids)
508  {
509  HGCSiliconDetId cellDetId(cell);
510  triggerCellVector += (cellDetId.det()==DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId) : hsiGeometry()->getPosition(cellDetId)).basicVector();
511  }
512  }
513  return GlobalPoint( triggerCellVector/cell_ids.size() );
514 
515 }
const HGCalGeometry * eeGeometry() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPosition(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
const HGCalGeometry * hsiGeometry() const
const HGCalGeometry * hscGeometry() const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
geom_set getCellsFromTriggerCell(const unsigned) const final
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp1::getTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 363 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getCellsFromModule(), and getOrderedCellsFromModule().

364 {
365  HGCalDetId module_det_id(module_id);
366  geom_set trigger_cell_det_ids;
367  unsigned module = module_det_id.wafer();
368  // Scintillator
369  if(module_det_id.subdetId()==ForwardSubdetector::HGCHEB)
370  {
371  // loop on the trigger cells in each module
372  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_sci_.at(module); trigger_cell++)
373  {
374  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), module_det_id.zside(), module_det_id.layer(), module_det_id.waferType(), module, trigger_cell);
375  if(validTriggerCell(trigger_cell_id)) trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
376  }
377  }
378  // Silicon
379  else
380  {
381  auto wafer_itrs = module_to_wafers_.equal_range(module);
382  // loop on the wafers included in the module
383  for(auto wafer_itr=wafer_itrs.first; wafer_itr!=wafer_itrs.second; wafer_itr++)
384  {
385  unsigned wafer = wafer_itr->second;
386  auto waferuv_itr = wafers_old_to_wafers_.find(wafer);
387  if(waferuv_itr==wafers_old_to_wafers_.end()) continue;
388  int waferu = 0;
389  int waferv = 0;
390  unpackWaferId(waferuv_itr->second, waferu, waferv);
391  DetId::Detector det = (module_det_id.subdetId()==ForwardSubdetector::HGCEE ? DetId::HGCalEE : DetId::HGCalHSi);
392  unsigned layer = module_det_id.layer();
393  unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv);
394  // loop on the trigger cells in each wafer
395  for(int trigger_cell=0; trigger_cell<number_trigger_cells_in_wafers_.at(wafer_type); trigger_cell++)
396  {
397  HGCalDetId trigger_cell_id((ForwardSubdetector)module_det_id.subdetId(), module_det_id.zside(), module_det_id.layer(), module_det_id.waferType(), wafer, trigger_cell);
398  if(validTriggerCell(trigger_cell_id)) trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
399  }
400  }
401  }
402  return trigger_cell_det_ids;
403 }
int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const
bool validTriggerCell(const unsigned) const final
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
ForwardSubdetector
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_sci_
Detector
Definition: DetId.h:26
void unpackWaferId(unsigned wafer, int &waferU, int &waferV) const
std::unordered_set< unsigned > geom_set
Definition: vlib.h:208
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
void HGCalTriggerGeometryV9Imp1::initialize ( const edm::ESHandle< CaloGeometry > &  calo_geometry)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 144 of file HGCalTriggerGeometryV9Imp1.cc.

References Exception.

Referenced by reset().

145 {
146  throw cms::Exception("BadGeometry")
147  << "HGCalTriggerGeometryV9Imp1 geometry cannot be initialized with the V7/V8 HGCAL geometry";
148 }
void HGCalTriggerGeometryV9Imp1::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 152 of file HGCalTriggerGeometryV9Imp1.cc.

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

156 {
157  setEEGeometry(hgc_ee_geometry);
158  setHSiGeometry(hgc_hsi_geometry);
159  setHScGeometry(hgc_hsc_geometry);
162  trigger_layers_.resize(totalLayers_+1);
163  unsigned trigger_layer = 0;
164  for(unsigned layer=0; layer<totalLayers_; layer++)
165  {
166  if(disconnected_layers_.find(layer)==disconnected_layers_.end())
167  {
168  // Increase trigger layer number if the layer is not disconnected
169  trigger_layers_[layer] = trigger_layer;
170  trigger_layer++;
171  }
172  else
173  {
174  trigger_layers_[layer] = 0;
175  }
176  }
177  fillMaps();
181 
182 }
std::unordered_set< unsigned > disconnected_layers_
const HGCalTopology & eeTopology() const
std::vector< unsigned > trigger_layers_
const HGCalTopology & hsiTopology() const
void setEEGeometry(const edm::ESHandle< HGCalGeometry > &geom)
unsigned int layers(bool reco) const
const HGCalDDDConstants & dddConstants() const
void fillNeighborMap(const edm::FileInPath &, neighbor_map &, bool)
void setHScGeometry(const edm::ESHandle< HGCalGeometry > &geom)
void setHSiGeometry(const edm::ESHandle< HGCalGeometry > &geom)
unsigned HGCalTriggerGeometryV9Imp1::layerWithOffset ( unsigned  id) const
private

Definition at line 1025 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

1026 {
1027  HGCalDetId detid(id);
1028  unsigned layer = 0;
1029  switch(detid.subdetId())
1030  {
1032  layer = detid.layer();
1033  break;
1035  layer = heOffset_ + detid.layer();
1036  break;
1038  layer = heOffset_ + detid.layer();
1039  break;
1040  };
1041  return layer;
1042 }
unsigned HGCalTriggerGeometryV9Imp1::packCellId ( unsigned  type,
unsigned  cellU,
unsigned  cellV 
) const
private
unsigned HGCalTriggerGeometryV9Imp1::packCellId ( unsigned  type,
unsigned  cell 
) const
private

Definition at line 831 of file HGCalTriggerGeometryV9Imp1.cc.

References HGCalDetId::kHGCalCellMask, HGCalDetId::kHGCalCellOffset, HGCSiliconDetId::kHGCalTypeMask, HGCSiliconDetId::kHGCalTypeOffset, and packCellId().

832 {
833  unsigned packed_value = 0;
834  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
836  return packed_value;
837 }
type
Definition: HCALResponse.h:21
static const int kHGCalTypeMask
static const int kHGCalTypeOffset
static const int kHGCalCellOffset
Definition: HGCalDetId.h:12
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
unsigned HGCalTriggerGeometryV9Imp1::packIetaIphi ( unsigned  ieta,
unsigned  iphi 
) const
private
unsigned HGCalTriggerGeometryV9Imp1::packTriggerCell ( unsigned  module,
unsigned  trigger_cell 
) const
private

Definition at line 984 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

985 {
986  unsigned packed_value = 0;
987  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
989  return packed_value;
990 }
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 HGCalTriggerGeometryV9Imp1::packTriggerCellWithType ( unsigned  type,
unsigned  module,
unsigned  trigger_cell 
) const
private

Definition at line 994 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by fillNeighborMap(), getNeighborsFromTriggerCell(), and packTriggerCell().

995 {
996  unsigned packed_value = 0;
997  packed_value |= ((trigger_cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
1000  return packed_value;
1001 }
type
Definition: HCALResponse.h:21
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 kHGCalWaferTypeMask
Definition: HGCalDetId.h:17
static const int kHGCalWaferOffset
Definition: HGCalDetId.h:14
Definition: vlib.h:208
static const int kHGCalWaferMask
Definition: HGCalDetId.h:15
unsigned HGCalTriggerGeometryV9Imp1::packWaferCellId ( unsigned  subdet,
unsigned  wafer,
unsigned  cell 
) const
private

Definition at line 819 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

820 {
821  unsigned packed_value = 0;
822  const int kSubdetMask = 0x7;
823  packed_value |= ((cell & HGCalDetId::kHGCalCellMask) << HGCalDetId::kHGCalCellOffset);
824  packed_value |= ((wafer & HGCalDetId::kHGCalWaferMask) << HGCalDetId::kHGCalWaferOffset);
825  packed_value |= ((subdet & kSubdetMask) << (HGCalDetId::kHGCalWaferTypeOffset));
826  return packed_value;
827 }
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
unsigned HGCalTriggerGeometryV9Imp1::packWaferId ( int  waferU,
int  waferV 
) const
private

Definition at line 852 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

853 {
854  unsigned packed_value = 0;
855  unsigned waferUabs = std::abs(waferU);
856  unsigned waferVabs = std::abs(waferV);
857  unsigned waferUsign = (waferU >= 0) ? 0 : 1;
858  unsigned waferVsign = (waferV >= 0) ? 0 : 1;
863  return packed_value;
864 }
static const int kHGCalWaferVOffset
static const int kHGCalWaferVSignOffset
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int kHGCalWaferVMask
static const int kHGCalWaferUSignMask
static const int kHGCalWaferUMask
static const int kHGCalWaferVSignMask
static const int kHGCalWaferUOffset
static const int kHGCalWaferUSignOffset
void HGCalTriggerGeometryV9Imp1::reset ( void  )
finalvirtual

Reimplemented from HGCalTriggerGeometryBase.

Definition at line 126 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by HGCalTriggerGeometryV9Imp1().

127 {
128  cells_to_trigger_cells_.clear();
129  trigger_cells_to_cells_.clear();
132  wafers_to_wafers_old_.clear();
133  wafers_old_to_wafers_.clear();
134  wafer_to_module_.clear();
135  module_to_wafers_.clear();
138  trigger_cell_neighbors_.clear();
140 }
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_sci_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_
std::unordered_map< unsigned, unsigned > cells_to_trigger_cells_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_
std::unordered_map< unsigned, unsigned > wafer_to_module_
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
std::unordered_multimap< unsigned, unsigned > trigger_cells_to_cells_sci_
std::unordered_map< unsigned, unsigned short > number_trigger_cells_in_wafers_sci_
std::unordered_map< unsigned, unsigned > wafers_to_wafers_old_
std::unordered_map< unsigned, unsigned > wafers_old_to_wafers_
unsigned HGCalTriggerGeometryV9Imp1::triggerLayer ( const unsigned  id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 931 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by disconnectedModule().

932 {
933  unsigned layer = layerWithOffset(id);
934  if(layer>=trigger_layers_.size()) return 0;
935  return trigger_layers_[layer];
936 }
std::vector< unsigned > trigger_layers_
unsigned layerWithOffset(unsigned) const
void HGCalTriggerGeometryV9Imp1::unpackCellId ( unsigned  cell,
unsigned &  cellU,
unsigned &  cellV 
) const
private
void HGCalTriggerGeometryV9Imp1::unpackIetaIphi ( unsigned  ieta_iphi,
unsigned &  ieta,
unsigned &  iphi 
) const
private
void HGCalTriggerGeometryV9Imp1::unpackWaferCellId ( unsigned  wafer_cell,
unsigned &  wafer,
unsigned &  cell 
) const
private

Definition at line 878 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getTriggerCellFromCell(), and packIetaIphi().

879 {
880  cell = wafer_cell & HGCalDetId::kHGCalCellMask;
882 }
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 HGCalTriggerGeometryV9Imp1::unpackWaferId ( unsigned  wafer,
int &  waferU,
int &  waferV 
) const
private

Definition at line 895 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

896 {
899  waferU = ( ((wafer >> HGCSiliconDetId::kHGCalWaferUSignOffset) & HGCSiliconDetId::kHGCalWaferUSignMask) ? -waferUAbs : waferUAbs );
900  waferV = ( ((wafer >> HGCSiliconDetId::kHGCalWaferVSignOffset) & HGCSiliconDetId::kHGCalWaferVSignMask) ? -waferVAbs : waferVAbs );
901 }
static const int kHGCalWaferVOffset
static const int kHGCalWaferVSignOffset
static const int kHGCalWaferVMask
static const int kHGCalWaferUSignMask
static const int kHGCalWaferUMask
static const int kHGCalWaferVSignMask
static const int kHGCalWaferUOffset
static const int kHGCalWaferUSignOffset
bool HGCalTriggerGeometryV9Imp1::validCellId ( unsigned  det,
unsigned  cell_id 
) const
private

Definition at line 960 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by getCellsFromTriggerCell(), and validTriggerCellFromCells().

961 {
962  bool is_valid = false;
963  switch(subdet)
964  {
966  is_valid = eeTopology().valid(cell_id);
967  break;
969  is_valid = hsiTopology().valid(cell_id);
970  break;
972  is_valid = hscTopology().valid(cell_id);
973  break;
974  default:
975  is_valid = false;
976  break;
977  }
978  return is_valid;
979 }
bool is_valid(const Digi &d)
Definition: GenericDigi.h:44
const HGCalTopology & eeTopology() const
const HGCalTopology & hsiTopology() const
const HGCalTopology & hscTopology() const
bool valid(const DetId &id) const override
Is this a valid cell id.
bool HGCalTriggerGeometryV9Imp1::validTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual
bool HGCalTriggerGeometryV9Imp1::validTriggerCellFromCells ( const unsigned  trigger_cell_id) const
private

Definition at line 940 of file HGCalTriggerGeometryV9Imp1.cc.

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

Referenced by fillInvalidTriggerCells(), and triggerLayer().

941 {
942  // Check the validity of a trigger cell with the
943  // validity of the cells. One valid cell in the
944  // trigger cell is enough to make the trigger cell
945  // valid.
946  HGCalDetId trigger_cell_det_id(trigger_cell_id);
947  unsigned subdet = trigger_cell_det_id.subdetId();
948  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
949  bool is_valid = false;
950  for(const auto cell_id : cells)
951  {
952  is_valid |= validCellId(subdet, cell_id);
953  if(is_valid) break;
954  }
955  return is_valid;
956 }
bool is_valid(const Digi &d)
Definition: GenericDigi.h:44
bool validCellId(unsigned det, unsigned cell_id) const
std::unordered_set< unsigned > geom_set
geom_set getCellsFromTriggerCell(const unsigned) const final

Member Data Documentation

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

Definition at line 58 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

Definition at line 60 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

Definition at line 77 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by disconnectedModule(), and HGCalTriggerGeometryV9Imp1().

unsigned HGCalTriggerGeometryV9Imp1::heOffset_
private

Definition at line 82 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by initialize(), and layerWithOffset().

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

Definition at line 66 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillInvalidTriggerCells(), and validTriggerCell().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tCellNeighborsMapping_
private

Definition at line 50 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tCellNeighborsSciMapping_
private

Definition at line 51 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by initialize().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tCellsMapping_
private

Definition at line 46 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tCellsSciMapping_
private

Definition at line 47 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tModulesMapping_
private

Definition at line 49 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillMaps().

edm::FileInPath HGCalTriggerGeometryV9Imp1::l1tWafersMapping_
private

Definition at line 48 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by fillMaps().

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

Definition at line 83 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by initialize().

neighbor_map HGCalTriggerGeometryV9Imp1::trigger_cell_neighbors_
private

Definition at line 73 of file HGCalTriggerGeometryV9Imp1.cc.

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

neighbor_map HGCalTriggerGeometryV9Imp1::trigger_cell_neighbors_sci_
private

Definition at line 74 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

Definition at line 59 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

Definition at line 61 of file HGCalTriggerGeometryV9Imp1.cc.

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

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

Definition at line 79 of file HGCalTriggerGeometryV9Imp1.cc.

Referenced by initialize(), and triggerLayer().

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

Definition at line 54 of file HGCalTriggerGeometryV9Imp1.cc.

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

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