Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef TextToRaw_h
0002 #define TextToRaw_h
0003 
0004 // -*- C++ -*-
0005 //
0006 // Package:    TextToRaw
0007 // Class:      TextToRaw
0008 //
0009 /**\class TextToRaw TextToRaw.cc L1Triggr/TextToDigi/src/TextToRaw.cc
0010 
0011  Description: Convert ASCII dump of a raw event to FEDRawData format for
0012  unpacking
0013 
0014  Implementation:
0015      Input format is a 32 bit hex string per line (LSW first). Events separated
0016  with blank line.
0017 */
0018 //
0019 // Original Author:  Jim Brooke
0020 //         Created:  Wed Nov  1 11:57:10 CET 2006
0021 //
0022 //
0023 
0024 // system include files
0025 #include <fstream>
0026 #include <memory>
0027 #include <string>
0028 
0029 // user include files
0030 #include "FWCore/Framework/interface/one/EDProducer.h"
0031 #include "FWCore/Framework/interface/Event.h"
0032 #include "FWCore/Framework/interface/Frameworkfwd.h"
0033 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0034 
0035 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
0036 
0037 //
0038 // class decleration
0039 //
0040 
0041 class TextToRaw : public edm::one::EDProducer<> {
0042 public:
0043   explicit TextToRaw(const edm::ParameterSet &);
0044   ~TextToRaw() override;
0045 
0046 private:  // methods
0047   void beginJob() override;
0048   void produce(edm::Event &, const edm::EventSetup &) override;
0049   void endJob() override;
0050 
0051 private:
0052   // ID of the FED to emulate
0053   int fedId_;
0054 
0055   // File to read
0056   std::string filename_;
0057   std::ifstream file_;
0058 
0059   // array to store the data
0060   static constexpr unsigned EVT_MAX_SIZE = 8192;
0061   char data_[EVT_MAX_SIZE];
0062 
0063   int fileEventOffset_;
0064   int nevt_;
0065   void putEmptyDigi(edm::Event &);
0066 };
0067 
0068 #endif