File indexing completed on 2024-06-04 04:35:08
0001 #ifndef L1Trigger_Phase2L1ParticleFlow_L1TCorrelatorLayer1PatternFileWriter_h
0002 #define L1Trigger_Phase2L1ParticleFlow_L1TCorrelatorLayer1PatternFileWriter_h
0003
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0006 #include "L1Trigger/DemonstratorTools/interface/BoardDataWriter.h"
0007 #include "L1Trigger/DemonstratorTools/interface/utilities.h"
0008
0009 #include "DataFormats/L1TParticleFlow/interface/layer1_emulator.h"
0010
0011 class L1TCorrelatorLayer1PatternFileWriter {
0012 public:
0013 L1TCorrelatorLayer1PatternFileWriter(const edm::ParameterSet& iConfig, const l1ct::Event& eventTemplate);
0014 ~L1TCorrelatorLayer1PatternFileWriter();
0015
0016 static edm::ParameterSetDescription getParameterSetDescription();
0017
0018 void write(const l1ct::Event& event);
0019 void flush();
0020
0021 private:
0022 enum class Partition { Barrel, HGCal, HGCalNoTk, HF };
0023
0024 Partition partition_;
0025 const unsigned int tmuxFactor_;
0026 bool writeInputs_, writeOutputs_;
0027 std::map<l1t::demo::LinkId, std::vector<size_t>> channelIdsInput_, channelIdsOutput_;
0028 std::map<std::string, l1t::demo::ChannelSpec> channelSpecsInput_, channelSpecsOutput_;
0029
0030 const unsigned int tfTmuxFactor_ = 18, tfLinksFactor_ = 1;
0031 const unsigned int hgcTmuxFactor_ = 18, hgcLinksFactor_ = 4;
0032 const unsigned int gctTmuxFactor_ = 1, gctSectors_ = 3;
0033 const unsigned int gmtTmuxFactor_ = 18, gmtLinksFactor_ = 1;
0034 const unsigned int gttTmuxFactor_ = 6, gttLinksFactor_ = 1;
0035 const unsigned int tfTimeslices_, hgcTimeslices_, gctTimeslices_, gmtTimeslices_, gttTimeslices_;
0036 uint32_t gctLinksEcal_, gctLinksHad_;
0037 bool gctSingleLink_;
0038 uint32_t gmtNumberOfMuons_;
0039 uint32_t gttNumberOfPVs_;
0040 uint32_t gttLatency_;
0041
0042 std::vector<uint32_t> outputRegions_, outputLinksPuppi_;
0043 unsigned int nPuppiFramesPerRegion_;
0044 int32_t outputBoard_, outputLinkEgamma_;
0045 uint32_t nEgammaObjectsOut_;
0046
0047
0048 uint32_t nInputFramesPerBX_, nOutputFramesPerBX_;
0049 const std::string fileFormat_;
0050
0051
0052 const uint32_t eventsPerFile_;
0053 uint32_t eventIndex_;
0054 std::unique_ptr<l1t::demo::BoardDataWriter> inputFileWriter_, outputFileWriter_;
0055
0056 static Partition parsePartition(const std::string& partition);
0057
0058 static std::unique_ptr<edm::ParameterDescriptionNode> describeTF();
0059 static std::unique_ptr<edm::ParameterDescriptionNode> describeGCT();
0060 static std::unique_ptr<edm::ParameterDescriptionNode> describeHGC();
0061 static std::unique_ptr<edm::ParameterDescriptionNode> describeGMT();
0062 static std::unique_ptr<edm::ParameterDescriptionNode> describeGTT();
0063 static std::unique_ptr<edm::ParameterDescriptionNode> describePuppi();
0064 static std::unique_ptr<edm::ParameterDescriptionNode> describeEG();
0065
0066 void configTimeSlices(const edm::ParameterSet& iConfig,
0067 const std::string& prefix,
0068 unsigned int nSectors,
0069 unsigned int nTimeSlices,
0070 unsigned int linksFactor);
0071 static std::unique_ptr<edm::ParameterDescriptionNode> describeTimeSlices(const std::string& prefix);
0072 void configSectors(const edm::ParameterSet& iConfig,
0073 const std::string& prefix,
0074 unsigned int nSectors,
0075 unsigned int linksFactor);
0076 static std::unique_ptr<edm::ParameterDescriptionNode> describeSectors(const std::string& prefix);
0077 void configLinks(const edm::ParameterSet& iConfig,
0078 const std::string& prefix,
0079 unsigned int linksFactor,
0080 unsigned int offset);
0081 static std::unique_ptr<edm::ParameterDescriptionNode> describeLinks(const std::string& prefix);
0082
0083 void writeTF(const l1ct::Event& event, l1t::demo::EventData& out);
0084 void writeBarrelGCT(const l1ct::Event& event, l1t::demo::EventData& out);
0085 void writeHGC(const l1ct::Event& event, l1t::demo::EventData& out);
0086 void writeGMT(const l1ct::Event& event, l1t::demo::EventData& out);
0087 void writeGTT(const l1ct::Event& event, l1t::demo::EventData& out);
0088 void writePuppi(const l1ct::Event& event, l1t::demo::EventData& out);
0089 void writeEgamma(const l1ct::OutputBoard& egboard, std::vector<ap_uint<64>>& out);
0090 void writeEgamma(const l1ct::Event& event, l1t::demo::EventData& out);
0091 };
0092
0093 #endif