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

[Backport HGC trigger] V10/V11 e/g ID + calibration and concentrator module sums #30355

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion L1Trigger/L1THGCal/interface/HGCalProcessorBase.h
Expand Up @@ -11,8 +11,11 @@
#include "DataFormats/L1THGCal/interface/HGCalTowerMap.h"
#include "DataFormats/L1THGCal/interface/HGCalTower.h"

#include <utility>

typedef HGCalProcessorBaseT<HGCalDigiCollection, l1t::HGCalTriggerCellBxCollection> HGCalVFEProcessorBase;
typedef HGCalProcessorBaseT<edm::Handle<l1t::HGCalTriggerCellBxCollection>, l1t::HGCalTriggerCellBxCollection>
typedef HGCalProcessorBaseT<edm::Handle<l1t::HGCalTriggerCellBxCollection>,
std::pair<l1t::HGCalTriggerCellBxCollection, l1t::HGCalTriggerSumsBxCollection> >
HGCalConcentratorProcessorBase;
typedef HGCalProcessorBaseT<edm::Handle<l1t::HGCalTriggerCellBxCollection>, l1t::HGCalClusterBxCollection>
HGCalBackendLayer1ProcessorBase;
Expand Down
Expand Up @@ -13,7 +13,8 @@ class HGCalConcentratorBestChoiceImpl {
void select(unsigned nLinks,
unsigned nWafers,
const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput);
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecNotSelected);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }

Expand Down
Expand Up @@ -6,11 +6,14 @@
#include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorBestChoiceImpl.h"
#include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorSuperTriggerCellImpl.h"
#include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorCoarsenerImpl.h"
#include "L1Trigger/L1THGCal/interface/concentrator/HGCalConcentratorTrigSumImpl.h"

#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"

#include <utility>

class HGCalConcentratorProcessorSelection : public HGCalConcentratorProcessorBase {
private:
enum SelectionType { thresholdSelect, bestChoiceSelect, superTriggerCellSelect, noSelection };
Expand All @@ -19,7 +22,7 @@ class HGCalConcentratorProcessorSelection : public HGCalConcentratorProcessorBas
HGCalConcentratorProcessorSelection(const edm::ParameterSet& conf);

void run(const edm::Handle<l1t::HGCalTriggerCellBxCollection>& triggerCellCollInput,
l1t::HGCalTriggerCellBxCollection& triggerCellCollOutput,
std::pair<l1t::HGCalTriggerCellBxCollection, l1t::HGCalTriggerSumsBxCollection>& triggerCollOutput,
const edm::EventSetup& es) override;

private:
Expand All @@ -34,6 +37,7 @@ class HGCalConcentratorProcessorSelection : public HGCalConcentratorProcessorBas
std::unique_ptr<HGCalConcentratorBestChoiceImpl> bestChoiceImpl_;
std::unique_ptr<HGCalConcentratorSuperTriggerCellImpl> superTriggerCellImpl_;
std::unique_ptr<HGCalConcentratorCoarsenerImpl> coarsenerImpl_;
std::unique_ptr<HGCalConcentratorTrigSumImpl> trigSumImpl_;

HGCalTriggerTools triggerTools_;
};
Expand Down
Expand Up @@ -11,7 +11,8 @@ class HGCalConcentratorThresholdImpl {
HGCalConcentratorThresholdImpl(const edm::ParameterSet& conf);

void select(const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput);
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecNotSelected);

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }

Expand Down
@@ -0,0 +1,24 @@
#ifndef __L1Trigger_L1THGCal_HGCalConcentratorTrigSumImpl_h__
#define __L1Trigger_L1THGCal_HGCalConcentratorTrigSumImpl_h__

#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerCell.h"
#include "DataFormats/L1THGCal/interface/HGCalTriggerSums.h"
#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h"
#include <vector>

