CMS 3D CMS Logo

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

Private Member Functions

int detIdWaferType (unsigned det, unsigned layer, short waferU, short waferV) const
 
void fillMaps ()
 
unsigned layerWithOffset (unsigned) const
 
unsigned packWaferId (int waferU, int waferV) 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_set< unsigned > disconnected_layers_
 
unsigned heOffset_
 
unsigned hSc_module_size_ = 12
 
unsigned hSc_triggercell_size_ = 2
 
edm::FileInPath l1tModulesMapping_
 
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
 
unsigned totalLayers_
 
std::vector< unsigned > trigger_layers_
 
std::unordered_map< unsigned, unsigned > wafer_to_module_
 

Additional Inherited Members

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

Detailed Description

Definition at line 16 of file HGCalTriggerGeometryV9Imp2.cc.

Constructor & Destructor Documentation

HGCalTriggerGeometryV9Imp2::HGCalTriggerGeometryV9Imp2 ( const edm::ParameterSet conf)

Definition at line 76 of file HGCalTriggerGeometryV9Imp2.cc.

78  hSc_triggercell_size_(conf.getParameter<unsigned>("ScintillatorTriggerCellSize")),
79  hSc_module_size_(conf.getParameter<unsigned>("ScintillatorModuleSize")),
80  l1tModulesMapping_(conf.getParameter<edm::FileInPath>("L1TModulesMapping")),
81  disconnected_layers_(conf.getParameter<std::vector<unsigned>>("DisconnectedLayers").begin(),
82  conf.getParameter<std::vector<unsigned>>("DisconnectedLayers").end()) {}
HGCalTriggerGeometryBase(const edm::ParameterSet &conf)
T getParameter(std::string const &) const
#define end
Definition: vmac.h:39
std::unordered_set< unsigned > disconnected_layers_

Member Function Documentation

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

Definition at line 507 of file HGCalTriggerGeometryV9Imp2.cc.

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

Referenced by getOrderedTriggerCellsFromModule(), and getTriggerCellsFromModule().

507  {
508  int wafer_type = 0;
509  switch (det) {
510  case DetId::HGCalEE:
511  wafer_type = eeTopology().dddConstants().getTypeHex(layer, waferU, waferV);
512  break;
513  case DetId::HGCalHSi:
514  wafer_type = hsiTopology().dddConstants().getTypeHex(layer, waferU, waferV);
515  break;
516  default:
517  break;
518  };
519  return wafer_type;
520 }
const HGCalTopology & eeTopology() const
int getTypeHex(int layer, int waferU, int waferV) const
const HGCalTopology & hsiTopology() const
const HGCalDDDConstants & dddConstants() const
bool HGCalTriggerGeometryV9Imp2::disconnectedModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 458 of file HGCalTriggerGeometryV9Imp2.cc.

References disconnected_layers_, and layerWithOffset().

458  {
459  bool disconnected = false;
460  if (disconnected_layers_.find(layerWithOffset(module_id)) != disconnected_layers_.end())
461  disconnected = true;
462  return disconnected;
463 }
std::unordered_set< unsigned > disconnected_layers_
unsigned layerWithOffset(unsigned) const
void HGCalTriggerGeometryV9Imp2::fillMaps ( )
private

Definition at line 413 of file HGCalTriggerGeometryV9Imp2.cc.

References Exception, edm::FileInPath::fullPath(), l1tModulesMapping_, module_to_wafers_, packWaferId(), and wafer_to_module_.

Referenced by initialize().

413  {
414  // read module mapping file
415  std::ifstream l1tModulesMappingStream(l1tModulesMapping_.fullPath());
416  if (!l1tModulesMappingStream.is_open()) {
417  throw cms::Exception("MissingDataFile") << "Cannot open HGCalTriggerGeometry L1TModulesMapping file\n";
418  }
419  short waferu = 0;
420  short waferv = 0;
421  short module = 0;
422  for (; l1tModulesMappingStream >> waferu >> waferv >> module;) {
423  unsigned wafer_key = packWaferId(waferu, waferv);
424  wafer_to_module_.emplace(wafer_key, module);
425  module_to_wafers_.emplace(module, wafer_key);
426  }
427  if (!l1tModulesMappingStream.eof()) {
428  throw cms::Exception("BadGeometryFile")
429  << "Error reading L1TModulesMapping '" << waferu << " " << waferv << " " << module << "' \n";
430  }
431  l1tModulesMappingStream.close();
432 }
unsigned packWaferId(int waferU, int waferV) const
std::unordered_map< unsigned, unsigned > wafer_to_module_
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
std::string fullPath() const
Definition: FileInPath.cc:163
Definition: vlib.h:208
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 232 of file HGCalTriggerGeometryV9Imp2.cc.

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

