Skip to content

Commit 65eee29

Browse files
committed
Tune TkEle WP + review comments
1 parent 86590fb commit 65eee29

File tree

7 files changed

+50
-49
lines changed

7 files changed

+50
-49
lines changed

L1Trigger/Phase2L1ParticleFlow/interface/corrector.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace l1tpf {
2222
nemf_(0),
2323
emfMax_(-1),
2424
emulate_(false),
25+
debug_(false),
2526
emulationMode_(l1tpf::corrector::EmulationMode::CorrectedPt) {}
2627
corrector(const std::string &iFile,
2728
float emfMax = -1,

L1Trigger/Phase2L1ParticleFlow/interface/egamma/pftkegalgo_ref.h

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -100,36 +100,40 @@ namespace l1ct {
100100

101101
PFTkEGAlgoEmuConfig(const edm::ParameterSet &iConfig);
102102
PFTkEGAlgoEmuConfig(
103-
unsigned int nTrack,
104-
unsigned int nTrack_in,
105-
unsigned int nEmCalo_in,
106-
unsigned int nEmOut,
107-
bool filterHwQuality,
108-
bool doBremRecovery,
109-
bool writeBeforeBremRecovery = false,
110-
int caloHwQual = 4,
111-
bool doEndcapHwQual = false,
112-
float emClusterPtMin = 2.,
113-
float dEtaMaxBrem = 0.02,
114-
float dPhiMaxBrem = 0.1,
115-
const std::vector<double> &absEtaBoundaries = {0.0, 1.5},
116-
const std::vector<double> &dEtaValues = {0.015, 0.01},
117-
const std::vector<double> &dPhiValues = {0.07, 0.07},
118-
float trkQualityPtMin = 10.,
119-
unsigned int algo = 0,
120-
unsigned int nCompCandPerCluster = 4,
121-
bool writeEgSta = false,
103+
unsigned int nTrack, // Number of tracks to consider
104+
unsigned int nTrack_in, // Number of tracks for EG input
105+
unsigned int nEmCalo_in, // Number of EM calos for EG input
106+
unsigned int nEmOut, // Number of EM objects at EG output
107+
bool filterHwQuality, // Enable hardware quality filtering
108+
bool doBremRecovery, // Enable brem recovery
109+
bool writeBeforeBremRecovery = false, // Write objects before brem recovery
110+
int caloHwQual = 4, // Calo hardware quality threshold (default: 4)
111+
bool doEndcapHwQual = false, // Use endcap hardware quality
112+
float emClusterPtMin = 2., // Minimum EM cluster pt [GeV]
113+
float dEtaMaxBrem = 0.02, // Max delta-eta for brem recovery
114+
float dPhiMaxBrem = 0.1, // Max delta-phi for brem recovery
115+
const std::vector<double> &absEtaBoundaries = {0.0, 1.5}, // Eta region boundaries
116+
const std::vector<double> &dEtaValues = {0.015, 0.01}, // Delta-eta cuts per region
117+
const std::vector<double> &dPhiValues = {0.07, 0.07}, // Delta-phi cuts per region
118+
float trkQualityPtMin = 10., // Minimum track pt for quality [GeV]
119+
unsigned int algo = 0, // Algorithm selector (see enum Algo)
120+
unsigned int nCompCandPerCluster = 4, // Max composite candidates per cluster
121+
bool writeEgSta = false, // Write EG standalone objects
122+
// Track isolation params for tkEle: min-pt, dZ, dRMin, dRMax
122123
const IsoParameters &tkIsoParams_tkEle = {2., 0.6, 0.03, 0.2},
124+
// Track isolation params for tkEm: min-pt, dZ, dRMin, dRMax
123125
const IsoParameters &tkIsoParams_tkEm = {2., 0.6, 0.07, 0.3},
126+
// PF isolation params for tkEle: min-pt, dZ, dRMin, dRMax
124127
const IsoParameters &pfIsoParams_tkEle = {1., 0.6, 0.03, 0.2},
128+
// PF isolation params for tkEm: min-pt, dZ, dRMin, dRMax
125129
const IsoParameters &pfIsoParams_tkEm = {1., 0.6, 0.07, 0.3},
126-
bool doTkIso = true,
127-
bool doPfIso = false,
128-
EGIsoEleObjEmu::IsoType hwIsoTypeTkEle = EGIsoEleObjEmu::IsoType::TkIso,
129-
EGIsoObjEmu::IsoType hwIsoTypeTkEm = EGIsoObjEmu::IsoType::TkIsoPV,
130+
bool doTkIso = true, // Enable track isolation
131+
bool doPfIso = false, // Enable PF isolation
132+
EGIsoEleObjEmu::IsoType hwIsoTypeTkEle = EGIsoEleObjEmu::IsoType::TkIso, // Isolation type for tkEle
133+
EGIsoObjEmu::IsoType hwIsoTypeTkEm = EGIsoObjEmu::IsoType::TkIsoPV, // Isolation type for tkEm
134+
// Composite ID params: pt-bins, loose-WP, pt-bins tight-WP, model, dPhi_max, dEta_max
130135
const CompIDParameters &compIDparams = {{0.}, {-4}, {0.}, {0.214844}, "compositeID.json", 0.2, 0.2},
131-
int debug = 0)
132-
136+
int debug = 0) // Debug level
133137
: nTRACK(nTrack),
134138
nTRACK_EGIN(nTrack_in),
135139
nEMCALO_EGIN(nEmCalo_in),
@@ -277,7 +281,7 @@ namespace l1ct {
277281
typedef ap_fixed<12, 3, AP_RND_CONV, AP_SAT> bdt_score_t;
278282

279283
private:
280-
conifer::BDT<bdt_feature_t, bdt_score_t, false> *model_;
284+
std::unique_ptr<conifer::BDT<bdt_feature_t, bdt_score_t, false>> model_;
281285
};
282286

283287
class TkEgCID_EE_v1 : public TkEGEleAssociationModel {
@@ -293,7 +297,7 @@ namespace l1ct {
293297
typedef ap_fixed<30, 20, AP_RND_CONV, AP_SAT> bdt_score_t;
294298

295299
private:
296-
conifer::BDT<bdt_feature_t, bdt_score_t, false> *model_;
300+
std::unique_ptr<conifer::BDT<bdt_feature_t, bdt_score_t, false>> model_;
297301
};
298302

299303
class TkEgCID_EB_v0 : public TkEGEleAssociationModel {
@@ -309,7 +313,7 @@ namespace l1ct {
309313
typedef ap_fixed<12, 4, AP_RND_CONV, AP_SAT> bdt_score_t;
310314

311315
private:
312-
conifer::BDT<bdt_feature_t, bdt_score_t, false> *model_;
316+
std::unique_ptr<conifer::BDT<bdt_feature_t, bdt_score_t, false>> model_;
313317
};
314318

315319
class TkEgCID_EB_v1 : public TkEGEleAssociationModel {
@@ -329,7 +333,7 @@ namespace l1ct {
329333
return inf + (x - min_x) / pow(2, bitshift);
330334
}
331335

332-
conifer::BDT<bdt_feature_t, bdt_score_t, false> *model_;
336+
std::unique_ptr<conifer::BDT<bdt_feature_t, bdt_score_t, false>> model_;
333337
};
334338

335339
class PFTkEGAlgoEmulator {

L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,6 @@ L1TCorrelatorLayer1Producer::L1TCorrelatorLayer1Producer(const edm::ParameterSet
385385
produces<std::vector<unsigned>>(std::string("vecNPuppi") + l1ct::OutputRegion::objTypeName[i]);
386386
}
387387

388-
produces<std::vector<l1t::PFCluster>>("decodedHadPFClusters");
389-
produces<std::vector<l1t::PFCluster>>("decodedEmPFClusters");
390-
391388
initSectorsAndRegions(iConfig);
392389
}
393390

@@ -738,6 +735,7 @@ void L1TCorrelatorLayer1Producer::rawHgcalClusterEncode(ap_uint<256> &cwrd,
738735
float em_frac_tot = c.hOverE() < 0 ? 0. : 1. / (c.hOverE() + 1.);
739736
ap_uint<8> w_emfrac_tot = std::min(round(em_frac_tot * 256), float(255.));
740737

738+
// LSB defintions according to the HGC/Correlator interface document
741739
static constexpr float ETAPHI_LSB = M_PI / 720;
742740
static constexpr float SIGMAZZ_LSB = 778.098 / (1 << 7);
743741
static constexpr float SIGMAPHIPHI_LSB = 0.12822 / (1 << 7);

L1Trigger/Phase2L1ParticleFlow/python/l1TkEgAlgoEmulator_cfi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@
6868
values=cms.vdouble(-1)
6969
),
7070
tight_wp=cms.PSet(
71-
bins=cms.vdouble(0, 5, 10, 20, 30, 50),
72-
values=cms.vdouble(0.17, 0.018, -0.08, -0.11, -0.215, -0.15),
71+
bins=cms.vdouble(0, 5, 10, 30),
72+
values=cms.vdouble(0.17, 0.018, -0.08, -0.11),
7373
),
7474
dPhi_max = cms.double(0.3),
7575
dEta_max = cms.double(0.03),

L1Trigger/Phase2L1ParticleFlow/src/corrector.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "L1Trigger/Phase2L1ParticleFlow/interface/corrector.h"
2+
#include "L1Trigger/Phase2L1ParticleFlow/interface/dbgPrintf.h"
23

34
#include <iostream>
45
#include <sstream>
@@ -33,7 +34,7 @@
3334

3435
l1tpf::corrector::corrector(
3536
const std::string &filename, float emfMax, bool debug, bool emulate, l1tpf::corrector::EmulationMode emulationMode)
36-
: emfMax_(emfMax), emulate_(emulate), emulationMode_(emulationMode) {
37+
: emfMax_(emfMax), emulate_(emulate), debug_(debug), emulationMode_(emulationMode) {
3738
if (!filename.empty())
3839
init_(filename, "", debug, emulate);
3940
}
@@ -44,14 +45,14 @@ l1tpf::corrector::corrector(const std::string &filename,
4445
bool debug,
4546
bool emulate,
4647
l1tpf::corrector::EmulationMode emulationMode)
47-
: emfMax_(emfMax), emulate_(emulate), emulationMode_(emulationMode) {
48+
: emfMax_(emfMax), emulate_(emulate), debug_(debug), emulationMode_(emulationMode) {
4849
if (!filename.empty())
4950
init_(filename, directory, debug, emulate);
5051
}
5152

5253
l1tpf::corrector::corrector(
5354
TDirectory *src, float emfMax, bool debug, bool emulate, l1tpf::corrector::EmulationMode emulationMode)
54-
: emfMax_(emfMax), emulate_(emulate), emulationMode_(emulationMode) {
55+
: emfMax_(emfMax), emulate_(emulate), debug_(debug), emulationMode_(emulationMode) {
5556
init_(src, debug);
5657
}
5758

@@ -286,13 +287,10 @@ float l1tpf::corrector::correctedPt(float pt, float emPt, float eta) const {
286287
throw std::runtime_error(ss.str());
287288
#endif
288289
}
289-
// std::cout << "pt: " << pt << " emPt: " << emPt << " eta: " << eta << std::endl;
290290

291291
ptcorr = std::min<float>(graph->Eval(total), 4 * total);
292292
} else { // emulation - read from the pt binned histogram
293293
TH1 *hist = correctionsEmulated_[ieta * nemf_ + iemf];
294-
// std::cout << "pt: " << pt << " emPt: " << emPt << " eta: " << eta << std::endl;
295-
// std::cout << "ieta: " << ieta << " iemf: " << iemf << std::endl;
296294
if (!hist) {
297295
#ifdef CMSSW_GIT_HASH
298296
throw cms::Exception("RuntimeError")
@@ -308,8 +306,9 @@ float l1tpf::corrector::correctedPt(float pt, float emPt, float eta) const {
308306
if (emulationMode_ == l1tpf::corrector::EmulationMode::Correction) {
309307
ptcorr = ptcorr * pt;
310308
}
311-
// FIXME: add debug flag
312-
// std::cout << "[EMU] ieta: " << ieta << " iemf: " << iemf << " ipt: " << ipt-1 << "corr: " << hist->GetBinContent(ipt) << " ptcorr: " << ptcorr << std::endl;
309+
if (debug_)
310+
dbgCout() << "[EMU] ieta: " << ieta << " iemf: " << iemf << " ipt: " << ipt - 1
311+
<< "corr: " << hist->GetBinContent(ipt) << " ptcorr: " << ptcorr << std::endl;
313312
}
314313
return ptcorr;
315314
}

L1Trigger/Phase2L1ParticleFlow/src/egamma/pftkegalgo_ref.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ l1ct::TkEgCID_EE_v0::TkEgCID_EE_v0(const l1ct::PFTkEGAlgoEmuConfig::CompIDParame
178178
#else
179179
auto resolvedFileName = params.conifer_model_;
180180
#endif
181-
model_ = new conifer::BDT<bdt_feature_t, bdt_score_t, false>(resolvedFileName);
181+
model_ = std::make_unique<conifer::BDT<bdt_feature_t, bdt_score_t, false>>(resolvedFileName);
182182
}
183183

184184
id_score_t l1ct::TkEgCID_EE_v0::compute_score(const CompositeCandidate &cand,
@@ -217,7 +217,7 @@ l1ct::TkEgCID_EE_v1::TkEgCID_EE_v1(const l1ct::PFTkEGAlgoEmuConfig::CompIDParame
217217
#else
218218
auto resolvedFileName = params.conifer_model_;
219219
#endif
220-
model_ = new conifer::BDT<bdt_feature_t, bdt_score_t, false>(resolvedFileName);
220+
model_ = std::make_unique<conifer::BDT<bdt_feature_t, bdt_score_t, false>>(resolvedFileName);
221221
}
222222

223223
id_score_t l1ct::TkEgCID_EE_v1::compute_score(const CompositeCandidate &cand,
@@ -274,7 +274,7 @@ l1ct::TkEgCID_EB_v0::TkEgCID_EB_v0(const l1ct::PFTkEGAlgoEmuConfig::CompIDParame
274274
#else
275275
auto resolvedFileName = params.conifer_model_;
276276
#endif
277-
model_ = new conifer::BDT<bdt_feature_t, bdt_score_t, false>(resolvedFileName);
277+
model_ = std::make_unique<conifer::BDT<bdt_feature_t, bdt_score_t, false>>(resolvedFileName);
278278
}
279279

280280
id_score_t l1ct::TkEgCID_EB_v0::compute_score(const CompositeCandidate &cand,
@@ -341,7 +341,7 @@ l1ct::TkEgCID_EB_v1::TkEgCID_EB_v1(const l1ct::PFTkEGAlgoEmuConfig::CompIDParame
341341
#else
342342
auto resolvedFileName = params.conifer_model_;
343343
#endif
344-
model_ = new conifer::BDT<bdt_feature_t, bdt_score_t, false>(resolvedFileName);
344+
model_ = std::make_unique<conifer::BDT<bdt_feature_t, bdt_score_t, false>>(resolvedFileName);
345345
}
346346

347347
id_score_t l1ct::TkEgCID_EB_v1::compute_score(const CompositeCandidate &cand,

L1Trigger/Phase2L1ParticleFlow/test/make_l1ct_binaryFiles_cfg.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
skipEvents = cms.untracked.uint32(0),
4747
)
4848

49-
process.load('Configuration.Geometry.GeometryExtendedRun4D95Reco_cff')
50-
process.load('Configuration.Geometry.GeometryExtendedRun4D95_cff')
49+
process.load('Configuration.Geometry.GeometryExtendedRun4D110Reco_cff')
50+
process.load('Configuration.Geometry.GeometryExtendedRun4D110_cff')
5151
process.load('Configuration.StandardSequences.MagneticField_cff')
5252
process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff') # needed to read HCal TPs
5353
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
@@ -187,7 +187,6 @@
187187
process.l1tLayer1HGCalNoTK.patternWriters = cms.untracked.VPSet(*hgcalNoTKWriterConfigs)
188188
process.l1tLayer1HF.patternWriters = cms.untracked.VPSet(*hfWriterConfigs)
189189

190-
process.l1tSC4NGJetProducer.l1tSC4NGJetModelPath = cms.string(os.environ['CMSSW_BASE']+"/src/L1TSC4NGJetModel/L1TSC4NGJetModel_v0")
191190
process.l1tSC4NGJetProducer.jets = cms.InputTag("l1tSC4PFL1PuppiCorrectedEmulator")
192191

193192
process.runPF = cms.Path(

0 commit comments

Comments
 (0)