Skip to content

Commit

Permalink
Merge pull request cms-sw#271 from PFCal-dev/fix-thickness-backport-1040
Browse files Browse the repository at this point in the history
[Backport 10_4_0] Fix thicknessIndex for trigger cells
  • Loading branch information
jbsauvan committed Feb 14, 2019
2 parents cf7a6b6 + 9b08f06 commit 9ab957f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 14 deletions.
7 changes: 6 additions & 1 deletion L1Trigger/L1THGCal/interface/HGCalTriggerTools.h
Expand Up @@ -46,7 +46,10 @@ class HGCalTriggerTools {
unsigned layer(const DetId&) const;
unsigned layerWithOffset(const DetId&) const;
int zside(const DetId&) const;
int thicknessIndex(const DetId&) const;
// tc argument is needed because of the impossibility
// to know whether the ID is a TC or a sensor cell
// in the v8 geometry detid scheme
int thicknessIndex(const DetId&, bool tc=false) const;

unsigned lastLayerEE() const {return eeLayers_;}
unsigned lastLayerFH() const {return eeLayers_+fhLayers_;}
Expand Down Expand Up @@ -84,6 +87,8 @@ class HGCalTriggerTools {
unsigned fhLayers_;
unsigned bhLayers_;
unsigned totalLayers_;

int sensorCellThicknessV8(const DetId& id) const;
};


Expand Down
46 changes: 34 additions & 12 deletions L1Trigger/L1THGCal/src/HGCalTriggerTools.cc
Expand Up @@ -167,23 +167,26 @@ zside(const DetId& id) const {

int
HGCalTriggerTools::
thicknessIndex(const DetId& id) const {
thicknessIndex(const DetId& id, bool tc) const {
unsigned det = id.det();
int thickness = 0;
// For the v8 geometry
if(det==DetId::Forward)
{
switch(id.subdetId())
{
case ForwardSubdetector::HGCEE:
thickness = geom_->eeTopology().dddConstants().waferTypeL(HGCalDetId(id).wafer())-1;
break;
case ForwardSubdetector::HGCHEF:
thickness = geom_->fhTopology().dddConstants().waferTypeL(HGCalDetId(id).wafer())-1;
break;
default:
break;
};
if(!tc) thickness = sensorCellThicknessV8(id);
else
{
// For the old geometry, TCs can contain sensor cells
// with different thicknesses.
// Use a majority logic to find the TC thickness
std::array<unsigned, 3> occurences = { {0,0,0} };
for(const auto& c_id : geom_->getCellsFromTriggerCell(id))
{
int c_thickness = sensorCellThicknessV8(c_id);
occurences[c_thickness]++;
}
thickness = std::max_element(occurences.begin(),occurences.end()) - occurences.begin();
}
}
// For the v9 geometry
else if(det==DetId::HGCalEE || det==DetId::HGCalHSi)
Expand Down Expand Up @@ -303,3 +306,22 @@ simToReco(const DetId& simid, const HcalTopology& topo) const
if (id.subdet()==int(HcalEndcap)) recoid = id;
return recoid;
}


int
HGCalTriggerTools::
sensorCellThicknessV8(const DetId& id) const {
int thickness = 0;
switch(id.subdetId())
{
case ForwardSubdetector::HGCEE:
thickness = geom_->eeTopology().dddConstants().waferTypeL(HGCalDetId(id).wafer())-1;
break;
case ForwardSubdetector::HGCHEF:
thickness = geom_->fhTopology().dddConstants().waferTypeL(HGCalDetId(id).wafer())-1;
break;
default:
break;
};
return thickness;
}
4 changes: 3 additions & 1 deletion L1Trigger/L1THGCal/test/testHGCalL1T_RelVal_cfg.py
Expand Up @@ -2,7 +2,9 @@
from Configuration.StandardSequences.Eras import eras
from Configuration.ProcessModifiers.convertHGCalDigisSim_cff import convertHGCalDigisSim

process = cms.Process('DIGI',eras.Phase2,convertHGCalDigisSim)
# For old samples use the digi converter
#process = cms.Process('DIGI',eras.Phase2,convertHGCalDigisSim)
process = cms.Process('DIGI',eras.Phase2)

# import of standard configurations
process.load('Configuration.StandardSequences.Services_cff')
Expand Down

0 comments on commit 9ab957f

Please sign in to comment.