File indexing completed on 2024-04-06 12:21:26
0001 #ifndef L1TRIGGER_PHASE2L1PARTICLEFLOW_BUFFERED_FOLDED_MULTIFIFO_REGIONZER_REF_H
0002 #define L1TRIGGER_PHASE2L1PARTICLEFLOW_BUFFERED_FOLDED_MULTIFIFO_REGIONZER_REF_H
0003
0004 #include "L1Trigger/Phase2L1ParticleFlow/interface/regionizer/folded_multififo_regionizer_ref.h"
0005 #include "L1Trigger/Phase2L1ParticleFlow/interface/dbgPrintf.h"
0006 #include <memory>
0007 #include <deque>
0008
0009 namespace l1ct {
0010 class BufferedFoldedMultififoRegionizerEmulator : public FoldedMultififoRegionizerEmulator {
0011 public:
0012 enum class FoldMode { EndcapEta2 };
0013
0014 BufferedFoldedMultififoRegionizerEmulator(unsigned int nclocks,
0015 unsigned int ntk,
0016 unsigned int ncalo,
0017 unsigned int nem,
0018 unsigned int nmu,
0019 bool streaming,
0020 unsigned int outii,
0021 unsigned int pauseii,
0022 bool useAlsoVtxCoords);
0023
0024 BufferedFoldedMultififoRegionizerEmulator(const edm::ParameterSet& iConfig);
0025
0026 ~BufferedFoldedMultififoRegionizerEmulator() override;
0027
0028 static edm::ParameterSetDescription getParameterSetDescription();
0029
0030 void initSectorsAndRegions(const RegionizerDecodedInputs& in, const std::vector<PFInputRegion>& out) override;
0031
0032 void run(const RegionizerDecodedInputs& in, std::vector<PFInputRegion>& out) override;
0033
0034 void fillLinks(unsigned int iclock, std::vector<l1ct::TkObjEmu>& links, std::vector<bool>& valid);
0035 void fillLinks(unsigned int iclock, std::vector<l1ct::HadCaloObjEmu>& links, std::vector<bool>& valid);
0036 void fillLinks(unsigned int iclock, std::vector<l1ct::EmCaloObjEmu>& links, std::vector<bool>& valid);
0037 void fillLinks(unsigned int iclock, std::vector<l1ct::MuObjEmu>& links, std::vector<bool>& valid);
0038
0039
0040 bool step(bool newEvent,
0041 const std::vector<l1ct::TkObjEmu>& links_tk,
0042 const std::vector<l1ct::HadCaloObjEmu>& links_hadCalo,
0043 const std::vector<l1ct::EmCaloObjEmu>& links_emCalo,
0044 const std::vector<l1ct::MuObjEmu>& links_mu,
0045 std::vector<l1ct::TkObjEmu>& out_tk,
0046 std::vector<l1ct::HadCaloObjEmu>& out_hadCalo,
0047 std::vector<l1ct::EmCaloObjEmu>& out_emCalo,
0048 std::vector<l1ct::MuObjEmu>& out_mu,
0049 bool mux = true);
0050
0051 template <typename TEmu, typename TFw>
0052 void toFirmware(const std::vector<TEmu>& emu, TFw fw[]) {
0053 for (unsigned int i = 0, n = emu.size(); i < n; ++i) {
0054 fw[i] = emu[i];
0055 }
0056 }
0057
0058 protected:
0059 std::vector<l1ct::multififo_regionizer::EtaPhiBuffer<l1ct::TkObjEmu>> tkBuffers_;
0060 std::vector<l1ct::multififo_regionizer::EtaPhiBuffer<l1ct::HadCaloObjEmu>> caloBuffers_;
0061 std::vector<l1ct::multififo_regionizer::EtaPhiBuffer<l1ct::MuObjEmu>> muBuffers_;
0062
0063 void findEtaBounds_(const l1ct::PFRegionEmu& sec,
0064 const std::vector<PFInputRegion>& reg,
0065 l1ct::glbeta_t& etaMin,
0066 l1ct::glbeta_t& etaMax);
0067
0068 template <typename T>
0069 void fillLinksPosNeg_(unsigned int iclock,
0070 const std::vector<l1ct::DetectorSector<T>>& secNeg,
0071 const std::vector<l1ct::DetectorSector<T>>& secPos,
0072 std::vector<T>& links,
0073 std::vector<bool>& valid);
0074 };
0075 }
0076
0077 #endif