CMS 3D CMS Logo

PixelDataFormatter.h
Go to the documentation of this file.
1 #ifndef PixelDataFormatter_H
2 #define PixelDataFormatter_H
3 
33 //
34 // Add the phase1 format
35 //
45 
46 #include <vector>
47 #include <map>
48 #include <set>
49 
50 class FEDRawData;
51 class SiPixelFedCabling;
52 class SiPixelQuality;
56 
58 public:
60 
61  typedef std::map<int, FEDRawData> RawData;
62  typedef std::vector<PixelDigi> DetDigis;
63  typedef std::map<cms_uint32_t, DetDigis> Digis;
64  typedef std::pair<DetDigis::const_iterator, DetDigis::const_iterator> Range;
65  typedef std::vector<SiPixelRawDataError> DetErrors;
66  typedef std::map<cms_uint32_t, DetErrors> Errors;
67  typedef std::vector<PixelFEDChannel> DetBadChannels;
68  typedef std::map<cms_uint32_t, DetBadChannels> BadChannels;
69 
72 
73  PixelDataFormatter(const SiPixelFedCabling* map, bool phase1 = false);
74 
75  void setErrorStatus(bool ErrorStatus);
76  void setQualityStatus(bool QualityStatus, const SiPixelQuality* QualityInfo);
77  void setModulesToUnpack(const std::set<unsigned int>* moduleIds);
78  void passFrameReverter(const SiPixelFrameReverter* reverter);
79 
80  int nDigis() const { return theDigiCounter; }
81  int nWords() const { return theWordCounter; }
82 
83  void interpretRawData(bool& errorsInEvent, int fedId, const FEDRawData& data, Collection& digis, Errors& errors);
84 
85  void formatRawData(unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, const BadChannels& badChannels);
86 
87  cms_uint32_t linkId(cms_uint32_t word32) { return (word32 >> LINK_shift) & LINK_mask; }
88 
89 private:
90  mutable int theDigiCounter;
91  mutable int theWordCounter;
92 
96  const std::set<unsigned int>* modulesToUnpack;
97 
100  bool debug;
103  std::unique_ptr<ErrorCheckerBase> errorcheck;
104 
105  // For the 32bit data format (moved from *.cc namespace, keep uppercase for compatibility)
106  // Add special layer 1 roc for phase1
110  bool phase1;
111 
112  int checkError(const Word32& data) const;
113 
114  int digi2word(cms_uint32_t detId, const PixelDigi& digi, std::map<int, std::vector<Word32> >& words) const;
116  const PixelDigi& digi,
117  std::map<int, std::vector<Word32> >& words) const;
118 
119  int word2digi(const int fedId,
121  const bool includeError,
122  const bool useQuality,
123  const Word32& word,
124  Digis& digis) const;
125 
126  std::string print(const PixelDigi& digi) const;
127  std::string print(const Word64& word) const;
128 
129  cms_uint32_t errorDetId(const SiPixelFrameConverter* converter, int fedId, int errorType, const Word32& word) const;
130 };
131 
132 #endif
int checkError(const Word32 &data) const
std::map< cms_uint32_t, DetDigis > Digis
void passFrameReverter(const SiPixelFrameReverter *reverter)
void formatRawData(unsigned int lvl1_ID, RawData &fedRawData, const Digis &digis, const BadChannels &badChannels)
cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int fedId, int errorType, const Word32 &word) const
void setErrorStatus(bool ErrorStatus)
int digi2wordPhase1Layer1(cms_uint32_t detId, const PixelDigi &digi, std::map< int, std::vector< Word32 > > &words) const
std::vector< SiPixelRawDataError > DetErrors
uint64_t word
std::map< cms_uint32_t, DetBadChannels > BadChannels
std::string print(const PixelDigi &digi) const
void setQualityStatus(bool QualityStatus, const SiPixelQuality *QualityInfo)
const std::set< unsigned int > * modulesToUnpack
const SiPixelQuality * badPixelInfo
unsigned int cms_uint32_t
Definition: typedefs.h:15
std::map< cms_uint32_t, DetErrors > Errors
std::pair< DetDigis::const_iterator, DetDigis::const_iterator > Range
void interpretRawData(bool &errorsInEvent, int fedId, const FEDRawData &data, Collection &digis, Errors &errors)
void setModulesToUnpack(const std::set< unsigned int > *moduleIds)
const SiPixelFrameReverter * theFrameReverter
std::map< int, FEDRawData > RawData
std::vector< PixelDigi > DetDigis
std::vector< PixelFEDChannel > DetBadChannels
int digi2word(cms_uint32_t detId, const PixelDigi &digi, std::map< int, std::vector< Word32 > > &words) const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
std::unique_ptr< ErrorCheckerBase > errorcheck
edm::DetSetVector< PixelDigi > Collection
cms_uint32_t linkId(cms_uint32_t word32)
int word2digi(const int fedId, const SiPixelFrameConverter *converter, const bool includeError, const bool useQuality, const Word32 &word, Digis &digis) const
Definition: errors.py:1
unsigned long long cms_uint64_t
Definition: typedefs.h:17
SiPixelFedCabling const * theCablingTree
PixelDataFormatter(const SiPixelFedCabling *map, bool phase1=false)