Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HGCAL trigger] Module splitting and updated seeding normalization #42246

Merged
merged 8 commits into from
Sep 14, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class HGCalTriggerModuleDetId : public DetId {
static const int kHGCalLayerMask = 0x1F;
static const int kHGCalTypeOffset = 19;
static const int kHGCalTypeMask = 0x3;
static const int kHGCalZsideOffset = 24;
static const int kHGCalZsideOffset = 21;
static const int kHGCalZsideMask = 0x1;
static const int kHGCalTriggerSubdetOffset = 22;
static const int kHGCalTriggerSubdetMask = 0x3;
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/ForwardDetId/src/HGCalTriggerBackendDetId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ HGCalTriggerBackendDetId::HGCalTriggerBackendDetId(uint32_t rawid) : DetId(rawid

HGCalTriggerBackendDetId::HGCalTriggerBackendDetId(int zp, int type, int sector, int label)
: DetId(Forward, HGCTrigger) {
int classid = HGCalTriggerClassIdentifier::ModuleDetId;
int classid = HGCalTriggerClassIdentifier::BackendDetId;
int zside = (zp < 0) ? 1 : 0;
id_ |= (((label & kHGCalLabelMask) << kHGCalLabelOffset) | ((sector & kHGCalSectorMask) << kHGCalSectorOffset) |
((zside & kHGCalZsideMask) << kHGCalZsideOffset) | ((type & kHGCalTypeMask) << kHGCalTypeOffset) |
Expand Down
5 changes: 3 additions & 2 deletions DataFormats/L1THGCal/interface/HGCalTowerID.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@ namespace l1t {

unsigned short rawId() const { return rawId_; }

private:
uint32_t rawId_;
static const int subDetMask = 0x1; // two for now 0 is HGC and 1 is HFNose
static const int subDetShift = 16;
static const int zsideMask = 0x1;
static const int zsideShift = 15;
static const int coordMask = 0x007F;
static const int coord1Shift = 7;
static const int coord2Shift = 0;

private:
uint32_t rawId_;
};

struct HGCalTowerCoord {
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/L1THGCal/interface/HGCalTowerMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace l1t {

const HGCalTowerMap& operator+=(const HGCalTowerMap& map);

bool addEt(short bin_id, float etEm, float etHad);
bool addEt(const std::unordered_map<unsigned short, float>& towerIDandShares, float etEm, float etHad);

unsigned nTowers() const { return towerMap_.size(); }
const std::unordered_map<unsigned short, l1t::HGCalTower>& towers() const { return towerMap_; }
Expand Down
15 changes: 8 additions & 7 deletions DataFormats/L1THGCal/src/HGCalTowerMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ const HGCalTowerMap& HGCalTowerMap::operator+=(const HGCalTowerMap& map) {
return *this;
}

bool HGCalTowerMap::addEt(short bin_id, float etEm, float etHad) {
auto this_tower = towerMap_.find(bin_id);
if (this_tower == towerMap_.end())
return false;
this_tower->second.addEtEm(etEm);
this_tower->second.addEtHad(etHad);

bool HGCalTowerMap::addEt(const std::unordered_map<unsigned short, float>& towerIDandShares, float etEm, float etHad) {
for (const auto& towerIDandShare : towerIDandShares) {
auto this_tower = towerMap_.find(towerIDandShare.first);
if (this_tower == towerMap_.end())
return false;
this_tower->second.addEtEm(etEm * towerIDandShare.second);
this_tower->second.addEtHad(etHad * towerIDandShare.second);
}
return true;
}
24 changes: 22 additions & 2 deletions L1Trigger/L1THGCal/interface/HGCalTriggerTowerGeometryHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"
#include "DataFormats/ForwardDetId/interface/HGCalTriggerModuleDetId.h"

#include <vector>
#include <unordered_map>
Expand All @@ -32,17 +33,29 @@ class HGCalTriggerTowerGeometryHelper {

void setGeometry(const HGCalTriggerGeometryBase* const geom) { triggerTools_.setGeometry(geom); }

unsigned packLayerSubdetWaferId(int subdet, int layer, int moduleU, int moduleV) const;
unsigned packTowerIDandShare(int towerEta, int towerPhi, int towerShare) const;
void unpackTowerIDandShare(unsigned towerIDandShare, int& towerEta_raw, int& towerPhi_raw, int& towerShare) const;
int moveToCorrectSector(int towerPhi_raw, int sector) const;
void reverseXaxis(int& towerPhi) const;

const std::vector<l1t::HGCalTowerCoord>& getTowerCoordinates() const;

unsigned short getTriggerTowerFromEtaPhi(const float& eta, const float& phi) const;
unsigned short getTriggerTower(const l1t::HGCalTriggerCell&) const;
unsigned short getTriggerTower(const l1t::HGCalTriggerSums&) const;
std::unordered_map<unsigned short, float> getTriggerTower(const l1t::HGCalTriggerCell&) const;
std::unordered_map<unsigned short, float> getTriggerTower(const l1t::HGCalTriggerSums&) const;

const bool isNose() { return doNose_; }

private:
static const int towerShareMask = 0x7F;
static const int towerShareShift = 14;
static const int signMask = 0x1;
static const int sign1Shift = 21;
static const int sign2Shift = 22;
std::vector<l1t::HGCalTowerCoord> tower_coords_;
std::unordered_map<unsigned, short> cells_to_trigger_towers_;
std::unordered_map<unsigned, std::vector<unsigned>> modules_to_trigger_towers_;

bool doNose_;
double minEta_;
Expand All @@ -55,6 +68,13 @@ class HGCalTriggerTowerGeometryHelper {
std::vector<double> binsEta_;
std::vector<double> binsPhi_;

bool splitModuleSum_;
int splitDivisorSilic_;
int splitDivisorScint_;
int rotate180Deg_;
int rotate120Deg_;
int reverseX_;

HGCalTriggerTools triggerTools_;
};

Expand Down
3 changes: 3 additions & 0 deletions L1Trigger/L1THGCal/interface/backend/HGCalHistoSeedingImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ class HGCalHistoSeedingImpl {
std::vector<double> neighbour_weights_;
std::vector<double> smoothing_ecal_;
std::vector<double> smoothing_hcal_;
bool seeds_norm_by_area_;

float area_10pct_;

HGCalTriggerTools triggerTools_;
Navigator navigator_;
Expand Down
14 changes: 14 additions & 0 deletions L1Trigger/L1THGCal/python/customHistoSeeding.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,17 @@ def custom_3dclustering_XYHistoMax(process,
process.l1tHGCalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters = parameters_c3d
return process


def custom_3dclustering_seedArea(process,
seed_threshold=cms.double(8.5)):
parameters_c3d = histoMax_C3d_seeding_params.clone(seeds_norm_by_area = True,
threshold_histo_multicluster = seed_threshold)
process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters = parameters_c3d
return process

def custom_3dclustering_seedNoArea(process,
seed_threshold=cms.double(20)):
parameters_c3d = histoMax_C3d_seeding_params.clone(seeds_norm_by_area = False,
threshold_histo_multicluster = seed_threshold)
process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters = parameters_c3d
return process
5 changes: 5 additions & 0 deletions L1Trigger/L1THGCal/python/customTowers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import FWCore.ParameterSet.Config as cms
from L1Trigger.L1THGCal.hgcalTowerMapProducer_cfi import L1TTriggerTowerConfig_energySplit
import math

def custom_towers_unclustered_tc(process):
Expand Down Expand Up @@ -35,6 +36,10 @@ def custom_towers_etaphi(process,
parameters_towers_2d.L1TTriggerTowerConfig.binsPhi = cms.vdouble(binsPhi)
return process

def custom_towers_energySplit(process):
parameters_towers_2d = L1TTriggerTowerConfig_energySplit.clone()
process.hgcalTowerMapProducer.ProcessorParameters.towermap_parameters.L1TTriggerTowerConfig = parameters_towers_2d
return process

def custom_towers_map(process,
towermapping='L1Trigger/L1THGCal/data/tower_mapping_hgcroc_eta-phi_v3.txt',
Expand Down
11 changes: 2 additions & 9 deletions L1Trigger/L1THGCal/python/l1tHGCalBackEndLayer2Producer_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@
binSumsHisto=binSums,
kROverZMin=cms.double(0.076),
kROverZMax=cms.double(0.58),
threshold_histo_multicluster=cms.double(10.),
threshold_histo_multicluster=cms.double(20.),
neighbour_weights=neighbour_weights_1stOrder,
seed_position=cms.string("TCWeighted"),#BinCentre, TCWeighted
seeding_space=cms.string("RPhi"),# RPhi, XY
seed_smoothing_ecal=seed_smoothing_ecal,
seed_smoothing_hcal=seed_smoothing_hcal,
seeds_norm_by_area=cms.bool(False)
)

histoMax_C3d_clustering_params = cms.PSet(dR_multicluster=cms.double(0.03),
Expand All @@ -102,14 +103,6 @@
maxTCs=cms.uint32(80),
)

# >= V9 samples have a different definition of the dEdx calibrations. To account for it
# we rescale the thresholds of the clustering seeds
# (see https://indico.cern.ch/event/806845/contributions/3359859/attachments/1815187/2966402/19-03-20_EGPerf_HGCBE.pdf
# for more details)
phase2_hgcalV10.toModify(histoMax_C3d_seeding_params,
threshold_histo_multicluster=8.5, # MipT
)


histoMaxVariableDR_C3d_params = histoMax_C3d_clustering_params.clone(
AlgoName = cms.string('HGCalHistoClusteringWrapper'),
Expand Down
16 changes: 15 additions & 1 deletion L1Trigger/L1THGCal/python/l1tHGCalTowerMapProducer_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,21 @@
nBinsEta=cms.int32(18),
nBinsPhi=cms.int32(72),
binsEta=cms.vdouble(),
binsPhi=cms.vdouble())
binsPhi=cms.vdouble(),
splitModuleSum=cms.bool(False))

L1TTriggerTowerConfig_energySplit = cms.PSet(readMappingFile=cms.bool(False),
doNose=cms.bool(False),
minEta=cms.double(1.305),
maxEta=cms.double(3.045),
minPhi=cms.double(-1*math.pi),
maxPhi=cms.double(math.pi),
nBinsEta=cms.int32(20),
nBinsPhi=cms.int32(72),
binsEta=cms.vdouble(),
binsPhi=cms.vdouble(),
splitModuleSum=cms.bool(True),
moduleTowerMapping=cms.FileInPath("L1Trigger/L1THGCal/data/tower_per_module_silic8_scint16.txt"))

towerMap2D_parValues = cms.PSet( useLayerWeights = cms.bool(False),
layerWeights = cms.vdouble(),
Expand Down
Loading