1 #ifndef PFTKEGALGO_REF_H 2 #define PFTKEGALGO_REF_H 49 ap_int<z0_t::width + 1>
dZ;
80 unsigned int nTrack_in,
81 unsigned int nEmCalo_in,
92 const std::vector<double> &
dEtaValues = {0.015, 0.01},
93 const std::vector<double> &
dPhiValues = {0.07, 0.07},
106 const CompIDParameters &
compIDparams = {-4, 0.214844,
"compositeID.json"},
167 void link_emCalo2emCalo(
const std::vector<EmCaloObjEmu> &emcalo, std::vector<int> &emCalo2emCalo)
const;
170 const std::vector<EmCaloObjEmu> &emcalo,
171 const std::vector<TkObjEmu> &
track,
172 std::vector<int> &emCalo2tk)
const;
175 const std::vector<EmCaloObjEmu> &emcalo,
176 const std::vector<TkObjEmu> &
track,
177 std::vector<int> &emCalo2tk,
178 std::vector<id_score_t> &emCaloTkBdtScore)
const;
187 const std::vector<EmCaloObjEmu> &emcalo,
188 const std::vector<TkObjEmu> &
track,
192 float deltaPhi(
float phi1,
float phi2)
const;
195 const std::vector<EmCaloObjEmu> &emcalo,
196 std::vector<EmCaloObjEmu> &emcalo_sel)
const;
199 const std::vector<EmCaloObjEmu> &emcalo,
200 const std::vector<TkObjEmu> &
track,
201 const std::vector<int> &emCalo2emCalo,
202 const std::vector<int> &emCalo2tk,
203 const std::vector<id_score_t> &emCaloTkBdtScore,
204 std::vector<EGObjEmu> &egstas,
205 std::vector<EGIsoObjEmu> &egobjs,
206 std::vector<EGIsoEleObjEmu> &egeleobjs)
const;
209 std::vector<EGIsoObjEmu> &egobjs,
210 std::vector<EGIsoEleObjEmu> &egeleobjs,
211 const std::vector<EmCaloObjEmu> &emcalo,
212 const std::vector<TkObjEmu> &
track,
214 const unsigned int hwQual,
218 const std::vector<unsigned int> &
components = {})
const;
222 const unsigned int hwQual,
224 const std::vector<unsigned int> &
components)
const;
228 const unsigned int hwQual,
229 const pt_t ptCorr)
const;
234 const unsigned int hwQual,
239 template <
typename T>
242 for (
int iout = 0; iout <
nOut; ++iout) {
245 for (
int it = 0; it <
nIn; ++it) {
246 for (
int iout = 0; iout <
nOut; ++iout) {
258 template <
typename T>
261 return dr2_int(charged.hwVtxEta(), charged.hwVtxPhi(), egphoton.
hwEta, egphoton.
hwPhi);
264 template <
typename T>
278 template <
typename T>
280 ap_int<z0_t::width + 1>
delta = charged.hwZ0 - z0;
286 template <
typename T>
288 ap_int<z0_t::width + 1>
delta = charged.hwZ0 - egele.
hwZ0;
294 template <
typename TCH,
typename TEG>
297 const std::vector<TCH> &
objects,
298 unsigned int nMaxObj,
302 for (
unsigned int itk = 0; itk < std::min<unsigned>(
objects.size(), nMaxObj); ++itk) {
319 template <
typename TEG>
322 const std::vector<PFNeutralObjEmu> &
objects,
323 unsigned int nMaxObj,
327 for (
unsigned int itk = 0; itk < std::min<unsigned>(
objects.size(), nMaxObj); ++itk) {
344 const std::vector<TkObjEmu> &
objects,
348 const std::vector<TkObjEmu> &
objects,
352 const std::vector<PFChargedObjEmu> &charged,
353 const std::vector<PFNeutralObjEmu> &neutrals,
357 const std::vector<PFChargedObjEmu> &charged,
358 const std::vector<PFNeutralObjEmu> &neutrals,
363 conifer::BDT<bdt_feature_t, ap_fixed<12, 3, AP_RND_CONV, AP_SAT>,
false> *
composite_bdt_;
void sel_emCalo(unsigned int nmax_sel, const std::vector< EmCaloObjEmu > &emcalo, std::vector< EmCaloObjEmu > &emcalo_sel) const
glbphi_t hwVtxPhi() const
virtual ~PFTkEGAlgoEmulator()
static edm::ParameterSetDescription getParameterSetDescription()
PFTkEGAlgoEmuConfig(const edm::ParameterSet &iConfig)
void setDebug(int verbose)
int deltaR2(const T &charged, const EGIsoEleObjEmu &egele) const
int dr2_int(eta_t eta1, phi_t phi1, eta_t eta2, phi_t phi2)
float deltaPhi(float phi1, float phi2) const
CompIDParameters(const edm::ParameterSet &)
IsoParameters tkIsoParams_tkEle
void compute_sumPt(iso_t &sumPt, iso_t &sumPtPV, const std::vector< PFNeutralObjEmu > &objects, unsigned int nMaxObj, const TEG &egobj, const PFTkEGAlgoEmuConfig::IsoParameters ¶ms, z0_t z0) const
id_score_t compute_composite_score(CompositeCandidate &cand, const std::vector< EmCaloObjEmu > &emcalo, const std::vector< TkObjEmu > &track, const PFTkEGAlgoEmuConfig::CompIDParameters ¶ms) const
ap_int< z0_t::width+1 > deltaZ0(const T &charged, const EGIsoObjEmu &egphoton, z0_t z0) const
const id_score_t bdtScore_loose_wp
bool writeBeforeBremRecovery
IsoParameters(float tkQualityPtMin, float dZ, float dRMin, float dRMax)
EGIsoEleObjEmu & addEGIsoEleToPF(std::vector< EGIsoEleObjEmu > &egobjs, const EmCaloObjEmu &calo, const TkObjEmu &track, const unsigned int hwQual, const pt_t ptCorr, const id_score_t bdtScore) const
ap_fixed< 12, 3, AP_RND_CONV, AP_SAT > bdt_score_t
pt_t makePtFromFloat(float pt)
static edm::ParameterSetDescription getParameterSetDescription()
IsoParameters tkIsoParams_tkEm
const std::string conifer_model
IsoParameters(const edm::ParameterSet &)
EGObjEmu & addEGStaToPF(std::vector< EGObjEmu > &egobjs, const EmCaloObjEmu &calo, const unsigned int hwQual, const pt_t ptCorr, const std::vector< unsigned int > &components) const
void runIso(const PFInputRegion &in, const std::vector< l1ct::PVObjEmu > &pvs, OutputRegion &out) const
int makeDR2FromFloatDR(float dr)
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
static edm::ParameterSetDescription getParameterSetDescription()
ap_ufixed< 11, 9, AP_TRN, AP_SAT > iso_t
void toFirmware(const PFInputRegion &in, PFRegion ®ion, EmCaloObj calo[], TkObj track[]) const
ap_fixed< 10, 1, AP_RND_CONV, AP_SAT > id_score_t
PFTkEGAlgoEmulator(const PFTkEGAlgoEmuConfig &config)
void link_emCalo2tk_elliptic(const PFRegionEmu &r, const std::vector< EmCaloObjEmu > &emcalo, const std::vector< TkObjEmu > &track, std::vector< int > &emCalo2tk) const
conifer::BDT< bdt_feature_t, ap_fixed< 12, 3, AP_RND_CONV, AP_SAT >, false > * composite_bdt_
ap_int< z0_t::width+1 > deltaZ0(const T &charged, const EGIsoEleObjEmu &egele, z0_t z0) const
const id_score_t bdtScore_tight_wp
glbeta_t hwVtxEta() const
IsoParameters pfIsoParams_tkEm
void run(const PFInputRegion &in, OutputRegion &out) const
std::vector< double > dEtaValues
ap_fixed< 21, 12, AP_RND_CONV, AP_SAT > bdt_feature_t
int deltaR2(const PFNeutralObjEmu &neutral, const EGIsoObjEmu &egphoton) const
void compute_isolation(std::vector< EGIsoObjEmu > &egobjs, const std::vector< TkObjEmu > &objects, const PFTkEGAlgoEmuConfig::IsoParameters ¶ms, z0_t z0) const
void link_emCalo2tk_composite(const PFRegionEmu &r, const std::vector< EmCaloObjEmu > &emcalo, const std::vector< TkObjEmu > &track, std::vector< int > &emCalo2tk, std::vector< id_score_t > &emCaloTkBdtScore) const
EGIsoObjEmu & addEGIsoToPF(std::vector< EGIsoObjEmu > &egobjs, const EmCaloObjEmu &calo, const unsigned int hwQual, const pt_t ptCorr) const
int deltaR2(const PFNeutralObjEmu &neutral, const EGIsoEleObjEmu &egele) const
ap_ufixed< 14, 12, AP_TRN, AP_SAT > pt_t
ap_int< z0_t::width+1 > dZ
int deltaR2(const T &charged, const EGIsoObjEmu &egphoton) const
EGIsoEleObjEmu::IsoType hwIsoTypeTkEle
void eg_algo(const PFRegionEmu ®ion, const std::vector< EmCaloObjEmu > &emcalo, const std::vector< TkObjEmu > &track, const std::vector< int > &emCalo2emCalo, const std::vector< int > &emCalo2tk, const std::vector< id_score_t > &emCaloTkBdtScore, std::vector< EGObjEmu > &egstas, std::vector< EGIsoObjEmu > &egobjs, std::vector< EGIsoEleObjEmu > &egeleobjs) const
CompIDParameters compIDparams
unsigned int nCompCandPerCluster
IsoParameters pfIsoParams_tkEle
PFTkEGAlgoEmuConfig(unsigned int nTrack, unsigned int nTrack_in, unsigned int nEmCalo_in, unsigned int nEmOut, bool filterHwQuality, bool doBremRecovery, bool writeBeforeBremRecovery=false, int caloHwQual=4, bool doEndcapHwQual=false, float emClusterPtMin=2., float dEtaMaxBrem=0.02, float dPhiMaxBrem=0.1, const std::vector< double > &absEtaBoundaries={0.0, 1.5}, const std::vector< double > &dEtaValues={0.015, 0.01}, const std::vector< double > &dPhiValues={0.07, 0.07}, float trkQualityPtMin=10., bool doCompositeTkEle=false, unsigned int nCompCandPerCluster=4, bool writeEgSta=false, const IsoParameters &tkIsoParams_tkEle={2., 0.6, 0.03, 0.2}, const IsoParameters &tkIsoParams_tkEm={2., 0.6, 0.07, 0.3}, const IsoParameters &pfIsoParams_tkEle={1., 0.6, 0.03, 0.2}, const IsoParameters &pfIsoParams_tkEm={1., 0.6, 0.07, 0.3}, bool doTkIso=true, bool doPfIso=false, EGIsoEleObjEmu::IsoType hwIsoTypeTkEle=EGIsoEleObjEmu::IsoType::TkIso, EGIsoObjEmu::IsoType hwIsoTypeTkEm=EGIsoObjEmu::IsoType::TkIsoPV, const CompIDParameters &compIDparams={-4, 0.214844, "compositeID.json"}, int debug=0)
std::vector< double > dPhiValues
void link_emCalo2emCalo(const std::vector< EmCaloObjEmu > &emcalo, std::vector< int > &emCalo2emCalo) const
std::vector< double > absEtaBoundaries
void ptsort_ref(int nIn, int nOut, const std::vector< T > &in, std::vector< T > &out) const
void addEgObjsToPF(std::vector< EGObjEmu > &egstas, std::vector< EGIsoObjEmu > &egobjs, std::vector< EGIsoEleObjEmu > &egeleobjs, const std::vector< EmCaloObjEmu > &emcalo, const std::vector< TkObjEmu > &track, const int calo_idx, const unsigned int hwQual, const pt_t ptCorr, const int tk_idx, const id_score_t bdtScore, const std::vector< unsigned int > &components={}) const
CompIDParameters(double bdtScore_loose_wp, double bdtScore_tight_wp, const std::string &model)
EGIsoObjEmu::IsoType hwIsoTypeTkEm
void compute_sumPt(iso_t &sumPt, iso_t &sumPtPV, const std::vector< TCH > &objects, unsigned int nMaxObj, const TEG &egobj, const PFTkEGAlgoEmuConfig::IsoParameters ¶ms, z0_t z0) const
unsigned int nEMCALO_EGIN