00001 #ifndef CamacTBDataFormatter_H 00002 #define CamacTBDataFormatter_H 00003 00011 #include <vector> 00012 #include <iostream> 00013 00014 #include "FWCore/ServiceRegistry/interface/Service.h" 00015 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00016 00017 #include <TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopePlaneRawHits.h> 00018 #include <TBDataFormats/EcalTBObjects/interface/EcalTBHodoscopeRawInfo.h> 00019 #include <TBDataFormats/EcalTBObjects/interface/EcalTBTDCRawInfo.h> 00020 #include <TBDataFormats/EcalTBObjects/interface/EcalTBEventHeader.h> 00021 #include <DataFormats/FEDRawData/interface/FEDRawData.h> 00022 00023 #include "TBDataFormats/EcalTBObjects/interface/EcalTBTDCSample.h" 00024 00025 00026 00027 00028 class CamacTBDataFormatter { 00029 00030 public: 00031 00032 CamacTBDataFormatter(); 00033 virtual ~CamacTBDataFormatter(){LogDebug("EcalTBRawToDigi") << "@SUB=CamacTBDataFormatter" << "\n"; }; 00034 00035 00036 void interpretRawData( const FEDRawData & data, EcalTBEventHeader& tbEventHeader, 00037 EcalTBHodoscopeRawInfo& hodoRaw, EcalTBTDCRawInfo& tdcRawInfo ); 00038 00039 // for tests based on standalone file 00040 /* void interpretRawData(unsigned long * buffer, unsigned long bufferSize, */ 00041 /* EcalTBEventHeader& tbEventHeader, */ 00042 /* EcalTBHodoscopeRawInfo & hodo, */ 00043 /* EcalTBTDCRawInfo & tdc); */ 00044 00045 00046 00047 private: 00048 00049 bool checkStatus(unsigned long word, int wordNumber); 00050 00051 int nWordsPerEvent; // Number of fibers per hodoscope plane 00052 00053 static const int nHodoFibers = 64; // Number of fibers per hodoscope plane 00054 static const int nHodoscopes = 2; // Number of different mappings between fiber and electronics 00055 static const int nHodoPlanes = 4; // Number of hodoscopes along the beam 00056 static const int hodoRawLen = 4; // The raw data is stored as 4 integers for each hodo plane 00057 00058 int nHodoHits[nHodoPlanes]; 00059 int hodoHits[nHodoPlanes][nHodoFibers]; 00060 int hodoAll[nHodoPlanes*nHodoFibers]; 00061 bool statusWords[148+4]; 00062 00063 std::vector<int> scalers_; 00064 }; 00065 #endif