From 22f877bd896271902894bfacdfd1086735a80e21 Mon Sep 17 00:00:00 2001 From: Nicholas Luongo Date: Mon, 3 May 2021 20:37:44 +0200 Subject: [PATCH 1/3] Refactor eFEX TOBs and EDMs --- .../L1CaloFEXSim/L1CaloFEXSim/eFEXDriver.h | 5 + .../L1CaloFEXSim/L1CaloFEXSim/eFEXFPGA.h | 11 ++- .../L1CaloFEXSim/L1CaloFEXSim/eFEXFillEDM.h | 57 ++++++++++++ .../L1CaloFEXSim/L1CaloFEXSim/eFEXFormTOBs.h | 46 ++++++++++ .../L1CaloFEXSim/L1CaloFEXSim/eFEXSim.h | 6 +- .../L1CaloFEXSim/L1CaloFEXSim/eFEXSysSim.h | 18 +++- .../L1CaloFEXSim/L1CaloFEXSim/eFEXtauTOB.h | 26 ++---- .../L1CaloFEX/L1CaloFEXSim/src/eFEXDriver.cxx | 35 +++++++ .../L1CaloFEX/L1CaloFEXSim/src/eFEXFPGA.cxx | 54 ++++++++--- .../L1CaloFEXSim/src/eFEXFillEDM.cxx | 76 +++++++++++++++ .../L1CaloFEXSim/src/eFEXFormTOBs.cxx | 92 +++++++++++++++++++ .../L1CaloFEX/L1CaloFEXSim/src/eFEXSim.cxx | 48 ++++++++-- .../L1CaloFEX/L1CaloFEXSim/src/eFEXSysSim.cxx | 48 +++++++++- .../L1CaloFEX/L1CaloFEXSim/src/eFEXtauTOB.cxx | 44 ++------- .../L1CaloFEXToolInterfaces/IeFEXFPGA.h | 7 +- .../L1CaloFEXToolInterfaces/IeFEXFillEDM.h | 49 ++++++++++ .../L1CaloFEXToolInterfaces/IeFEXFormTOBs.h | 45 +++++++++ .../L1CaloFEXToolInterfaces/IeFEXSim.h | 1 + .../L1CaloFEXToolInterfaces/IeFEXSysSim.h | 6 +- 19 files changed, 582 insertions(+), 92 deletions(-) create mode 100644 Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFillEDM.h create mode 100644 Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFormTOBs.h create mode 100644 Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFillEDM.cxx create mode 100644 Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFormTOBs.cxx create mode 100644 Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFillEDM.h create mode 100644 Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFormTOBs.h diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXDriver.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXDriver.h index b2a69d086c8..4c2f8e206b2 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXDriver.h +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXDriver.h @@ -14,11 +14,13 @@ #include "L1CaloFEXSim/eSuperCellTowerMapper.h" #include "L1CaloFEXToolInterfaces/IeFEXSysSim.h" #include "L1CaloFEXSim/eFEXSim.h" +#include "L1CaloFEXSim/eTowerContainer.h" #include "xAODTrigL1Calo/TriggerTowerContainer.h" #include "CaloIdentifier/CaloIdManager.h" #include "CaloIdentifier/CaloCell_SuperCell_ID.h" #include "L1CaloFEXSim/eFEXOutputCollection.h" #include "xAODTrigger/eFexEMRoIContainer.h" +#include "xAODTrigger/eFexTauRoIContainer.h" class CaloIdManager; @@ -36,6 +38,7 @@ class eFEXDriver : public AthAlgorithm virtual StatusCode execute(/*const EventContext& ctx*/);// const; StatusCode finalize(); virtual StatusCode testEDM(); + virtual StatusCode testTauEDM(); private: @@ -49,6 +52,8 @@ class eFEXDriver : public AthAlgorithm SG::ReadHandleKey m_eEDMKey {this, "myEDM", "L1_eEMRoI", "Reading container of eFexEMRoIs"}; + SG::ReadHandleKey m_eTauEDMKey {this, "myTauEDM", "L1_eTauRoI", "Reading container of eFexTauRoIs"}; + ToolHandle m_eTowerBuilderTool {this, "eTowerBuilderTool", "LVL1::eTowerBuilder", "Tool that builds eTowers for simulation"}; ToolHandle m_eSuperCellTowerMapperTool {this, "eSuperCellTowerMapperTool", "LVL1::eSuperCellTowerMapper", "Tool that maps supercells to eTowers"}; ToolHandle m_eFEXSysSimTool {this, "eFEXSysSimTool", "LVL1::eFEXSysSim", "Tool that creates the eFEX System Simulation"}; diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFPGA.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFPGA.h index aef324c1ba0..1b38c556d16 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFPGA.h +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFPGA.h @@ -19,6 +19,7 @@ #include "L1CaloFEXSim/eTowerContainer.h" #include "L1CaloFEXToolInterfaces/IeFEXtauAlgo.h" #include "L1CaloFEXToolInterfaces/IeFEXegAlgo.h" +#include "L1CaloFEXToolInterfaces/IeFEXFormTOBs.h" #include "L1CaloFEXSim/eFEXOutputCollection.h" #include @@ -51,10 +52,8 @@ namespace LVL1 { virtual void SetTowersAndCells_SG( int [][6] ) override ; virtual void SetIsoWP(std::vector &, std::vector &, unsigned int &) override ; - /**Form a tob word out of the potential candidate EM tob */ - virtual uint32_t formEmTOB(int &, int &) override ; - virtual std::vector getEmTOBs() override ; + virtual std::vector getTauTOBs() override ; /** Internal data */ @@ -63,7 +62,8 @@ namespace LVL1 { int m_id; int m_efexid; - std::vector< uint32_t > m_tobwords; + std::vector< uint32_t > m_emTobWords; + std::vector< uint32_t > m_tauTobWords; int m_eTowersIDs [10][6]; SG::ReadHandleKey m_eFEXFPGA_eTowerContainerKey {this, "MyETowers", "eTowerContainer", "Input container for eTowers"}; @@ -73,7 +73,8 @@ namespace LVL1 { ToolHandle m_eFEXtauAlgoTool {this, "eFEXtauAlgoTool", "LVL1::eFEXtauAlgo", "Tool that runs the eFEX tau algorithm"}; ToolHandle m_eFEXegAlgoTool {this, "eFEXegAlgoTool", "LVL1::eFEXegAlgo", "Tool that runs the eFEX e/gamma algorithm"}; - + + ToolHandle m_eFEXFormTOBsTool {this, "eFEXFormTOBs", "LVL1::eFEXFormTOBs", "Tool that creates eFEX TOB words"}; }; } // end of namespace diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFillEDM.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFillEDM.h new file mode 100644 index 00000000000..f613a95d732 --- /dev/null +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFillEDM.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +//*********************************************************************** +// eFEXFillEDM - description +// --------------------- +// begin : 22 04 2021 +// email : nluongo@uoregon.edu +//*********************************************************************** + +#ifndef eFEXFillEDM_H +#define eFEXFillEDM_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "L1CaloFEXToolInterfaces/IeFEXFillEDM.h" +#include "xAODTrigger/eFexEMRoI.h" +#include "xAODTrigger/eFexTauRoI.h" + +namespace LVL1 { + + //Doxygen class description below: + /** The eFEXFillEDM class defines how to fill eFEX EDM + */ + + class eFEXFillEDM : public AthAlgTool, virtual public IeFEXFillEDM { + + public: + + /** Constructors */ + + eFEXFillEDM(const std::string& type, const std::string& name, const IInterface* parent); + + /** Destructor */ + + eFEXFillEDM&& operator= (const eFEXFillEDM& ) = delete; + + /** standard Athena-Algorithm method */ + virtual StatusCode initialize() override; + /** standard Athena-Algorithm method */ + virtual StatusCode finalize() override; + + virtual StatusCode execute() override; + + /** Create and fill a new fillEmEDM object (corresponding to this window), and return a pointer to it */ + virtual xAOD::eFexEMRoI* fillEmEDM(uint8_t eFEXNumber, uint32_t tobWord) override; + /** Create and fill a new fillTauEDM object (corresponding to this window), and return a pointer to it */ + virtual xAOD::eFexTauRoI* fillTauEDM(uint8_t eFEXNumber, uint32_t tobWord) override; + + /** Internal data */ + private: + + }; + +} // end of namespace + +#endif diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFormTOBs.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFormTOBs.h new file mode 100644 index 00000000000..afd45aaac90 --- /dev/null +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFormTOBs.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +//*********************************************************************** +// eFEXFormTOBs.h +// -------------- +// begin : 30 04 2021 +// email : nicholas.andrew.luongo@cern.ch +//*********************************************************************** + +#ifndef eFEXFORMTOBS_H +#define eFEXFORMTOBS_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "L1CaloFEXToolInterfaces/IeFEXFormTOBs.h" + +namespace LVL1 { + + //Doxygen class description below: + /** The eFEXFormTOBs class provides functions for creating TOBs for eFEX objects + */ + + class eFEXFormTOBs : public AthAlgTool, virtual public IeFEXFormTOBs { + + public: + /** Constructors */ + eFEXFormTOBs(const std::string& type, const std::string& name, const IInterface* parent); + + /** standard Athena-Algorithm method */ + virtual StatusCode initialize() override; + /** Destructor */ + virtual ~eFEXFormTOBs(); + + virtual uint32_t formTauTOBWord(int &, int &, int &, unsigned int &) = 0; + + virtual uint32_t formEmTOBWord(int &, int &, int &, unsigned int &) = 0; + + /** Internal data */ + private: + + }; + +} // end of namespace + +#endif diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXSim.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXSim.h index 04753957035..7cf0675f675 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXSim.h +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXSim.h @@ -59,6 +59,8 @@ namespace LVL1 { virtual std::vector getEmTOBs() override; + virtual std::vector getTauTOBs() override; + /** Internal data */ private: static bool etSort (uint32_t i,uint32_t j) { return (((i >> 0 ) & 0xfff)>((j >> 0 ) & 0xfff)); } @@ -69,7 +71,9 @@ namespace LVL1 { CaloCellContainer m_sCellsCollection; std::vector m_eFEXFPGACollection; - std::vector > m_tobWords; + std::vector > m_emTobWords; + + std::vector > m_tauTobWords; ToolHandle m_eFEXFPGATool {this, "eFEXFPGATool", "LVL1::eFEXFPGA", "Tool that simulates the FPGA hardware"}; diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXSysSim.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXSysSim.h index 79b3923adb6..b3f0b2642a9 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXSysSim.h +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXSysSim.h @@ -14,6 +14,7 @@ #define eFEXSysSim_H #include "AthenaBaseComps/AthAlgTool.h" #include "L1CaloFEXToolInterfaces/IeFEXSysSim.h" +#include "L1CaloFEXToolInterfaces/IeFEXFillEDM.h" #include "AthenaKernel/CLASS_DEF.h" #include "L1CaloFEXSim/eFEXSim.h" #include "L1CaloFEXSim/eTower.h" @@ -24,6 +25,8 @@ #include "xAODTrigger/eFexEMRoIContainer.h" #include "xAODTrigger/eFexEMRoIAuxContainer.h" +#include "xAODTrigger/eFexTauRoIContainer.h" +#include "xAODTrigger/eFexTauRoIAuxContainer.h" namespace LVL1 { @@ -59,7 +62,9 @@ namespace LVL1 { virtual int calcTowerID(int eta, int phi, int mod) override ; /**Create and fill a new eFexEMRoI object (corresponding to this window), and return a pointer to it*/ - virtual StatusCode fillEDM(uint8_t eFEXNumber, uint32_t tobWord) override ; + //virtual StatusCode fillEmEDM(uint8_t eFEXNumber, uint32_t tobWord) override ; + /**Create and fill a new eFexTauRoI object (corresponding to this window), and return a pointer to it*/ + //virtual StatusCode fillTauEDM(uint8_t eFEXNumber, uint32_t tobWord) override ; /** Internal data */ @@ -67,18 +72,27 @@ namespace LVL1 { std::unique_ptr< xAOD::eFexEMRoIContainer > m_eContainer; std::unique_ptr< xAOD::eFexEMRoIAuxContainer > m_eAuxContainer; + std::unique_ptr< xAOD::eFexTauRoIContainer > m_tauContainer; + std::unique_ptr< xAOD::eFexTauRoIAuxContainer > m_tauAuxContainer; + std::vector m_eFEXCollection; - ToolHandle m_eFEXSimTool {this, "eFEXSimTool", "LVL1::eFEXSim", "Tool that creates the eFEX Simulation"}; + ToolHandle m_eFEXSimTool {this, "eFEXSimTool", "LVL1::eFEXSim", "Tool that creates the eFEX Simulation"}; + + ToolHandle m_eFEXFillEDMTool {this, "eFEXFillEDMTool", "LVL1::eFEXFillEDM", "Tool to fille eFEX EDMs"}; SG::ReadHandleKey m_eTowerContainerSGKey {this, "MyETowers", "eTowerContainer", "Input container for eTowers"}; SG::ReadHandleKey m_scellsCollectionSGKey {this, "SCell", "SCell", "SCell"}; SG::WriteHandleKey< xAOD::eFexEMRoIContainer > m_eFexOutKey {this,"Key_eFexEMOutputContainer","L1_eEMRoI","Output eFexEM container"}; + SG::WriteHandleKey< xAOD::eFexTauRoIContainer > m_eFexTauOutKey {this,"Key_eFexTauOutputContainer","L1_eTauRoI","Output eFexTau container"}; + //std::map m_eTowersColl; std::map > m_allEmTobs; + + std::map > m_allTauTobs; }; diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXtauTOB.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXtauTOB.h index 68c6771174a..6fe5a9aba64 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXtauTOB.h +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXtauTOB.h @@ -25,12 +25,8 @@ namespace LVL1 { unsigned int m_et; unsigned int m_bitwise_et; float m_iso; - unsigned int m_reta_num; - unsigned int m_reta_den; - unsigned int m_rhad_num; - unsigned int m_rhad_den; - unsigned int m_wstot_num; - unsigned int m_wstot_den; + unsigned int m_fcore_num; + unsigned int m_fcore_den; unsigned int m_fpga_id; unsigned int m_efex_id; bool m_seed_und; @@ -51,28 +47,20 @@ namespace LVL1 { inline bool getSeedUnD() const {return m_seed_und;} // seed index in eta inline unsigned int getSeed() const {return m_seed;} - inline unsigned int getRetaNum() const {return m_reta_num;} - inline unsigned int getRetaDen() const {return m_reta_den;} - inline unsigned int getRhadNum() const {return m_rhad_num;} - inline unsigned int getRhadDen() const {return m_rhad_den;} - inline unsigned int getWstotNum() const {return m_wstot_num;} - inline unsigned int getWstotDen() const {return m_wstot_den;} + inline unsigned int getFcoreNum() const {return m_fcore_num;} + inline unsigned int getFcoreDen() const {return m_fcore_den;} unsigned int setEta(unsigned int); unsigned int setPhi(unsigned int); unsigned int setEt(unsigned int); unsigned int setBitwiseEt(unsigned int); - float setIso(unsigned int); + float setIso(float); unsigned int setFPGAID(unsigned int); unsigned int setEFEXID(unsigned int); bool setSeedUnD(bool); unsigned int setSeed(unsigned int); - unsigned int setRetaNum(unsigned int); - unsigned int setRetaDen(unsigned int); - unsigned int setRhadNum(unsigned int); - unsigned int setRhadDen(unsigned int); - unsigned int setWstotNum(unsigned int); - unsigned int setWstotDen(unsigned int); + unsigned int setFcoreNum(unsigned int); + unsigned int setFcoreDen(unsigned int); }; } // end of namespace diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXDriver.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXDriver.cxx index 96dbb7e907a..9fc003c9305 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXDriver.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXDriver.cxx @@ -34,6 +34,9 @@ #include "xAODTrigger/eFexEMRoI.h" #include "xAODTrigger/eFexEMRoIContainer.h" +#include "xAODTrigger/eFexTauRoI.h" +#include "xAODTrigger/eFexTauRoIContainer.h" + #include #include "SGTools/TestStore.h" @@ -90,6 +93,7 @@ StatusCode eFEXDriver::initialize() ATH_CHECK( m_eTowerContainerSGKey.initialize() ); ATH_CHECK( m_eEDMKey.initialize() ); + ATH_CHECK( m_eTauEDMKey.initialize() ); //ATH_CHECK( m_eFEXOutputCollectionSGKey.initialize() ); @@ -188,6 +192,7 @@ StatusCode eFEXDriver::finalize() ///STEP 6.5 - test the EDM ATH_CHECK(testEDM()); + ATH_CHECK(testTauEDM()); // STEP 7 - Close and clean the event m_eFEXSysSimTool->cleanup(); @@ -232,4 +237,34 @@ StatusCode eFEXDriver::finalize() return StatusCode::SUCCESS; } +StatusCode eFEXDriver::testTauEDM(){ + + const xAOD::eFexTauRoI* myRoI = 0; + + SG::ReadHandle myRoIContainer(m_eTauEDMKey); + if(!myRoIContainer.isValid()){ + ATH_MSG_FATAL("Could not retrieve EDM Container " << m_eTauEDMKey.key()); + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG("----got container: " << myRoIContainer.key()); + + for(const auto& it : * myRoIContainer){ + myRoI = it; + ATH_MSG_DEBUG("EDM eFex Number: " + << myRoI->eFexNumber() // returns an 8 bit unsigned integer referring to the eFEX number + << " et: " + << myRoI->et() // returns the et value of the EM cluster in MeV + << " eta: " + << myRoI->eta() // returns a floating point global eta (will be at full precision 0.025, but currently only at 0.1) + << " phi: " + << myRoI->phi() // returns a floating point global phi + << " is TOB? " + << +myRoI->isTOB() // returns 1 if true, returns 0 if xTOB + ); + } + + return StatusCode::SUCCESS; +} + } // end of LVL1 namespace diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFPGA.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFPGA.cxx index 37b02cd2284..369b6662832 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFPGA.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFPGA.cxx @@ -78,7 +78,8 @@ void eFEXFPGA::reset(){ StatusCode eFEXFPGA::execute(){ - m_tobwords.clear(); + m_emTobWords.clear(); + m_tauTobWords.clear(); SG::ReadHandle jk_eFEXFPGA_eTowerContainer(m_eFEXFPGA_eTowerContainerKey/*,ctx*/); if(!jk_eFEXFPGA_eTowerContainer.isValid()){ @@ -111,13 +112,13 @@ StatusCode eFEXFPGA::execute(){ }; ATH_CHECK( m_eFEXegAlgoTool.retrieve() ); - + ATH_CHECK( m_eFEXegAlgoTool->safetyTest() ); m_eFEXegAlgoTool->setup(tobtable); // temporarily(?) removed for debugging //if (eFEXFPGA_egAlgo->haveSeed() == false) continue; - + // Get Reta and Rhad outputs std::vector RetaCoreEnv; m_eFEXegAlgoTool->getReta(RetaCoreEnv); @@ -139,12 +140,14 @@ StatusCode eFEXFPGA::execute(){ SetIsoWP(RetaCoreEnv,tempThrs,RetaWP); SetIsoWP(RhadCoreEnv,tempThrs,RhadWP); SetIsoWP(WstotCoreEnv,tempThrs,WstotWP); + int eta_ind = ieta - 1; int phi_ind = iphi - 1; + unsigned int et = m_eFEXegAlgoTool->getET(); - uint32_t tobword = formEmTOB(eta_ind,phi_ind); - if ( tobword != 0 ) m_tobwords.push_back(tobword); + uint32_t tobword = m_eFEXFormTOBsTool->formEmTOBWord(m_id, eta_ind, phi_ind, et); + if ( tobword != 0 ) m_emTobWords.push_back(tobword); std::unique_ptr tmp_tob = m_eFEXegAlgoTool->geteFEXegTOB(); @@ -194,10 +197,17 @@ StatusCode eFEXFPGA::execute(){ }; ATH_CHECK( m_eFEXtauAlgoTool.retrieve() ); - + ATH_CHECK( m_eFEXtauAlgoTool->safetyTest() ); m_eFEXtauAlgoTool->setup(tobtable); + int eta_ind = ieta - 1; + int phi_ind = iphi - 1; + unsigned int et = m_eFEXtauAlgoTool->getEt(); + + uint32_t tobword = m_eFEXFormTOBsTool->formTauTOBWord(m_id, eta_ind, phi_ind, et); + if ( tobword != 0 ) m_tauTobWords.push_back(tobword); + // for plotting eFEXOutputs->addValue_tau("isCentralTowerSeed", m_eFEXtauAlgoTool->isCentralTowerSeed()); eFEXOutputs->addValue_tau("Et", m_eFEXtauAlgoTool->getEt()); @@ -208,18 +218,16 @@ StatusCode eFEXFPGA::execute(){ if (!m_eFEXtauAlgoTool->isCentralTowerSeed()){ continue; } } - } + } return StatusCode::SUCCESS; } - - std::vector eFEXFPGA::getEmTOBs() { - auto tobsSort = m_tobwords; + auto tobsSort = m_emTobWords; ATH_MSG_DEBUG("number of tobs: " < eFEXFPGA::getEmTOBs() } +std::vector eFEXFPGA::getTauTOBs() +{ + auto tobsSort = m_tauTobWords; + + ATH_MSG_DEBUG("number of tobs: " <(j) << std::endl; + } + */ + + // return the top 6 highest ET TOBs from the FPGA + tobsSort.resize(6); + return tobsSort; + +} void eFEXFPGA::SetTowersAndCells_SG(int tmp_eTowersIDs_subset[][6]){ @@ -322,9 +350,7 @@ void eFEXFPGA::SetIsoWP(std::vector & CoreEnv, std::vector(this); + } + + //----------------- Initialization ---------------------------- + + StatusCode eFEXFillEDM::initialize() + { + return StatusCode::SUCCESS; + } + + //----------------- Execute ---------------------------- + + StatusCode eFEXFillEDM::execute() + { + return StatusCode::SUCCESS; + } + + //----------------- Finalisation ------------------------------ + + StatusCode eFEXFillEDM::finalize() + { + return StatusCode::SUCCESS; + } + + xAOD::eFexEMRoI* eFEXFillEDM::fillEmEDM(uint8_t eFexNum, uint32_t tobWord) + { + uint8_t eFEXNumber = eFexNum; + uint32_t tobWord0 = tobWord; + uint32_t tobWord1 = 0; + + xAOD::eFexEMRoI* myEmEDM = new xAOD::eFexEMRoI(); + + myEmEDM->initialize(eFEXNumber, tobWord0, tobWord1); + ATH_MSG_DEBUG(" setting eFEX Number: " << +myEmEDM->eFexNumber() << " et: " << myEmEDM->et() << " eta: " << myEmEDM->eta() << " phi: " << myEmEDM->phi() ); + + return myEmEDM; + + } + + xAOD::eFexTauRoI* eFEXFillEDM::fillTauEDM(uint8_t eFexNum, uint32_t tobWord) + { + uint8_t eFEXNumber = eFexNum; + uint32_t tobWord0 = tobWord; + uint32_t tobWord1 = 0; + + xAOD::eFexTauRoI* myTauEDM = new xAOD::eFexTauRoI(); + + myTauEDM->initialize(eFEXNumber, tobWord0, tobWord1); + ATH_MSG_DEBUG(" setting eFEX Number: " << +myTauEDM->eFexNumber() << " et: " << myTauEDM->et() << " eta: " << myTauEDM->eta() << " phi: " << myTauEDM->phi() ); + + return myTauEDM; + + } + +} // end of namespace bracket + diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFormTOBs.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFormTOBs.cxx new file mode 100644 index 00000000000..0f5a056de0a --- /dev/null +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFormTOBs.cxx @@ -0,0 +1,92 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +//*************************************************************************** +// eFEXFormTOBs +// ------------------- +// begin : 30 04 2021 +// email : nicholas.andrew.luongo@cern.ch +// ***************************************************************************/ + +#include "L1CaloFEXSim/eFEXFormTOBs.h" +#include "L1CaloFEXSim/eFEXtauAlgo.h" +#include "L1CaloFEXSim/eFEXegAlgo.h" + +namespace LVL1 { + + // default constructor for persistency + +eFEXFormTOBs::eFEXFormTOBs(const std::string& type, const std::string& name, const IInterface* parent): + AthAlgTool(type, name, parent) + { + declareInterface(this); + } + +/** Desctructor */ +eFEXFormTOBs::~eFEXFormTOBs() +{ +} + +StatusCode eFEXFormTOBs::initialize() +{ + return StatusCode::SUCCESS; +} + +uint32_t eFEXFormTOBs::formTauTOBWord(int & id, int & ieta, int & iphi, unsigned int & et) +{ + uint32_t tobWord = 0; + const unsigned int eFexTobstep = 100; + + // Steps of 100 MeV for the TOB + unsigned int eFexTobEt = et / eFexTobstep; + + // Truncate at 12 bits, set to max value of 4095, 0xfff, or 111111111111 + if (eFexTobEt > 0xfff) + eFexTobEt = 0xfff; + + int eta = ieta; + int phi = iphi; + + // Create bare minimum tob word with et, eta, phi, and fpga index, bitshifted to the appropriate locations + tobWord = tobWord + eFexTobEt + (phi << 24) + (eta << 27) + (id << 30); + + ATH_MSG_DEBUG("Tau tobword with et, eta, phi, fpga: " << std::bitset<32>(tobWord) ); + + // Some arbitrary cut so that we're not flooded with tobs, to be taken from the Trigger menu in the future! + unsigned int minEtThreshold = 30; + if (et < minEtThreshold) + return 0; + else + return tobWord; +} + +uint32_t eFEXFormTOBs::formEmTOBWord(int & id, int & ieta, int & iphi, unsigned int & et) +{ + uint32_t tobWord = 0; + const unsigned int eFexTobstep = 100; + + // Steps of 100 MeV for the TOB + unsigned int eFexTobEt = et / eFexTobstep; + + // Truncate at 12 bits, set to max value of 4095, 0xfff, or 111111111111 + if (eFexTobEt > 0xfff) + eFexTobEt = 0xfff; + + int eta = ieta; + int phi = iphi; + + // Create bare minimum tob word with et, eta, phi, and fpga index, bitshifted to the appropriate locations + tobWord = tobWord + eFexTobEt + (phi << 24) + (eta << 27) + (id << 30); + + ATH_MSG_DEBUG("Tau tobword with et, eta, phi, fpga: " << std::bitset<32>(tobWord) ); + + // Some arbitrary cut so that we're not flooded with tobs, to be taken from the Trigger menu in the future! + unsigned int minEtThreshold = 30; + if (et < minEtThreshold) + return 0; + else + return tobWord; +} + +} diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSim.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSim.cxx index c3bf63b0e3c..fda1fdf9e86 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSim.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSim.cxx @@ -75,7 +75,8 @@ namespace LVL1 { } StatusCode eFEXSim::NewExecute(int tmp_eTowersIDs_subset[10][18]){ - m_tobWords.clear(); + m_emTobWords.clear(); + m_tauTobWords.clear(); std::copy(&tmp_eTowersIDs_subset[0][0], &tmp_eTowersIDs_subset[0][0]+(10*18),&m_eTowersIDs[0][0]); @@ -93,7 +94,8 @@ StatusCode eFEXSim::NewExecute(int tmp_eTowersIDs_subset[10][18]){ ATH_CHECK(m_eFEXFPGATool->init(0, m_id)); m_eFEXFPGATool->SetTowersAndCells_SG(tmp_eTowersIDs_subset_FPGA); ATH_CHECK(m_eFEXFPGATool->execute()); - m_tobWords.push_back(m_eFEXFPGATool->getEmTOBs()); + m_emTobWords.push_back(m_eFEXFPGATool->getEmTOBs()); + m_tauTobWords.push_back(m_eFEXFPGATool->getTauTOBs()); m_eFEXFPGATool->reset(); //FPGA 0---------------------------------------------------------------------------------------------------------------------------------------------- @@ -107,7 +109,8 @@ StatusCode eFEXSim::NewExecute(int tmp_eTowersIDs_subset[10][18]){ ATH_CHECK(m_eFEXFPGATool->init(1, m_id)); m_eFEXFPGATool->SetTowersAndCells_SG(tmp_eTowersIDs_subset_FPGA); ATH_CHECK(m_eFEXFPGATool->execute()); - m_tobWords.push_back(m_eFEXFPGATool->getEmTOBs()); + m_emTobWords.push_back(m_eFEXFPGATool->getEmTOBs()); + m_tauTobWords.push_back(m_eFEXFPGATool->getTauTOBs()); m_eFEXFPGATool->reset(); //FPGA 1---------------------------------------------------------------------------------------------------------------------------------------------- @@ -122,7 +125,8 @@ StatusCode eFEXSim::NewExecute(int tmp_eTowersIDs_subset[10][18]){ ATH_CHECK(m_eFEXFPGATool->init(2, m_id)); m_eFEXFPGATool->SetTowersAndCells_SG(tmp_eTowersIDs_subset_FPGA); ATH_CHECK(m_eFEXFPGATool->execute()); - m_tobWords.push_back(m_eFEXFPGATool->getEmTOBs()); + m_emTobWords.push_back(m_eFEXFPGATool->getEmTOBs()); + m_tauTobWords.push_back(m_eFEXFPGATool->getTauTOBs()); m_eFEXFPGATool->reset(); //FPGA 2---------------------------------------------------------------------------------------------------------------------------------------------- @@ -136,7 +140,8 @@ StatusCode eFEXSim::NewExecute(int tmp_eTowersIDs_subset[10][18]){ ATH_CHECK(m_eFEXFPGATool->init(3, m_id)); m_eFEXFPGATool->SetTowersAndCells_SG(tmp_eTowersIDs_subset_FPGA); ATH_CHECK(m_eFEXFPGATool->execute()); - m_tobWords.push_back(m_eFEXFPGATool->getEmTOBs()); + m_emTobWords.push_back(m_eFEXFPGATool->getEmTOBs()); + m_tauTobWords.push_back(m_eFEXFPGATool->getTauTOBs()); m_eFEXFPGATool->reset(); //FPGA 3---------------------------------------------------------------------------------------------------------------------------------------------- @@ -144,7 +149,6 @@ StatusCode eFEXSim::NewExecute(int tmp_eTowersIDs_subset[10][18]){ } - std::vector eFEXSim::getEmTOBs() { @@ -153,7 +157,7 @@ std::vector eFEXSim::getEmTOBs() bool first = true; // concatonate tobs from the fpgas - for(auto &j : m_tobWords){ + for(auto &j : m_emTobWords){ if (first) tobsSort = j; else tobsSort.insert(tobsSort.end(),j.begin(),j.end()); first = false; @@ -175,6 +179,36 @@ std::vector eFEXSim::getEmTOBs() return tobsSort; } +std::vector eFEXSim::getTauTOBs() +{ + + std::vector tobsSort; + tobsSort.clear(); + bool first = true; + + // concatonate tobs from the fpgas + for(auto &j : m_tauTobWords){ + if (first) tobsSort = j; + else tobsSort.insert(tobsSort.end(),j.begin(),j.end()); + first = false; + } + + ATH_MSG_DEBUG("number of tau tobs: " <(j) << std::endl; + } + */ + + // return the tob 6 highest ET TOBs from the efex + tobsSort.resize(6); + return tobsSort; +} + void eFEXSim::SetTowersAndCells_SG(int tmp_eTowersIDs_subset[10][18]){ // METHOD USING ONLY IDS std::copy(&tmp_eTowersIDs_subset[0][0], &tmp_eTowersIDs_subset[0][0]+(10*18),&m_eTowersIDs[0][0]); diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSysSim.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSysSim.cxx index f9d06567446..e85dfce590e 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSysSim.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSysSim.cxx @@ -25,6 +25,10 @@ #include "xAODTrigger/eFexEMRoIContainer.h" #include "xAODTrigger/eFexEMRoIAuxContainer.h" +#include "xAODTrigger/eFexTauRoI.h" +#include "xAODTrigger/eFexTauRoIContainer.h" +#include "xAODTrigger/eFexTauRoIAuxContainer.h" + #include namespace LVL1 { @@ -56,6 +60,8 @@ namespace LVL1 { ATH_CHECK(m_eFexOutKey.initialize()); + ATH_CHECK(m_eFexTauOutKey.initialize()); + return StatusCode::SUCCESS; } @@ -202,6 +208,7 @@ namespace LVL1 { m_eFEXSimTool->init(thisEFEX); ATH_CHECK(m_eFEXSimTool->NewExecute(tmp_eTowersIDs_subset)); m_allEmTobs.insert( std::map >::value_type(thisEFEX, (m_eFEXSimTool->getEmTOBs() ) )); + m_allTauTobs.insert( std::map >::value_type(thisEFEX, (m_eFEXSimTool->getTauTOBs() ) )); m_eFEXSimTool->reset(); fexcounter++; @@ -272,6 +279,7 @@ namespace LVL1 { m_eFEXSimTool->init(thisEFEX); ATH_CHECK(m_eFEXSimTool->NewExecute(tmp_eTowersIDs_subset)); m_allEmTobs.insert( std::map >::value_type(thisEFEX, (m_eFEXSimTool->getEmTOBs() ) )); + m_allTauTobs.insert( std::map >::value_type(thisEFEX, (m_eFEXSimTool->getTauTOBs() ) )); m_eFEXSimTool->reset(); fexcounter++; @@ -356,6 +364,7 @@ namespace LVL1 { m_eFEXSimTool->init(thisEFEX); ATH_CHECK(m_eFEXSimTool->NewExecute(tmp_eTowersIDs_subset)); m_allEmTobs.insert( std::map >::value_type(thisEFEX, (m_eFEXSimTool->getEmTOBs() ) )); + m_allTauTobs.insert( std::map >::value_type(thisEFEX, (m_eFEXSimTool->getTauTOBs() ) )); m_eFEXSimTool->reset(); fexcounter++; @@ -367,10 +376,15 @@ namespace LVL1 { m_eAuxContainer = std::make_unique (); m_eContainer->setStore(m_eAuxContainer.get()); + m_tauContainer = std::make_unique (); + m_tauAuxContainer = std::make_unique (); + m_tauContainer->setStore(m_tauAuxContainer.get()); + // iterate over all Em Tobs and fill EDM with them for( auto const& [efex, tobs] : m_allEmTobs ){ for(auto &tob : tobs){ - ATH_CHECK(fillEDM(efex,tob)); + xAOD::eFexEMRoI* emEDM = m_eFEXFillEDMTool->fillEmEDM(efex,tob); + m_eContainer->push_back(emEDM); } } @@ -378,6 +392,17 @@ namespace LVL1 { ATH_MSG_DEBUG(" write: " << outputeFexHandle.key() << " = " << "..." ); ATH_CHECK(outputeFexHandle.record(std::move(m_eContainer),std::move(m_eAuxContainer))); + // iterate over all tau TOBs and fill EDM with them + for( auto const& [efex, tobs] : m_allTauTobs ){ + for(auto &tob : tobs){ + xAOD::eFexTauRoI* tauEDM = m_eFEXFillEDMTool->fillTauEDM(efex,tob); + m_tauContainer->push_back(tauEDM); + } + } + + SG::WriteHandle outputeFexTauHandle(m_eFexTauOutKey/*, ctx*/); + ATH_MSG_DEBUG(" write: " << outputeFexTauHandle.key() << " = " << "..." ); + ATH_CHECK(outputeFexTauHandle.record(std::move(m_tauContainer),std::move(m_tauAuxContainer))); //Send TOBs to bytestream? // ToDo @@ -388,8 +413,8 @@ namespace LVL1 { } - - StatusCode eFEXSysSim::fillEDM(uint8_t eFexNum, uint32_t tobWord){ +/* + StatusCode eFEXSysSim::fillEmEDM(uint8_t eFexNum, uint32_t tobWord){ uint8_t eFEXNumber = eFexNum; uint32_t tobWord0 = tobWord; @@ -405,6 +430,21 @@ namespace LVL1 { } - + StatusCode eFEXSysSim::fillTauEDM(uint8_t eFexNum, uint32_t tobWord){ + + uint8_t eFEXNumber = eFexNum; + uint32_t tobWord0 = tobWord; + uint32_t tobWord1 = 0; + + xAOD::eFexTauRoI* myEDM = new xAOD::eFexTauRoI(); + m_tauContainer->push_back( myEDM ); + + myEDM->initialize(eFEXNumber, tobWord0, tobWord1); + ATH_MSG_DEBUG(" setting eFEX Number: " << +myEDM->eFexNumber() << " et: " << myEDM->et() << " eta: " << myEDM->eta() << " phi: " << myEDM->phi() ); + + return StatusCode::SUCCESS; + + } +*/ } // end of namespace bracket diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXtauTOB.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXtauTOB.cxx index 03369fad58d..f359643026d 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXtauTOB.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXtauTOB.cxx @@ -17,12 +17,6 @@ LVL1::eFEXtauTOB::eFEXtauTOB(): m_eta{99999}, m_phi{99999}, m_et{99999}, - m_reta_num{99999}, - m_reta_den{99999}, - m_rhad_num{99999}, - m_rhad_den{99999}, - m_wstot_num{99999}, - m_wstot_den{99999}, m_fpga_id{99999}, m_efex_id{99999}, m_seed_und{1}, @@ -53,7 +47,7 @@ unsigned int LVL1::eFEXtauTOB::setBitwiseEt(unsigned int bitwise_et) return m_bitwise_et; } -float LVL1::eFEXtauTOB::setIso(unsigned int iso) +float LVL1::eFEXtauTOB::setIso(float iso) { m_iso = iso; return m_iso; @@ -83,38 +77,14 @@ unsigned int LVL1::eFEXtauTOB::setSeed(unsigned int seed) return m_seed; } -unsigned int LVL1::eFEXtauTOB::setRetaNum(unsigned int retanum) +unsigned int LVL1::eFEXtauTOB::setFcoreNum(unsigned int fcorenum) { - m_reta_num = retanum; - return m_reta_num; + m_fcore_num = fcorenum; + return m_fcore_num; } -unsigned int LVL1::eFEXtauTOB::setRetaDen(unsigned int retaden) +unsigned int LVL1::eFEXtauTOB::setFcoreDen(unsigned int fcoreden) { - m_reta_den = retaden; - return m_reta_den; -} - -unsigned int LVL1::eFEXtauTOB::setRhadNum(unsigned int rhadnum) -{ - m_rhad_num = rhadnum; - return m_rhad_num; -} - -unsigned int LVL1::eFEXtauTOB::setRhadDen(unsigned int rhadden) -{ - m_rhad_den = rhadden; - return m_rhad_den; -} - -unsigned int LVL1::eFEXtauTOB::setWstotNum(unsigned int wstot_num) -{ - m_wstot_num = wstot_num; - return wstot_num; -} - -unsigned int LVL1::eFEXtauTOB::setWstotDen(unsigned int wstot_den) -{ - m_wstot_den = wstot_den; - return wstot_den; + m_fcore_den = fcoreden; + return m_fcore_den; } diff --git a/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFPGA.h b/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFPGA.h index ac153498038..381b5a8cb6a 100644 --- a/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFPGA.h +++ b/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFPGA.h @@ -15,6 +15,7 @@ #include "GaudiKernel/IAlgTool.h" #include "xAODTrigger/eFexEMRoI.h" +#include "xAODTrigger/eFexTauRoI.h" namespace LVL1 { @@ -40,10 +41,14 @@ Interface definition for eFEXFPGA virtual void SetIsoWP(std::vector &, std::vector &, unsigned int &) = 0; - virtual uint32_t formEmTOB(int &, int &) = 0; + //virtual uint32_t formEmTOB(int &, int &) = 0; virtual std::vector getEmTOBs() = 0; + //virtual uint32_t formTauTOB(int &, int &) = 0; + + virtual std::vector getTauTOBs() = 0; + // static virtual bool etSort(uint32_t &, uint32_t &) = 0; private: diff --git a/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFillEDM.h b/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFillEDM.h new file mode 100644 index 00000000000..304042b8d4a --- /dev/null +++ b/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFillEDM.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +//*************************************************************************** +// IeFEXFillEDM.h - +// ------------------- +// begin : 02 05 2021 +// email : nicholas.andrew.luongo@cern.ch +//***************************************************************************/ + +#ifndef IeFEXFillEDM_H +#define IeFEXFillEDM_H + +#include "GaudiKernel/IAlgTool.h" +#include "xAODTrigger/eFexEMRoI.h" +#include "xAODTrigger/eFexTauRoI.h" + +namespace LVL1 { + +/* +Interface definition for eFEXFillEDM +*/ + + static const InterfaceID IID_IeFEXFillEDM("LVL1::IeFEXFillEDM", 1, 0); + + class IeFEXFillEDM : virtual public IAlgTool { + public: + static const InterfaceID& interfaceID( ) ; + + virtual StatusCode initialize() = 0; + virtual StatusCode finalize() = 0; + virtual StatusCode execute() = 0; + + virtual xAOD::eFexEMRoI* fillEmEDM(uint8_t eFEXNumber, uint32_t tobWord) = 0; + virtual xAOD::eFexTauRoI* fillTauEDM(uint8_t eFEXNumber, uint32_t tobWord) = 0; + + private: + + }; + + inline const InterfaceID& LVL1::IeFEXFillEDM::interfaceID() + { + return IID_IeFEXFillEDM; + } + +} // end of namespace + +#endif diff --git a/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFormTOBs.h b/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFormTOBs.h new file mode 100644 index 00000000000..33caaff3abf --- /dev/null +++ b/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXFormTOBs.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +//*************************************************************************** +// IeFEXFormTOBs.h - +// ------------------- +// begin : 30 04 2021 +// email : nicholas.andrew.luongo@cern.ch +// ***************************************************************************/ + +#ifndef IeFEXFormTOBs_H +#define IeFEXFormTOBs_H + +#include "GaudiKernel/IAlgTool.h" + +namespace LVL1 { + +/* +Interface definition for eFEXFormTOBs +*/ + + static const InterfaceID IID_IeFEXFormTOBs("LVL1::IeFEXFormTOBs", 1, 0); + + class IeFEXFormTOBs : virtual public IAlgTool { + public: + static const InterfaceID& interfaceID( ) ; + + virtual uint32_t formTauTOBWord(int &, int &, int &, unsigned int &) = 0; + + virtual uint32_t formEmTOBWord(int &, int &, int &, unsigned int &) = 0; + + private: + + }; + + inline const InterfaceID& LVL1::IeFEXFormTOBs::interfaceID() + { + return IID_IeFEXFormTOBs; + } + +} // end of namespace + +#endif + diff --git a/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXSim.h b/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXSim.h index 16de6efe106..4de1f7bb476 100644 --- a/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXSim.h +++ b/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXSim.h @@ -39,6 +39,7 @@ Interface definition for eFEXSim virtual StatusCode NewExecute(int tmp[10][18]) = 0; virtual std::vector getEmTOBs() = 0; + virtual std::vector getTauTOBs() = 0; private: diff --git a/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXSysSim.h b/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXSysSim.h index 5b3d2d5c4c9..343c27a5172 100644 --- a/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXSysSim.h +++ b/Trigger/TrigT1/L1CaloFEXToolInterfaces/L1CaloFEXToolInterfaces/IeFEXSysSim.h @@ -36,9 +36,11 @@ Interface definition for eFEXSysSim virtual void cleanup() = 0; virtual int calcTowerID(int eta, int phi, int mod) = 0 ; - - virtual StatusCode fillEDM(uint8_t eFEXNumber, uint32_t tobWord) = 0; +/* + virtual StatusCode fillEmEDM(uint8_t eFEXNumber, uint32_t tobWord) = 0; + virtual StatusCode fillTauEDM(uint8_t eFEXNumber, uint32_t tobWord) = 0; +*/ private: }; -- GitLab From 5066787605a8c836a76f27057e1a5753b192732e Mon Sep 17 00:00:00 2001 From: Nicholas Luongo Date: Fri, 14 May 2021 00:14:43 +0200 Subject: [PATCH 2/3] Update FEXDriver_entries --- .../L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFormTOBs.h | 6 ++++-- .../L1CaloFEXSim/src/components/FEXDriver_entries.cxx | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFormTOBs.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFormTOBs.h index afd45aaac90..4acd4f8cff7 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFormTOBs.h +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/L1CaloFEXSim/eFEXFormTOBs.h @@ -32,9 +32,9 @@ namespace LVL1 { /** Destructor */ virtual ~eFEXFormTOBs(); - virtual uint32_t formTauTOBWord(int &, int &, int &, unsigned int &) = 0; + virtual uint32_t formTauTOBWord(int &, int &, int &, unsigned int &) override; - virtual uint32_t formEmTOBWord(int &, int &, int &, unsigned int &) = 0; + virtual uint32_t formEmTOBWord(int &, int &, int &, unsigned int &) override; /** Internal data */ private: @@ -43,4 +43,6 @@ namespace LVL1 { } // end of namespace +CLASS_DEF( LVL1::eFEXFormTOBs , 261506707 , 1 ) + #endif diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/components/FEXDriver_entries.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/components/FEXDriver_entries.cxx index d4573d17b55..ab4f549bb7c 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/components/FEXDriver_entries.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/components/FEXDriver_entries.cxx @@ -8,6 +8,8 @@ #include "L1CaloFEXSim/eFEXFPGA.h" #include "L1CaloFEXSim/eFEXtauAlgo.h" #include "L1CaloFEXSim/eFEXegAlgo.h" +#include "L1CaloFEXSim/eFEXFormTOBs.h" +#include "L1CaloFEXSim/eFEXFillEDM.h" #include "L1CaloFEXSim/eFEXNtupleWriter.h" #include "L1CaloFEXSim/jFEXDriver.h" #include "L1CaloFEXSim/jFEXSysSim.h" @@ -29,6 +31,8 @@ DECLARE_COMPONENT(eSuperCellTowerMapper) DECLARE_COMPONENT(eFEXFPGA) DECLARE_COMPONENT(eFEXtauAlgo) DECLARE_COMPONENT(eFEXegAlgo) +DECLARE_COMPONENT(eFEXFormTOBs) +DECLARE_COMPONENT(eFEXFillEDM) DECLARE_COMPONENT(eFEXNtupleWriter) DECLARE_COMPONENT(jFEXDriver) -- GitLab From 1fdd1b8f9b6bdba2fabe71798473530b1549a7ca Mon Sep 17 00:00:00 2001 From: Nicholas Luongo Date: Tue, 18 May 2021 01:04:38 +0200 Subject: [PATCH 3/3] Further changes --- .../Root/eFexEMRoIAuxContainer_v1.cxx | 4 +- Event/xAOD/xAODTrigger/Root/eFexEMRoI_v1.cxx | 38 +++++++++---------- .../versions/eFexEMRoIAuxContainer_v1.h | 4 +- .../xAODTrigger/versions/eFexEMRoI_v1.h | 6 +-- .../L1CaloFEXSim/src/eFEXFillEDM.cxx | 14 ++++++- .../L1CaloFEX/L1CaloFEXSim/src/eFEXSysSim.cxx | 1 + .../src/EMTauInputProviderFEX.cxx | 2 +- 7 files changed, 40 insertions(+), 29 deletions(-) diff --git a/Event/xAOD/xAODTrigger/Root/eFexEMRoIAuxContainer_v1.cxx b/Event/xAOD/xAODTrigger/Root/eFexEMRoIAuxContainer_v1.cxx index 652259372b9..95e3a250c2b 100644 --- a/Event/xAOD/xAODTrigger/Root/eFexEMRoIAuxContainer_v1.cxx +++ b/Event/xAOD/xAODTrigger/Root/eFexEMRoIAuxContainer_v1.cxx @@ -12,8 +12,8 @@ namespace xAOD { eFexEMRoIAuxContainer_v1::eFexEMRoIAuxContainer_v1() : AuxContainerBase() { - AUX_VARIABLE( Word0); - AUX_VARIABLE( Word1); + AUX_VARIABLE( word0); + AUX_VARIABLE( word1); AUX_VARIABLE( eFexNumber); AUX_VARIABLE( shelfNumber); AUX_VARIABLE( RetaEnv); diff --git a/Event/xAOD/xAODTrigger/Root/eFexEMRoI_v1.cxx b/Event/xAOD/xAODTrigger/Root/eFexEMRoI_v1.cxx index 28691699671..ff7a1a689e1 100755 --- a/Event/xAOD/xAODTrigger/Root/eFexEMRoI_v1.cxx +++ b/Event/xAOD/xAODTrigger/Root/eFexEMRoI_v1.cxx @@ -50,9 +50,9 @@ namespace xAOD { /// Raw data words - AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint32_t, Word0, + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint32_t, word0, setWord0 ) - AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint32_t, Word1, + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint32_t, word1, setWord1 ) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( eFexEMRoI_v1, uint8_t, eFexNumber, seteFexNumber ) @@ -91,40 +91,40 @@ namespace xAOD { /// TOB or xTOB? eFexEMRoI_v1::ObjectType eFexEMRoI_v1::type() const { - if (Word1() == 0) return TOB; + if (word1() == 0) return TOB; else return xTOB; } /// Hardware coordinate elements unsigned int eFexEMRoI_v1::fpga() const { - return (Word0() >> s_fpgaBit) & s_fpgaMask; + return (word0() >> s_fpgaBit) & s_fpgaMask; } unsigned int eFexEMRoI_v1::fpgaEta() const { - return (Word0() >> s_etaBit) & s_etaMask; + return (word0() >> s_etaBit) & s_etaMask; } unsigned int eFexEMRoI_v1::fpgaPhi() const { - return (Word0() >> s_phiBit) & s_phiMask; + return (word0() >> s_phiBit) & s_phiMask; } unsigned int eFexEMRoI_v1::UpNotDown() const { - return (Word0() >> s_updownBit) & s_updownMask; + return (word0() >> s_updownBit) & s_updownMask; } unsigned int eFexEMRoI_v1::seed() const { - return (Word0() >> s_seedBit) & s_seedMask; + return (word0() >> s_seedBit) & s_seedMask; } unsigned int eFexEMRoI_v1::seedMax() const { - return (Word0() >> s_maxBit) & s_maxMask; + return (word0() >> s_maxBit) & s_maxMask; } /// Raw ET on TOB scale (100 MeV/count) unsigned int eFexEMRoI_v1::etTOB() const { // Data content = TOB - if (Word1() == 0) { - return (Word0() >> s_etBit) & s_etMask; + if (word1() == 0) { + return (word0() >> s_etBit) & s_etMask; } // Data Content = xTOB. Need to remove lower bits and cap range else { @@ -137,39 +137,39 @@ namespace xAOD { /// Full precision ET (25 MeV/count, only available if object is an xTOB unsigned int eFexEMRoI_v1::etXTOB() const { /// If the object is not an xTOB return 0 as high-precision ET unavailable - if (Word1() == 0) { + if (word1() == 0) { //return etTOB()*s_tobEtScale/s_xTobEtScale; return 0; } else { - return (Word1() >> s_etBit) & s_etFullMask; + return (word1() >> s_etBit) & s_etFullMask; } } /// Results of the 3 jet discriminant algorithms unsigned int eFexEMRoI_v1::RetaThresholds() const { - return (Word0() >> s_veto1Bit) & s_veto1Mask; + return (word0() >> s_veto1Bit) & s_veto1Mask; } unsigned int eFexEMRoI_v1::RhadThresholds() const { - return (Word0() >> s_veto2Bit) & s_veto2Mask; + return (word0() >> s_veto2Bit) & s_veto2Mask; } unsigned int eFexEMRoI_v1::WstotThresholds() const { - return (Word0() >> s_veto3Bit) & s_veto3Mask; + return (word0() >> s_veto3Bit) & s_veto3Mask; } unsigned int eFexEMRoI_v1::bcn4() const { - return (Word1() >> s_bcn4Bit) & s_bcn4Mask; + return (word1() >> s_bcn4Bit) & s_bcn4Mask; } /// Return single 32-bit TOB word from an xTOB uint32_t eFexEMRoI_v1::tobWord() const { // Do something sensible if called for a TOB - if (Word1() == 0) return Word0(); + if (word1() == 0) return word0(); // When called for xTOB else { - uint32_t word = Word0() + etTOB(); + uint32_t word = word0() + etTOB(); return word; } } diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/versions/eFexEMRoIAuxContainer_v1.h b/Event/xAOD/xAODTrigger/xAODTrigger/versions/eFexEMRoIAuxContainer_v1.h index b6d1a784a4d..3db36f50269 100644 --- a/Event/xAOD/xAODTrigger/xAODTrigger/versions/eFexEMRoIAuxContainer_v1.h +++ b/Event/xAOD/xAODTrigger/xAODTrigger/versions/eFexEMRoIAuxContainer_v1.h @@ -37,8 +37,8 @@ namespace xAOD { eFexEMRoIAuxContainer_v1(); private: - std::vector< uint32_t > Word0; - std::vector< uint32_t > Word1; + std::vector< uint32_t > word0; + std::vector< uint32_t > word1; std::vector< uint8_t > eFexNumber; std::vector< uint8_t > shelfNumber; std::vector< uint16_t > RetaEnv; diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/versions/eFexEMRoI_v1.h b/Event/xAOD/xAODTrigger/xAODTrigger/versions/eFexEMRoI_v1.h index 55d4eda2dfe..3c6501c23b8 100755 --- a/Event/xAOD/xAODTrigger/xAODTrigger/versions/eFexEMRoI_v1.h +++ b/Event/xAOD/xAODTrigger/xAODTrigger/versions/eFexEMRoI_v1.h @@ -37,7 +37,7 @@ namespace xAOD { eFexEMRoI_v1(); /// Initialise the object with its most important properties - void initialize( uint8_t eFexNumber, uint8_t shelf, uint32_t Word0, uint32_t Word1 = 0 ); + void initialize( uint8_t eFexNumber, uint8_t shelf, uint32_t word0, uint32_t word1 = 0 ); /// Object types enum ObjectType { @@ -46,8 +46,8 @@ namespace xAOD { }; /// The "raw" 32-bit words describing the e/gamma candidate - uint32_t Word0() const; - uint32_t Word1() const; + uint32_t word0() const; + uint32_t word1() const; /// Set the "raw" 32-bit words describing the e/gamma candidate void setWord0( uint32_t value ); void setWord1( uint32_t value ); diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFillEDM.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFillEDM.cxx index 3652a3ef28e..a77299b62aa 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFillEDM.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXFillEDM.cxx @@ -48,10 +48,20 @@ namespace LVL1 { uint32_t tobWord0 = tobWord; uint32_t tobWord1 = 0; + // Kludge to test new eFEX number format + int offset = 0; + if (eFEXNumber < 0xC0) offset = 1; + if (eFEXNumber < 0xB0) offset = 2; + int octant = eFEXNumber&0xf; + int residual = octant%4; + + uint8_t shelf = (octant > 3 ? 1 : 0); + uint8_t eFEX = residual*3 + offset; + xAOD::eFexEMRoI* myEmEDM = new xAOD::eFexEMRoI(); - myEmEDM->initialize(eFEXNumber, tobWord0, tobWord1); - ATH_MSG_DEBUG(" setting eFEX Number: " << +myEmEDM->eFexNumber() << " et: " << myEmEDM->et() << " eta: " << myEmEDM->eta() << " phi: " << myEmEDM->phi() ); + myEmEDM->initialize(eFEX, shelf, tobWord0, tobWord1); + ATH_MSG_DEBUG(" setting eFEX Number: " << +myEmEDM->eFexNumber() << " shelf: " << myEmEDM->shelfNumber() << " et: " << myEmEDM->et() << " eta: " << myEmEDM->eta() << " phi: " << myEmEDM->phi() ); return myEmEDM; diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSysSim.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSysSim.cxx index 07188aeb955..51718cdfb8a 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSysSim.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/src/eFEXSysSim.cxx @@ -458,3 +458,4 @@ namespace LVL1 { */ } // end of namespace bracket + diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.cxx index 1acb547fecd..7f4115c1ec3 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/EMTauInputProviderFEX.cxx @@ -136,7 +136,7 @@ EMTauInputProviderFEX::fillTopoInputEvent(TCS::TopoInputEvent& inputEvent) const unsigned int iet = static_cast(eFexRoI->et()/Gaudi::Units::GeV); //EM TOB - TCS::ClusterTOB cluster( iet, static_cast(0), ieta, iphi, TCS::CLUSTER , static_cast(eFexRoI->Word0()) ); + TCS::ClusterTOB cluster( iet, static_cast(0), ieta, iphi, TCS::CLUSTER , static_cast(eFexRoI->word0()) ); cluster.setEtaDouble( eFexRoI->eta() ); cluster.setPhiDouble( eFexRoI->phi() ); -- GitLab