class HGCalConcentratorTrigSumImpl {
public:
HGCalConcentratorTrigSumImpl(const edm::ParameterSet& conf);

void doSum(uint32_t module_id,
const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
std::vector<l1t::HGCalTriggerSums>& trigSumsVecOutput) const;

void eventSetup(const edm::EventSetup& es) { triggerTools_.eventSetup(es); }

private:
HGCalTriggerTools triggerTools_;
};

#endif
11 changes: 5 additions & 6 deletions L1Trigger/L1THGCal/plugins/HGCalConcentratorProducer.cc
Expand Up @@ -14,6 +14,7 @@
#include "L1Trigger/L1THGCal/interface/HGCalProcessorBase.h"

#include <memory>
#include <utility>

class HGCalConcentratorProducer : public edm::stream::EDProducer<> {
public:
Expand Down Expand Up @@ -54,16 +55,14 @@ void HGCalConcentratorProducer::beginRun(const edm::Run& /*run*/, const edm::Eve

void HGCalConcentratorProducer::produce(edm::Event& e, const edm::EventSetup& es) {
// Output collections
auto cc_trigcell_output = std::make_unique<l1t::HGCalTriggerCellBxCollection>();
auto cc_trigsums_output = std::make_unique<l1t::HGCalTriggerSumsBxCollection>();
std::pair<l1t::HGCalTriggerCellBxCollection, l1t::HGCalTriggerSumsBxCollection> cc_output;

// Input collections
edm::Handle<l1t::HGCalTriggerCellBxCollection> trigCellBxColl;

e.getByToken(input_cell_, trigCellBxColl);
concentratorProcess_->run(trigCellBxColl, *cc_trigcell_output, es);
concentratorProcess_->run(trigCellBxColl, cc_output, es);
// Put in the event
// At the moment the HGCalTriggerSumsBxCollection is empty
e.put(std::move(cc_trigcell_output), concentratorProcess_->name());
e.put(std::move(cc_trigsums_output), concentratorProcess_->name());
e.put(std::make_unique<l1t::HGCalTriggerCellBxCollection>(std::move(cc_output.first)), concentratorProcess_->name());
e.put(std::make_unique<l1t::HGCalTriggerSumsBxCollection>(std::move(cc_output.second)), concentratorProcess_->name());
}
Expand Up @@ -21,10 +21,14 @@ HGCalConcentratorProcessorSelection::HGCalConcentratorProcessorSelection(const e
selectionType_[subdet] = thresholdSelect;
if (!thresholdImpl_)
thresholdImpl_ = std::make_unique<HGCalConcentratorThresholdImpl>(conf);
if (!trigSumImpl_)
trigSumImpl_ = std::make_unique<HGCalConcentratorTrigSumImpl>(conf);
} else if (selectionType[subdet] == "bestChoiceSelect") {
selectionType_[subdet] = bestChoiceSelect;
if (!bestChoiceImpl_)
bestChoiceImpl_ = std::make_unique<HGCalConcentratorBestChoiceImpl>(conf);
if (!trigSumImpl_)
trigSumImpl_ = std::make_unique<HGCalConcentratorTrigSumImpl>(conf);
} else if (selectionType[subdet] == "superTriggerCellSelect") {
selectionType_[subdet] = superTriggerCellSelect;
if (!superTriggerCellImpl_)
Expand All @@ -43,9 +47,10 @@ HGCalConcentratorProcessorSelection::HGCalConcentratorProcessorSelection(const e
}
}

void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTriggerCellBxCollection>& triggerCellCollInput,
l1t::HGCalTriggerCellBxCollection& triggerCellCollOutput,
const edm::EventSetup& es) {
void HGCalConcentratorProcessorSelection::run(
const edm::Handle<l1t::HGCalTriggerCellBxCollection>& triggerCellCollInput,
std::pair<l1t::HGCalTriggerCellBxCollection, l1t::HGCalTriggerSumsBxCollection>& triggerCollOutput,
const edm::EventSetup& es) {
if (thresholdImpl_)
thresholdImpl_->eventSetup(es);
if (bestChoiceImpl_)
Expand All @@ -54,8 +59,13 @@ void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTrigge
superTriggerCellImpl_->eventSetup(es);
if (coarsenerImpl_)
coarsenerImpl_->eventSetup(es);
if (trigSumImpl_)
trigSumImpl_->eventSetup(es);
triggerTools_.eventSetup(es);

auto& triggerCellCollOutput = triggerCollOutput.first;
auto& triggerSumCollOutput = triggerCollOutput.second;

const l1t::HGCalTriggerCellBxCollection& collInput = *triggerCellCollInput;

std::unordered_map<uint32_t, std::vector<l1t::HGCalTriggerCell>> tc_modules;
Expand All @@ -67,6 +77,8 @@ void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTrigge
for (const auto& module_trigcell : tc_modules) {
std::vector<l1t::HGCalTriggerCell> trigCellVecOutput;
std::vector<l1t::HGCalTriggerCell> trigCellVecCoarsened;
std::vector<l1t::HGCalTriggerCell> trigCellVecNotSelected;
std::vector<l1t::HGCalTriggerSums> trigSumsVecOutput;

int thickness = triggerTools_.thicknessIndex(module_trigcell.second.at(0).detId(), true);

Expand All @@ -77,19 +89,21 @@ void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTrigge

switch (selectionType_[subdet]) {
case thresholdSelect:
thresholdImpl_->select(trigCellVecCoarsened, trigCellVecOutput);
thresholdImpl_->select(trigCellVecCoarsened, trigCellVecOutput, trigCellVecNotSelected);
break;
case bestChoiceSelect:
if (triggerTools_.isEm(module_trigcell.first)) {
bestChoiceImpl_->select(geometry_->getLinksInModule(module_trigcell.first),
geometry_->getModuleSize(module_trigcell.first),
module_trigcell.second,
trigCellVecOutput);
trigCellVecOutput,
trigCellVecNotSelected);
} else {
bestChoiceImpl_->select(geometry_->getLinksInModule(module_trigcell.first),
geometry_->getModuleSize(module_trigcell.first),
trigCellVecCoarsened,
trigCellVecOutput);
trigCellVecOutput,
trigCellVecNotSelected);
}
break;
case superTriggerCellSelect:
Expand All @@ -106,13 +120,14 @@ void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTrigge
} else {
switch (selectionType_[subdet]) {
case thresholdSelect:
thresholdImpl_->select(module_trigcell.second, trigCellVecOutput);
thresholdImpl_->select(module_trigcell.second, trigCellVecOutput, trigCellVecNotSelected);
break;
case bestChoiceSelect:
bestChoiceImpl_->select(geometry_->getLinksInModule(module_trigcell.first),
geometry_->getModuleSize(module_trigcell.first),
module_trigcell.second,
trigCellVecOutput);
trigCellVecOutput,
trigCellVecNotSelected);
break;
case superTriggerCellSelect:
superTriggerCellImpl_->select(module_trigcell.second, trigCellVecOutput);
Expand All @@ -126,8 +141,16 @@ void HGCalConcentratorProcessorSelection::run(const edm::Handle<l1t::HGCalTrigge
}
}

// trigger sum
if (trigSumImpl_) {
trigSumImpl_->doSum(module_trigcell.first, trigCellVecNotSelected, trigSumsVecOutput);
}

for (const auto& trigCell : trigCellVecOutput) {
triggerCellCollOutput.push_back(0, trigCell);
}
for (const auto& trigSums : trigSumsVecOutput) {
triggerSumCollOutput.push_back(0, trigSums);
}
}
}
47 changes: 44 additions & 3 deletions L1Trigger/L1THGCal/python/egammaIdentification.py
@@ -1,6 +1,8 @@
import FWCore.ParameterSet.Config as cms

