Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:28

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;  // numbers not really configurable in current architecture
0031   const unsigned int hgcTmuxFactor_ = 18, hgcLinksFactor_ = 4;  // not really configurable in current architecture
0032   const unsigned int gctTmuxFactor_ = 1, gctSectors_ = 3;       // not really configurable in current architecture
0033   const unsigned int gctLinksEcal_ = 1, gctLinksHad_ = 2;       // could be made configurable later
0034   const unsigned int gmtTmuxFactor_ = 18, gmtLinksFactor_ = 1;  // not really configurable in current architecture
0035   const unsigned int gttTmuxFactor_ = 6, gttLinksFactor_ = 1;   // not really configurable in current architecture
0036   const unsigned int tfTimeslices_, hgcTimeslices_, gctTimeslices_, gmtTimeslices_, gttTimeslices_;
0037   uint32_t gmtNumberOfMuons_;
0038   uint32_t gttNumberOfPVs_;
0039   uint32_t gttLatency_;
0040 
0041   std::vector<uint32_t> outputRegions_, outputLinksPuppi_;
0042   unsigned int nPuppiFramesPerRegion_;
0043   int32_t outputBoard_, outputLinkEgamma_;
0044   uint32_t nEgammaObjectsOut_;
0045 
0046   // Common stuff related to the format
0047   uint32_t nInputFramesPerBX_, nOutputFramesPerBX_;
0048   const std::string fileFormat_;
0049 
0050   // final helper
0051   const uint32_t eventsPerFile_;
0052   uint32_t eventIndex_;
0053   std::unique_ptr<l1t::demo::BoardDataWriter> inputFileWriter_, outputFileWriter_;
0054 
0055   static Partition parsePartition(const std::string& partition);
0056 
0057   static std::unique_ptr<edm::ParameterDescriptionNode> describeTF();
0058   static std::unique_ptr<edm::ParameterDescriptionNode> describeGCT();
0059   static std::unique_ptr<edm::ParameterDescriptionNode> describeHGC();
0060   static std::unique_ptr<edm::ParameterDescriptionNode> describeGMT();
0061   static std::unique_ptr<edm::ParameterDescriptionNode> describeGTT();
0062   static std::unique_ptr<edm::ParameterDescriptionNode> describePuppi();
0063   static std::unique_ptr<edm::ParameterDescriptionNode> describeEG();
0064 
0065   void configTimeSlices(const edm::ParameterSet& iConfig,
0066                         const std::string& prefix,
0067                         unsigned int nSectors,
0068                         unsigned int nTimeSlices,
0069                         unsigned int linksFactor);
0070   static std::unique_ptr<edm::ParameterDescriptionNode> describeTimeSlices(const std::string& prefix);
0071   void configSectors(const edm::ParameterSet& iConfig,
0072                      const std::string& prefix,
0073                      unsigned int nSectors,
0074                      unsigned int linksFactor);
0075   static std::unique_ptr<edm::ParameterDescriptionNode> describeSectors(const std::string& prefix);
0076   void configLinks(const edm::ParameterSet& iConfig,
0077                    const std::string& prefix,
0078                    unsigned int linksFactor,
0079                    unsigned int offset);
0080   static std::unique_ptr<edm::ParameterDescriptionNode> describeLinks(const std::string& prefix);
0081 
0082   void writeTF(const l1ct::Event& event, l1t::demo::EventData& out);
0083   void writeBarrelGCT(const l1ct::Event& event, l1t::demo::EventData& out);
0084   void writeHGC(const l1ct::Event& event, l1t::demo::EventData& out);
0085   void writeGMT(const l1ct::Event& event, l1t::demo::EventData& out);
0086   void writeGTT(const l1ct::Event& event, l1t::demo::EventData& out);
0087   void writePuppi(const l1ct::Event& event, l1t::demo::EventData& out);
0088   void writeEgamma(const l1ct::OutputBoard& egboard, std::vector<ap_uint<64>>& out);
0089   void writeEgamma(const l1ct::Event& event, l1t::demo::EventData& out);
0090 };
0091 
0092 #endif