CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h

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