Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:14:58

0001 #ifndef ESDATAFORMATTER_H
0002 #define ESDATAFORMATTER_H
0003 
0004 #include <iostream>
0005 #include <vector>
0006 #include <bitset>
0007 #include <sstream>
0008 #include <map>
0009 
0010 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0011 #include "DataFormats/EcalDigi/interface/ESDataFrame.h"
0012 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0013 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 
0016 class ESDataFormatter {
0017 public:
0018   struct Meta_Data {
0019     int run_number = 0;
0020     int orbit_number = 0;
0021     int bx = 0;
0022     int lv1 = 0;
0023     int kchip_bc = 0;
0024     int kchip_ec = 0;
0025     Meta_Data() = default;
0026     Meta_Data(int r, int o, int b, int l, int k_bc, int k_ec)
0027         : run_number(r), orbit_number(o), bx(b), lv1(l), kchip_bc(k_bc), kchip_ec(k_ec){};
0028   };
0029 
0030   typedef std::vector<ESDataFrame> DetDigis;
0031   typedef std::map<int, DetDigis> Digis;
0032 
0033   typedef uint8_t Word8;
0034   typedef uint16_t Word16;
0035   typedef uint32_t Word32;
0036   typedef uint64_t Word64;
0037 
0038   ESDataFormatter(const edm::ParameterSet& ps)
0039       : pset_(ps),
0040         trgtype_(0),
0041         debug_(pset_.getUntrackedParameter<bool>("debugMode", false)),
0042         printInHex_(pset_.getUntrackedParameter<bool>("printInHex", false)){};
0043   virtual ~ESDataFormatter(){};
0044 
0045   virtual void DigiToRaw(int fedId, Digis& digis, FEDRawData& fedRawData, const Meta_Data& meta_data) const = 0;
0046 
0047 protected:
0048   const edm::ParameterSet pset_;
0049   const int trgtype_;
0050   const bool debug_;
0051   const bool printInHex_;
0052 
0053   int formatMajor_;
0054   int formatMinor_;
0055 
0056   std::string print(const Word64& word) const;
0057   std::string print(const Word16& word) const;
0058 };
0059 
0060 #endif