Referenced by getModulePosition().

232  {
233  geom_set cell_det_ids;
234  geom_set trigger_cells = getTriggerCellsFromModule(module_id);
235  for (auto trigger_cell_id : trigger_cells) {
236  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
237  cell_det_ids.insert(cells.begin(), cells.end());
238  }
239  return cell_det_ids;
240 }
geom_set getCellsFromTriggerCell(const unsigned) const final
geom_set getTriggerCellsFromModule(const unsigned) const final
std::unordered_set< unsigned > geom_set
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getCellsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 191 of file HGCalTriggerGeometryV9Imp2.cc.

References HGCalTriggerDetId::cellU(), HGCalTriggerDetId::cellV(), DetId::det(), DetId::HGCalEE, HGCalEETrigger, DetId::HGCalHSc, DetId::HGCalHSi, HGCalHSiTrigger, hSc_triggercell_size_, HGCScintillatorDetId::ietaAbs(), createfilelist::int, HGCScintillatorDetId::iphi(), HGCScintillatorDetId::layer(), HGCalTriggerDetId::layer(), DetId::rawId(), HGCalTriggerDetId::subdet(), HGCScintillatorDetId::type(), HGCalTriggerDetId::type(), validCellId(), HGCalTriggerDetId::waferU(), HGCalTriggerDetId::waferV(), HGCScintillatorDetId::zside(), HGCalTriggerDetId::zside(), and ecaldqm::zside().

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

