CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h

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 
00040 #include <boost/cstdint.hpp>
00041 #include <vector>
00042 #include <map>
00043 
00044 class FEDRawData;
00045 class SiPixelFedCabling;
00046 class SiPixelQuality;
00047 class SiPixelFrameConverter;
00048 class SiPixelFrameReverter;
00049 
00050 class PixelDataFormatter {
00051 
00052 public:
00053 
00054   typedef std::map<int, FEDRawData> RawData;
00055   typedef std::vector<PixelDigi> DetDigis;
00056   typedef std::map<uint32_t, DetDigis> Digis;
00057   typedef std::pair<DetDigis::const_iterator, DetDigis::const_iterator> Range; 
00058   typedef std::vector<SiPixelRawDataError> DetErrors;
00059   typedef std::map<uint32_t, DetErrors> Errors;
00060 
00061   typedef uint32_t Word32;
00062   typedef uint64_t Word64;
00063 
00064   PixelDataFormatter(const SiPixelFedCabling* map);
00065 
00066   void setErrorStatus(bool ErrorStatus);
00067   void setQualityStatus(bool QualityStatus, const SiPixelQuality* QualityInfo);
00068   void passFrameReverter(const SiPixelFrameReverter* reverter);
00069 
00070   int nDigis() const { return theDigiCounter; }
00071   int nWords() const { return theWordCounter; }
00072 
00073   void interpretRawData(bool& errorsInEvent, int fedId,  const FEDRawData & data, Digis & digis, Errors & errors);
00074 
00075   void formatRawData( unsigned int lvl1_ID, RawData & fedRawData, const Digis & digis);
00076 
00077 private:
00078   mutable int theDigiCounter;
00079   mutable int theWordCounter;
00080 
00081   const SiPixelFedCabling* theCablingTree;
00082   const SiPixelFrameReverter* theFrameReverter;
00083   const SiPixelQuality* badPixelInfo;
00084   bool includeErrors;
00085   bool useQualityInfo;
00086   bool debug;
00087   int allDetDigis;
00088   int hasDetDigis;
00089   ErrorChecker errorcheck;
00090 
00091   int checkError(const Word32& data) const;
00092 
00093   int digi2word(  uint32_t detId, const PixelDigi& digi,
00094                   std::map<int, std::vector<Word32> > & words) const;
00095 
00096   int word2digi(  const int fedId,
00097                   const SiPixelFrameConverter* converter,
00098                   const bool includeError,
00099                   const bool useQuality,
00100                   const Word32& word, 
00101                   Digis & digis) const;
00102 
00103   std::string print(const PixelDigi & digi) const;
00104   std::string print(const Word64    & word) const;
00105 
00106   uint32_t errorDetId(const SiPixelFrameConverter* converter, 
00107                       int fedId, int errorType, const Word32 & word) const;
00108 
00109 };
00110 
00111 #endif