CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
l1ct::PFTkEGAlgoEmulator Class Reference

#include <pftkegalgo_ref.h>

Classes

struct  CompositeCandidate
 

Public Types

typedef ap_fixed< 21, 12, AP_RND_CONV, AP_SAT > bdt_feature_t
 
typedef ap_fixed< 12, 3, AP_RND_CONV, AP_SAT > bdt_score_t
 

Public Member Functions

 PFTkEGAlgoEmulator (const PFTkEGAlgoEmuConfig &config)
 
void run (const PFInputRegion &in, OutputRegion &out) const
 
void runIso (const PFInputRegion &in, const std::vector< l1ct::PVObjEmu > &pvs, OutputRegion &out) const
 
void setDebug (int verbose)
 
void toFirmware (const PFInputRegion &in, PFRegion &region, EmCaloObj calo[], TkObj track[]) const
 
void toFirmware (const OutputRegion &out, EGIsoObj out_egphs[], EGIsoEleObj out_egeles[]) const
 
void toFirmware (const PFInputRegion &in, const l1ct::PVObjEmu &pvin, PFRegion &region, TkObj track[], PVObj &pv) const
 
bool writeEgSta () const
 
virtual ~PFTkEGAlgoEmulator ()
 

Private Member Functions

EGIsoEleObjEmuaddEGIsoEleToPF (std::vector< EGIsoEleObjEmu > &egobjs, const EmCaloObjEmu &calo, const TkObjEmu &track, const unsigned int hwQual, const pt_t ptCorr, const float bdtScore) const
 
EGIsoObjEmuaddEGIsoToPF (std::vector< EGIsoObjEmu > &egobjs, const EmCaloObjEmu &calo, const unsigned int hwQual, const pt_t ptCorr) 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 float bdtScore, const std::vector< unsigned int > &components={}) const
 
EGObjEmuaddEGStaToPF (std::vector< EGObjEmu > &egobjs, const EmCaloObjEmu &calo, const unsigned int hwQual, const pt_t ptCorr, const std::vector< unsigned int > &components) const
 
float compute_composite_score (CompositeCandidate &cand, const std::vector< EmCaloObjEmu > &emcalo, const std::vector< TkObjEmu > &track, const PFTkEGAlgoEmuConfig::CompIDParameters &params) const
 
void compute_isolation (std::vector< EGIsoObjEmu > &egobjs, const std::vector< TkObjEmu > &objects, const PFTkEGAlgoEmuConfig::IsoParameters &params, z0_t z0) const
 
void compute_isolation (std::vector< EGIsoEleObjEmu > &egobjs, const std::vector< TkObjEmu > &objects, const PFTkEGAlgoEmuConfig::IsoParameters &params, z0_t z0) const
 
void compute_isolation (std::vector< EGIsoObjEmu > &egobjs, const std::vector< PFChargedObjEmu > &charged, const std::vector< PFNeutralObjEmu > &neutrals, const PFTkEGAlgoEmuConfig::IsoParameters &params, z0_t z0) const
 
void compute_isolation (std::vector< EGIsoEleObjEmu > &egobjs, const std::vector< PFChargedObjEmu > &charged, const std::vector< PFNeutralObjEmu > &neutrals, const PFTkEGAlgoEmuConfig::IsoParameters &params, z0_t z0) const
 
template<typename TCH , typename TEG >
void compute_sumPt (iso_t &sumPt, iso_t &sumPtPV, const std::vector< TCH > &objects, unsigned int nMaxObj, const TEG &egobj, const PFTkEGAlgoEmuConfig::IsoParameters &params, z0_t z0) const
 
template<typename TEG >
void compute_sumPt (iso_t &sumPt, iso_t &sumPtPV, const std::vector< PFNeutralObjEmu > &objects, unsigned int nMaxObj, const TEG &egobj, const PFTkEGAlgoEmuConfig::IsoParameters &params, z0_t z0) const
 
float deltaPhi (float phi1, float phi2) const
 
template<typename T >
int deltaR2 (const T &charged, const EGIsoObjEmu &egphoton) const
 
template<typename T >
int deltaR2 (const T &charged, const EGIsoEleObjEmu &egele) const
 
int deltaR2 (const PFNeutralObjEmu &neutral, const EGIsoObjEmu &egphoton) const
 
int deltaR2 (const PFNeutralObjEmu &neutral, const EGIsoEleObjEmu &egele) const
 
template<typename T >
ap_int< z0_t::width+1 > deltaZ0 (const T &charged, const EGIsoObjEmu &egphoton, z0_t z0) const
 
