From 60dbc4c8387e67f3cda7b545596ed9a98fbcea03 Mon Sep 17 00:00:00 2001 From: Gianluca Date: Wed, 8 Nov 2023 12:15:08 +0100 Subject: [PATCH] GT format: change charge convention, use eta and phi at vertex, use on pv-based isolation. Set charge of TkElectrons --- DataFormats/L1TParticleFlow/interface/egamma.h | 11 ++++++----- .../plugins/L1TCorrelatorLayer1Producer.cc | 3 ++- .../Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc | 1 + .../python/l1TkEgAlgoEmulator_cfi.py | 6 +----- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/DataFormats/L1TParticleFlow/interface/egamma.h b/DataFormats/L1TParticleFlow/interface/egamma.h index 4a61e317a6a15..4b5c85e8f7d7e 100644 --- a/DataFormats/L1TParticleFlow/interface/egamma.h +++ b/DataFormats/L1TParticleFlow/interface/egamma.h @@ -90,8 +90,8 @@ namespace l1ct { id_score_t hwIDScore; bool hwCharge; - phi_t hwVtxPhi() const { return hwCharge ? hwPhi + hwDPhi : hwPhi - hwDPhi; } - eta_t hwVtxEta() const { return hwEta + hwDEta; } + glbphi_t hwVtxPhi() const { return hwCharge ? hwPhi + hwDPhi : hwPhi - hwDPhi; } + glbeta_t hwVtxEta() const { return hwEta + hwDEta; } inline bool operator==(const EGIsoEleObj &other) const { return hwPt == other.hwPt && hwEta == other.hwEta && hwPhi == other.hwPhi && hwQual == other.hwQual && @@ -164,10 +164,11 @@ namespace l1ct { l1gt::Electron ele; ele.valid = hwPt != 0; ele.v3.pt = CTtoGT_pt(hwPt); - ele.v3.phi = CTtoGT_phi(hwPhi); - ele.v3.eta = CTtoGT_eta(hwEta); + ele.v3.phi = CTtoGT_phi(hwVtxPhi()); + ele.v3.eta = CTtoGT_eta(hwVtxEta()); ele.quality = hwQual; - ele.charge = hwCharge; + // NOTE: GT: 0 = positive, 1 = negative, CT: 0 = negative, 1 = positive + ele.charge = !hwCharge; ele.z0 = hwZ0; ele.isolation = hwIso; return ele; diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc index 70facf22c7aa0..5f1a0b55752c2 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc @@ -1078,7 +1078,7 @@ void L1TCorrelatorLayer1Producer::putEgObjects(edm::Event &iEvent, if (egele.hwPt == 0) continue; - reco::Candidate::PolarLorentzVector mom(egele.floatPt(), egele.floatEta(), egele.floatPhi(), 0.); + reco::Candidate::PolarLorentzVector mom(egele.floatPt(), egele.floatVtxEta(), egele.floatVtxPhi(), 0.); l1t::TkElectron tkele(reco::Candidate::LorentzVector(mom), egele.srcCluster->constituentsAndFractions()[0].first, @@ -1088,6 +1088,7 @@ void L1TCorrelatorLayer1Producer::putEgObjects(edm::Event &iEvent, tkele.setPFIsol(egele.floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::PfIso)); tkele.setEgBinaryWord(egele.pack(), l1t::TkElectron::HWEncoding::CT); tkele.setIdScore(egele.floatIDScore()); + tkele.setCharge(egele.intCharge()); tkeles->push_back(tkele); nele_obj.push_back(tkeles->size() - 1); } diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc index fa13bd6286137..7134ea9b2c25d 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc @@ -396,6 +396,7 @@ l1t::TkElectron L1TCtL2EgProducer::convertFromEmu(const l1ct::EGIsoEleObjEmu &eg tkele.setPuppiIsol(egele.floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::PuppiIso)); tkele.setEgBinaryWord(gteg.pack(), l1t::TkElectron::HWEncoding::GT); tkele.setIdScore(egele.floatIDScore()); + tkele.setCharge(egele.intCharge()); return tkele; } diff --git a/L1Trigger/Phase2L1ParticleFlow/python/l1TkEgAlgoEmulator_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/l1TkEgAlgoEmulator_cfi.py index 9b68b7fa615a2..2fb19ea8b56eb 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/l1TkEgAlgoEmulator_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/l1TkEgAlgoEmulator_cfi.py @@ -24,33 +24,29 @@ dZ=cms.double(0.6), dRMin=cms.double(0.07), dRMax=cms.double(0.30), - tkQualityChi2Max=cms.double(100), ), tkIsoParametersTkEle=cms.PSet( tkQualityPtMin=cms.double(2.), dZ=cms.double(0.6), dRMin=cms.double(0.03), dRMax=cms.double(0.20), - tkQualityChi2Max=cms.double(1e10), ), pfIsoParametersTkEm=cms.PSet( tkQualityPtMin=cms.double(1.), dZ=cms.double(0.6), dRMin=cms.double(0.07), dRMax=cms.double(0.30), - tkQualityChi2Max=cms.double(100), ), pfIsoParametersTkEle=cms.PSet( tkQualityPtMin=cms.double(1.), dZ=cms.double(0.6), dRMin=cms.double(0.03), dRMax=cms.double(0.20), - tkQualityChi2Max=cms.double(1e10), ), doTkIso=cms.bool(True), doPfIso=cms.bool(True), hwIsoTypeTkEle=cms.uint32(0), - hwIsoTypeTkEm=cms.uint32(2), + hwIsoTypeTkEm=cms.uint32(0), doCompositeTkEle=cms.bool(False), nCompCandPerCluster=cms.uint32(3), compositeParametersTkEle=cms.PSet(