Skip to content

Commit

Permalink
Change charge and eta phi defintion for GT format. Set charge of TkEl…
Browse files Browse the repository at this point in the history
…ectrons
  • Loading branch information
cerminar committed Nov 16, 2023
1 parent 49ac2c5 commit 3f26897
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 6 additions & 5 deletions DataFormats/L1TParticleFlow/interface/egamma.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 3f26897

Please sign in to comment.