Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef GTPSBTEXTTODIGI_H
0002 #define GTPSBTEXTTODIGI_H
0003 
0004 /*\class GtPsbTextToDigi
0005  *\description makes digis from GT PSB captured data file
0006  *\author Nuno Leonardo (CERN)
0007  *\date 08.08
0008  */
0009 
0010 /*\note on format
0011   input file names: m_textFileName + mem# + .txt
0012   each line corresponds to one 80MHz clock (2 cycles/lines per event)
0013   input data: 16 bits: cycle (msb) + GCT em cand raw data (14:0)
0014   msb set once at cycle 0 to indicate BC0 signal, for GT synch check
0015   file/mem#:0  line/cycle:0  electron 1
0016                line/cycle:1  electron 3
0017   file/mem#:1  line/cycle:0  electron 2
0018                line/cycle:1  electron 4
0019   file/mem#:6  line/cycle:0  electron 1
0020                line/cycle:1  electron 3
0021   file/mem#:7  line/cycle:0  electron 2
0022                line/cycle:1  electron 4
0023   as specified to me by I.Mikulec, M.Jeitler, J.Brooke
0024 */
0025 
0026 #include "FWCore/Framework/interface/one/EDProducer.h"
0027 #include "FWCore/Framework/interface/Event.h"
0028 #include "FWCore/Framework/interface/Frameworkfwd.h"
0029 #include "FWCore/Framework/interface/MakerMacros.h"
0030 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0031 #include <fstream>
0032 #include <memory>
0033 
0034 class GtPsbTextToDigi : public edm::one::EDProducer<> {
0035 public:
0036   explicit GtPsbTextToDigi(const edm::ParameterSet &);
0037   ~GtPsbTextToDigi() override;
0038 
0039 private:
0040   void produce(edm::Event &, const edm::EventSetup &) override;
0041   void endJob() override;
0042 
0043 private:
0044   /// Create empty digi collection
0045   void putEmptyDigi(edm::Event &);
0046 
0047   /// Number of events to be offset wrt input
0048   int m_fileEventOffset;
0049 
0050   /// Name out input file
0051   std::string m_textFileName;
0052 
0053   /// Event counter
0054   int m_nevt;
0055 
0056   /// File handle
0057   std::ifstream m_file[4];
0058 
0059   /// Hold detected BC0 signal position per file
0060   int m_bc0[4];
0061 };
0062 
0063 #endif