template<typename T >
ap_int< z0_t::width+1 > deltaZ0 (const T &charged, const EGIsoEleObjEmu &egele, z0_t z0) const
 
void eg_algo (const PFRegionEmu &region, const std::vector< EmCaloObjEmu > &emcalo, const std::vector< TkObjEmu > &track, const std::vector< int > &emCalo2emCalo, const std::vector< int > &emCalo2tk, const std::vector< float > &emCaloTkBdtScore, std::vector< EGObjEmu > &egstas, std::vector< EGIsoObjEmu > &egobjs, std::vector< EGIsoEleObjEmu > &egeleobjs) const
 
void link_emCalo2emCalo (const std::vector< EmCaloObjEmu > &emcalo, std::vector< int > &emCalo2emCalo) const
 
void link_emCalo2tk_composite (const PFRegionEmu &r, const std::vector< EmCaloObjEmu > &emcalo, const std::vector< TkObjEmu > &track, std::vector< int > &emCalo2tk, std::vector< float > &emCaloTkBdtScore) const
 
void link_emCalo2tk_elliptic (const PFRegionEmu &r, const std::vector< EmCaloObjEmu > &emcalo, const std::vector< TkObjEmu > &track, std::vector< int > &emCalo2tk) const
 
template<typename T >
void ptsort_ref (int nIn, int nOut, const std::vector< T > &in, std::vector< T > &out) const
 
void sel_emCalo (unsigned int nmax_sel, const std::vector< EmCaloObjEmu > &emcalo, std::vector< EmCaloObjEmu > &emcalo_sel) const
 

Private Attributes

PFTkEGAlgoEmuConfig cfg
 
conifer::BDT< bdt_feature_t, ap_fixed< 12, 3, AP_RND_CONV, AP_SAT >, false > * composite_bdt_
 
int debug_
 

Detailed Description

Definition at line 136 of file pftkegalgo_ref.h.

Member Typedef Documentation

◆ bdt_feature_t

typedef ap_fixed<21, 12, AP_RND_CONV, AP_SAT> l1ct::PFTkEGAlgoEmulator::bdt_feature_t

Definition at line 157 of file pftkegalgo_ref.h.

◆ bdt_score_t

typedef ap_fixed<12, 3, AP_RND_CONV, AP_SAT> l1ct::PFTkEGAlgoEmulator::bdt_score_t

Definition at line 158 of file pftkegalgo_ref.h.

Constructor & Destructor Documentation

◆ PFTkEGAlgoEmulator()

l1ct::PFTkEGAlgoEmulator::PFTkEGAlgoEmulator ( const PFTkEGAlgoEmuConfig config)

◆ ~PFTkEGAlgoEmulator()

virtual l1ct::PFTkEGAlgoEmulator::~PFTkEGAlgoEmulator ( )
inlinevirtual

Definition at line 140 of file pftkegalgo_ref.h.

140 {}

Member Function Documentation

◆ addEGIsoEleToPF()

EGIsoEleObjEmu& l1ct::PFTkEGAlgoEmulator::addEGIsoEleToPF ( std::vector< EGIsoEleObjEmu > &  egobjs,
const EmCaloObjEmu calo,
const TkObjEmu track,
const unsigned int  hwQual,
const pt_t  ptCorr,
const float  bdtScore 
) const
private

◆ addEGIsoToPF()

EGIsoObjEmu& l1ct::PFTkEGAlgoEmulator::addEGIsoToPF ( std::vector< EGIsoObjEmu > &  egobjs,
const EmCaloObjEmu calo,
const unsigned int  hwQual,
const pt_t  ptCorr 
) const
private

◆ addEgObjsToPF()

void l1ct::PFTkEGAlgoEmulator::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 float  bdtScore,
const std::vector< unsigned int > &  components = {} 
) const
private

◆ addEGStaToPF()

EGObjEmu& l1ct::PFTkEGAlgoEmulator::addEGStaToPF ( std::vector< EGObjEmu > &  egobjs,
const EmCaloObjEmu calo,
const unsigned int  hwQual,
const pt_t  ptCorr,
const std::vector< unsigned int > &  components 
) const
private

◆ compute_composite_score()

float l1ct::PFTkEGAlgoEmulator::compute_composite_score ( CompositeCandidate cand,
const std::vector< EmCaloObjEmu > &  emcalo,
const std::vector< TkObjEmu > &  track,
const PFTkEGAlgoEmuConfig::CompIDParameters params 
) const
private

◆ compute_isolation() [1/4]

void l1ct::PFTkEGAlgoEmulator::compute_isolation ( std::vector< EGIsoObjEmu > &  egobjs,
const std::vector< TkObjEmu > &  objects,
const PFTkEGAlgoEmuConfig::IsoParameters params,
z0_t  z0 
) const
private

