21 #include "hls4ml/emulator.h" 28 ~TOoLLiPProducer()
override =
default;
45 std::shared_ptr<hls4mlEmulator::Model>
model;
50 fUseRawPt_(
cfg.getParameter<
bool>(
"useRawPt")),
51 fMinPt_(
cfg.getParameter<double>(
"minPt")),
52 fMaxEta_(
cfg.getParameter<double>(
"maxEta")),
53 fMaxJets_(
cfg.getParameter<
int>(
"maxJets")),
54 fNParticles_(
cfg.getParameter<
int>(
"nParticles")),
56 loader(hls4mlEmulator::ModelLoader(
cfg.getParameter<
string>(
"TOoLLiPVersion"))) {
58 fJetId_ = std::make_unique<JetId>(
60 produces<edm::ValueMap<float>>(
"L1PFLLPJets");
69 iEvent.getByToken(fVtxEmu_, vtxEmuHandle);
70 for (
const auto&
vtx : *vtxEmuHandle) {
71 if (ptsum == 0 ||
vtx.pt() > ptsum) {
77 std::vector<float> LLPScores;
78 for (
const auto& srcjet : *
jets) {
79 if (((fUseRawPt_ ? srcjet.rawPt() : srcjet.pt()) < fMinPt_) ||
std::abs(srcjet.eta()) > fMaxEta_ ||
80 LLPScores.size() >= fMaxJets_) {
81 LLPScores.push_back(-1.);
84 ap_fixed<16, 6> LLPScore = fJetId_->computeFixed(srcjet,
vz, fUseRawPt_);
85 LLPScores.push_back(LLPScore);
88 auto outT = std::make_unique<edm::ValueMap<float>>();
90 fillerT.insert(
jets, LLPScores.begin(), LLPScores.end());
99 desc.add<
bool>(
"useRawPt",
true);
103 desc.add<
int>(
"maxJets", 10);
104 desc.add<
int>(
"nParticles", 10);
105 desc.add<
double>(
"minPt", 20);
106 desc.add<
double>(
"maxEta", 2.4);
108 descriptions.
add(
"TOoLLiPProducer",
desc);
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)