Skip to content

Commit

Permalink
Merge pull request cms-sw#145 from jbsauvan/disconnected-layer-940pre2
Browse files Browse the repository at this point in the history
Disconnected layers
  • Loading branch information
jbsauvan authored Oct 11, 2017
2 parents beebddb + fc9e25e commit ed87015
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ class HGCalTriggerGeometryHexLayerBasedImp1 : public HGCalTriggerGeometryBase
std::unordered_map<int, std::set<std::pair<short,short>>> trigger_cell_neighbors_;
std::unordered_map<int, std::set<std::pair<short,short>>> trigger_cell_neighbors_bh_;

// Disconnected modules
// Disconnected modules and layers
std::unordered_set<unsigned> disconnected_modules_;
std::unordered_set<unsigned> disconnected_layers_;

// layer offsets
unsigned fhOffset_;
unsigned bhOffset_;

void fillMaps();
void fillNeighborMaps(const edm::FileInPath&, std::unordered_map<int, std::set<std::pair<short,short>>>&);
Expand All @@ -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;
};


Expand All @@ -95,6 +102,8 @@ HGCalTriggerGeometryHexLayerBasedImp1(const edm::ParameterSet& conf):
{
std::vector<unsigned> tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedModules");
std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_modules_, disconnected_modules_.end()));
tmp_vector = conf.getParameter<std::vector<unsigned>>("DisconnectedLayers");
std::move(tmp_vector.begin(), tmp_vector.end(), std::inserter(disconnected_layers_, disconnected_layers_.end()));
}

void
Expand All @@ -118,6 +127,8 @@ HGCalTriggerGeometryHexLayerBasedImp1::
initialize(const edm::ESHandle<CaloGeometry>& 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_);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
20 changes: 19 additions & 1 deletion L1Trigger/L1THGCal/python/hgcalTriggerGeometryESProducer_cfi.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
import FWCore.ParameterSet.Config as cms

disconnectedTriggerLayers = [
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"),
L1TModulesMapping = cms.FileInPath("L1Trigger/L1THGCal/data/panel_mapping_60deg_6mod_0.txt"),
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([])
)

hgcalTriggerGeometryESProducer = cms.ESProducer(
Expand Down

0 comments on commit ed87015

Please sign in to comment.