◆ compute_isolation() [2/4]

void l1ct::PFTkEGAlgoEmulator::compute_isolation ( std::vector< EGIsoEleObjEmu > &  egobjs,
const std::vector< TkObjEmu > &  objects,
const PFTkEGAlgoEmuConfig::IsoParameters params,
z0_t  z0 
) const
private

◆ compute_isolation() [3/4]

void l1ct::PFTkEGAlgoEmulator::compute_isolation ( std::vector< EGIsoObjEmu > &  egobjs,
const std::vector< PFChargedObjEmu > &  charged,
const std::vector< PFNeutralObjEmu > &  neutrals,
const PFTkEGAlgoEmuConfig::IsoParameters params,
z0_t  z0 
) const
private

◆ compute_isolation() [4/4]

void l1ct::PFTkEGAlgoEmulator::compute_isolation ( std::vector< EGIsoEleObjEmu > &  egobjs,
const std::vector< PFChargedObjEmu > &  charged,
const std::vector< PFNeutralObjEmu > &  neutrals,
const PFTkEGAlgoEmuConfig::IsoParameters params,
z0_t  z0 
) const
private

◆ compute_sumPt() [1/2]

template<typename TCH , typename TEG >
void l1ct::PFTkEGAlgoEmulator::compute_sumPt ( iso_t sumPt,
iso_t sumPtPV,
const std::vector< TCH > &  objects,
unsigned int  nMaxObj,
const TEG &  egobj,
const PFTkEGAlgoEmuConfig::IsoParameters params,
z0_t  z0 
) const
inlineprivate

Definition at line 289 of file pftkegalgo_ref.h.

References deltaR2(), deltaZ0(), getGTfromDQMFile::obj, submitPVValidationJobs::params, and TtFullHadEvtBuilder_cfi::sumPt.

295  {
296  for (unsigned int itk = 0; itk < std::min<unsigned>(objects.size(), nMaxObj); ++itk) {
297  const auto &obj = objects[itk];
298 
299  if (obj.hwPt < params.tkQualityPtMin)
300  continue;
301 
302  int dR2 = deltaR2(obj, egobj);
303 
304  if (dR2 > params.dRMin2 && dR2 < params.dRMax2) {
305  sumPt += obj.hwPt;
306  if (deltaZ0(obj, egobj, z0) < params.dZ) {
307  sumPtPV += obj.hwPt;
308  }
309  }
310  }
311  }
ap_int< z0_t::width+1 > deltaZ0(const T &charged, const EGIsoObjEmu &egphoton, z0_t z0) const
int deltaR2(const T &charged, const EGIsoObjEmu &egphoton) const

◆ compute_sumPt() [2/2]

template<typename TEG >
void l1ct::PFTkEGAlgoEmulator::compute_sumPt ( iso_t sumPt,
iso_t sumPtPV,
const std::vector< PFNeutralObjEmu > &  objects,
unsigned int  nMaxObj,
const TEG &  egobj,
const PFTkEGAlgoEmuConfig::IsoParameters params,
z0_t  z0 
) const
inlineprivate

Definition at line 314 of file pftkegalgo_ref.h.

References deltaR2(), getGTfromDQMFile::obj, submitPVValidationJobs::params, and TtFullHadEvtBuilder_cfi::sumPt.

320  {
321  for (unsigned int itk = 0; itk < std::min<unsigned>(objects.size(), nMaxObj); ++itk) {
322  const auto &obj = objects[itk];
323 
324  if (obj.hwPt < params.tkQualityPtMin)
325  continue;
326 
327  int dR2 = deltaR2(obj, egobj);
328 
329  if (dR2 > params.dRMin2 && dR2 < params.dRMax2) {
330  sumPt += obj.hwPt;
331  // PF neutrals are not constrained by PV (since their Z0 is 0 by design)
332  sumPtPV += obj.hwPt;
333  }
334  }
335  }
int deltaR2(const T &charged, const EGIsoObjEmu &egphoton) const

◆ deltaPhi()

float l1ct::PFTkEGAlgoEmulator::deltaPhi ( float  phi1,
float  phi2 
) const
private

◆ deltaR2() [1/4]

template<typename T >
int l1ct::PFTkEGAlgoEmulator::deltaR2 ( const T charged,
const EGIsoObjEmu egphoton 
) const
inlineprivate

Definition at line 253 of file pftkegalgo_ref.h.

References l1ct::dr2_int(), l1ct::EGIsoObj::hwEta, and l1ct::EGIsoObj::hwPhi.