192  {
193  DetId trigger_cell_det_id(trigger_cell_id);
194  unsigned det = trigger_cell_det_id.det();
195  geom_set cell_det_ids;
196  // Scintillator
197  if (det == DetId::HGCalHSc) {
198  HGCScintillatorDetId trigger_cell_sc_id(trigger_cell_id);
199  int ieta0 = (trigger_cell_sc_id.ietaAbs() - 1) * hSc_triggercell_size_ + 1;
200  int iphi0 = (trigger_cell_sc_id.iphi() - 1) * hSc_triggercell_size_ + 1;
201  for (int ietaAbs = ieta0; ietaAbs < ieta0 + (int)hSc_triggercell_size_; ietaAbs++) {
202  int ieta = ietaAbs * trigger_cell_sc_id.zside();
203  for (int iphi = iphi0; iphi < iphi0 + (int)hSc_triggercell_size_; iphi++) {
204  unsigned cell_id = HGCScintillatorDetId(trigger_cell_sc_id.type(), trigger_cell_sc_id.layer(), ieta, iphi);
205  if (validCellId(DetId::HGCalHSc, cell_id))
206  cell_det_ids.emplace(cell_id);
207  }
208  }
209  }
210  // Silicon
211  else {
212  HGCalTriggerDetId trigger_cell_trig_id(trigger_cell_id);
213  unsigned subdet = trigger_cell_trig_id.subdet();
216  int layer = trigger_cell_trig_id.layer();
217  int zside = trigger_cell_trig_id.zside();
218  int type = trigger_cell_trig_id.type();
219  int waferu = trigger_cell_trig_id.waferU();
220  int waferv = trigger_cell_trig_id.waferV();
221  std::vector<int> cellus = trigger_cell_trig_id.cellU();
222  std::vector<int> cellvs = trigger_cell_trig_id.cellV();
223  for (unsigned ic = 0; ic < cellus.size(); ic++) {
224  HGCSiliconDetId cell_det_id(cell_det, zside, type, layer, waferu, waferv, cellus[ic], cellvs[ic]);
225  cell_det_ids.emplace(cell_det_id.rawId());
226  }
227  }
228  }
229  return cell_det_ids;
230 }
type
Definition: HCALResponse.h:21
bool validCellId(unsigned det, unsigned cell_id) const
int zside(DetId const &)
Definition: DetId.h:18
Detector
Definition: DetId.h:26
std::unordered_set< unsigned > geom_set
unsigned HGCalTriggerGeometryV9Imp2::getModuleFromCell ( const unsigned  cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 144 of file HGCalTriggerGeometryV9Imp2.cc.

References getModuleFromTriggerCell(), and getTriggerCellFromCell().

144  {
146 }
unsigned getTriggerCellFromCell(const unsigned) const final
unsigned getModuleFromTriggerCell(const unsigned) const final
unsigned HGCalTriggerGeometryV9Imp2::getModuleFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 148 of file HGCalTriggerGeometryV9Imp2.cc.

References DetId::det(), Exception, HGCalEETrigger, DetId::HGCalHSc, HGCalHSiTrigger, HGCEE, HGCHEF, hSc_module_size_, HGCScintillatorDetId::ietaAbs(), HGCScintillatorDetId::iphi(), HGCalDetId::kHGCalCellMask, HGCScintillatorDetId::layer(), HGCalTriggerDetId::layer(), packWaferId(), DetId::rawId(), HGCalTriggerDetId::subdet(), HGCScintillatorDetId::type(), wafer_to_module_, HGCalTriggerDetId::waferU(), HGCalTriggerDetId::waferV(), HGCScintillatorDetId::zside(), HGCalTriggerDetId::zside(), and ecaldqm::zside().

Referenced by getModuleFromCell().

148  {
149  unsigned det = DetId(trigger_cell_id).det();
150  unsigned module = 0;
151  unsigned subdet_old = 0;
152  int zside = 0;
153  unsigned tc_type = 1;
154  unsigned layer = 0;
155  unsigned module_id = 0;
156  // Scintillator
157  if (det == DetId::HGCalHSc) {
158  HGCScintillatorDetId trigger_cell_sc_id(trigger_cell_id);
159  tc_type = trigger_cell_sc_id.type();
160  layer = trigger_cell_sc_id.layer();
161  zside = trigger_cell_sc_id.zside();
162  int ieta = ((trigger_cell_sc_id.ietaAbs() - 1) / hSc_module_size_ + 1) * zside;
163  int iphi = (trigger_cell_sc_id.iphi() - 1) / hSc_module_size_ + 1;
164  module_id = HGCScintillatorDetId(tc_type, layer, ieta, iphi);
165  }
166  // Silicon
167  else {
168  HGCalTriggerDetId trigger_cell_trig_id(trigger_cell_id);
169  unsigned subdet = trigger_cell_trig_id.subdet();
170  subdet_old =
172  layer = trigger_cell_trig_id.layer();
173  zside = trigger_cell_trig_id.zside();
175  int waferu = trigger_cell_trig_id.waferU();
176  int waferv = trigger_cell_trig_id.waferV();
177  auto module_itr = wafer_to_module_.find(packWaferId(waferu, waferv));
178  if (module_itr == wafer_to_module_.end()) {
179  throw cms::Exception("BadGeometry")
180  << trigger_cell_trig_id << "HGCalTriggerGeometry: Wafer (" << waferu << "," << waferv
181  << ") is not mapped to any trigger module. The module mapping should be modified. \n";
182  }
183  module = module_itr->second;
184  }
185  module_id =
186  HGCalDetId((ForwardSubdetector)subdet_old, zside, layer, tc_type, module, HGCalDetId::kHGCalCellMask).rawId();
187  }
188  return module_id;
189 }
unsigned packWaferId(int waferU, int waferV) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
std::unordered_map< unsigned, unsigned > wafer_to_module_
int zside(DetId const &)
ForwardSubdetector
static const int kHGCalCellMask
Definition: HGCalDetId.h:13
Definition: DetId.h:18
Definition: vlib.h:208
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
GlobalPoint HGCalTriggerGeometryV9Imp2::getModulePosition ( const unsigned  module_det_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 389 of file HGCalTriggerGeometryV9Imp2.cc.

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

389  {
390  unsigned det = DetId(module_det_id).det();
391  // Position: barycenter of the module.
392  Basic3DVector<float> moduleVector(0., 0., 0.);
393  const auto cell_ids = getCellsFromModule(module_det_id);
394  // Scintillator
395  if (det == DetId::HGCalHSc) {
396  for (const auto& cell : cell_ids) {
397  HGCScintillatorDetId cellDetId(cell);
398  moduleVector += hscGeometry()->getPosition(cellDetId).basicVector();
399  }
400  }
401  // Silicon
402  else {
403  for (const auto& cell : cell_ids) {
404  HGCSiliconDetId cellDetId(cell);
405  moduleVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId)
406  : hsiGeometry()->getPosition(cellDetId))
407  .basicVector();
408  }
409  }
410  return GlobalPoint(moduleVector / cell_ids.size());
411 }
const HGCalGeometry * eeGeometry() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPosition(const DetId &id) const
geom_set getCellsFromModule(const unsigned) const final
const HGCalGeometry * hsiGeometry() const
Definition: DetId.h:18
const HGCalGeometry * hscGeometry() const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getNeighborsFromTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 358 of file HGCalTriggerGeometryV9Imp2.cc.

