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 using namespace std; 00017 using namespace edm; 00018 00019 class ESDigiToRaw; 00020 00021 class ESDataFormatter { 00022 00023 public : 00024 00025 typedef vector<ESDataFrame> DetDigis; 00026 typedef map<int, DetDigis> Digis; 00027 00028 typedef unsigned char Word8; 00029 typedef unsigned short Word16; 00030 typedef unsigned int Word32; 00031 typedef long long Word64; 00032 00033 ESDataFormatter(const ParameterSet& ps); 00034 ~ESDataFormatter(); 00035 00036 FEDRawData * DigiToRaw(int fedId, const Digis & digis); 00037 FEDRawData * DigiToRawTB(int fedId, const Digis & digis); 00038 00039 void setRunNumber(int i) {run_number_ = i;}; 00040 void setOrbitNumber(int i) {orbit_number_ = i;}; 00041 void setBX(int i) {bx_ = i;}; 00042 void setLV1(int i) {lv1_ = i;}; 00043 void setTriggerType(int i) {trgtype_ = i;}; 00044 00045 private : 00046 00047 const ParameterSet pset_; 00048 00049 int run_number_; 00050 int orbit_number_; 00051 int bx_; 00052 int lv1_; 00053 int trgtype_; 00054 00055 bool debug_; 00056 00057 string print(const Word64 & word) const; 00058 string print(const Word16 & word) const; 00059 00060 protected : 00061 00062 static const int bDHEAD, bDH, bDEL, bDERR, bDRUN, bDRUNTYPE, bDTRGTYPE, bDCOMFLAG, bDORBIT; 00063 static const int bDVMINOR, bDVMAJOR, bDCH, bDOPTO; 00064 static const int sDHEAD, sDH, sDEL, sDERR, sDRUN, sDRUNTYPE, sDTRGTYPE, sDCOMFLAG, sDORBIT; 00065 static const int sDVMINOR, sDVMAJOR, sDCH, sDOPTO; 00066 static const int bKEC, bKFLAG2, bKBC, bKFLAG1, bKET, bKCRC, bKCE, bKID, bFIBER, bKHEAD1, bKHEAD2; 00067 static const int sKEC, sKFLAG2, sKBC, sKFLAG1, sKET, sKCRC, sKCE, sKID, sFIBER, sKHEAD1, sKHEAD2; 00068 static const int bHEAD, bE1, bE0, bSTRIP, bPACE, bADC2, bADC1, bADC0; 00069 static const int sHEAD, sE1, sE0, sSTRIP, sPACE, sADC2, sADC1, sADC0; 00070 00071 00072 }; 00073 00074 #endif