Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-01 01:02:11

0001 #ifndef L1Trigger_Phase2L1ParticleFlow_L1TCorrelatorLayer1PatternFileWriter_h
0002 #define L1Trigger_Phase2L1ParticleFlow_L1TCorrelatorLayer1PatternFileWriter_h
0003 
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "L1Trigger/DemonstratorTools/interface/BoardDataWriter.h"
0006 #include "L1Trigger/DemonstratorTools/interface/utilities.h"
0007 
0008 #include "DataFormats/L1TParticleFlow/interface/layer1_emulator.h"
0009 
0010 class L1TCorrelatorLayer1PatternFileWriter {
0011 public:
0012   L1TCorrelatorLayer1PatternFileWriter(const edm::ParameterSet& iConfig, const l1ct::Event& eventTemplate);
0013   ~L1TCorrelatorLayer1PatternFileWriter();
0014 
0015   void write(const l1ct::Event& event);
0016   void flush();
0017 
0018 private:
0019   enum class Partition { Barrel, HGCal, HGCalNoTk, HF };
0020 
0021   Partition partition_;
0022   const unsigned int tmuxFactor_ = 6;  // not really configurable in current architecture
0023   bool writeInputs_, writeOutputs_;
0024   std::map<l1t::demo::LinkId, std::vector<size_t>> channelIdsInput_, channelIdsOutput_;
0025   std::map<std::string, l1t::demo::ChannelSpec> channelSpecsInput_, channelSpecsOutput_;
0026 
0027   const unsigned int tfTimeslices_ = 3, tfLinksFactor_ = 1;    // not really configurable in current architecture
0028   const unsigned int hgcTimeslices_ = 3, hgcLinksFactor_ = 4;  // not really configurable in current architecture
0029   const unsigned int gctTimeslices_ = 1, gctSectors_ = 3;      // not really configurable in current architecture
0030   const unsigned int gctLinksEcal_ = 1, gctLinksHad_ = 2;      // could be made configurable later
0031   const unsigned int gmtTimeslices_ = 3, gmtLinksFactor_ = 1;  // not really configurable in current architecture
0032   const unsigned int gttTimeslices_ = 1, gttLinksFactor_ = 1;  // not really configurable in current architecture
0033   uint32_t gmtNumberOfMuons_;
0034   uint32_t gttNumberOfPVs_;
0035   uint32_t gttLatency_;
0036 
0037   std::vector<uint32_t> outputRegions_, outputLinksPuppi_;
0038   unsigned int nPuppiFramesPerRegion_;
0039   int32_t outputBoard_, outputLinkEgamma_;
0040   uint32_t nEgammaObjectsOut_;
0041 
0042   // Common stuff related to the format
0043   uint32_t nInputFramesPerBX_, nOutputFramesPerBX_;
0044   const std::string fileFormat_;
0045 
0046   // final helper
0047   const uint32_t eventsPerFile_;
0048   uint32_t eventIndex_;
0049   std::unique_ptr<l1t::demo::BoardDataWriter> inputFileWriter_, outputFileWriter_;
0050 
0051   static Partition parsePartition(const std::string& partition);
0052 
0053   void configTimeSlices(const edm::ParameterSet& iConfig,
0054                         const std::string& prefix,
0055                         unsigned int nSectors,
0056                         unsigned int nTimeSlices,
0057                         unsigned int linksFactor);
0058   void configSectors(const edm::ParameterSet& iConfig,
0059                      const std::string& prefix,
0060                      unsigned int nSectors,
0061                      unsigned int linksFactor);
0062   void configLinks(const edm::ParameterSet& iConfig,
0063                    const std::string& prefix,
0064                    unsigned int linksFactor,
0065                    unsigned int offset);
0066 
0067   void writeTF(const l1ct::Event& event, l1t::demo::EventData& out);
0068   void writeBarrelGCT(const l1ct::Event& event, l1t::demo::EventData& out);
0069   void writeHGC(const l1ct::Event& event, l1t::demo::EventData& out);
0070   void writeGMT(const l1ct::Event& event, l1t::demo::EventData& out);
0071   void writeGTT(const l1ct::Event& event, l1t::demo::EventData& out);
0072   void writePuppi(const l1ct::Event& event, l1t::demo::EventData& out);
0073   void writeEgamma(const l1ct::Event& event, l1t::demo::EventData& out);
0074 };
0075 
0076 #endif