359  {
360  HGCalDetId trigger_cell_det_id(trigger_cell_id);
361  geom_set neighbor_detids;
362  return neighbor_detids;
363 }
std::unordered_set< unsigned > geom_set
HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp2::getOrderedCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 242 of file HGCalTriggerGeometryV9Imp2.cc.

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

243  {
244  geom_ordered_set cell_det_ids;
245  geom_ordered_set trigger_cells = getOrderedTriggerCellsFromModule(module_id);
246  for (auto trigger_cell_id : trigger_cells) {
247  geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
248  cell_det_ids.insert(cells.begin(), cells.end());
249  }
250  return cell_det_ids;
251 }
geom_set getCellsFromTriggerCell(const unsigned) const final
geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final
std::set< unsigned > geom_ordered_set
std::unordered_set< unsigned > geom_set
HGCalTriggerGeometryBase::geom_ordered_set HGCalTriggerGeometryV9Imp2::getOrderedTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 306 of file HGCalTriggerGeometryV9Imp2.cc.

References DetId::det(), detIdWaferType(), HGCSiliconDetIdToROC::getTriggerId(), DetId::HGCalEE, HGCalEETrigger, HGCSiliconDetId::HGCalFine, DetId::HGCalHSc, DetId::HGCalHSi, HGCalHSiTrigger, HGCEE, hSc_module_size_, HGCScintillatorDetId::ietaAbs(), createfilelist::int, HGCScintillatorDetId::iphi(), HGCalDetId::layer(), HGCScintillatorDetId::layer(), module_to_wafers_, DetId::subdetId(), HGCScintillatorDetId::type(), unpackWaferId(), validTriggerCellFromCells(), HGCalDetId::wafer(), HGCScintillatorDetId::zside(), and HGCalDetId::zside().

Referenced by getOrderedCellsFromModule().

