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 
59 public:
60 
62 
63  typedef std::map<int, FEDRawData> RawData;
64  typedef std::vector<PixelDigi> DetDigis;
65  typedef std::map<cms_uint32_t, DetDigis> Digis;
66  typedef std::pair<DetDigis::const_iterator, DetDigis::const_iterator> Range;
67  typedef std::vector<SiPixelRawDataError> DetErrors;
68  typedef std::map<cms_uint32_t, DetErrors> Errors;
69  typedef std::vector<PixelFEDChannel> DetBadChannels;
70  typedef std::map<cms_uint32_t, DetBadChannels> BadChannels;
71 
74 
75  PixelDataFormatter(const SiPixelFedCabling* map, bool phase1=false);
76 
77  void setErrorStatus(bool ErrorStatus);
78  void setQualityStatus(bool QualityStatus, const SiPixelQuality* QualityInfo);
79  void setModulesToUnpack(const std::set<unsigned int> * moduleIds);
80  void passFrameReverter(const SiPixelFrameReverter* reverter);
81 
82  int nDigis() const { return theDigiCounter; }
83  int nWords() const { return theWordCounter; }
84 
85  void interpretRawData(bool& errorsInEvent, int fedId, const FEDRawData & data, Collection & digis, Errors & errors);
86 
87  void formatRawData( unsigned int lvl1_ID, RawData & fedRawData, const Digis & digis, const BadChannels & badChannels);
88 
89  cms_uint32_t linkId(cms_uint32_t word32) { return (word32 >> LINK_shift) & LINK_mask; }
90 
91 private:
92  mutable int theDigiCounter;
93  mutable int theWordCounter;
94 
98  const std::set<unsigned int> * modulesToUnpack;
99 
102  bool debug;
105  std::unique_ptr<ErrorCheckerBase> errorcheck;
106 
107  // For the 32bit data format (moved from *.cc namespace, keep uppercase for compatibility)
108  // Add special layer 1 roc for phase1
114  bool phase1;
115 
116 
117  int checkError(const Word32& data) const;
118 
119  int digi2word( cms_uint32_t detId, const PixelDigi& digi,
120  std::map<int, std::vector<Word32> > & words) const;
121  int digi2wordPhase1Layer1( cms_uint32_t detId, const PixelDigi& digi,
122  std::map<int, std::vector<Word32> > & words) const;
123 
124  int word2digi( const int fedId,
126  const bool includeError,
127  const bool useQuality,
128  const Word32& word,
129  Digis & digis) const;
130 
131  std::string print(const PixelDigi & digi) const;
132  std::string print(const Word64 & word) const;
133 
135  int fedId, int errorType, const Word32 & word) const;
136 
137 };
138 
139 #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
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:82
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)