Referenced by compute_sumPt().

253  {
254  // NOTE: we compare Tk at vertex against the calo variable...
255  return dr2_int(charged.hwVtxEta(), charged.hwVtxPhi(), egphoton.hwEta, egphoton.hwPhi);
256  }
int dr2_int(eta_t eta1, phi_t phi1, eta_t eta2, phi_t phi2)
Definition: datatypes.h:219

◆ deltaR2() [2/4]

template<typename T >
int l1ct::PFTkEGAlgoEmulator::deltaR2 ( const T charged,
const EGIsoEleObjEmu egele 
) const
inlineprivate

Definition at line 259 of file pftkegalgo_ref.h.

References l1ct::dr2_int(), l1ct::EGIsoEleObj::hwVtxEta(), and l1ct::EGIsoEleObj::hwVtxPhi().

259  {
260  return dr2_int(charged.hwVtxEta(), charged.hwVtxPhi(), egele.hwVtxEta(), egele.hwVtxPhi());
261  }
int dr2_int(eta_t eta1, phi_t phi1, eta_t eta2, phi_t phi2)
Definition: datatypes.h:219

◆ deltaR2() [3/4]

int l1ct::PFTkEGAlgoEmulator::deltaR2 ( const PFNeutralObjEmu neutral,
const EGIsoObjEmu egphoton 
) const
inlineprivate

Definition at line 263 of file pftkegalgo_ref.h.

References l1ct::dr2_int(), l1ct::PFCommonObj::hwEta, l1ct::EGIsoObj::hwEta, l1ct::PFCommonObj::hwPhi, and l1ct::EGIsoObj::hwPhi.

263  {
264  return dr2_int(neutral.hwEta, neutral.hwPhi, egphoton.hwEta, egphoton.hwPhi);
265  }
int dr2_int(eta_t eta1, phi_t phi1, eta_t eta2, phi_t phi2)
Definition: datatypes.h:219

◆ deltaR2() [4/4]

int l1ct::PFTkEGAlgoEmulator::deltaR2 ( const PFNeutralObjEmu neutral,
const EGIsoEleObjEmu egele 
) const
inlineprivate

Definition at line 267 of file pftkegalgo_ref.h.

References l1ct::dr2_int(), l1ct::PFCommonObj::hwEta, l1ct::PFCommonObj::hwPhi, l1ct::EGIsoEleObj::hwVtxEta(), and l1ct::EGIsoEleObj::hwVtxPhi().

267  {
268  // NOTE: we compare Tk at vertex against the calo variable...
269  return dr2_int(neutral.hwEta, neutral.hwPhi, egele.hwVtxEta(), egele.hwVtxPhi());
270  }
int dr2_int(eta_t eta1, phi_t phi1, eta_t eta2, phi_t phi2)
Definition: datatypes.h:219

◆ deltaZ0() [1/2]

template<typename T >
ap_int<z0_t::width + 1> l1ct::PFTkEGAlgoEmulator::deltaZ0 ( const T charged,
const EGIsoObjEmu egphoton,
z0_t  z0 
) const
inlineprivate

Definition at line 273 of file pftkegalgo_ref.h.

References dumpMFGeometry_cfg::delta.

Referenced by compute_sumPt().

273  {
274  ap_int<z0_t::width + 1> delta = charged.hwZ0 - z0;
275  if (delta < 0)
276  delta = -delta;
277  return delta;
278  }

◆ deltaZ0() [2/2]

template<typename T >
ap_int<z0_t::width + 1> l1ct::PFTkEGAlgoEmulator::deltaZ0 ( const T charged,
const EGIsoEleObjEmu egele,
z0_t  z0 
) const
inlineprivate

Definition at line 281 of file pftkegalgo_ref.h.

References dumpMFGeometry_cfg::delta, and l1ct::EGIsoEleObj::hwZ0.

281  {
282  ap_int<z0_t::width + 1> delta = charged.hwZ0 - egele.hwZ0;
283  if (delta < 0)
284  delta = -delta;
285  return delta;
286  }

◆ eg_algo()

void l1ct::PFTkEGAlgoEmulator::eg_algo ( const PFRegionEmu region,
const std::vector< EmCaloObjEmu > &  emcalo,
const std::vector< TkObjEmu > &  track,
const std::vector< int > &  emCalo2emCalo,
const std::vector< int > &  emCalo2tk,
const std::vector< float > &  emCaloTkBdtScore,
std::vector< EGObjEmu > &  egstas,
std::vector< EGIsoObjEmu > &  egobjs,
std::vector< EGIsoEleObjEmu > &  egeleobjs 
) const
private

◆ link_emCalo2emCalo()

