66 bool validCellId(
unsigned det,
unsigned cell_id)
const;
69 int detIdWaferType(
unsigned det,
unsigned layer,
short waferU,
short waferV)
const;
71 void unpackWaferId(
unsigned wafer,
int& waferU,
int& waferV)
const;
82 conf.getParameter<
std::vector<unsigned>>(
"DisconnectedLayers").
end()) {}
91 <<
"HGCalTriggerGeometryV9Imp2 geometry cannot be initialized with the V7/V8 HGCAL geometry";
104 unsigned trigger_layer = 1;
118 unsigned det =
DetId(cell_id).
det();
119 unsigned trigger_cell_id = 0;
141 return trigger_cell_id;
149 unsigned det =
DetId(trigger_cell_id).
det();
151 unsigned subdet_old = 0;
153 unsigned tc_type = 1;
155 unsigned module_id = 0;
159 tc_type = trigger_cell_sc_id.
type();
160 layer = trigger_cell_sc_id.
layer();
161 zside = trigger_cell_sc_id.
zside();
169 unsigned subdet = trigger_cell_trig_id.
subdet();
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();
180 << trigger_cell_trig_id <<
"HGCalTriggerGeometry: Wafer (" << waferu <<
"," << waferv
181 <<
") is not mapped to any trigger module. The module mapping should be modified. \n";
183 module = module_itr->second;
192 const unsigned trigger_cell_id)
const {
193 DetId trigger_cell_det_id(trigger_cell_id);
194 unsigned det = trigger_cell_det_id.
det();
202 int ieta = ietaAbs * trigger_cell_sc_id.
zside();
206 cell_det_ids.emplace(cell_id);
213 unsigned subdet = trigger_cell_trig_id.
subdet();
216 int layer = trigger_cell_trig_id.
layer();
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());
235 for (
auto trigger_cell_id : trigger_cells) {
237 cell_det_ids.insert(cells.begin(), cells.end());
243 const unsigned module_id)
const {
246 for (
auto trigger_cell_id : trigger_cells) {
248 cell_det_ids.insert(cells.begin(), cells.end());
254 const unsigned module_id)
const {
255 DetId module_det_id(module_id);
256 unsigned det = module_det_id.
det();
264 int ieta = ietaAbs * module_sc_id.
zside();
268 trigger_cell_det_ids.emplace(trigger_cell_id);
279 for (
auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
287 unsigned layer = module_si_id.
layer();
291 for (
int roc = 1; roc <= nroc; roc++) {
294 for (
const auto& tc_uv : tc_uvs) {
296 subdet, module_si_id.
zside(), wafer_type, layer, waferu, waferv, tc_uv.first, tc_uv.second);
298 trigger_cell_det_ids.emplace(trigger_cell_id.rawId());
303 return trigger_cell_det_ids;
307 const unsigned module_id)
const {
308 DetId module_det_id(module_id);
309 unsigned det = module_det_id.
det();
317 int ieta = ietaAbs * module_sc_id.
zside();
321 trigger_cell_det_ids.emplace(trigger_cell_id);
332 for (
auto wafer_itr = wafer_itrs.first; wafer_itr != wafer_itrs.second; wafer_itr++) {
340 unsigned layer = module_si_id.
layer();
344 for (
int roc = 1; roc <= nroc; roc++) {
347 for (
const auto& tc_uv : tc_uvs) {
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());
355 return trigger_cell_det_ids;
359 const unsigned trigger_cell_id)
const {
360 HGCalDetId trigger_cell_det_id(trigger_cell_id);
362 return neighbor_detids;
366 unsigned det =
DetId(trigger_cell_det_id).
det();
372 for (
const auto& cell : cell_ids) {
379 for (
const auto& cell : cell_ids) {
386 return GlobalPoint(triggerCellVector / cell_ids.size());
390 unsigned det =
DetId(module_det_id).
det();
396 for (
const auto& cell : cell_ids) {
403 for (
const auto& cell : cell_ids) {
410 return GlobalPoint(moduleVector / cell_ids.size());
416 if (!l1tModulesMappingStream.is_open()) {
417 throw cms::Exception(
"MissingDataFile") <<
"Cannot open HGCalTriggerGeometry L1TModulesMapping file\n";
422 for (; l1tModulesMappingStream >> waferu >> waferv >> module;) {
427 if (!l1tModulesMappingStream.eof()) {
429 <<
"Error reading L1TModulesMapping '" << waferu <<
" " << waferv <<
" " << module <<
"' \n";
431 l1tModulesMappingStream.close();
435 unsigned packed_value = 0;
436 unsigned waferUsign = (waferU >= 0) ? 0 : 1;
437 unsigned waferVsign = (waferV >= 0) ? 0 : 1;
459 bool disconnected =
false;
479 for (
const auto cell_id : cells) {
480 unsigned det =
DetId(cell_id).
det();
unsigned getModuleFromCell(const unsigned) const final
static const int kHGCalWaferVOffset
bool validCellId(unsigned det, unsigned cell_id) const
geom_set getNeighborsFromTriggerCell(const unsigned) const final
unsigned packWaferId(int waferU, int waferV) const
HGCalTriggerSubdetector subdet() const
get the subdetector
int detIdWaferType(unsigned det, unsigned layer, short waferU, short waferV) const
unsigned triggerLayer(const unsigned) const final
bool is_valid(const Digi &d)
GlobalPoint getTriggerCellPosition(const unsigned) const final
std::vector< unsigned > trigger_layers_
const HGCalGeometry * eeGeometry() const
const HGCalTopology & eeTopology() const
static const int kHGCalWaferVSignOffset
unsigned hSc_triggercell_size_
Global3DPoint GlobalPoint
constexpr uint32_t rawId() const
get the raw id
int getTypeHex(int layer, int waferU, int waferV) const
int type() const
get the type
GlobalPoint getPosition(const DetId &id) const
int zside() const
get the z-side of the cell (1/-1)
std::unordered_map< unsigned, unsigned > wafer_to_module_
int zside() const
get the z-side of the cell (1/-1)
const HGCalTopology & hsiTopology() const
void setEEGeometry(const edm::ESHandle< HGCalGeometry > &geom)
int type() const
get the type
unsigned getTriggerCellFromCell(const unsigned) const final
std::vector< std::pair< int, int > > getTriggerId(int roc, int type) const
int layer() const
get the layer #
static const int kHGCalCellMask
unsigned int layers(bool reco) const
int zside() const
get the z-side of the cell (1/-1)
int type() const
get the type
geom_set getCellsFromModule(const unsigned) const final
int layer() const
get the layer #
void unpackWaferId(unsigned wafer, int &waferU, int &waferV) const
geom_set getCellsFromTriggerCell(const unsigned) const final
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
HGCalTriggerGeometryV9Imp2(const edm::ParameterSet &conf)
std::vector< int > cellV() const
geom_set getTriggerCellsFromModule(const unsigned) const final
int iphi() const
get the phi index
int wafer() const
get the wafer #
geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned) const final
unsigned getModuleFromTriggerCell(const unsigned) const final
bool disconnectedModule(const unsigned) const final
const HGCalGeometry * hsiGeometry() const
GlobalPoint getModulePosition(const unsigned) const final
static const int kHGCalWaferVMask
static const int kHGCalWaferUSignMask
static const int kHGCalWaferUMask
const HGCalDDDConstants & dddConstants() const
const HGCalGeometry * hscGeometry() const
const HGCalTopology & hscTopology() const
static const int kHGCalWaferVSignMask
geom_ordered_set getOrderedCellsFromModule(const unsigned) const final
std::set< unsigned > geom_ordered_set
void setHScGeometry(const edm::ESHandle< HGCalGeometry > &geom)
int layer() const
get the layer #
std::unordered_set< unsigned > disconnected_layers_
bool validTriggerCell(const unsigned) const final
std::vector< int > cellU() const
int zside() const
get the z-side of the cell (1/-1)
std::unordered_set< unsigned > geom_set
std::unordered_multimap< unsigned, unsigned > module_to_wafers_
edm::FileInPath l1tModulesMapping_
std::string fullPath() const
unsigned layerWithOffset(unsigned) const
#define DEFINE_EDM_PLUGIN(factory, type, name)
static const int kHGCalWaferUOffset
bool valid(const DetId &id) const override
Is this a valid cell id.
const BasicVectorType & basicVector() const
static const int kHGCalWaferUSignOffset
void setHSiGeometry(const edm::ESHandle< HGCalGeometry > &geom)
bool validTriggerCellFromCells(const unsigned) const
int layer() const
get the layer #
unsigned hSc_module_size_
constexpr Detector det() const
get the detector field from this detid
void initialize(const edm::ESHandle< CaloGeometry > &) final