Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-03 00:12:14

0001 #ifndef L1Trigger_TrackerTFP_Demonstrator_h
0002 #define L1Trigger_TrackerTFP_Demonstrator_h
0003 
0004 #include "FWCore/Framework/interface/data_default_record_trait.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0006 #include "L1Trigger/TrackTrigger/interface/Setup.h"
0007 
0008 #include <vector>
0009 #include <string>
0010 
0011 namespace trackerTFP {
0012 
0013   /*! \class  trackerTFP::Demonstrator
0014    *  \brief  ESProduct providing the algorithm to run input data through modelsim
0015    *          and to compares results with expected output data
0016    *  \date   2021, April
0017    */
0018   class Demonstrator {
0019   public:
0020     // configuration
0021     struct Config {
0022       std::string dirIPBB_;
0023       double runTime_;
0024       std::vector<int> linkMappingIn_;
0025       std::vector<int> linkMappingOut_;
0026     };
0027     Demonstrator() {}
0028     Demonstrator(const Config& iConfig, const tt::Setup* setup);
0029     ~Demonstrator() = default;
0030     // plays input through modelsim and compares result with output
0031     bool analyze(const std::vector<std::vector<tt::Frame>>& input,
0032                  const std::vector<std::vector<tt::Frame>>& output) const;
0033 
0034   private:
0035     // converts streams of bv into stringstream
0036     void convert(const std::vector<std::vector<tt::Frame>>& bits,
0037                  std::stringstream& ss,
0038                  const std::vector<int>& mapping) const;
0039     // plays stringstream through modelsim
0040     void sim(const std::stringstream& ss) const;
0041     // compares stringstream with modelsim output
0042     bool compare(std::stringstream& ss) const;
0043     // creates emp file header
0044     std::string header(const std::vector<int>& links) const;
0045     // creates 6 frame gap between packets
0046     std::string infraGap(int& nFrame, int numLinks) const;
0047     // creates frame number
0048     std::string frame(int& nFrame) const;
0049     // converts bv into hex
0050     std::string hex(const tt::Frame& bv, bool first = false) const;
0051 
0052     // path to ipbb proj area
0053     std::string dirIPBB_;
0054     // runtime in ms
0055     double runTime_;
0056     //
0057     std::vector<int> linkMappingIn_;
0058     //
0059     std::vector<int> linkMappingOut_;
0060     // path to input text file
0061     std::string dirIn_;
0062     // path to output text file
0063     std::string dirOut_;
0064     // path to expected output text file
0065     std::string dirPre_;
0066     // path to diff text file
0067     std::string dirDiff_;
0068     // number of frames per event (161)
0069     int numFrames_;
0070     // number of emp reset frames per event (6)
0071     int numFramesInfra_;
0072     // number of TFPs per time node (9)
0073     int numRegions_;
0074   };
0075 
0076 }  // namespace trackerTFP
0077 
0078 EVENTSETUP_DATA_DEFAULT_RECORD(trackerTFP::Demonstrator, tt::SetupRcd);
0079 
0080 #endif