CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/EventFilter/ESDigiToRaw/interface/ESDataFormatter.h

Go to the documentation of this file.
00001 #ifndef ESDATAFORMATTER_H
00002 #define ESDATAFORMATTER_H
00003 
00004 #include <iostream>
00005 #include <vector>
00006 #include <bitset>
00007 #include <sstream>
00008 #include <map>
00009 
00010 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00011 #include "DataFormats/EcalDigi/interface/ESDataFrame.h"
00012 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00013 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
00014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00015 
00016 class ESDataFormatter {
00017   
00018   public :
00019     
00020   typedef std::vector<ESDataFrame> DetDigis;
00021   typedef std::map<int, DetDigis> Digis;
00022 
00023   typedef uint8_t  Word8;
00024   typedef uint16_t Word16;
00025   typedef uint32_t Word32;
00026   typedef uint64_t Word64;
00027 
00028   ESDataFormatter(const edm::ParameterSet& ps) : 
00029     pset_(ps), run_number_(0), orbit_number_(0), bx_(0), lv1_(0), trgtype_(0),
00030     kchip_bc_(0), kchip_ec_(0) { 
00031     debug_ = pset_.getUntrackedParameter<bool>("debugMode", false);
00032     printInHex_ = pset_.getUntrackedParameter<bool>("printInHex", false);
00033   };
00034   virtual ~ESDataFormatter() {};
00035 
00036   virtual void DigiToRaw(int fedId, Digis & digis, FEDRawData& fedRawData) = 0;
00037 
00038   virtual void setRunNumber(int i) {run_number_ = i;};
00039   virtual void setOrbitNumber(int i) {orbit_number_ = i;};
00040   virtual void setBX(int i) {bx_ = i;};
00041   virtual void setLV1(int i) {lv1_ = i;};
00042   virtual void setTriggerType(int i) {trgtype_ = i;};
00043   virtual void setKchipBC(int i) {kchip_bc_ = i;};
00044   virtual void setKchipEC(int i) {kchip_ec_ = i;};
00045 
00046   protected :    
00047     
00048   const edm::ParameterSet pset_;
00049 
00050   int run_number_;
00051   int orbit_number_;
00052   int bx_;
00053   int lv1_;
00054   int trgtype_;
00055   int kchip_bc_; 
00056   int kchip_ec_;
00057 
00058   bool debug_;
00059   bool printInHex_; 
00060 
00061   int formatMajor_; 
00062   int formatMinor_;
00063 
00064   std::string print(const Word64 & word) const;
00065   std::string print(const Word16 & word) const;
00066 
00067 };
00068 
00069 #endif