from Configuration.Eras.Modifier_phase2_hgcalV9_cff import phase2_hgcalV9
from Configuration.Eras.Modifier_phase2_hgcalV10_cff import phase2_hgcalV10
from Configuration.Eras.Modifier_phase2_hgcalV11_cff import phase2_hgcalV11

inputs_small = ['cl3d_firstlayer', 'cl3d_coreshowerlength', 'cl3d_maxlayer', 'cl3d_srrmean']
inputs_large = ['cl3d_coreshowerlength', 'cl3d_showerlength', 'cl3d_firstlayer', 'cl3d_maxlayer', 'cl3d_szz', 'cl3d_srrmean', 'cl3d_srrtot', 'cl3d_seetot', 'cl3d_spptot']
Expand Down Expand Up @@ -75,7 +77,8 @@ def __init__(self, eta_min, eta_max, pt_min, pt_max):
input_features_histomax = {
"v8_352":inputs_small,
"v9_370":inputs_large,
"v9_394":inputs_large
"v9_394":inputs_large,
"v10_3151":inputs_large
}

bdt_weights_histomax = {
Expand All @@ -96,6 +99,12 @@ def __init__(self, eta_min, eta_max, pt_min, pt_max):
'L1Trigger/L1THGCal/data/egamma_id_histomax_394_loweta_v0.xml',
# High eta
'L1Trigger/L1THGCal/data/egamma_id_histomax_394_higheta_v0.xml'
],
"v10_3151":[ #trained using TPG software version 3.15.1
# Low eta
'L1Trigger/L1THGCal/data/egamma_id_histomax_3151_loweta_v0.xml',
# High eta
'L1Trigger/L1THGCal/data/egamma_id_histomax_3151_higheta_v0.xml'
]
}

