Go to the documentation of this file.00001 #ifndef PixelDataFormatter_H
00002 #define PixelDataFormatter_H
00003
00034 #include "CondFormats/SiPixelObjects/interface/SiPixelFrameReverter.h"
00035 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
00036 #include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h"
00037 #include "DataFormats/Common/interface/DetSetVector.h"
00038 #include "EventFilter/SiPixelRawToDigi/interface/ErrorChecker.h"
00039 #include "FWCore/Utilities/interface/typedefs.h"
00040
00041 #include <vector>
00042 #include <map>
00043 #include <set>
00044
00045 class FEDRawData;
00046 class SiPixelFedCabling;
00047 class SiPixelQuality;
00048 class SiPixelFrameConverter;
00049 class SiPixelFrameReverter;
00050
00051 class PixelDataFormatter {
00052
00053 public:
00054
00055 typedef std::map<int, FEDRawData> RawData;
00056 typedef std::vector<PixelDigi> DetDigis;
00057 typedef std::map<cms_uint32_t, DetDigis> Digis;
00058 typedef std::pair<DetDigis::const_iterator, DetDigis::const_iterator> Range;
00059 typedef std::vector<SiPixelRawDataError> DetErrors;
00060 typedef std::map<cms_uint32_t, DetErrors> Errors;
00061
00062 typedef cms_uint32_t Word32;
00063 typedef cms_uint64_t Word64;
00064
00065 PixelDataFormatter(const SiPixelFedCabling* map);
00066
00067 void setErrorStatus(bool ErrorStatus);
00068 void setQualityStatus(bool QualityStatus, const SiPixelQuality* QualityInfo);
00069 void setModulesToUnpack(const std::set<unsigned int> * moduleIds);
00070 void passFrameReverter(const SiPixelFrameReverter* reverter);
00071
00072 int nDigis() const { return theDigiCounter; }
00073 int nWords() const { return theWordCounter; }
00074
00075 void interpretRawData(bool& errorsInEvent, int fedId, const FEDRawData & data, Digis & digis, Errors & errors);
00076
00077 void formatRawData( unsigned int lvl1_ID, RawData & fedRawData, const Digis & digis);
00078
00079 private:
00080 mutable int theDigiCounter;
00081 mutable int theWordCounter;
00082
00083 const SiPixelFedCabling* theCablingTree;
00084 const SiPixelFrameReverter* theFrameReverter;
00085 const SiPixelQuality* badPixelInfo;
00086 const std::set<unsigned int> * modulesToUnpack;
00087
00088 bool includeErrors;
00089 bool useQualityInfo;
00090 bool debug;
00091 int allDetDigis;
00092 int hasDetDigis;
00093 ErrorChecker errorcheck;
00094
00095 int checkError(const Word32& data) const;
00096
00097 int digi2word( cms_uint32_t detId, const PixelDigi& digi,
00098 std::map<int, std::vector<Word32> > & words) const;
00099
00100 int word2digi( const int fedId,
00101 const SiPixelFrameConverter* converter,
00102 const bool includeError,
00103 const bool useQuality,
00104 const Word32& word,
00105 Digis & digis) const;
00106
00107 std::string print(const PixelDigi & digi) const;
00108 std::string print(const Word64 & word) const;
00109
00110 cms_uint32_t errorDetId(const SiPixelFrameConverter* converter,
00111 int fedId, int errorType, const Word32 & word) const;
00112
00113 };
00114
00115 #endif