307  {
308  DetId module_det_id(module_id);
309  unsigned det = module_det_id.det();
310  geom_ordered_set trigger_cell_det_ids;
311  // Scintillator
312  if (det == DetId::HGCalHSc) {
313  HGCScintillatorDetId module_sc_id(module_id);
314  int ieta0 = (module_sc_id.ietaAbs() - 1) * hSc_module_size_ + 1;
315  int iphi0 = (module_sc_id.iphi() - 1) * hSc_module_size_ + 1;
316  for (int ietaAbs = ieta0; ietaAbs < ieta0 + (int)hSc_module_size_; ietaAbs++) {
317  int ieta = ietaAbs * module_sc_id.zside();
318  for (int iphi = iphi0; iphi < iphi0 + (int)hSc_module_size_; iphi++) {
319  unsigned trigger_cell_id = HGCScintillatorDetId(module_sc_id.type(), module_sc_id.layer(), ieta, iphi);
320  if (validTriggerCellFromCells(trigger_cell_id))
321  trigger_cell_det_ids.emplace(trigger_cell_id);
322  }
323  }
324  }
325  // EE or FH
326  else {
327  HGCalDetId module_si_id(module_id);
328  unsigned module = module_si_id.wafer();
329  HGCSiliconDetIdToROC tc2roc;
330  auto wafer_itrs = module_to_wafers_.equal_range(module);
331  // loop on the wafers included in the module
332  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
333  int waferu = 0;
334  int waferv = 0;
335  unpackWaferId(wafer_itr->second, waferu, waferv);
336  DetId::Detector det = (module_si_id.subdetId() == ForwardSubdetector::HGCEE ? DetId::HGCalEE : DetId::HGCalHSi);
337  HGCalTriggerSubdetector subdet =
340  unsigned layer = module_si_id.layer();
341  unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv);
342  int nroc = (wafer_type == HGCSiliconDetId::HGCalFine ? 6 : 3);
343  // Loop on ROCs in wafer
344  for (int roc = 1; roc <= nroc; roc++) {
345  // loop on TCs in ROC
346  auto tc_uvs = tc2roc.getTriggerId(roc, wafer_type);
347  for (const auto& tc_uv : tc_uvs) {
348  HGCalTriggerDetId trigger_cell_id(
349  subdet, module_si_id.zside(), wafer_type, layer, waferu, waferv, tc_uv.first, tc_uv.second);
350  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
351  }
352  }
353  }
354  }
355  return trigger_cell_det_ids;
356 }
HGCalTriggerSubdetector
int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const
std::vector< std::pair< int, int > > getTriggerId(int roc, int type) const
void unpackWaferId(unsigned wafer, int &waferU, int &waferV) const
Definition: DetId.h:18
Detector
Definition: DetId.h:26
std::set< unsigned > geom_ordered_set
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
Definition: vlib.h:208
bool validTriggerCellFromCells(const unsigned) const
unsigned HGCalTriggerGeometryV9Imp2::getTriggerCellFromCell ( const unsigned  cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 117 of file HGCalTriggerGeometryV9Imp2.cc.

References DetId::det(), DetId::HGCalEE, HGCalEETrigger, DetId::HGCalHSc, DetId::HGCalHSi, HGCalHSiTrigger, hSc_triggercell_size_, HGCScintillatorDetId::ietaAbs(), HGCScintillatorDetId::iphi(), HGCScintillatorDetId::layer(), HGCSiliconDetId::layer(), HGCSiliconDetId::triggerCellU(), HGCSiliconDetId::triggerCellV(), HGCScintillatorDetId::type(), HGCSiliconDetId::type(), HGCSiliconDetId::waferU(), HGCSiliconDetId::waferV(), HGCScintillatorDetId::zside(), and HGCSiliconDetId::zside().

Referenced by getModuleFromCell().

117  {
118  unsigned det = DetId(cell_id).det();
119  unsigned trigger_cell_id = 0;
120  // Scintillator
121  if (det == DetId::HGCalHSc) {
122  // Very rough mapping from cells to TC
123  HGCScintillatorDetId cell_sc_id(cell_id);
124  int ieta = ((cell_sc_id.ietaAbs() - 1) / hSc_triggercell_size_ + 1) * cell_sc_id.zside();
125  int iphi = (cell_sc_id.iphi() - 1) / hSc_triggercell_size_ + 1;
126  trigger_cell_id = HGCScintillatorDetId(cell_sc_id.type(), cell_sc_id.layer(), ieta, iphi);
127  }
128  // Silicon
129  else if (det == DetId::HGCalEE || det == DetId::HGCalHSi) {
130  HGCSiliconDetId cell_si_id(cell_id);
131  trigger_cell_id = HGCalTriggerDetId(
133  cell_si_id.zside(),
134  cell_si_id.type(),
135  cell_si_id.layer(),
136  cell_si_id.waferU(),
137  cell_si_id.waferV(),
138  cell_si_id.triggerCellU(),
139  cell_si_id.triggerCellV());
140  }
141  return trigger_cell_id;
142 }
Definition: DetId.h:18
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
GlobalPoint HGCalTriggerGeometryV9Imp2::getTriggerCellPosition ( const unsigned  trigger_cell_det_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 365 of file HGCalTriggerGeometryV9Imp2.cc.

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

365  {
366  unsigned det = DetId(trigger_cell_det_id).det();
367  // Position: barycenter of the trigger cell.
368  Basic3DVector<float> triggerCellVector(0., 0., 0.);
369  const auto cell_ids = getCellsFromTriggerCell(trigger_cell_det_id);
370  // Scintillator
371  if (det == DetId::HGCalHSc) {
372  for (const auto& cell : cell_ids) {
373  HGCScintillatorDetId cellDetId(cell);
374  triggerCellVector += hscGeometry()->getPosition(cellDetId).basicVector();
375  }
376  }
377  // Silicon
378  else {
379  for (const auto& cell : cell_ids) {
380  HGCSiliconDetId cellDetId(cell);
381  triggerCellVector += (cellDetId.det() == DetId::HGCalEE ? eeGeometry()->getPosition(cellDetId)
382  : hsiGeometry()->getPosition(cellDetId))
383  .basicVector();
384  }
385  }
386  return GlobalPoint(triggerCellVector / cell_ids.size());
387 }
const HGCalGeometry * eeGeometry() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
GlobalPoint getPosition(const DetId &id) const
geom_set getCellsFromTriggerCell(const unsigned) const final
const HGCalGeometry * hsiGeometry() const
Definition: DetId.h:18
const HGCalGeometry * hscGeometry() const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
HGCalTriggerGeometryBase::geom_set HGCalTriggerGeometryV9Imp2::getTriggerCellsFromModule ( const unsigned  module_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 253 of file HGCalTriggerGeometryV9Imp2.cc.

References DetId::det(), detIdWaferType(), HGCSiliconDetIdToROC::getTriggerId(), DetId::HGCalEE, HGCalEETrigger, HGCSiliconDetId::HGCalFine, DetId::HGCalHSc, DetId::HGCalHSi, HGCalHSiTrigger, HGCEE, hSc_module_size_, HGCScintillatorDetId::ietaAbs(), createfilelist::int, HGCScintillatorDetId::iphi(), HGCalDetId::layer(), HGCScintillatorDetId::layer(), module_to_wafers_, DetId::subdetId(), HGCScintillatorDetId::type(), unpackWaferId(), validTriggerCellFromCells(), HGCalDetId::wafer(), HGCScintillatorDetId::zside(), and HGCalDetId::zside().

Referenced by getCellsFromModule().

254  {
255  DetId module_det_id(module_id);
256  unsigned det = module_det_id.det();
257  geom_set trigger_cell_det_ids;
258  // Scintillator
259  if (det == DetId::HGCalHSc) {
260  HGCScintillatorDetId module_sc_id(module_id);
261  int ieta0 = (module_sc_id.ietaAbs() - 1) * hSc_module_size_ + 1;
262  int iphi0 = (module_sc_id.iphi() - 1) * hSc_module_size_ + 1;
263  for (int ietaAbs = ieta0; ietaAbs < ieta0 + (int)hSc_module_size_; ietaAbs++) {
264  int ieta = ietaAbs * module_sc_id.zside();
265  for (int iphi = iphi0; iphi < iphi0 + (int)hSc_module_size_; iphi++) {
266  unsigned trigger_cell_id = HGCScintillatorDetId(module_sc_id.type(), module_sc_id.layer(), ieta, iphi);
267  if (validTriggerCellFromCells(trigger_cell_id))
268  trigger_cell_det_ids.emplace(trigger_cell_id);
269  }
270  }
271  }
272  // Silicon
273  else {
274  HGCalDetId module_si_id(module_id);
275  unsigned module = module_si_id.wafer();
276  HGCSiliconDetIdToROC tc2roc;
277  auto wafer_itrs = module_to_wafers_.equal_range(module);
278  // loop on the wafers included in the module
279  for (auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
280  int waferu = 0;
281  int waferv = 0;
282  unpackWaferId(wafer_itr->second, waferu, waferv);
283  DetId::Detector det = (module_si_id.subdetId() == ForwardSubdetector::HGCEE ? DetId::HGCalEE : DetId::HGCalHSi);
284  HGCalTriggerSubdetector subdet =
287  unsigned layer = module_si_id.layer();
288  unsigned wafer_type = detIdWaferType(det, layer, waferu, waferv);
289  int nroc = (wafer_type == HGCSiliconDetId::HGCalFine ? 6 : 3);
290  // Loop on ROCs in wafer
291  for (int roc = 1; roc <= nroc; roc++) {
292  // loop on TCs in ROC
293  auto tc_uvs = tc2roc.getTriggerId(roc, wafer_type);
294  for (const auto& tc_uv : tc_uvs) {
295  HGCalTriggerDetId trigger_cell_id(
296  subdet, module_si_id.zside(), wafer_type, layer, waferu, waferv, tc_uv.first, tc_uv.second);
297  if (validTriggerCellFromCells(trigger_cell_id))
298  trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
299  }
300  }
301  }
302  }
303  return trigger_cell_det_ids;
304 }
HGCalTriggerSubdetector
int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const
std::vector< std::pair< int, int > > getTriggerId(int roc, int type) const
void unpackWaferId(unsigned wafer, int &waferU, int &waferV) const
Definition: DetId.h:18
Detector
Definition: DetId.h:26
std::unordered_set< unsigned > geom_set
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
Definition: vlib.h:208
bool validTriggerCellFromCells(const unsigned) const
void HGCalTriggerGeometryV9Imp2::initialize ( const edm::ESHandle< CaloGeometry > &  calo_geometry)
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 89 of file HGCalTriggerGeometryV9Imp2.cc.

References Exception.

89  {
90  throw cms::Exception("BadGeometry")
91  << "HGCalTriggerGeometryV9Imp2 geometry cannot be initialized with the V7/V8 HGCAL geometry";
92 }
void HGCalTriggerGeometryV9Imp2::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 94 of file HGCalTriggerGeometryV9Imp2.cc.

References HGCalTopology::dddConstants(), disconnected_layers_, HGCalTriggerGeometryBase::eeTopology(), fillMaps(), heOffset_, HGCalTriggerGeometryBase::hsiTopology(), HGCalDDDConstants::layers(), HGCalTriggerGeometryBase::setEEGeometry(), HGCalTriggerGeometryBase::setHScGeometry(), HGCalTriggerGeometryBase::setHSiGeometry(), totalLayers_, and trigger_layers_.

96  {
97  setEEGeometry(hgc_ee_geometry);
98  setHSiGeometry(hgc_hsi_geometry);
99  setHScGeometry(hgc_hsc_geometry);
102  trigger_layers_.resize(totalLayers_ + 1);
103  trigger_layers_[0] = 0; // layer number 0 doesn't exist
104  unsigned trigger_layer = 1;
105  for (unsigned layer = 1; layer < trigger_layers_.size(); layer++) {
106  if (disconnected_layers_.find(layer) == disconnected_layers_.end()) {
107  // Increase trigger layer number if the layer is not disconnected
108  trigger_layers_[layer] = trigger_layer;
109  trigger_layer++;
110  } else {
111  trigger_layers_[layer] = 0;
112  }
113  }
114  fillMaps();
115 }
std::vector< unsigned > trigger_layers_
const HGCalTopology & eeTopology() const
const HGCalTopology & hsiTopology() const
void setEEGeometry(const edm::ESHandle< HGCalGeometry > &geom)
unsigned int layers(bool reco) const
const HGCalDDDConstants & dddConstants() const
void setHScGeometry(const edm::ESHandle< HGCalGeometry > &geom)
std::unordered_set< unsigned > disconnected_layers_
void setHSiGeometry(const edm::ESHandle< HGCalGeometry > &geom)
unsigned HGCalTriggerGeometryV9Imp2::layerWithOffset ( unsigned  id) const
private

Definition at line 522 of file HGCalTriggerGeometryV9Imp2.cc.

References DEFINE_EDM_PLUGIN, DetId::det(), DetId::Forward, heOffset_, HGCalEETrigger, DetId::HGCalHSc, HGCalHSiTrigger, DetId::HGCalTrigger, HGCEE, HGCHEB, HGCHEF, HGCalDetId::layer(), HGCScintillatorDetId::layer(), HGCalTriggerDetId::layer(), HGCalTriggerDetId::subdet(), and DetId::subdetId().

Referenced by disconnectedModule(), and triggerLayer().

522  {
523  unsigned det = DetId(id).det();
524  unsigned layer = 0;
525  if (det == DetId::HGCalTrigger) {
526  unsigned subdet = HGCalTriggerDetId(id).subdet();
528  layer = HGCalTriggerDetId(id).layer();
529  } else if (subdet == HGCalTriggerSubdetector::HGCalHSiTrigger) {
530  layer = heOffset_ + HGCalTriggerDetId(id).layer();
531  }
532  } else if (det == DetId::HGCalHSc) {
533  layer = heOffset_ + HGCScintillatorDetId(id).layer();
534  } else if (det == DetId::Forward) {
535  unsigned subdet = HGCalDetId(id).subdetId();
536  if (subdet == ForwardSubdetector::HGCEE) {
537  layer = HGCalDetId(id).layer();
538  } else if (subdet == ForwardSubdetector::HGCHEF || subdet == ForwardSubdetector::HGCHEB) {
539  layer = heOffset_ + HGCalTriggerDetId(id).layer();
540  }
541  }
542  return layer;
543 }
HGCalTriggerSubdetector subdet() const
get the subdetector
int layer() const
get the layer #
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
Definition: DetId.h:18
int layer() const
get the layer #
int layer() const
get the layer #
Definition: HGCalDetId.h:48
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
unsigned HGCalTriggerGeometryV9Imp2::packWaferId ( int  waferU,
int  waferV 
) const
private

Definition at line 434 of file HGCalTriggerGeometryV9Imp2.cc.

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

Referenced by fillMaps(), and getModuleFromTriggerCell().

434  {
435  unsigned packed_value = 0;
436  unsigned waferUsign = (waferU >= 0) ? 0 : 1;
437  unsigned waferVsign = (waferV >= 0) ? 0 : 1;
442  return packed_value;
443 }
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 HGCalTriggerGeometryV9Imp2::reset ( void  )
finalvirtual

Reimplemented from HGCalTriggerGeometryBase.

Definition at line 84 of file HGCalTriggerGeometryV9Imp2.cc.

References module_to_wafers_, and wafer_to_module_.

84  {
85  wafer_to_module_.clear();
86  module_to_wafers_.clear();
87 }
std::unordered_map< unsigned, unsigned > wafer_to_module_
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
unsigned HGCalTriggerGeometryV9Imp2::triggerLayer ( const unsigned  id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 465 of file HGCalTriggerGeometryV9Imp2.cc.

References layerWithOffset(), and trigger_layers_.

465  {
466  unsigned layer = layerWithOffset(id);
467  if (layer >= trigger_layers_.size())
468  return 0;
469  return trigger_layers_[layer];
470 }
std::vector< unsigned > trigger_layers_
unsigned layerWithOffset(unsigned) const
void HGCalTriggerGeometryV9Imp2::unpackWaferId ( unsigned  wafer,
int &  waferU,
int &  waferV 
) const
private

Definition at line 445 of file HGCalTriggerGeometryV9Imp2.cc.

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

Referenced by getOrderedTriggerCellsFromModule(), and getTriggerCellsFromModule().

445  {
449  : waferUAbs);
451  : waferVAbs);
452 }
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 HGCalTriggerGeometryV9Imp2::validCellId ( unsigned  det,
unsigned  cell_id 
) const
private

Definition at line 488 of file HGCalTriggerGeometryV9Imp2.cc.

References HGCalTriggerGeometryBase::eeTopology(), DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, HGCalTriggerGeometryBase::hscTopology(), HGCalTriggerGeometryBase::hsiTopology(), matching::is_valid(), and HGCalTopology::valid().

Referenced by getCellsFromTriggerCell(), and validTriggerCellFromCells().

488  {
489  bool is_valid = false;
490  switch (subdet) {
491  case DetId::HGCalEE:
492  is_valid = eeTopology().valid(cell_id);
493  break;
494  case DetId::HGCalHSi:
495  is_valid = hsiTopology().valid(cell_id);
496  break;
497  case DetId::HGCalHSc:
498  is_valid = hscTopology().valid(cell_id);
499  break;
500  default:
501  is_valid = false;
502  break;
503  }
504  return is_valid;
505 }
bool is_valid(const Digi &d)
Definition: GenericDigi.h:64
const HGCalTopology & eeTopology() const
const HGCalTopology & hsiTopology() const
const HGCalTopology & hscTopology() const
bool valid(const DetId &id) const override
Is this a valid cell id.
bool HGCalTriggerGeometryV9Imp2::validTriggerCell ( const unsigned  trigger_cell_id) const
finalvirtual

Implements HGCalTriggerGeometryBase.

Definition at line 454 of file HGCalTriggerGeometryV9Imp2.cc.

References validTriggerCellFromCells().

454  {
455  return validTriggerCellFromCells(trigger_cell_id);
456 }
bool validTriggerCellFromCells(const unsigned) const
bool HGCalTriggerGeometryV9Imp2::validTriggerCellFromCells ( const unsigned  trigger_cell_id) const
private

Definition at line 472 of file HGCalTriggerGeometryV9Imp2.cc.

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

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

472  {
473  // Check the validity of a trigger cell with the
474  // validity of the cells. One valid cell in the
475  // trigger cell is enough to make the trigger cell
476  // valid.
477  const geom_set cells = getCellsFromTriggerCell(trigger_cell_id);
478  bool is_valid = false;
479  for (const auto cell_id : cells) {
480  unsigned det = DetId(cell_id).det();
481  is_valid |= validCellId(det, cell_id);
482  if (is_valid)
483  break;
484  }
485  return is_valid;
486 }
bool validCellId(unsigned det, unsigned cell_id) const
bool is_valid(const Digi &d)
Definition: GenericDigi.h:64
geom_set getCellsFromTriggerCell(const unsigned) const final
Definition: DetId.h:18
std::unordered_set< unsigned > geom_set
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39

Member Data Documentation

std::unordered_set<unsigned> HGCalTriggerGeometryV9Imp2::disconnected_layers_
private

Definition at line 58 of file HGCalTriggerGeometryV9Imp2.cc.

Referenced by disconnectedModule(), and initialize().

unsigned HGCalTriggerGeometryV9Imp2::heOffset_
private

Definition at line 62 of file HGCalTriggerGeometryV9Imp2.cc.

Referenced by initialize(), and layerWithOffset().

unsigned HGCalTriggerGeometryV9Imp2::hSc_module_size_ = 12
private
unsigned HGCalTriggerGeometryV9Imp2::hSc_triggercell_size_ = 2
private
edm::FileInPath HGCalTriggerGeometryV9Imp2::l1tModulesMapping_
private

Definition at line 51 of file HGCalTriggerGeometryV9Imp2.cc.

Referenced by fillMaps().

std::unordered_multimap<unsigned, unsigned> HGCalTriggerGeometryV9Imp2::module_to_wafers_
private
unsigned HGCalTriggerGeometryV9Imp2::totalLayers_
private

Definition at line 63 of file HGCalTriggerGeometryV9Imp2.cc.

Referenced by initialize().

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

Definition at line 59 of file HGCalTriggerGeometryV9Imp2.cc.

Referenced by initialize(), and triggerLayer().

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

Definition at line 54 of file HGCalTriggerGeometryV9Imp2.cc.

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