Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:37:04

0001 #ifndef L1Trigger_Phase2L1ParticleFlow_deregionizer_input_h
0002 #define L1Trigger_Phase2L1ParticleFlow_deregionizer_input_h
0003 
0004 #include <vector>
0005 #include <algorithm>
0006 #include "DataFormats/L1TParticleFlow/interface/layer1_emulator.h"
0007 
0008 namespace edm {
0009   class ParameterSet;
0010 }
0011 
0012 namespace l1ct {
0013 
0014   class DeregionizerInput {
0015   public:
0016     // struct to represent how each correlator layer 1 board output is structured
0017     struct BoardInfo {
0018       uint nOutputFramesPerBX_;
0019       uint nPuppiFramesPerRegion_;
0020       uint nLinksPuppi_;
0021       uint nPuppiPerRegion_;
0022       uint order_;
0023       std::vector<uint> regions_;
0024     };
0025 
0026     // struct to represent how each puppi object is positioned in the input frame
0027     struct LinkPlacementInfo {
0028       uint board_;
0029       uint link_;
0030       uint clock_cycle_;
0031       // for sorting
0032       bool operator<(const LinkPlacementInfo &other) const {
0033         bool cc_lt = this->clock_cycle_ < other.clock_cycle_;
0034         bool cc_eq = this->clock_cycle_ == other.clock_cycle_;
0035         bool board_lt = this->board_ < other.board_;
0036         bool board_eq = this->board_ == other.board_;
0037         bool link_lt = this->link_ < other.link_;
0038         return cc_eq ? (board_eq ? link_lt : board_lt) : cc_lt;
0039       }
0040     };
0041     typedef LinkPlacementInfo LPI;
0042     typedef std::pair<l1ct::PuppiObjEmu, LPI> PlacedPuppi;
0043 
0044     std::vector<BoardInfo> boardInfos_;
0045 
0046     // note: this one for use in standalone testbench
0047     DeregionizerInput(std::vector<BoardInfo> boardInfos) : boardInfos_(boardInfos) {}
0048 
0049     // note: this one will work only in CMSSW
0050     DeregionizerInput(const std::vector<edm::ParameterSet> linkConfigs);
0051 
0052     ~DeregionizerInput() {}
0053 
0054     std::vector<std::pair<l1ct::PuppiObjEmu, LPI>> inputOrderInfo(
0055         const std::vector<l1ct::OutputRegion> &inputRegions) const;
0056     std::vector<std::vector<std::vector<l1ct::PuppiObjEmu>>> orderInputs(
0057         const std::vector<l1ct::OutputRegion> &inputRegions) const;
0058 
0059     void setDebug(bool debug = true) { debug_ = debug; }
0060 
0061   private:
0062     bool debug_ = false;
0063     // these are not configurable in current design
0064     static constexpr uint nInputFramesPerBX_ = 9;
0065     static constexpr uint tmuxFactor_ = 6;
0066   };
0067 
0068 }  // namespace l1ct
0069 
0070 #endif