diff --git a/DataFormats/L1TCorrelator/interface/TkElectron.h b/DataFormats/L1TCorrelator/interface/TkElectron.h index c5b70d79598fb..29a1df62b023b 100644 --- a/DataFormats/L1TCorrelator/interface/TkElectron.h +++ b/DataFormats/L1TCorrelator/interface/TkElectron.h @@ -7,7 +7,6 @@ // Class : TkEm // -#include "DataFormats/Common/interface/Ref.h" #include "DataFormats/Common/interface/Ptr.h" #include "DataFormats/L1Trigger/interface/EGamma.h" @@ -29,27 +28,34 @@ namespace l1t { TkElectron(); TkElectron(const LorentzVector& p4, - const edm::Ref& egRef, + const edm::Ptr& egCaloPtr, const edm::Ptr& trkPtr, float tkisol = -999.); + TkElectron(const LorentzVector& p4, float tkisol = -999.); + // ---------- const member functions --------------------- const edm::Ptr& trkPtr() const { return trkPtr_; } float trkzVtx() const { return trkzVtx_; } - double trackCurvature() const { return trackCurvature_; } float idScore() const { return idScore_; } // ---------- member functions --------------------------- + void setTrkPtr(const edm::Ptr& tkPtr) { trkPtr_ = tkPtr; } void setTrkzVtx(float TrkzVtx) { trkzVtx_ = TrkzVtx; } - void setTrackCurvature(double trackCurvature) { trackCurvature_ = trackCurvature; } void setIdScore(float score) { idScore_ = score; } + l1gt::Electron hwObj() const { + if (encoding() != HWEncoding::GT) { + throw cms::Exception("RuntimeError") << "TkElectron::hwObj : encoding is not in GT format!" << std::endl; + } + return l1gt::Electron::unpack_ap(egBinaryWord()); + } + private: edm::Ptr trkPtr_; float trkzVtx_; - double trackCurvature_; float idScore_; }; } // namespace l1t diff --git a/DataFormats/L1TCorrelator/interface/TkEm.h b/DataFormats/L1TCorrelator/interface/TkEm.h index d3d9c36a41c7f..051a324a8e082 100644 --- a/DataFormats/L1TCorrelator/interface/TkEm.h +++ b/DataFormats/L1TCorrelator/interface/TkEm.h @@ -8,11 +8,14 @@ // #include "DataFormats/L1Trigger/interface/L1Candidate.h" -#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/Common/interface/Ptr.h" #include "DataFormats/L1Trigger/interface/EGamma.h" #include "DataFormats/L1TrackTrigger/interface/TTTypes.h" +#include "DataFormats/L1TParticleFlow/interface/gt_datatypes.h" +#include "FWCore/Utilities/interface/Exception.h" + #include namespace l1t { @@ -21,22 +24,15 @@ namespace l1t { public: TkEm(); - TkEm(const LorentzVector& p4, const edm::Ref& egRef, float tkisol = -999.); - - TkEm(const LorentzVector& p4, - const edm::Ref& egRef, - float tkisol = -999., - float tkisolPV = -999); - - // ---------- const member functions --------------------- + TkEm(const LorentzVector& p4, float tkisol = -999., float tkisolPV = -999); - const edm::Ref& EGRef() const { return egRef_; } + TkEm(const LorentzVector& p4, const edm::Ptr& egCaloPtr, float tkisol = -999., float tkisolPV = -999); - const double l1RefEta() const { return egRef_->eta(); } + enum class HWEncoding { None, CT, GT }; - const double l1RefPhi() const { return egRef_->phi(); } + // ---------- const member functions --------------------- - const double l1RefEt() const { return egRef_->et(); } + const edm::Ptr& egCaloPtr() const { return egCaloPtr_; } float trkIsol() const { return trkIsol_; } // not constrained to the PV, just track ptSum float trkIsolPV() const { return trkIsolPV_; } // constrained to the PV by DZ @@ -53,13 +49,21 @@ namespace l1t { void setPFIsolPV(float pfIsolPV) { pfIsolPV_ = pfIsolPV; } void setPuppiIsol(float puppiIsol) { puppiIsol_ = puppiIsol; } void setPuppiIsolPV(float puppiIsolPV) { puppiIsolPV_ = puppiIsolPV; } - void setEGRef(const edm::Ref& egRef) { egRef_ = egRef; } + void setEgCaloPtr(const edm::Ptr& egPtr) { egCaloPtr_ = egPtr; } template - void setEgBinaryWord(ap_uint word) { + void setEgBinaryWord(ap_uint word, HWEncoding encoding) { egBinaryWord0_ = word; egBinaryWord1_ = (word >> 32); egBinaryWord2_ = (word >> 64); + encoding_ = encoding; + } + + l1gt::Photon hwObj() const { + if (encoding() != HWEncoding::GT) { + throw cms::Exception("RuntimeError") << "TkEm::hwObj : encoding is not in GT format!" << std::endl; + } + return l1gt::Photon::unpack_ap(egBinaryWord()); } template @@ -67,8 +71,10 @@ namespace l1t { return ap_uint(egBinaryWord0_) | (ap_uint(egBinaryWord1_) << 32) | (ap_uint(egBinaryWord2_) << 64); } + HWEncoding encoding() const { return encoding_; } + private: - edm::Ref egRef_; + edm::Ptr egCaloPtr_; float trkIsol_; float trkIsolPV_; float pfIsol_; @@ -78,6 +84,7 @@ namespace l1t { uint32_t egBinaryWord0_; uint32_t egBinaryWord1_; uint32_t egBinaryWord2_; + HWEncoding encoding_; }; } // namespace l1t diff --git a/DataFormats/L1TCorrelator/src/TkElectron.cc b/DataFormats/L1TCorrelator/src/TkElectron.cc index d587395584e92..60a1ae72c91d7 100644 --- a/DataFormats/L1TCorrelator/src/TkElectron.cc +++ b/DataFormats/L1TCorrelator/src/TkElectron.cc @@ -11,14 +11,14 @@ using namespace l1t; TkElectron::TkElectron() {} TkElectron::TkElectron(const LorentzVector& p4, - const edm::Ref& egRef, + const edm::Ptr& egCaloPtr, const edm::Ptr& trackPtr, float tkisol) - : TkEm(p4, egRef, tkisol, -999), - trkPtr_(trackPtr) - -{ + : TkEm(p4, egCaloPtr, tkisol, -999), trkPtr_(trackPtr) { if (trkPtr_.isNonnull()) { setTrkzVtx(trkPtr()->POCA().z()); } } + +TkElectron::TkElectron(const LorentzVector& p4, float tkisol) + : TkElectron(p4, edm::Ptr(nullptr, 0), edm::Ptr(nullptr, 0), tkisol) {} diff --git a/DataFormats/L1TCorrelator/src/TkEm.cc b/DataFormats/L1TCorrelator/src/TkEm.cc index 276f13c1ec0bf..adbee94433ed3 100644 --- a/DataFormats/L1TCorrelator/src/TkEm.cc +++ b/DataFormats/L1TCorrelator/src/TkEm.cc @@ -5,17 +5,19 @@ // #include "DataFormats/L1TCorrelator/interface/TkEm.h" +// FIXME: can remove +#include "DataFormats/Common/interface/RefToPtr.h" using namespace l1t; TkEm::TkEm() {} -TkEm::TkEm(const LorentzVector& p4, const edm::Ref& egRef, float tkisol) - : TkEm(p4, egRef, tkisol, -999) {} +TkEm::TkEm(const LorentzVector& p4, float tkisol, float tkisolPV) + : TkEm(p4, edm::Ptr(nullptr, 0), tkisol, tkisolPV) {} -TkEm::TkEm(const LorentzVector& p4, const edm::Ref& egRef, float tkisol, float tkisolPV) +TkEm::TkEm(const LorentzVector& p4, const edm::Ptr& egCaloPtr, float tkisol, float tkisolPV) : L1Candidate(p4), - egRef_(egRef), + egCaloPtr_(egCaloPtr), trkIsol_(tkisol), trkIsolPV_(tkisolPV), pfIsol_(-999), @@ -24,4 +26,5 @@ TkEm::TkEm(const LorentzVector& p4, const edm::Ref& egRef, f puppiIsolPV_(-999), egBinaryWord0_(0), egBinaryWord1_(0), - egBinaryWord2_(0) {} + egBinaryWord2_(0), + encoding_(HWEncoding::None) {} diff --git a/DataFormats/L1TCorrelator/src/classes_def.xml b/DataFormats/L1TCorrelator/src/classes_def.xml index 6b5acaf05cbc1..2846fcf2ba77a 100644 --- a/DataFormats/L1TCorrelator/src/classes_def.xml +++ b/DataFormats/L1TCorrelator/src/classes_def.xml @@ -10,7 +10,8 @@ - + + @@ -23,6 +24,12 @@ + + setEgCaloPtr(edm::refToPtr(onfile.egRef_)); + ]]> + + @@ -44,7 +51,9 @@ - + + + diff --git a/DataFormats/L1TParticleFlow/interface/datatypes.h b/DataFormats/L1TParticleFlow/interface/datatypes.h index be802bc540b6e..67655a80a99ba 100644 --- a/DataFormats/L1TParticleFlow/interface/datatypes.h +++ b/DataFormats/L1TParticleFlow/interface/datatypes.h @@ -44,6 +44,7 @@ namespace l1ct { typedef ap_uint<8> meanz_t; // mean - MEANZ_OFFSET(= 320 cm) typedef ap_ufixed<10, 5, AP_TRN, AP_SAT> hoe_t; typedef ap_uint<4> redChi2Bin_t; + typedef ap_fixed<10, 1, AP_RND_CONV, AP_SAT> id_score_t; // ID score to be between -1 (background) and 1 (signal) // FIXME: adjust range 10-11bits -> 1/4 - 1/2TeV is probably more than enough for all reasonable use cases typedef ap_ufixed<11, 9, AP_TRN, AP_SAT> iso_t; @@ -178,6 +179,7 @@ namespace l1ct { inline float floatSrrTot(srrtot_t srrtot) { return srrtot.to_float() / SRRTOT_SCALE; }; inline float floatMeanZ(meanz_t meanz) { return meanz + MEANZ_OFFSET; }; inline float floatHoe(hoe_t hoe) { return hoe.to_float(); }; + inline float floatIDScore(id_score_t score) { return score.to_float(); }; inline pt_t makePt(int pt) { return ap_ufixed<16, 14>(pt) >> 2; } inline dpt_t makeDPt(int dpt) { return ap_fixed<18, 16>(dpt) >> 2; } diff --git a/DataFormats/L1TParticleFlow/interface/egamma.h b/DataFormats/L1TParticleFlow/interface/egamma.h index 457b1700d1021..4b5c85e8f7d7e 100644 --- a/DataFormats/L1TParticleFlow/interface/egamma.h +++ b/DataFormats/L1TParticleFlow/interface/egamma.h @@ -87,15 +87,16 @@ namespace l1ct { z0_t hwZ0; tkdeta_t hwDEta; // relative to the region center, at calo tkdphi_t hwDPhi; // relative to the region center, at calo + 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 && hwIso == other.hwIso && hwDEta == other.hwDEta && hwDPhi == other.hwDPhi && hwZ0 == other.hwZ0 && - hwCharge == other.hwCharge; + hwIDScore == other.hwIDScore && hwCharge == other.hwCharge; } inline bool operator>(const EGIsoEleObj &other) const { return hwPt > other.hwPt; } @@ -110,6 +111,7 @@ namespace l1ct { hwDEta = 0; hwDPhi = 0; hwZ0 = 0; + hwIDScore = 0; hwCharge = false; } @@ -119,8 +121,10 @@ namespace l1ct { float floatVtxEta() const { return Scales::floatEta(hwVtxEta()); } float floatVtxPhi() const { return Scales::floatPhi(hwVtxPhi()); } float floatZ0() const { return Scales::floatZ0(hwZ0); } + float floatIDScore() const { return Scales::floatIDScore(hwIDScore); } - static const int BITWIDTH = EGIsoObj::BITWIDTH + tkdeta_t::width + tkdphi_t::width + z0_t::width + 1; + static const int BITWIDTH = + EGIsoObj::BITWIDTH + tkdeta_t::width + tkdphi_t::width + z0_t::width + id_score_t::width + 1; inline ap_uint pack() const { ap_uint ret; unsigned int start = 0; @@ -133,6 +137,7 @@ namespace l1ct { pack_into_bits(ret, start, hwDPhi); pack_into_bits(ret, start, hwZ0); pack_bool_into_bits(ret, start, hwCharge); + pack_into_bits(ret, start, hwIDScore); return ret; } inline static EGIsoEleObj unpack(const ap_uint &src) { @@ -152,16 +157,18 @@ namespace l1ct { unpack_from_bits(src, start, hwDPhi); unpack_from_bits(src, start, hwZ0); unpack_bool_from_bits(src, start, hwCharge); + unpack_from_bits(src, start, hwIDScore); } l1gt::Electron toGT() const { 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/DataFormats/L1TParticleFlow/interface/layer1_emulator.h b/DataFormats/L1TParticleFlow/interface/layer1_emulator.h index fcb415d426017..50ebbd9893afe 100644 --- a/DataFormats/L1TParticleFlow/interface/layer1_emulator.h +++ b/DataFormats/L1TParticleFlow/interface/layer1_emulator.h @@ -158,14 +158,16 @@ namespace l1ct { struct EGIsoObjEmu : public EGIsoObj { const l1t::PFCluster *srcCluster; - // we use an index to the standalone object needed to retrieve a Ref when putting - int sta_idx; + + // NOTE: we use an index to the persistable RefPtr when we reshuffle collections + // this way we avoid complex object in the object interface which needs to be used in standalone programs + int src_idx; bool read(std::fstream &from); bool write(std::fstream &to) const; void clear() { EGIsoObj::clear(); srcCluster = nullptr; - sta_idx = -1; + src_idx = -1; clearIsoVars(); } @@ -193,17 +195,17 @@ namespace l1ct { struct EGIsoEleObjEmu : public EGIsoEleObj { const l1t::PFCluster *srcCluster; const l1t::PFTrack *srcTrack; - // we use an index to the standalone object needed to retrieve a Ref when putting - int sta_idx; - float idScore; + + // NOTE: we use an index to the persistable RefPtr when we reshuffle collections + // this way we avoid complex object in the object interface which needs to be used in standalone programs + int src_idx; bool read(std::fstream &from); bool write(std::fstream &to) const; void clear() { EGIsoEleObj::clear(); srcCluster = nullptr; srcTrack = nullptr; - sta_idx = -1; - idScore = -999; + src_idx = -1; clearIsoVars(); } @@ -335,7 +337,7 @@ namespace l1ct { }; struct Event { - enum { VERSION = 12 }; + enum { VERSION = 13 }; uint32_t run, lumi; uint64_t event; RawInputs raw; diff --git a/DataFormats/L1TParticleFlow/src/layer1_emulator.cpp b/DataFormats/L1TParticleFlow/src/layer1_emulator.cpp index 3f1284413bbf7..3af2dd4e3eece 100644 --- a/DataFormats/L1TParticleFlow/src/layer1_emulator.cpp +++ b/DataFormats/L1TParticleFlow/src/layer1_emulator.cpp @@ -77,7 +77,7 @@ bool l1ct::PuppiObjEmu::write(std::fstream& to) const { return writeObj(from, *this); } @@ -87,7 +87,7 @@ bool l1ct::EGIsoObjEmu::write(std::fstream& to) const { return writeObj(from, *this); } diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisPhaseII.cc b/L1Trigger/L1TNtuples/src/L1AnalysisPhaseII.cc index 18a4d89de1873..3fc9a7246fd4d 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisPhaseII.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisPhaseII.cc @@ -202,19 +202,18 @@ void L1Analysis::L1AnalysisPhaseII::SetTkEG(const edm::Handleet()); l1extra_.tkElectronEta.push_back(it->eta()); l1extra_.tkElectronPhi.push_back(it->phi()); - int chargeFromCurvature = (it->trackCurvature() > 0) ? 1 : -1; // ThisIsACheck - l1extra_.tkElectronChg.push_back(chargeFromCurvature); + l1extra_.tkElectronChg.push_back(it->charge()); l1extra_.tkElectronzVtx.push_back(it->trkzVtx()); l1extra_.tkElectronTrkIso.push_back(it->trkIsol()); - l1extra_.tkElectronHwQual.push_back(it->EGRef()->hwQual()); - l1extra_.tkElectronEGRefPt.push_back(it->EGRef()->et()); - l1extra_.tkElectronEGRefEta.push_back(it->EGRef()->eta()); - l1extra_.tkElectronEGRefPhi.push_back(it->EGRef()->phi()); + l1extra_.tkElectronHwQual.push_back(it->egCaloPtr()->hwQual()); + l1extra_.tkElectronEGRefPt.push_back(it->egCaloPtr()->et()); + l1extra_.tkElectronEGRefEta.push_back(it->egCaloPtr()->eta()); + l1extra_.tkElectronEGRefPhi.push_back(it->egCaloPtr()->phi()); l1extra_.tkElectronBx.push_back(0); //it->bx()); l1extra_.tkElectronHGC.push_back(0); - bool quality = ((it->EGRef()->hwQual() >> 1) & 1) > 0; // LooseTrackID should be the second bit + bool quality = ((it->egCaloPtr()->hwQual() >> 1) & 1) > 0; // LooseTrackID should be the second bit l1extra_.tkElectronPassesLooseTrackID.push_back(quality); - quality = ((it->EGRef()->hwQual() >> 2) & 1) > 0; // LooseTrackID should be the second bit + quality = ((it->egCaloPtr()->hwQual() >> 2) & 1) > 0; // LooseTrackID should be the second bit l1extra_.tkElectronPassesPhotonID.push_back(quality); l1extra_.nTkElectrons++; } @@ -227,17 +226,16 @@ void L1Analysis::L1AnalysisPhaseII::SetTkEG(const edm::Handleet()); l1extra_.tkElectronEta.push_back(it->eta()); l1extra_.tkElectronPhi.push_back(it->phi()); - int chargeFromCurvature = (it->trackCurvature() > 0) ? 1 : -1; // ThisIsACheck - l1extra_.tkElectronChg.push_back(chargeFromCurvature); + l1extra_.tkElectronChg.push_back(it->charge()); l1extra_.tkElectronzVtx.push_back(it->trkzVtx()); l1extra_.tkElectronTrkIso.push_back(it->trkIsol()); - l1extra_.tkElectronHwQual.push_back(it->EGRef()->hwQual()); - l1extra_.tkElectronEGRefPt.push_back(it->EGRef()->et()); - l1extra_.tkElectronEGRefEta.push_back(it->EGRef()->eta()); - l1extra_.tkElectronEGRefPhi.push_back(it->EGRef()->phi()); + l1extra_.tkElectronHwQual.push_back(it->egCaloPtr()->hwQual()); + l1extra_.tkElectronEGRefPt.push_back(it->egCaloPtr()->et()); + l1extra_.tkElectronEGRefEta.push_back(it->egCaloPtr()->eta()); + l1extra_.tkElectronEGRefPhi.push_back(it->egCaloPtr()->phi()); l1extra_.tkElectronBx.push_back(0); //it->bx()); l1extra_.tkElectronHGC.push_back(1); - bool quality = (it->EGRef()->hwQual() == 5); + bool quality = (it->egCaloPtr()->hwQual() == 5); l1extra_.tkElectronPassesLooseTrackID.push_back(quality); l1extra_.tkElectronPassesPhotonID.push_back(quality); l1extra_.nTkElectrons++; @@ -255,19 +253,18 @@ void L1Analysis::L1AnalysisPhaseII::SetTkEGV2(const edm::Handleet()); l1extra_.tkElectronV2Eta.push_back(it->eta()); l1extra_.tkElectronV2Phi.push_back(it->phi()); - int chargeFromCurvature = (it->trackCurvature() > 0) ? 1 : -1; // ThisIsACheck - l1extra_.tkElectronV2Chg.push_back(chargeFromCurvature); + l1extra_.tkElectronV2Chg.push_back(it->charge()); l1extra_.tkElectronV2zVtx.push_back(it->trkzVtx()); l1extra_.tkElectronV2TrkIso.push_back(it->trkIsol()); - l1extra_.tkElectronV2HwQual.push_back(it->EGRef()->hwQual()); - l1extra_.tkElectronV2EGRefPt.push_back(it->EGRef()->et()); - l1extra_.tkElectronV2EGRefEta.push_back(it->EGRef()->eta()); - l1extra_.tkElectronV2EGRefPhi.push_back(it->EGRef()->phi()); + l1extra_.tkElectronV2HwQual.push_back(it->egCaloPtr()->hwQual()); + l1extra_.tkElectronV2EGRefPt.push_back(it->egCaloPtr()->et()); + l1extra_.tkElectronV2EGRefEta.push_back(it->egCaloPtr()->eta()); + l1extra_.tkElectronV2EGRefPhi.push_back(it->egCaloPtr()->phi()); l1extra_.tkElectronV2Bx.push_back(0); //it->bx()); l1extra_.tkElectronV2HGC.push_back(0); - bool quality = ((it->EGRef()->hwQual() >> 1) & 1) > 0; + bool quality = ((it->egCaloPtr()->hwQual() >> 1) & 1) > 0; l1extra_.tkElectronV2PassesLooseTrackID.push_back(quality); - quality = ((it->EGRef()->hwQual() >> 2) & 1) > 0; + quality = ((it->egCaloPtr()->hwQual() >> 2) & 1) > 0; l1extra_.tkElectronV2PassesPhotonID.push_back(quality); l1extra_.nTkElectronsV2++; } @@ -280,17 +277,16 @@ void L1Analysis::L1AnalysisPhaseII::SetTkEGV2(const edm::Handleet()); l1extra_.tkElectronV2Eta.push_back(it->eta()); l1extra_.tkElectronV2Phi.push_back(it->phi()); - int chargeFromCurvature = (it->trackCurvature() > 0) ? 1 : -1; // ThisIsACheck - l1extra_.tkElectronV2Chg.push_back(chargeFromCurvature); + l1extra_.tkElectronV2Chg.push_back(it->charge()); l1extra_.tkElectronV2zVtx.push_back(it->trkzVtx()); l1extra_.tkElectronV2TrkIso.push_back(it->trkIsol()); - l1extra_.tkElectronV2HwQual.push_back(it->EGRef()->hwQual()); - l1extra_.tkElectronV2EGRefPt.push_back(it->EGRef()->et()); - l1extra_.tkElectronV2EGRefEta.push_back(it->EGRef()->eta()); - l1extra_.tkElectronV2EGRefPhi.push_back(it->EGRef()->phi()); + l1extra_.tkElectronV2HwQual.push_back(it->egCaloPtr()->hwQual()); + l1extra_.tkElectronV2EGRefPt.push_back(it->egCaloPtr()->et()); + l1extra_.tkElectronV2EGRefEta.push_back(it->egCaloPtr()->eta()); + l1extra_.tkElectronV2EGRefPhi.push_back(it->egCaloPtr()->phi()); l1extra_.tkElectronV2Bx.push_back(0); //it->bx()); l1extra_.tkElectronV2HGC.push_back(1); - bool quality = (it->EGRef()->hwQual() == 5); + bool quality = (it->egCaloPtr()->hwQual() == 5); l1extra_.tkElectronV2PassesLooseTrackID.push_back(quality); l1extra_.tkElectronV2PassesPhotonID.push_back(quality); l1extra_.nTkElectronsV2++; @@ -311,14 +307,14 @@ void L1Analysis::L1AnalysisPhaseII::SetTkEM(const edm::HandletrkIsol()); l1extra_.tkPhotonTrkIsoPV.push_back(it->trkIsolPV()); l1extra_.tkPhotonBx.push_back(0); //it->bx()); - l1extra_.tkPhotonHwQual.push_back(it->EGRef()->hwQual()); - l1extra_.tkPhotonEGRefPt.push_back(it->EGRef()->et()); - l1extra_.tkPhotonEGRefEta.push_back(it->EGRef()->eta()); - l1extra_.tkPhotonEGRefPhi.push_back(it->EGRef()->phi()); + l1extra_.tkPhotonHwQual.push_back(it->egCaloPtr()->hwQual()); + l1extra_.tkPhotonEGRefPt.push_back(it->egCaloPtr()->et()); + l1extra_.tkPhotonEGRefEta.push_back(it->egCaloPtr()->eta()); + l1extra_.tkPhotonEGRefPhi.push_back(it->egCaloPtr()->phi()); l1extra_.tkPhotonHGC.push_back(0); - bool quality = ((it->EGRef()->hwQual() >> 1) & 1) > 0; + bool quality = ((it->egCaloPtr()->hwQual() >> 1) & 1) > 0; l1extra_.tkPhotonPassesLooseTrackID.push_back(quality); - quality = ((it->EGRef()->hwQual() >> 2) & 1) > 0; // Photon Id should be the third bit + quality = ((it->egCaloPtr()->hwQual() >> 2) & 1) > 0; // Photon Id should be the third bit l1extra_.tkPhotonPassesPhotonID.push_back(quality); l1extra_.nTkPhotons++; } @@ -333,12 +329,12 @@ void L1Analysis::L1AnalysisPhaseII::SetTkEM(const edm::HandletrkIsol()); l1extra_.tkPhotonTrkIsoPV.push_back(it->trkIsolPV()); l1extra_.tkPhotonBx.push_back(0); //it->bx()); - l1extra_.tkPhotonHwQual.push_back(it->EGRef()->hwQual()); - l1extra_.tkPhotonEGRefPt.push_back(it->EGRef()->et()); - l1extra_.tkPhotonEGRefEta.push_back(it->EGRef()->eta()); - l1extra_.tkPhotonEGRefPhi.push_back(it->EGRef()->phi()); + l1extra_.tkPhotonHwQual.push_back(it->egCaloPtr()->hwQual()); + l1extra_.tkPhotonEGRefPt.push_back(it->egCaloPtr()->et()); + l1extra_.tkPhotonEGRefEta.push_back(it->egCaloPtr()->eta()); + l1extra_.tkPhotonEGRefPhi.push_back(it->egCaloPtr()->phi()); l1extra_.tkPhotonHGC.push_back(1); - bool quality = (it->EGRef()->hwQual() == 5); + bool quality = (it->egCaloPtr()->hwQual() == 5); l1extra_.tkPhotonPassesLooseTrackID.push_back(quality); l1extra_.tkPhotonPassesPhotonID.push_back(quality); l1extra_.nTkPhotons++; diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisPhaseIIStep1.cc b/L1Trigger/L1TNtuples/src/L1AnalysisPhaseIIStep1.cc index 0611575b68ad0..fb8b40bd8f778 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisPhaseIIStep1.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisPhaseIIStep1.cc @@ -170,21 +170,20 @@ void L1Analysis::L1AnalysisPhaseIIStep1::SetTkEG(const edm::Handleet()); l1extra_.tkElectronEta.push_back(it->eta()); l1extra_.tkElectronPhi.push_back(it->phi()); - int chargeFromCurvature = (it->trackCurvature() > 0) ? 1 : -1; // ThisIsACheck - l1extra_.tkElectronChg.push_back(chargeFromCurvature); + l1extra_.tkElectronChg.push_back(it->charge()); l1extra_.tkElectronzVtx.push_back(it->trkzVtx()); l1extra_.tkElectronTrkIso.push_back(it->trkIsol()); l1extra_.tkElectronPfIso.push_back(it->pfIsol()); l1extra_.tkElectronPuppiIso.push_back(it->puppiIsol()); - l1extra_.tkElectronHwQual.push_back(it->EGRef()->hwQual()); - l1extra_.tkElectronEGRefPt.push_back(it->EGRef()->et()); //Rename this? - l1extra_.tkElectronEGRefEta.push_back(it->EGRef()->eta()); - l1extra_.tkElectronEGRefPhi.push_back(it->EGRef()->phi()); + l1extra_.tkElectronHwQual.push_back(it->egCaloPtr()->hwQual()); + l1extra_.tkElectronEGRefPt.push_back(it->egCaloPtr()->et()); //Rename this? + l1extra_.tkElectronEGRefEta.push_back(it->egCaloPtr()->eta()); + l1extra_.tkElectronEGRefPhi.push_back(it->egCaloPtr()->phi()); l1extra_.tkElectronBx.push_back(0); //it->bx()); l1extra_.tkElectronHGC.push_back(0); - bool quality = ((it->EGRef()->hwQual() >> 1) & 1) > 0; // LooseTrackID should be the second bit + bool quality = ((it->egCaloPtr()->hwQual() >> 1) & 1) > 0; // LooseTrackID should be the second bit l1extra_.tkElectronPassesLooseTrackID.push_back(quality); - quality = ((it->EGRef()->hwQual() >> 2) & 1) > 0; // LooseTrackID should be the second bit + quality = ((it->egCaloPtr()->hwQual() >> 2) & 1) > 0; // LooseTrackID should be the second bit l1extra_.tkElectronPassesPhotonID.push_back(quality); l1extra_.nTkElectrons++; } @@ -198,19 +197,18 @@ void L1Analysis::L1AnalysisPhaseIIStep1::SetTkEG(const edm::Handleet()); l1extra_.tkElectronEta.push_back(it->eta()); l1extra_.tkElectronPhi.push_back(it->phi()); - int chargeFromCurvature = (it->trackCurvature() > 0) ? 1 : -1; // ThisIsACheck - l1extra_.tkElectronChg.push_back(chargeFromCurvature); + l1extra_.tkElectronChg.push_back(it->charge()); l1extra_.tkElectronzVtx.push_back(it->trkzVtx()); l1extra_.tkElectronTrkIso.push_back(it->trkIsol()); l1extra_.tkElectronPfIso.push_back(it->pfIsol()); l1extra_.tkElectronPuppiIso.push_back(it->puppiIsol()); - l1extra_.tkElectronHwQual.push_back(it->EGRef()->hwQual()); - l1extra_.tkElectronEGRefPt.push_back(it->EGRef()->et()); //Rename this? - l1extra_.tkElectronEGRefEta.push_back(it->EGRef()->eta()); - l1extra_.tkElectronEGRefPhi.push_back(it->EGRef()->phi()); + l1extra_.tkElectronHwQual.push_back(it->egCaloPtr()->hwQual()); + l1extra_.tkElectronEGRefPt.push_back(it->egCaloPtr()->et()); //Rename this? + l1extra_.tkElectronEGRefEta.push_back(it->egCaloPtr()->eta()); + l1extra_.tkElectronEGRefPhi.push_back(it->egCaloPtr()->phi()); l1extra_.tkElectronBx.push_back(0); //it->bx()); l1extra_.tkElectronHGC.push_back(1); - bool quality = (it->EGRef()->hwQual() == 3); + bool quality = (it->egCaloPtr()->hwQual() == 3); l1extra_.tkElectronPassesLooseTrackID.push_back(quality); l1extra_.tkElectronPassesPhotonID.push_back(quality); l1extra_.nTkElectrons++; @@ -236,14 +234,14 @@ void L1Analysis::L1AnalysisPhaseIIStep1::SetTkEM(const edm::HandlepuppiIsol()); l1extra_.tkPhotonPuppiIsoPV.push_back(it->puppiIsolPV()); l1extra_.tkPhotonBx.push_back(0); //it->bx()); - l1extra_.tkPhotonHwQual.push_back(it->EGRef()->hwQual()); - l1extra_.tkPhotonEGRefPt.push_back(it->EGRef()->et()); //REname this? - l1extra_.tkPhotonEGRefEta.push_back(it->EGRef()->eta()); - l1extra_.tkPhotonEGRefPhi.push_back(it->EGRef()->phi()); + l1extra_.tkPhotonHwQual.push_back(it->egCaloPtr()->hwQual()); + l1extra_.tkPhotonEGRefPt.push_back(it->egCaloPtr()->et()); //REname this? + l1extra_.tkPhotonEGRefEta.push_back(it->egCaloPtr()->eta()); + l1extra_.tkPhotonEGRefPhi.push_back(it->egCaloPtr()->phi()); l1extra_.tkPhotonHGC.push_back(0); - bool quality = ((it->EGRef()->hwQual() >> 1) & 1) > 0; + bool quality = ((it->egCaloPtr()->hwQual() >> 1) & 1) > 0; l1extra_.tkPhotonPassesLooseTrackID.push_back(quality); - quality = ((it->EGRef()->hwQual() >> 2) & 1) > 0; // Photon Id should be the third bit + quality = ((it->egCaloPtr()->hwQual() >> 2) & 1) > 0; // Photon Id should be the third bit l1extra_.tkPhotonPassesPhotonID.push_back(quality); l1extra_.nTkPhotons++; } @@ -263,12 +261,12 @@ void L1Analysis::L1AnalysisPhaseIIStep1::SetTkEM(const edm::HandlepuppiIsol()); l1extra_.tkPhotonPuppiIsoPV.push_back(it->puppiIsolPV()); l1extra_.tkPhotonBx.push_back(0); //it->bx()); - l1extra_.tkPhotonHwQual.push_back(it->EGRef()->hwQual()); - l1extra_.tkPhotonEGRefPt.push_back(it->EGRef()->et()); //rename this? - l1extra_.tkPhotonEGRefEta.push_back(it->EGRef()->eta()); - l1extra_.tkPhotonEGRefPhi.push_back(it->EGRef()->phi()); + l1extra_.tkPhotonHwQual.push_back(it->egCaloPtr()->hwQual()); + l1extra_.tkPhotonEGRefPt.push_back(it->egCaloPtr()->et()); //rename this? + l1extra_.tkPhotonEGRefEta.push_back(it->egCaloPtr()->eta()); + l1extra_.tkPhotonEGRefPhi.push_back(it->egCaloPtr()->phi()); l1extra_.tkPhotonHGC.push_back(1); - bool quality = (it->EGRef()->hwQual() == 3); + bool quality = (it->egCaloPtr()->hwQual() == 3); l1extra_.tkPhotonPassesLooseTrackID.push_back(quality); l1extra_.tkPhotonPassesPhotonID.push_back(quality); l1extra_.nTkPhotons++; diff --git a/L1Trigger/Phase2L1ParticleFlow/interface/egamma/pftkegalgo_ref.h b/L1Trigger/Phase2L1ParticleFlow/interface/egamma/pftkegalgo_ref.h index 560325e46cb0c..c1a6a690a4d38 100644 --- a/L1Trigger/Phase2L1ParticleFlow/interface/egamma/pftkegalgo_ref.h +++ b/L1Trigger/Phase2L1ParticleFlow/interface/egamma/pftkegalgo_ref.h @@ -62,8 +62,8 @@ namespace l1ct { CompIDParameters(const edm::ParameterSet &); CompIDParameters(double bdtScore_loose_wp, double bdtScore_tight_wp, const std::string &model) : bdtScore_loose_wp(bdtScore_loose_wp), bdtScore_tight_wp(bdtScore_tight_wp), conifer_model(model) {} - const double bdtScore_loose_wp; // XGBOOST score - const double bdtScore_tight_wp; // XGBOOST score + const id_score_t bdtScore_loose_wp; // Conifer score/4 + const id_score_t bdtScore_tight_wp; // Conifer score/4 const std::string conifer_model; }; @@ -169,7 +169,7 @@ namespace l1ct { const std::vector &emcalo, const std::vector &track, std::vector &emCalo2tk, - std::vector &emCaloTkBdtScore) const; + std::vector &emCaloTkBdtScore) const; struct CompositeCandidate { unsigned int cluster_idx; @@ -177,10 +177,10 @@ namespace l1ct { double dpt; // For sorting }; - float compute_composite_score(CompositeCandidate &cand, - const std::vector &emcalo, - const std::vector &track, - const PFTkEGAlgoEmuConfig::CompIDParameters ¶ms) const; + id_score_t compute_composite_score(CompositeCandidate &cand, + const std::vector &emcalo, + const std::vector &track, + const PFTkEGAlgoEmuConfig::CompIDParameters ¶ms) const; //FIXME: still needed float deltaPhi(float phi1, float phi2) const; @@ -194,7 +194,7 @@ namespace l1ct { const std::vector &track, const std::vector &emCalo2emCalo, const std::vector &emCalo2tk, - const std::vector &emCaloTkBdtScore, + const std::vector &emCaloTkBdtScore, std::vector &egstas, std::vector &egobjs, std::vector &egeleobjs) const; @@ -208,7 +208,7 @@ namespace l1ct { const unsigned int hwQual, const pt_t ptCorr, const int tk_idx, - const float bdtScore, + const id_score_t bdtScore, const std::vector &components = {}) const; EGObjEmu &addEGStaToPF(std::vector &egobjs, @@ -227,7 +227,7 @@ namespace l1ct { const TkObjEmu &track, const unsigned int hwQual, const pt_t ptCorr, - const float bdtScore) const; + const id_score_t bdtScore) const; // FIXME: reimplemented from PFAlgoEmulatorBase template diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc index 6d3779404c679..5f1a0b55752c2 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCorrelatorLayer1Producer.cc @@ -152,12 +152,9 @@ class L1TCorrelatorLayer1Producer : public edm::stream::EDProducer<> { std::unique_ptr> fetchDecodedTracks() const; void putPuppi(edm::Event &iEvent) const; - void putEgStaObjects(edm::Event &iEvent, - const std::string &egLablel, - std::vector>> &egsta_refs); + void putEgStaObjects(edm::Event &iEvent, const std::string &egLablel) const; void putEgObjects(edm::Event &iEvent, const bool writeEgSta, - const std::vector>> &egsta_refs, const std::string &tkEmLabel, const std::string &tkEmPerBoardLabel, const std::string &tkEleLabel, @@ -489,7 +486,7 @@ void L1TCorrelatorLayer1Producer::produce(edm::Event &iEvent, const edm::EventSe // get a global reference to the EGSta before being mixed among differente regions std::vector>> egsta_refs; if (l1tkegalgo_->writeEgSta()) { - putEgStaObjects(iEvent, "L1Eg", egsta_refs); + putEgStaObjects(iEvent, "L1Eg"); } // l1tkegsorter_->setDebug(true); @@ -505,7 +502,7 @@ void L1TCorrelatorLayer1Producer::produce(edm::Event &iEvent, const edm::EventSe putPuppi(iEvent); // save the EG objects - putEgObjects(iEvent, l1tkegalgo_->writeEgSta(), egsta_refs, "L1TkEm", "L1TkEmPerBoard", "L1TkEle", "L1TkElePerBoard"); + putEgObjects(iEvent, l1tkegalgo_->writeEgSta(), "L1TkEm", "L1TkEmPerBoard", "L1TkEle", "L1TkElePerBoard"); // Then go do the multiplicities for (int i = 0; i <= l1muType; ++i) { @@ -1015,22 +1012,13 @@ void L1TCorrelatorLayer1Producer::putPuppi(edm::Event &iEvent) const { iEvent.put(std::move(reg), "PuppiRegional"); } -// NOTE: as a side effect we change the "sta_idx" of TkEle and TkEm objects to an index of the -// vector of refs, for this reason this is not const. We could make this more explicit via arguments -void L1TCorrelatorLayer1Producer::putEgStaObjects(edm::Event &iEvent, - const std::string &egLablel, - std::vector>> &egsta_refs) { +void L1TCorrelatorLayer1Producer::putEgStaObjects(edm::Event &iEvent, const std::string &egLablel) const { auto egs = std::make_unique>(); - edm::RefProd> ref_egs = iEvent.getRefBeforePut>(egLablel); - - edm::Ref>::key_type idx = 0; // FIXME: in case more BXes are introduced shuld probably use egs->key(egs->end(bx)); for (unsigned int ir = 0, nr = event_.pfinputs.size(); ir < nr; ++ir) { const auto ® = event_.pfinputs[ir].region; - std::vector ref_pos(event_.out[ir].egsta.size()); - // EG standalone objects for (unsigned int ieg = 0, neg = event_.out[ir].egsta.size(); ieg < neg; ++ieg) { const auto &p = event_.out[ir].egsta[ieg]; @@ -1040,20 +1028,6 @@ void L1TCorrelatorLayer1Producer::putEgStaObjects(edm::Event &iEvent, reco::Candidate::PolarLorentzVector(p.floatPt(), reg.floatGlbEta(p.hwEta), reg.floatGlbPhi(p.hwPhi), 0.)); eg.setHwQual(p.hwQual); egs->push_back(0, eg); - egsta_refs.push_back(edm::Ref>(ref_egs, idx++)); - ref_pos[ieg] = egsta_refs.size() - 1; - } - - for (auto &egiso : event_.out[ir].egphoton) { - if (egiso.hwPt == 0) - continue; - egiso.sta_idx = ref_pos[egiso.sta_idx]; - } - - for (auto &egele : event_.out[ir].egelectron) { - if (egele.hwPt == 0) - continue; - egele.sta_idx = ref_pos[egele.sta_idx]; } } @@ -1062,7 +1036,6 @@ void L1TCorrelatorLayer1Producer::putEgStaObjects(edm::Event &iEvent, void L1TCorrelatorLayer1Producer::putEgObjects(edm::Event &iEvent, const bool writeEgSta, - const std::vector>> &egsta_refs, const std::string &tkEmLabel, const std::string &tkEmPerBoardLabel, const std::string &tkEleLabel, @@ -1085,25 +1058,16 @@ void L1TCorrelatorLayer1Producer::putEgObjects(edm::Event &iEvent, if (egiso.hwPt == 0) continue; - edm::Ref> ref_egsta; - if (writeEgSta) { - ref_egsta = egsta_refs[egiso.sta_idx]; - } else { - auto egptr = egiso.srcCluster->constituentsAndFractions()[0].first; - ref_egsta = - edm::Ref>(egptr.id(), dynamic_cast(egptr.get()), egptr.key()); - } - reco::Candidate::PolarLorentzVector mom(egiso.floatPt(), egiso.floatEta(), egiso.floatPhi(), 0.); l1t::TkEm tkem(reco::Candidate::LorentzVector(mom), - ref_egsta, + egiso.srcCluster->constituentsAndFractions()[0].first, egiso.floatRelIso(l1ct::EGIsoObjEmu::IsoType::TkIso), egiso.floatRelIso(l1ct::EGIsoObjEmu::IsoType::TkIsoPV)); tkem.setHwQual(egiso.hwQual); tkem.setPFIsol(egiso.floatRelIso(l1ct::EGIsoObjEmu::IsoType::PfIso)); tkem.setPFIsolPV(egiso.floatRelIso(l1ct::EGIsoObjEmu::IsoType::PfIsoPV)); - tkem.setEgBinaryWord(egiso.pack()); + tkem.setEgBinaryWord(egiso.pack(), l1t::TkEm::HWEncoding::CT); tkems->push_back(tkem); npho_obj.push_back(tkems->size() - 1); } @@ -1114,25 +1078,17 @@ void L1TCorrelatorLayer1Producer::putEgObjects(edm::Event &iEvent, if (egele.hwPt == 0) continue; - edm::Ref> ref_egsta; - if (writeEgSta) { - ref_egsta = egsta_refs[egele.sta_idx]; - } else { - auto egptr = egele.srcCluster->constituentsAndFractions()[0].first; - ref_egsta = - edm::Ref>(egptr.id(), dynamic_cast(egptr.get()), egptr.key()); - } - - 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), - ref_egsta, + egele.srcCluster->constituentsAndFractions()[0].first, edm::refToPtr(egele.srcTrack->track()), egele.floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::TkIso)); tkele.setHwQual(egele.hwQual); tkele.setPFIsol(egele.floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::PfIso)); - tkele.setEgBinaryWord(egele.pack()); - tkele.setIdScore(egele.idScore); + 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 6097408bf20e3..7134ea9b2c25d 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1TCtL2EgProducer.cc @@ -44,16 +44,13 @@ class L1TCtL2EgProducer : public edm::global::EDProducer<> { void endJob() override; - struct RefRemapper { - typedef TTTrack L1TTTrackType; + typedef TTTrack L1TTTrackType; + typedef std::vector, edm::Ptr>> ConstituentPtrVector; - BXVector>> oldRefs; - std::map>, edm::Ref>> old2newRefMap; - std::vector, edm::Ptr>> origRefAndPtr; - }; - - void convertToEmu(const l1t::TkElectron &tkele, RefRemapper &refRemapper, l1ct::OutputBoard &boarOut) const; - void convertToEmu(const l1t::TkEm &tkele, RefRemapper &refRemapper, l1ct::OutputBoard &boarOut) const; + void convertToEmu(const l1t::TkElectron &tkele, + ConstituentPtrVector &constituentsPtrs, + l1ct::OutputBoard &boarOut) const; + void convertToEmu(const l1t::TkEm &tkele, ConstituentPtrVector &constituentsPtrs, l1ct::OutputBoard &boarOut) const; void convertToPuppi(const l1t::PFCandidateCollection &l1PFCands, l1ct::PuppiObjs &puppiObjs) const; template @@ -115,24 +112,12 @@ class L1TCtL2EgProducer : public edm::global::EDProducer<> { template void merge(const PFInstanceInputs &instance, edm::Event &iEvent, - RefRemapper &refRemapper, + ConstituentPtrVector &constituentsPtrs, std::unique_ptr &out) const { edm::Handle handle; for (const auto &tokenAndChannel : instance.tokensAndChannels()) { iEvent.getByToken(tokenAndChannel.first, handle); - populate(out, handle, tokenAndChannel.second, refRemapper); - } - remapRefs(iEvent, out, refRemapper); - } - - template - void remapRefs(edm::Event &iEvent, std::unique_ptr &out, RefRemapper &refRemapper) const {} - - void remapRefs(edm::Event &iEvent, std::unique_ptr> &out, RefRemapper &refRemapper) const { - edm::RefProd> ref_egs = iEvent.getRefBeforePut>(tkEGInstanceLabel_); - edm::Ref>::key_type idx = 0; - for (std::size_t ix = 0; ix < out->size(); ix++) { - refRemapper.old2newRefMap[refRemapper.oldRefs[ix]] = edm::Ref>(ref_egs, idx++); + populate(out, handle, tokenAndChannel.second, constituentsPtrs); } } @@ -140,7 +125,7 @@ class L1TCtL2EgProducer : public edm::global::EDProducer<> { void populate(std::unique_ptr &out, const edm::Handle &in, const std::vector &links, - RefRemapper &refRemapper) const { + ConstituentPtrVector &constituentsPtrs) const { assert(links.size() == in->nRegions()); for (unsigned int iBoard = 0, nBoard = in->nRegions(); iBoard < nBoard; ++iBoard) { auto region = in->region(iBoard); @@ -149,7 +134,7 @@ class L1TCtL2EgProducer : public edm::global::EDProducer<> { continue; // std::cout << "Board eta: " << in->eta(iBoard) << " phi: " << in->phi(iBoard) << " link: " << linkID << std::endl; for (const auto &obj : region) { - convertToEmu(obj, refRemapper, out->at(linkID)); + convertToEmu(obj, constituentsPtrs, out->at(linkID)); } } } @@ -157,36 +142,31 @@ class L1TCtL2EgProducer : public edm::global::EDProducer<> { void populate(std::unique_ptr> &out, const edm::Handle> &in, const std::vector &links, - RefRemapper &refRemapper) const { - edm::Ref>::key_type idx = 0; + ConstituentPtrVector &constituentsPtrs) const { for (int bx = in->getFirstBX(); bx <= in->getLastBX(); bx++) { for (auto egee_itr = in->begin(bx); egee_itr != in->end(bx); egee_itr++) { out->push_back(bx, *egee_itr); - // this to ensure that the old ref and the new object have the same - // index in the BXVector collection so that we can still match them no - // matter which BX we will insert next - refRemapper.oldRefs.push_back(bx, edm::Ref>(in, idx++)); } } } template void putEgObjects(edm::Event &iEvent, - const RefRemapper &refRemapper, + const ConstituentPtrVector &constituentsPtrs, const std::string &label, const std::vector emulated) const { auto egobjs = std::make_unique(); for (const auto &emu : emulated) { if (emu.hwPt == 0) continue; - auto obj = convertFromEmu(emu, refRemapper); + auto obj = convertFromEmu(emu, constituentsPtrs); egobjs->push_back(obj); } iEvent.put(std::move(egobjs), label); } - l1t::TkEm convertFromEmu(const l1ct::EGIsoObjEmu &emu, const RefRemapper &refRemapper) const; - l1t::TkElectron convertFromEmu(const l1ct::EGIsoEleObjEmu &emu, const RefRemapper &refRemapper) const; + l1t::TkEm convertFromEmu(const l1ct::EGIsoObjEmu &emu, const ConstituentPtrVector &constituentsPtrs) const; + l1t::TkElectron convertFromEmu(const l1ct::EGIsoEleObjEmu &emu, const ConstituentPtrVector &constituentsPtrs) const; PFInstanceInputs> tkEGInputs_; PFInstanceInputs tkEmInputs_; @@ -283,16 +263,16 @@ std::vector> L1TCtL2EgProducer::encodeLayer1EgObjs(unsigned int nObj } void L1TCtL2EgProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &) const { - RefRemapper refmapper; + ConstituentPtrVector constituents; auto outEgs = std::make_unique>(); - merge(tkEGInputs_, iEvent, refmapper, outEgs); + merge(tkEGInputs_, iEvent, constituents, outEgs); iEvent.put(std::move(outEgs), tkEGInstanceLabel_); auto boards = std::make_unique>(l2egsorter.nInputBoards()); - merge(tkEleInputs_, iEvent, refmapper, boards); - merge(tkEmInputs_, iEvent, refmapper, boards); + merge(tkEleInputs_, iEvent, constituents, boards); + merge(tkEmInputs_, iEvent, constituents, boards); if (doInPtrn_) { l1t::demo::EventData inData; @@ -321,8 +301,8 @@ void L1TCtL2EgProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::Ev outPtrnWrt_->addEvent(outData); } - putEgObjects(iEvent, refmapper, tkEmInstanceLabel_, out_photons_emu); - putEgObjects(iEvent, refmapper, tkEleInstanceLabel_, out_eles_emu); + putEgObjects(iEvent, constituents, tkEmInstanceLabel_, out_photons_emu); + putEgObjects(iEvent, constituents, tkEleInstanceLabel_, out_eles_emu); } void L1TCtL2EgProducer::endJob() { @@ -334,49 +314,40 @@ void L1TCtL2EgProducer::endJob() { } void L1TCtL2EgProducer::convertToEmu(const l1t::TkElectron &tkele, - RefRemapper &refRemapper, + ConstituentPtrVector &constituentsPtrs, l1ct::OutputBoard &boarOut) const { EGIsoEleObjEmu emu; emu.initFromBits(tkele.egBinaryWord()); emu.srcCluster = nullptr; emu.srcTrack = nullptr; - auto refEg = tkele.EGRef(); - const auto newref = refRemapper.old2newRefMap.find(refEg); - if (newref != refRemapper.old2newRefMap.end()) { - refEg = newref->second; - } - refRemapper.origRefAndPtr.push_back(std::make_pair(refEg, tkele.trkPtr())); - emu.sta_idx = refRemapper.origRefAndPtr.size() - 1; + + // FIXME: this is hugly + constituentsPtrs.push_back(std::make_pair(tkele.egCaloPtr(), tkele.trkPtr())); + emu.src_idx = constituentsPtrs.size() - 1; + // NOTE: The emulator and FW data-format stores absolute iso while the CMSSW object stores relative iso emu.setHwIso(EGIsoEleObjEmu::IsoType::TkIso, l1ct::Scales::makeIso(tkele.trkIsol() * tkele.pt())); emu.setHwIso(EGIsoEleObjEmu::IsoType::PfIso, l1ct::Scales::makeIso(tkele.pfIsol() * tkele.pt())); emu.setHwIso(EGIsoEleObjEmu::IsoType::PuppiIso, l1ct::Scales::makeIso(tkele.puppiIsol() * tkele.pt())); - // std::cout << "[convertToEmu] TkEle pt: " << emu.hwPt << " eta: " << emu.hwEta << " phi: " << emu.hwPhi << " staidx: " << emu.sta_idx << std::endl; - // FIXME: this is temporary while waiting to move the BDT score to the FW object - emu.idScore = tkele.idScore(); + // std::cout << "[convertToEmu] TkEle pt: " << emu.hwPt << " eta: " << emu.hwEta << " phi: " << emu.hwPhi << " staidx: " << emu.src_idx << std::endl; boarOut.egelectron.push_back(emu); } void L1TCtL2EgProducer::convertToEmu(const l1t::TkEm &tkem, - RefRemapper &refRemapper, + ConstituentPtrVector &constituentsPtrs, l1ct::OutputBoard &boarOut) const { EGIsoObjEmu emu; emu.initFromBits(tkem.egBinaryWord()); emu.srcCluster = nullptr; - auto refEg = tkem.EGRef(); - const auto newref = refRemapper.old2newRefMap.find(refEg); - if (newref != refRemapper.old2newRefMap.end()) { - refEg = newref->second; - } - refRemapper.origRefAndPtr.push_back(std::make_pair(refEg, edm::Ptr(nullptr, 0))); - emu.sta_idx = refRemapper.origRefAndPtr.size() - 1; + constituentsPtrs.push_back(std::make_pair(tkem.egCaloPtr(), edm::Ptr(nullptr, 0))); + emu.src_idx = constituentsPtrs.size() - 1; // NOTE: The emulator and FW data-format stores absolute iso while the CMSSW object stores relative iso emu.setHwIso(EGIsoObjEmu::IsoType::TkIso, l1ct::Scales::makeIso(tkem.trkIsol() * tkem.pt())); emu.setHwIso(EGIsoObjEmu::IsoType::PfIso, l1ct::Scales::makeIso(tkem.pfIsol() * tkem.pt())); emu.setHwIso(EGIsoObjEmu::IsoType::PuppiIso, l1ct::Scales::makeIso(tkem.puppiIsol() * tkem.pt())); emu.setHwIso(EGIsoObjEmu::IsoType::TkIsoPV, l1ct::Scales::makeIso(tkem.trkIsolPV() * tkem.pt())); emu.setHwIso(EGIsoObjEmu::IsoType::PfIsoPV, l1ct::Scales::makeIso(tkem.pfIsolPV() * tkem.pt())); - // std::cout << "[convertToEmu] TkEM pt: " << emu.hwPt << " eta: " << emu.hwEta << " phi: " << emu.hwPhi << " staidx: " << emu.sta_idx << std::endl; + // std::cout << "[convertToEmu] TkEM pt: " << emu.hwPt << " eta: " << emu.hwEta << " phi: " << emu.hwPhi << " staidx: " << emu.src_idx << std::endl; boarOut.egphoton.push_back(emu); } @@ -388,42 +359,44 @@ void L1TCtL2EgProducer::convertToPuppi(const l1t::PFCandidateCollection &l1PFCan } } -l1t::TkEm L1TCtL2EgProducer::convertFromEmu(const l1ct::EGIsoObjEmu &egiso, const RefRemapper &refRemapper) const { - // std::cout << "[convertFromEmu] TkEm pt: " << egiso.hwPt << " eta: " << egiso.hwEta << " phi: " << egiso.hwPhi << " staidx: " << egiso.sta_idx << std::endl; +l1t::TkEm L1TCtL2EgProducer::convertFromEmu(const l1ct::EGIsoObjEmu &egiso, + const ConstituentPtrVector &constituentsPtrs) const { + // std::cout << "[convertFromEmu] TkEm pt: " << egiso.hwPt << " eta: " << egiso.hwEta << " phi: " << egiso.hwPhi << " staidx: " << egiso.src_idx << std::endl; // NOTE: the TkEM object is created with the accuracy as in GT object (not the Correlator internal one)! const auto gteg = egiso.toGT(); reco::Candidate::PolarLorentzVector mom( l1gt::Scales::floatPt(gteg.v3.pt), l1gt::Scales::floatEta(gteg.v3.eta), l1gt::Scales::floatPhi(gteg.v3.phi), 0.); // NOTE: The emulator and FW data-format stores absolute iso while the CMSSW object stores relative iso l1t::TkEm tkem(reco::Candidate::LorentzVector(mom), - refRemapper.origRefAndPtr[egiso.sta_idx].first, + constituentsPtrs[egiso.src_idx].first, egiso.floatRelIso(l1ct::EGIsoObjEmu::IsoType::TkIso), egiso.floatRelIso(l1ct::EGIsoObjEmu::IsoType::TkIsoPV)); tkem.setHwQual(gteg.quality); tkem.setPFIsol(egiso.floatRelIso(l1ct::EGIsoObjEmu::IsoType::PfIso)); tkem.setPFIsolPV(egiso.floatRelIso(l1ct::EGIsoObjEmu::IsoType::PfIsoPV)); tkem.setPuppiIsol(egiso.floatRelIso(l1ct::EGIsoObjEmu::IsoType::PuppiIso)); - tkem.setEgBinaryWord(gteg.pack()); + tkem.setEgBinaryWord(gteg.pack(), l1t::TkEm::HWEncoding::GT); return tkem; } l1t::TkElectron L1TCtL2EgProducer::convertFromEmu(const l1ct::EGIsoEleObjEmu &egele, - const RefRemapper &refRemapper) const { - // std::cout << "[convertFromEmu] TkEle pt: " << egele.hwPt << " eta: " << egele.hwEta << " phi: " << egele.hwPhi << " staidx: " << egele.sta_idx << std::endl; + const ConstituentPtrVector &constituentsPtrs) const { + // std::cout << "[convertFromEmu] TkEle pt: " << egele.hwPt << " eta: " << egele.hwEta << " phi: " << egele.hwPhi << " staidx: " << egele.src_idx << std::endl; // NOTE: the TkElectron object is created with the accuracy as in GT object (not the Correlator internal one)! const auto gteg = egele.toGT(); reco::Candidate::PolarLorentzVector mom( l1gt::Scales::floatPt(gteg.v3.pt), l1gt::Scales::floatEta(gteg.v3.eta), l1gt::Scales::floatPhi(gteg.v3.phi), 0.); // NOTE: The emulator and FW data-format stores absolute iso while the CMSSW object stores relative iso l1t::TkElectron tkele(reco::Candidate::LorentzVector(mom), - refRemapper.origRefAndPtr[egele.sta_idx].first, - refRemapper.origRefAndPtr[egele.sta_idx].second, + constituentsPtrs[egele.src_idx].first, + constituentsPtrs[egele.src_idx].second, egele.floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::TkIso)); tkele.setHwQual(gteg.quality); tkele.setPFIsol(egele.floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::PfIso)); tkele.setPuppiIsol(egele.floatRelIso(l1ct::EGIsoEleObjEmu::IsoType::PuppiIso)); - tkele.setEgBinaryWord(gteg.pack()); - tkele.setIdScore(egele.idScore); + tkele.setEgBinaryWord(gteg.pack(), l1t::TkElectron::HWEncoding::GT); + tkele.setIdScore(egele.floatIDScore()); + tkele.setCharge(egele.intCharge()); return tkele; } diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TEGMultiMerger.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1TEGMultiMerger.cc index 44a83bf22db7a..0a7f01fa8c254 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TEGMultiMerger.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1TEGMultiMerger.cc @@ -20,11 +20,6 @@ class L1TEGMultiMerger : public edm::global::EDProducer<> { private: void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - struct RefRemapper { - BXVector>> oldRefs; - std::map>, edm::Ref>> old2newRefMap; - }; - template class InstanceMerger { public: @@ -38,51 +33,26 @@ class L1TEGMultiMerger : public edm::global::EDProducer<> { prod->produces(instanceLabel_); } - void produce(edm::Event& iEvent, RefRemapper& refRemapper) const { + void produce(edm::Event& iEvent) const { edm::Handle handle; auto out = std::make_unique(); for (const auto& token : tokens_) { iEvent.getByToken(token, handle); - populate(out, handle, refRemapper); + populate(out, handle); } - remapRefs(iEvent, out, refRemapper); iEvent.put(std::move(out), instanceLabel_); } private: template - void remapRefs(edm::Event& iEvent, std::unique_ptr& out, RefRemapper& refRemapper) const { - for (auto& egobj : *out) { - auto newref = refRemapper.old2newRefMap.find(egobj.EGRef()); - if (newref != refRemapper.old2newRefMap.end()) { - egobj.setEGRef(newref->second); - } - } - } - - void remapRefs(edm::Event& iEvent, std::unique_ptr>& out, RefRemapper& refRemapper) const { - edm::RefProd> ref_egs = iEvent.getRefBeforePut>(instanceLabel_); - edm::Ref>::key_type idx = 0; - for (std::size_t ix = 0; ix < out->size(); ix++) { - refRemapper.old2newRefMap[refRemapper.oldRefs[ix]] = edm::Ref>(ref_egs, idx++); - } - } - - template - void populate(std::unique_ptr& out, const edm::Handle& in, RefRemapper& refRemapper) const { + void populate(std::unique_ptr& out, const edm::Handle& in) const { out->insert(out->end(), in->begin(), in->end()); } - void populate(std::unique_ptr>& out, - const edm::Handle>& in, - RefRemapper& refRemapper) const { - edm::Ref>::key_type idx = 0; + void populate(std::unique_ptr>& out, const edm::Handle>& in) const { for (int bx = in->getFirstBX(); bx <= in->getLastBX(); bx++) { for (auto egee_itr = in->begin(bx); egee_itr != in->end(bx); egee_itr++) { out->push_back(bx, *egee_itr); - // this to ensure that the old ref and the new object have the same index in the BXVector collection so that we can still match them - // no matter which BX we will insert next - refRemapper.oldRefs.push_back(bx, edm::Ref>(in, idx++)); } } } @@ -111,13 +81,12 @@ L1TEGMultiMerger::L1TEGMultiMerger(const edm::ParameterSet& conf) { L1TEGMultiMerger::~L1TEGMultiMerger() {} void L1TEGMultiMerger::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { - RefRemapper refmapper; for (const auto& egMerger : tkEGMerger) - egMerger.produce(iEvent, refmapper); + egMerger.produce(iEvent); for (const auto& eleMerger : tkEleMerger) - eleMerger.produce(iEvent, refmapper); + eleMerger.produce(iEvent); for (const auto& emMerger : tkEmMerger) - emMerger.produce(iEvent, refmapper); + emMerger.produce(iEvent); } #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/L1Trigger/Phase2L1ParticleFlow/python/l1TkEgAlgoEmulator_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/l1TkEgAlgoEmulator_cfi.py index 4b267ff987db1..2fb19ea8b56eb 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/l1TkEgAlgoEmulator_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/l1TkEgAlgoEmulator_cfi.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms tkEgAlgoParameters = cms.PSet( + # debug=cms.untracked.uint32(4), nTRACK=cms.uint32(50), # very large numbers for first test nTRACK_EGIN=cms.uint32(50), # very large numbers for first test nEMCALO_EGIN=cms.uint32(50), # very large numbers for first test @@ -23,39 +24,36 @@ 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( - # the working points are cuts on BDT output logits log(p/1-p) - loose_wp=cms.double(-0.732422), - tight_wp=cms.double(0.214844), + # NOTE: conifer BDT score is log(p/1-p) + # the working points are cuts on BDT output logits [log(p/1-p)]/4 (range -1 to 1 to match the FW dataformat) + loose_wp=cms.double(-0.181641), + tight_wp=cms.double(0.0527344), model=cms.string("L1Trigger/Phase2L1ParticleFlow/data/compositeID.json") ), ) diff --git a/L1Trigger/Phase2L1ParticleFlow/src/egamma/pftkegalgo_ref.cpp b/L1Trigger/Phase2L1ParticleFlow/src/egamma/pftkegalgo_ref.cpp index da9baff109831..8cb6f63682561 100644 --- a/L1Trigger/Phase2L1ParticleFlow/src/egamma/pftkegalgo_ref.cpp +++ b/L1Trigger/Phase2L1ParticleFlow/src/egamma/pftkegalgo_ref.cpp @@ -181,7 +181,7 @@ void PFTkEGAlgoEmulator::link_emCalo2tk_composite(const PFRegionEmu &r, const std::vector &emcalo, const std::vector &track, std::vector &emCalo2tk, - std::vector &emCaloTkBdtScore) const { + std::vector &emCaloTkBdtScore) const { unsigned int nTrackMax = std::min(track.size(), cfg.nTRACK_EGIN); for (int ic = 0, nc = emcalo.size(); ic < nc; ++ic) { auto &calo = emcalo[ic]; @@ -214,12 +214,12 @@ void PFTkEGAlgoEmulator::link_emCalo2tk_composite(const PFRegionEmu &r, if (nCandPerCluster == 0) continue; - float maxScore = -999; + id_score_t maxScore = -pow(2, l1ct::id_score_t::iwidth - 1); int ibest = -1; for (unsigned int icand = 0; icand < nCandPerCluster; icand++) { auto &cand = candidates[icand]; const std::vector &emcalo_sel = emcalo; - float score = compute_composite_score(cand, emcalo_sel, track, cfg.compIDparams); + id_score_t score = compute_composite_score(cand, emcalo_sel, track, cfg.compIDparams); if ((score > cfg.compIDparams.bdtScore_loose_wp) && (score > maxScore)) { maxScore = score; ibest = icand; @@ -232,10 +232,10 @@ void PFTkEGAlgoEmulator::link_emCalo2tk_composite(const PFRegionEmu &r, } } -float PFTkEGAlgoEmulator::compute_composite_score(CompositeCandidate &cand, - const std::vector &emcalo, - const std::vector &track, - const PFTkEGAlgoEmuConfig::CompIDParameters ¶ms) const { +id_score_t PFTkEGAlgoEmulator::compute_composite_score(CompositeCandidate &cand, + const std::vector &emcalo, + const std::vector &track, + const PFTkEGAlgoEmuConfig::CompIDParameters ¶ms) const { // Get the cluster/track objects that form the composite candidate const auto &calo = emcalo[cand.cluster_idx]; const auto &tk = track[cand.track_idx]; @@ -258,7 +258,7 @@ float PFTkEGAlgoEmulator::compute_composite_score(CompositeCandidate &cand, std::vector inputs = {tkpt, hoe, srrtot, deta, dphi, dpt, meanz, nstubs, chi2rphi, chi2rz, chi2bend}; std::vector bdt_score = composite_bdt_->decision_function(inputs); - return bdt_score[0]; + return bdt_score[0] / 4; } void PFTkEGAlgoEmulator::sel_emCalo(unsigned int nmax_sel, @@ -297,7 +297,7 @@ void PFTkEGAlgoEmulator::run(const PFInputRegion &in, OutputRegion &out) const { link_emCalo2emCalo(emcalo_sel, emCalo2emCalo); std::vector emCalo2tk(emcalo_sel.size(), -1); - std::vector emCaloTkBdtScore(emcalo_sel.size(), -999); + std::vector emCaloTkBdtScore(emcalo_sel.size(), 0); if (cfg.doCompositeTkEle) { link_emCalo2tk_composite(in.region, emcalo_sel, in.track, emCalo2tk, emCaloTkBdtScore); @@ -325,7 +325,7 @@ void PFTkEGAlgoEmulator::eg_algo(const PFRegionEmu ®ion, const std::vector &track, const std::vector &emCalo2emCalo, const std::vector &emCalo2tk, - const std::vector &emCaloTkBdtScore, + const std::vector &emCaloTkBdtScore, std::vector &egstas, std::vector &egobjs, std::vector &egeleobjs) const { @@ -341,7 +341,7 @@ void PFTkEGAlgoEmulator::eg_algo(const PFRegionEmu ®ion, << " phi " << calo.hwPhi << std::endl; int itk = emCalo2tk[ic]; - float bdt = emCaloTkBdtScore[ic]; + id_score_t bdt = emCaloTkBdtScore[ic]; // check if brem recovery is on if (!cfg.doBremRecovery || cfg.writeBeforeBremRecovery) { @@ -376,7 +376,6 @@ void PFTkEGAlgoEmulator::eg_algo(const PFRegionEmu ®ion, } // 2. create EG objects with brem recovery - // NOTE: duplicating the object is suboptimal but this is done for keeping things as in TDR code... addEgObjsToPF(egstas, egobjs, egeleobjs, emcalo, track, ic, calo.hwEmID, ptBremReco, itk, bdt, components); } } @@ -432,7 +431,7 @@ EGIsoEleObjEmu &PFTkEGAlgoEmulator::addEGIsoEleToPF(std::vector const TkObjEmu &track, const unsigned int hwQual, const pt_t ptCorr, - const float bdtScore) const { + const id_score_t bdtScore) const { EGIsoEleObjEmu egiso; egiso.clear(); egiso.hwPt = ptCorr; @@ -456,7 +455,7 @@ EGIsoEleObjEmu &PFTkEGAlgoEmulator::addEGIsoEleToPF(std::vector egiso.hwCharge = track.hwCharge; egiso.srcCluster = calo.src; egiso.srcTrack = track.src; - egiso.idScore = bdtScore; + egiso.hwIDScore = bdtScore; egobjs.push_back(egiso); if (debug_ > 2) @@ -475,18 +474,18 @@ void PFTkEGAlgoEmulator::addEgObjsToPF(std::vector &egstas, const unsigned int hwQual, const pt_t ptCorr, const int tk_idx, - const float bdtScore, + const id_score_t bdtScore, const std::vector &components) const { - int sta_idx = -1; + int src_idx = -1; if (writeEgSta()) { addEGStaToPF(egstas, emcalo[calo_idx], hwQual, ptCorr, components); - sta_idx = egstas.size() - 1; + src_idx = egstas.size() - 1; } EGIsoObjEmu &egobj = addEGIsoToPF(egobjs, emcalo[calo_idx], hwQual, ptCorr); - egobj.sta_idx = sta_idx; + egobj.src_idx = src_idx; if (tk_idx != -1) { EGIsoEleObjEmu &eleobj = addEGIsoEleToPF(egeleobjs, emcalo[calo_idx], track[tk_idx], hwQual, ptCorr, bdtScore); - eleobj.sta_idx = sta_idx; + eleobj.src_idx = src_idx; } }