Expand Down Expand Up @@ -128,7 +137,7 @@ def __init__(self, eta_min, eta_max, pt_min, pt_max):
{
'900':0.7078400, #epsilon_b = 3.5%
'950':-0.0239623, #epsilon_b = 6.9%
'975':-0.7045071, #epsilon_b = 11.6%
'975':-0.7045071, #epsilon_b = 11.6%
'995':-0.9811426, #epsilon_b = 26.1%
}
],
Expand All @@ -144,9 +153,25 @@ def __init__(self, eta_min, eta_max, pt_min, pt_max):
{
'900':0.8825340, #epsilon_b = 1.0%
'950':0.2856039, #epsilon_b = 1.7%
'975':-0.5274948, #epsilon_b = 2.8%
'975':-0.5274948, #epsilon_b = 2.8%
'995':-0.9864445, #epsilon_b = 7.6%
}
],
"v10_3151": [
# Low eta
{
'900': 0.9903189,
'950': 0.9646683,
'975': 0.8292287,
'995': -0.7099538,
},
# High eta
{
'900': 0.9932326,
'950': 0.9611762,
'975': 0.7616282,
'995': -0.9163715,
}
]
}

Expand Down Expand Up @@ -192,3 +217,19 @@ def __init__(self, eta_min, eta_max, pt_min, pt_max):
[wps[eff] for wps,eff in zip(working_points_histomax['v9_394'],tight_wp)]
)
)

phase2_hgcalV10.toModify(egamma_identification_histomax,
Inputs=cms.vstring(input_features_histomax['v10_3151']),
Weights=cms.vstring(bdt_weights_histomax['v10_3151']),
WorkingPoints=cms.vdouble(
[wps[eff] for wps,eff in zip(working_points_histomax['v10_3151'],tight_wp)]
)
)

phase2_hgcalV11.toModify(egamma_identification_histomax,
Inputs=cms.vstring(input_features_histomax['v10_3151']),
Weights=cms.vstring(bdt_weights_histomax['v10_3151']),
WorkingPoints=cms.vdouble(
[wps[eff] for wps,eff in zip(working_points_histomax['v10_3151'],tight_wp)]
)
)
20 changes: 14 additions & 6 deletions L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py
Expand Up @@ -6,6 +6,7 @@

from Configuration.Eras.Modifier_phase2_hgcalV9_cff import phase2_hgcalV9
from Configuration.Eras.Modifier_phase2_hgcalV10_cff import phase2_hgcalV10
from Configuration.Eras.Modifier_phase2_hgcalV11_cff import phase2_hgcalV11
from Configuration.Eras.Modifier_phase2_hfnose_cff import phase2_hfnose


