File indexing completed on 2024-04-06 12:21:27
0001 #ifndef multififo_regionizer_ref_h
0002 #define multififo_regionizer_ref_h
0003
0004 #include "L1Trigger/Phase2L1ParticleFlow/interface/regionizer/regionizer_base_ref.h"
0005 #include "L1Trigger/Phase2L1ParticleFlow/interface/egamma/pfeginput_ref.h"
0006 #include "L1Trigger/Phase2L1ParticleFlow/interface/regionizer/multififo_regionizer_elements_ref.h"
0007 #include <memory>
0008
0009 namespace edm {
0010 class ParameterSet;
0011 class ParameterSetDescription;
0012 }
0013
0014 namespace l1ct {
0015 class EGInputSelectorEmulator;
0016 struct EGInputSelectorEmuConfig;
0017 }
0018
0019 namespace l1ct {
0020 class MultififoRegionizerEmulator : public RegionizerEmulator {
0021 public:
0022 MultififoRegionizerEmulator(unsigned int nendcaps,
0023 unsigned int nclocks,
0024 unsigned int ntklinks,
0025 unsigned int ncalolinks,
0026 unsigned int ntk,
0027 unsigned int ncalo,
0028 unsigned int nem,
0029 unsigned int nmu,
0030 bool streaming,
0031 unsigned int outii,
0032 unsigned int pauseii,
0033 bool useAlsoVtxCoords);
0034
0035 enum class BarrelSetup { Full54, Full27, Central18, Central9, Phi18, Phi9 };
0036 MultififoRegionizerEmulator(BarrelSetup barrelSetup,
0037 unsigned int ntklinks,
0038 unsigned int nHCalLinks,
0039 unsigned int nECalLinks,
0040 unsigned int nclocks,
0041 unsigned int ntk,
0042 unsigned int ncalo,
0043 unsigned int nem,
0044 unsigned int nmu,
0045 bool streaming,
0046 unsigned int outii,
0047 unsigned int pauseii,
0048 bool useAlsoVtxCoords);
0049
0050 MultififoRegionizerEmulator(const edm::ParameterSet& iConfig);
0051 MultififoRegionizerEmulator(const std::string& barrelSetup, const edm::ParameterSet& iConfig);
0052
0053 ~MultififoRegionizerEmulator() override;
0054
0055 static edm::ParameterSetDescription getParameterSetDescription();
0056 static edm::ParameterSetDescription getParameterSetDescriptionBarrel();
0057
0058 static BarrelSetup parseBarrelSetup(const std::string& setup);
0059
0060 void setEgInterceptMode(bool afterFifo, const l1ct::EGInputSelectorEmuConfig& interceptorConfig);
0061 void initSectorsAndRegions(const RegionizerDecodedInputs& in, const std::vector<PFInputRegion>& out) override;
0062
0063 void run(const RegionizerDecodedInputs& in, std::vector<PFInputRegion>& out) override;
0064
0065
0066 bool step(bool newEvent,
0067 const std::vector<l1ct::TkObjEmu>& links,
0068 std::vector<l1ct::TkObjEmu>& out,
0069 bool mux = true);
0070 bool step(bool newEvent,
0071 const std::vector<l1ct::EmCaloObjEmu>& links,
0072 std::vector<l1ct::EmCaloObjEmu>& out,
0073 bool mux = true);
0074 bool step(bool newEvent,
0075 const std::vector<l1ct::HadCaloObjEmu>& links,
0076 std::vector<l1ct::HadCaloObjEmu>& out,
0077 bool mux = true);
0078 bool step(bool newEvent,
0079 const std::vector<l1ct::MuObjEmu>& links,
0080 std::vector<l1ct::MuObjEmu>& out,
0081 bool mux = true);
0082 bool step(bool newEvent,
0083 const std::vector<l1ct::TkObjEmu>& links_tk,
0084 const std::vector<l1ct::HadCaloObjEmu>& links_hadCalo,
0085 const std::vector<l1ct::EmCaloObjEmu>& links_emCalo,
0086 const std::vector<l1ct::MuObjEmu>& links_mu,
0087 std::vector<l1ct::TkObjEmu>& out_tk,
0088 std::vector<l1ct::HadCaloObjEmu>& out_hadCalo,
0089 std::vector<l1ct::EmCaloObjEmu>& out_emCalo,
0090 std::vector<l1ct::MuObjEmu>& out_mu,
0091 bool mux = true);
0092 void destream(int iclock,
0093 const std::vector<l1ct::TkObjEmu>& tk_out,
0094 const std::vector<l1ct::EmCaloObjEmu>& em_out,
0095 const std::vector<l1ct::HadCaloObjEmu>& calo_out,
0096 const std::vector<l1ct::MuObjEmu>& mu_out,
0097 PFInputRegion& out);
0098
0099
0100 void fillLinks(unsigned int iclock,
0101 const RegionizerDecodedInputs& in,
0102 std::vector<l1ct::TkObjEmu>& links,
0103 std::vector<bool>& valid);
0104 void fillLinks(unsigned int iclock,
0105 const RegionizerDecodedInputs& in,
0106 std::vector<l1ct::HadCaloObjEmu>& links,
0107 std::vector<bool>& valid);
0108 void fillLinks(unsigned int iclock,
0109 const RegionizerDecodedInputs& in,
0110 std::vector<l1ct::EmCaloObjEmu>& links,
0111 std::vector<bool>& valid);
0112 void fillLinks(unsigned int iclock,
0113 const RegionizerDecodedInputs& in,
0114 std::vector<l1ct::MuObjEmu>& links,
0115 std::vector<bool>& valid);
0116 template <typename T>
0117 void fillLinks(unsigned int iclock, const RegionizerDecodedInputs& in, std::vector<T>& links) {
0118 std::vector<bool> unused;
0119 fillLinks(iclock, in, links, unused);
0120 }
0121
0122
0123 void toFirmware(const std::vector<l1ct::TkObjEmu>& emu, TkObj fw[]);
0124 void toFirmware(const std::vector<l1ct::HadCaloObjEmu>& emu, HadCaloObj fw[]);
0125 void toFirmware(const std::vector<l1ct::EmCaloObjEmu>& emu, EmCaloObj fw[]);
0126 void toFirmware(const std::vector<l1ct::MuObjEmu>& emu, MuObj fw[]);
0127
0128 void reset();
0129
0130 private:
0131 const unsigned int NTK_SECTORS, NCALO_SECTORS;
0132 const unsigned int NTK_LINKS, NCALO_LINKS, HCAL_LINKS, ECAL_LINKS, NMU_LINKS;
0133 unsigned int nendcaps_, nclocks_, ntk_, ncalo_, nem_, nmu_, outii_, pauseii_, nregions_;
0134 bool streaming_;
0135 enum EmInterceptMode { noIntercept = 0, interceptPreFifo, interceptPostFifo } emInterceptMode_;
0136 std::unique_ptr<EGInputSelectorEmulator> interceptor_;
0137 bool init_;
0138
0139 multififo_regionizer::Regionizer<l1ct::TkObjEmu> tkRegionizer_;
0140 multififo_regionizer::Regionizer<l1ct::HadCaloObjEmu> hadCaloRegionizer_;
0141 multififo_regionizer::Regionizer<l1ct::EmCaloObjEmu> emCaloRegionizer_;
0142 multififo_regionizer::Regionizer<l1ct::MuObjEmu> muRegionizer_;
0143 std::vector<l1ct::multififo_regionizer::Route> tkRoutes_, caloRoutes_, emCaloRoutes_, muRoutes_;
0144
0145 template <typename T>
0146 void fillCaloLinks(unsigned int iclock,
0147 const std::vector<DetectorSector<T>>& in,
0148 std::vector<T>& links,
0149 std::vector<bool>& valid);
0150 };
0151
0152 }
0153
0154 #endif