From dd6f8b575b79ff0496a4509683a9d772613c0575 Mon Sep 17 00:00:00 2001 From: Melissa Quinnan Date: Fri, 26 Jan 2024 03:22:05 +0100 Subject: [PATCH 1/2] menu fix --- L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py | 2 +- L1Trigger/L1TGlobal/src/AXOL1TLCondition.cc | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py b/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py index 28909e6077644..685ae9b7dd690 100644 --- a/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py +++ b/L1Trigger/L1TGlobal/python/simGtStage2Digis_cfi.py @@ -16,7 +16,7 @@ JetInputTag = cms.InputTag("simCaloStage2Digis"), EtSumInputTag = cms.InputTag("simCaloStage2Digis"), EtSumZdcInputTag = cms.InputTag("etSumZdcProducer"), - AXOL1TLModelVersion = cms.string("GTADModel_v1"), + AXOL1TLModelVersion = cms.string("GTADModel_v3"), AlgorithmTriggersUnmasked = cms.bool(True), AlgorithmTriggersUnprescaled = cms.bool(True), GetPrescaleColumnFromData = cms.bool(False), diff --git a/L1Trigger/L1TGlobal/src/AXOL1TLCondition.cc b/L1Trigger/L1TGlobal/src/AXOL1TLCondition.cc index bcc0f051278f4..633112093c0bd 100644 --- a/L1Trigger/L1TGlobal/src/AXOL1TLCondition.cc +++ b/L1Trigger/L1TGlobal/src/AXOL1TLCondition.cc @@ -90,11 +90,12 @@ const bool l1t::AXOL1TLCondition::evaluateCondition(const int bxEval) const { int useBx = bxEval + m_gtAXOL1TLTemplate->condRelativeBx(); //HLS4ML stuff - std::string AXOL1TLmodelversion = m_AXOL1TLmodelversion; + std::string AXOL1TLmodelversion = m_AXOL1TLmodelversion; //config loading method + // std::string AXOL1TLmodelversion = "L1Trigger/L1TGlobal/test/GTADModel_v3"; //for .so file in test dir loading method hls4mlEmulator::ModelLoader loader(AXOL1TLmodelversion); std::shared_ptr model; model = loader.load_model(); - cout << "loading model... " << AXOL1TLmodelversion << std::endl; + // cout << "loading model... " << AXOL1TLmodelversion << std::endl; // //pointers to objects const BXVector* candMuVec = m_gtGTB->getCandL1Mu(); @@ -129,9 +130,9 @@ const bool l1t::AXOL1TLCondition::evaluateCondition(const int bxEval) const { ap_fixed<18, 13> EtSumInput[EtSumVecSize]; //declare result vectors +score - std::array, 13> result; + std::array, 8> result; //v3 ap_ufixed<18, 14> loss; - std::pair, 13>, ap_ufixed<18, 14>> + std::pair, 8>, ap_ufixed<18, 14>> ADModelResult; //model outputs a pair of the (result vector, loss) float score = -1.0; //not sure what the best default is hm?? From d5058b111ca5bd1ade1b4ce340e1d6b4792c7053 Mon Sep 17 00:00:00 2001 From: Melissa Quinnan Date: Fri, 26 Jan 2024 22:51:37 +0100 Subject: [PATCH 2/2] edits added --- L1Trigger/L1TGlobal/src/AXOL1TLCondition.cc | 30 ++++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/L1Trigger/L1TGlobal/src/AXOL1TLCondition.cc b/L1Trigger/L1TGlobal/src/AXOL1TLCondition.cc index 633112093c0bd..76861ea2ec598 100644 --- a/L1Trigger/L1TGlobal/src/AXOL1TLCondition.cc +++ b/L1Trigger/L1TGlobal/src/AXOL1TLCondition.cc @@ -91,11 +91,9 @@ const bool l1t::AXOL1TLCondition::evaluateCondition(const int bxEval) const { //HLS4ML stuff std::string AXOL1TLmodelversion = m_AXOL1TLmodelversion; //config loading method - // std::string AXOL1TLmodelversion = "L1Trigger/L1TGlobal/test/GTADModel_v3"; //for .so file in test dir loading method hls4mlEmulator::ModelLoader loader(AXOL1TLmodelversion); std::shared_ptr model; model = loader.load_model(); - // cout << "loading model... " << AXOL1TLmodelversion << std::endl; // //pointers to objects const BXVector* candMuVec = m_gtGTB->getCandL1Mu(); @@ -117,24 +115,30 @@ const bool l1t::AXOL1TLCondition::evaluateCondition(const int bxEval) const { //total # inputs in vector is (4+10+4+1)*3 = 57 const int NInputs = 57; + //types of inputs and outputs + typedef ap_fixed<18, 13> inputtype; + typedef std::array, 8> resulttype; //v3 + typedef ap_ufixed<18, 14> losstype; + typedef std::pair pairtype; + // typedef std::array, 13> resulttype; //deprecated v1 type: + //define zero - ap_fixed<18, 13> fillzero = 0.0; + inputtype fillzero = 0.0; //AD vector declaration, will fill later - ap_fixed<18, 13> ADModelInput[NInputs] = {}; + inputtype ADModelInput[NInputs] = {}; //initializing vector by type for my sanity - ap_fixed<18, 13> MuInput[MuVecSize]; - ap_fixed<18, 13> JetInput[JVecSize]; - ap_fixed<18, 13> EgammaInput[EGVecSize]; - ap_fixed<18, 13> EtSumInput[EtSumVecSize]; + inputtype MuInput[MuVecSize]; + inputtype JetInput[JVecSize]; + inputtype EgammaInput[EGVecSize]; + inputtype EtSumInput[EtSumVecSize]; //declare result vectors +score - std::array, 8> result; //v3 - ap_ufixed<18, 14> loss; - std::pair, 8>, ap_ufixed<18, 14>> - ADModelResult; //model outputs a pair of the (result vector, loss) - float score = -1.0; //not sure what the best default is hm?? + resulttype result; + losstype loss; + pairtype ADModelResult; //model outputs a pair of the (result vector, loss) + float score = -1.0; //not sure what the best default is hm?? //check number of input objects we actually have (muons, jets etc) int NCandMu = candMuVec->size(useBx);