Skip to content

Commit

Permalink
remove normalisation by area in seeding
Browse files Browse the repository at this point in the history
  • Loading branch information
echapon authored Jul 27, 2021
1 parent 874e4c4 commit dda19c4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
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
6 changes: 6 additions & 0 deletions L1Trigger/L1THGCal/python/customHistoSeeding.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,9 @@ def custom_3dclustering_XYHistoMax(process,
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
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(True)
)

histoMax_C3d_clustering_params = cms.PSet(dR_multicluster=cms.double(0.03),
Expand Down
19 changes: 16 additions & 3 deletions L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ HGCalHistoSeedingImpl::HGCalHistoSeedingImpl(const edm::ParameterSet& conf)
neighbour_weights_(conf.getParameter<std::vector<double>>("neighbour_weights")),
smoothing_ecal_(conf.getParameter<std::vector<double>>("seed_smoothing_ecal")),
smoothing_hcal_(conf.getParameter<std::vector<double>>("seed_smoothing_hcal")),
seeds_norm_by_area_(conf.getParameter<bool>("seeds_norm_by_area")),
kROverZMin_(conf.getParameter<double>("kROverZMin")),
kROverZMax_(conf.getParameter<double>("kROverZMax")) {
if (seedingAlgoType_ == "HistoMaxC3d") {
Expand Down Expand Up @@ -64,6 +65,13 @@ HGCalHistoSeedingImpl::HGCalHistoSeedingImpl(const edm::ParameterSet& conf)
<< "Inconsistent size of neighbour weights vector in HGCalMulticlustering ( " << neighbour_weights_.size()
<< " ). Should be " << neighbour_weights_size_ << "\n";
}

// compute quantities for non-normalised-by-area histoMax
// The 0.1 factor in bin1_10pct is an attempt to keep the same rough scale for seeds. The exact value is arbitrary.
int bin1_10pct = (int)0.1 * nBins1_;
float R1_10pct = kROverZMin_ + bin1_10pct * (kROverZMax_ - kROverZMin_) / nBins1_;
float R2_10pct = R1_10pct + ((kROverZMax_ - kROverZMin_) / nBins1_);
area_10pct_ = ((M_PI * (pow(R2_10pct, 2) - pow(R1_10pct, 2))) / nBins2_);
}

HGCalHistoSeedingImpl::Histogram HGCalHistoSeedingImpl::fillHistoClusters(
Expand Down Expand Up @@ -166,16 +174,21 @@ HGCalHistoSeedingImpl::Histogram HGCalHistoSeedingImpl::fillSmoothPhiHistoCluste
for (int z_side : {-1, 1}) {
for (unsigned bin1 = 0; bin1 < nBins1_; bin1++) {
int nBinsSide = (binSums[bin1] - 1) / 2;
float R1 = kROverZMin_ + bin1 * (kROverZMax_ - kROverZMin_) / nBins1_;
float R2 = R1 + ((kROverZMax_ - kROverZMin_) / nBins1_);
double area =
((M_PI * (pow(R2, 2) - pow(R1, 2))) / nBins2_) *
(1 +
2.0 *
(1 -
pow(0.5,
nBinsSide))); // Takes into account different area of bins in different R-rings + sum of quadratic weights used

if (seeds_norm_by_area_) {
float R1 = kROverZMin_ + bin1 * (kROverZMax_ - kROverZMin_) / nBins1_;
float R2 = R1 + ((kROverZMax_ - kROverZMin_) / nBins1_);
area = area * ((M_PI * (pow(R2, 2) - pow(R1, 2))) / nBins2_);
} else {
area = area * area_10pct_;
}

for (unsigned bin2 = 0; bin2 < nBins2_; bin2++) {
const auto& bin_orig = histoClusters.at(z_side, bin1, bin2);
float content = bin_orig.values[Bin::Content::Sum];
Expand Down

0 comments on commit dda19c4

Please sign in to comment.