Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 35 additions & 23 deletions L1Trigger/Phase2L1ParticleFlow/interface/L1TSC4NGJetID.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

namespace L1TSC4NGJet {

typedef ap_fixed<64, 32, AP_RND, AP_SAT, 0> inputtype;

template <class t>
t candidate_mass(l1ct::PuppiObj puppicand) {
// Define lookup table
Expand Down Expand Up @@ -44,38 +46,48 @@ class L1TSC4NGJetID {
public:
L1TSC4NGJetID(const std::shared_ptr<hls4mlEmulator::Model> model, int iNParticles, bool debug);

typedef ap_fixed<24, 12, AP_RND, AP_SAT, 0> inputtype;
typedef std::array<ap_ufixed<24, 12, AP_RND, AP_SAT, 0>, 8> classtype;
typedef std::array<ap_fixed<16, 6>, 1> regressiontype;
typedef std::pair<regressiontype, classtype> pairtype;
static const int N_candidates = 16;
static const int N_candidate_features = 21;
static const int N_candidate_inputs = N_candidates * N_candidate_features;
static const int N_jet_inputs = 2;
static const int N_class_outputs = 8;
static const int N_regression_outputs = 1;

// Intermediate output type to allow full precision multiplication of jet pt by the ratio
typedef ap_ufixed<22, 12, AP_TRN, AP_SAT> output_regression_type;
// Intermediate output type for classification score to be loaded into jet word
typedef std::array<l1ct::jet_tag_score_t, 8> output_class_type;
typedef std::pair<regressiontype, output_class_type> outputpairtype;
void setNNVectorVar();
typedef std::array<l1ct::jet_tag_score_t, N_class_outputs> output_class_type;
typedef std::pair<std::array<output_regression_type, N_regression_outputs>, output_class_type> outputpairtype;

void setVectors();
outputpairtype EvaluateNNFixed();
outputpairtype computeFixed(const l1t::PFJet &iJet);

private:
std::vector<inputtype> NNvectorVar_;
std::vector<L1TSC4NGJet::inputtype> candidate_vector_;
std::vector<L1TSC4NGJet::inputtype> jet_vector_;

int fNParticles_;
std::unique_ptr<inputtype[]> fPt_;
std::unique_ptr<inputtype[]> fPt_rel_;
std::unique_ptr<inputtype[]> fDEta_;
std::unique_ptr<inputtype[]> fDPhi_;
std::unique_ptr<inputtype[]> fPt_log_;
std::unique_ptr<inputtype[]> fMass_;
std::unique_ptr<inputtype[]> fZ0_;
std::unique_ptr<inputtype[]> fDxy_;
std::unique_ptr<inputtype[]> fIs_filled_;
std::unique_ptr<inputtype[]> fPuppi_weight_;
std::unique_ptr<inputtype[]> fEmID_;
std::unique_ptr<inputtype[]> fQuality_;

std::unique_ptr<inputtype[]> fCharge_;
std::unique_ptr<inputtype[]> fId_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fPt_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fPt_rel_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fDEta_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fDPhi_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fPt_log_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fMass_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fZ0_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fDxy_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fIs_filled_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fPuppi_weight_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fEmID_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fQuality_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fEta_;

std::unique_ptr<L1TSC4NGJet::inputtype[]> fCharge_;
std::unique_ptr<L1TSC4NGJet::inputtype[]> fId_;

L1TSC4NGJet::inputtype fJetPt_;
L1TSC4NGJet::inputtype fJetEta_;

std::shared_ptr<hls4mlEmulator::Model> modelRef_;

bool isDebugEnabled_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void L1TSC4NGJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descr
desc.add<bool>("returnRawPt", false);
desc.add<std::string>("correctorFile", "");
desc.add<std::string>("correctorDir", "");
desc.add<std::string>("l1tSC4NGJetModelPath", std::string("L1TSC4NGJetModel_v1_0_1"));
desc.add<std::string>("l1tSC4NGJetModelPath", std::string("L1TSC4NGJetModel_v2_0_0"));
desc.add<int>("maxJets", 16);
desc.add<int>("nParticles", 16);
desc.add<double>("minPt", 10);
Expand Down
Loading