void l1ct::PFTkEGAlgoEmulator::link_emCalo2emCalo ( const std::vector< EmCaloObjEmu > &  emcalo,
std::vector< int > &  emCalo2emCalo 
) const
private

◆ link_emCalo2tk_composite()

void l1ct::PFTkEGAlgoEmulator::link_emCalo2tk_composite ( const PFRegionEmu r,
const std::vector< EmCaloObjEmu > &  emcalo,
const std::vector< TkObjEmu > &  track,
std::vector< int > &  emCalo2tk,
std::vector< float > &  emCaloTkBdtScore 
) const
private

◆ link_emCalo2tk_elliptic()

void l1ct::PFTkEGAlgoEmulator::link_emCalo2tk_elliptic ( const PFRegionEmu r,
const std::vector< EmCaloObjEmu > &  emcalo,
const std::vector< TkObjEmu > &  track,
std::vector< int > &  emCalo2tk 
) const
private

◆ ptsort_ref()

template<typename T >
void l1ct::PFTkEGAlgoEmulator::ptsort_ref ( int  nIn,
int  nOut,
const std::vector< T > &  in,
std::vector< T > &  out 
) const
inlineprivate

Definition at line 234 of file pftkegalgo_ref.h.

References l1trig_cff::hwPt, testProducerWithPsetDescEmpty_cfi::i2, recoMuon::in, l1ctLayer1_cff::nIn, l1ctLayer1_cff::nOut, and MillePedeFileConverter_cfg::out.

234  {
235  out.resize(nOut);
236  for (int iout = 0; iout < nOut; ++iout) {
237  out[iout].clear();
238  }
239  for (int it = 0; it < nIn; ++it) {
240  for (int iout = 0; iout < nOut; ++iout) {
241  if (in[it].hwPt >= out[iout].hwPt) {
242  for (int i2 = nOut - 1; i2 > iout; --i2) {
243  out[i2] = out[i2 - 1];
244  }
245  out[iout] = in[it];
246  break;
247  }
248  }
249  }
250  }

◆ run()

void l1ct::PFTkEGAlgoEmulator::run ( const PFInputRegion in,
OutputRegion out 
) const

◆ runIso()

void l1ct::PFTkEGAlgoEmulator::runIso ( const PFInputRegion in,
const std::vector< l1ct::PVObjEmu > &  pvs,
OutputRegion out 
) const

◆ sel_emCalo()

void l1ct::PFTkEGAlgoEmulator::sel_emCalo ( unsigned int  nmax_sel,
const std::vector< EmCaloObjEmu > &  emcalo,
std::vector< EmCaloObjEmu > &  emcalo_sel 
) const
private

◆ setDebug()

void l1ct::PFTkEGAlgoEmulator::setDebug ( int  verbose)
inline

Definition at line 153 of file pftkegalgo_ref.h.

References debug_, and verbose.

◆ toFirmware() [1/3]

void l1ct::PFTkEGAlgoEmulator::toFirmware ( const PFInputRegion in,
PFRegion region,
EmCaloObj  calo[],
TkObj  track[] 
) const

◆ toFirmware() [2/3]

void l1ct::PFTkEGAlgoEmulator::toFirmware ( const OutputRegion out,
EGIsoObj  out_egphs[],
EGIsoEleObj  out_egeles[] 
) const

◆ toFirmware() [3/3]

void l1ct::PFTkEGAlgoEmulator::toFirmware ( const PFInputRegion in,
const l1ct::PVObjEmu pvin,
PFRegion region,
TkObj  track[],
PVObj pv 
) const

◆ writeEgSta()

bool l1ct::PFTkEGAlgoEmulator::writeEgSta ( ) const
inline

Definition at line 155 of file pftkegalgo_ref.h.

References cfg, and l1ct::PFTkEGAlgoEmuConfig::writeEgSta.

155 { return cfg.writeEgSta; }
PFTkEGAlgoEmuConfig cfg

Member Data Documentation

◆ cfg

PFTkEGAlgoEmuConfig l1ct::PFTkEGAlgoEmulator::cfg
private

Definition at line 356 of file pftkegalgo_ref.h.

Referenced by writeEgSta().

◆ composite_bdt_

conifer::BDT<bdt_feature_t, ap_fixed<12, 3, AP_RND_CONV, AP_SAT>, false>* l1ct::PFTkEGAlgoEmulator::composite_bdt_
private

Definition at line 357 of file pftkegalgo_ref.h.

◆ debug_

int l1ct::PFTkEGAlgoEmulator::debug_
private

Definition at line 358 of file pftkegalgo_ref.h.

Referenced by setDebug().