From fa90bc9698bd4134f9e5304b533b55f8a7cd906b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Sauvan Date: Tue, 29 Aug 2017 11:46:14 +0200 Subject: [PATCH 1/2] Add possibility to disconnect layers for the trigger --- .../HGCalTriggerGeometryHexLayerBasedImp1.cc | 40 ++++++++++++++++++- .../hgcalTriggerGeometryESProducer_cfi.py | 20 +++++++++- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryHexLayerBasedImp1.cc b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryHexLayerBasedImp1.cc index f0e2fe0212095..da3529d1cc5b5 100644 --- a/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryHexLayerBasedImp1.cc +++ b/L1Trigger/L1THGCal/plugins/geometries/HGCalTriggerGeometryHexLayerBasedImp1.cc @@ -65,8 +65,13 @@ class HGCalTriggerGeometryHexLayerBasedImp1 : public HGCalTriggerGeometryBase std::unordered_map>> trigger_cell_neighbors_; std::unordered_map>> trigger_cell_neighbors_bh_; - // Disconnected modules + // Disconnected modules and layers std::unordered_set disconnected_modules_; + std::unordered_set disconnected_layers_; + + // layer offsets + unsigned fhOffset_; + unsigned bhOffset_; void fillMaps(); void fillNeighborMaps(const edm::FileInPath&, std::unordered_map>>&); @@ -81,6 +86,8 @@ class HGCalTriggerGeometryHexLayerBasedImp1 : public HGCalTriggerGeometryBase unsigned packIetaIphi(unsigned ieta, unsigned iphi) const; void unpackWaferCellId(unsigned wafer_cell, unsigned& wafer, unsigned& cell) const; void unpackIetaIphi(unsigned ieta_iphi, unsigned& ieta, unsigned& iphi) const; + + unsigned layerWithOffset(unsigned) const; }; @@ -95,6 +102,8 @@ HGCalTriggerGeometryHexLayerBasedImp1(const edm::ParameterSet& conf): { std::vector tmp_vector = conf.getParameter>("DisconnectedModules"); std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_modules_, disconnected_modules_.end())); + tmp_vector = conf.getParameter>("DisconnectedLayers"); + std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end())); } void @@ -118,6 +127,8 @@ HGCalTriggerGeometryHexLayerBasedImp1:: initialize(const edm::ESHandle& calo_geometry) { setCaloGeometry(calo_geometry); + fhOffset_ = eeTopology().dddConstants().layers(true); + bhOffset_ = fhOffset_ + fhTopology().dddConstants().layers(true); fillMaps(); fillNeighborMaps(l1tCellNeighborsMapping_, trigger_cell_neighbors_); fillNeighborMaps(l1tCellNeighborsBHMapping_, trigger_cell_neighbors_bh_); @@ -681,7 +692,10 @@ bool HGCalTriggerGeometryHexLayerBasedImp1:: disconnectedModule(const unsigned module_id) const { - return disconnected_modules_.find(HGCalDetId(module_id).wafer())!=disconnected_modules_.end(); + bool disconnected = false; + if(disconnected_modules_.find(HGCalDetId(module_id).wafer())!=disconnected_modules_.end()) disconnected = true; + if(disconnected_layers_.find(layerWithOffset(module_id))!=disconnected_layers_.end()) disconnected = true; + return disconnected; } bool @@ -761,6 +775,28 @@ detIdWaferType(unsigned subdet, short wafer) const } +unsigned +HGCalTriggerGeometryHexLayerBasedImp1:: +layerWithOffset(unsigned id) const +{ + HGCalDetId detid(id); + unsigned layer = 0; + switch(detid.subdetId()) + { + case ForwardSubdetector::HGCEE: + layer = detid.layer(); + break; + case ForwardSubdetector::HGCHEF: + layer = fhOffset_ + detid.layer(); + break; + case ForwardSubdetector::HGCHEB: + layer = bhOffset_ + detid.layer(); + break; + }; + return layer; +} + + DEFINE_EDM_PLUGIN(HGCalTriggerGeometryFactory, HGCalTriggerGeometryHexLayerBasedImp1, diff --git a/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py b/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py index 57f112097ff0b..ffce42d4f6628 100644 --- a/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py +++ b/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py @@ -1,5 +1,22 @@ import FWCore.ParameterSet.Config as cms +disconnectedLayers = [ + 1, + 3, + 5, + 7, + 9, + 11, + 13, + 15, + 17, + 19, + 21, + 23, + 25, + 27 + ] + geometry = cms.PSet( TriggerGeometryName = cms.string('HGCalTriggerGeometryHexLayerBasedImp1'), L1TCellsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_8inch_aligned_192_432_V8_0.txt"), @@ -7,7 +24,8 @@ L1TCellNeighborsMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_8inch_aligned_192_432_0.txt"), L1TCellsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_BH_3x3_30deg_0.txt"), L1TCellNeighborsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_BH_3x3_30deg_0.txt"), - DisconnectedModules = cms.vuint32(0) + DisconnectedModules = cms.vuint32(0), + DisconnectedLayers = cms.vuint32(disconnectedLayers) ) hgcalTriggerGeometryESProducer = cms.ESProducer( From fc9e25edbab2aa3d4ea9f2e9625ef8e99c5a28af Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Sauvan Date: Wed, 11 Oct 2017 17:29:34 +0200 Subject: [PATCH 2/2] Remove default disconnected layers --- .../L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py b/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py index ffce42d4f6628..da6eb2ed5dfa3 100644 --- a/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py +++ b/L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -disconnectedLayers = [ +disconnectedTriggerLayers = [ 1, 3, 5, @@ -25,7 +25,7 @@ L1TCellsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_mapping_BH_3x3_30deg_0.txt"), L1TCellNeighborsBHMapping = cms.FileInPath("L1Trigger/L1THGCal/data/triggercell_neighbor_mapping_BH_3x3_30deg_0.txt"), DisconnectedModules = cms.vuint32(0), - DisconnectedLayers = cms.vuint32(disconnectedLayers) + DisconnectedLayers = cms.vuint32([]) ) hgcalTriggerGeometryESProducer = cms.ESProducer(