Expand Down Expand Up @@ -144,15 +145,22 @@


energy_interpretations_em = cms.PSet(type = cms.string('HGCalTriggerClusterInterpretationEM'),
layer_containment_corrs = cms.vdouble(0., 0., 1.6144949, 0.92495334, 1.0820811, 0.9753549, 0.9742881, 1.0634482, 1.0599478, 0.9376349, 0.92587173, 0.8003076, 1.0417082, 1.7032381, 2.),
scale_correction_coeff = cms.vdouble(16.68182373, -8.487143517),
layer_containment_corrs = cms.vdouble(0., 0.0, 1.38, 0.97, 1.11, 0.92, 1.06, 1.01, 1.06, 0.89, 1.0, 1.06, 0.89, 1.62, 1.83),
scale_correction_coeff = cms.vdouble(-27.15, 53.94),
dr_bylayer = cms.vdouble([0.015]*15)
)

phase2_hgcalV10.toModify(energy_interpretations_em,
layer_containment_corrs=cms.vdouble(0., 0., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.),
scale_correction_coeff=cms.vdouble(0., 0.),
)
phase2_hgcalV10.toModify(
energy_interpretations_em,
layer_containment_corrs=cms.vdouble(0., 0.0, 1.73, 0.97, 1.08, 1.1, 1.01, 0.96, 1.18, 0.98, 1.05, 0.99, 0.89, 1.75, 2.0),
scale_correction_coeff=cms.vdouble(-27.53, 53.92),
)

phase2_hgcalV11.toModify(
energy_interpretations_em,
layer_containment_corrs=cms.vdouble(0., 0.0, 1.28, 1.09, 1.0, 1.07, 1.09, 1.04, 1.0, 1.09, 1.07, 1.03, 0.93, 1.4, 1.89),
scale_correction_coeff=cms.vdouble(-24.96, 52.99),
)


energy_interpretations = cms.VPSet(energy_interpretations_em)
Expand Down
Expand Up @@ -15,8 +15,10 @@ HGCalConcentratorBestChoiceImpl::HGCalConcentratorBestChoiceImpl(const edm::Para
void HGCalConcentratorBestChoiceImpl::select(unsigned nLinks,
unsigned nWafers,
const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput) {
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecNotSelected) {
trigCellVecOutput = trigCellVecInput;
trigCellVecNotSelected.resize(0);
// sort, reverse order
std::sort(
trigCellVecOutput.begin(),
Expand All @@ -36,6 +38,10 @@ void HGCalConcentratorBestChoiceImpl::select(unsigned nLinks,
<< " NWafers=" << nWafers << " and NLinks=" << nLinks;
}
// keep only N trigger cells
if (trigCellVecOutput.size() > nData)
if (trigCellVecOutput.size() > nData) {
// store the last cells (not selected)
std::move(trigCellVecOutput.begin() + nData, trigCellVecOutput.end(), std::back_inserter(trigCellVecNotSelected));
// keep only N trigger cells
trigCellVecOutput.resize(nData);
}
}
Expand Up @@ -5,12 +5,15 @@ HGCalConcentratorThresholdImpl::HGCalConcentratorThresholdImpl(const edm::Parame
threshold_scintillator_(conf.getParameter<double>("threshold_scintillator")) {}

void HGCalConcentratorThresholdImpl::select(const std::vector<l1t::HGCalTriggerCell>& trigCellVecInput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput) {
std::vector<l1t::HGCalTriggerCell>& trigCellVecOutput,
std::vector<l1t::HGCalTriggerCell>& trigCellVecNotSelected) {
for (const auto& trigCell : trigCellVecInput) {
bool isScintillator = triggerTools_.isScintillator(trigCell.detId());
double threshold = (isScintillator ? threshold_scintillator_ : threshold_silicon_);
if (trigCell.mipPt() >= threshold) {
trigCellVecOutput.push_back(trigCell);
} else {
trigCellVecNotSelected.push_back(trigCell);
}
}
}