CMS 3D CMS Logo

PixelDataFormatter.h
Go to the documentation of this file.
1 #ifndef EventFilter_SiPixelRawToDigi_interface_PixelDataFormatter_h
2 #define EventFilter_SiPixelRawToDigi_interface_PixelDataFormatter_h
3 
33 //
34 // Add the phase1 format
35 //
36 // CMSSW include(s)
48 
49 // standard include(s)
50 #include <vector>
51 #include <map>
52 #include <set>
53 
54 class FEDRawData;
55 class SiPixelFedCabling;
56 class SiPixelQuality;
60 
62 public:
63  using DetErrors = std::vector<SiPixelRawDataError>;
64  using Errors = std::map<cms_uint32_t, DetErrors>;
66  using RawData = std::map<int, FEDRawData>;
67  using DetDigis = std::vector<PixelDigi>;
68  using Digis = std::map<cms_uint32_t, DetDigis>;
69  using DetBadChannels = std::vector<PixelFEDChannel>;
70  using BadChannels = std::map<cms_uint32_t, DetBadChannels>;
71  using FEDWordsMap = std::map<int, std::vector<Word32>>;
72  using ModuleIDSet = std::set<unsigned int>;
73 
75 
76  void setErrorStatus(bool ErrorStatus);
77  void setQualityStatus(bool QualityStatus, const SiPixelQuality* QualityInfo);
78  void setModulesToUnpack(const ModuleIDSet* moduleIds);
79  void passFrameReverter(const SiPixelFrameReverter* reverter);
80 
81  int nDigis() const { return theDigiCounter_; }
82  int nWords() const { return theWordCounter_; }
83 
84  void interpretRawData(bool& errorsInEvent, int fedId, const FEDRawData& data, Collection& digis, Errors& errors);
85 
86  void formatRawData(unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, const BadChannels& badChannels);
87 
88  void unpackFEDErrors(Errors const& errors,
89  std::vector<int> const& tkerrorlist,
90  std::vector<int> const& usererrorlist,
92  DetIdCollection& tkerror_detidcollection,
93  DetIdCollection& usererror_detidcollection,
94  edmNew::DetSetVector<PixelFEDChannel>& disabled_channelcollection,
95  DetErrors& nodeterrors);
96 
97 private:
98  mutable int theDigiCounter_;
99  mutable int theWordCounter_;
100 
105 
110  std::unique_ptr<ErrorCheckerBase> errorcheck_;
111 
113  bool phase1_;
114 
115  int checkError(const Word32& data) const;
116 
117  int digi2word(cms_uint32_t detId, const PixelDigi& digi, FEDWordsMap& words) const;
118  int digi2wordPhase1Layer1(cms_uint32_t detId, const PixelDigi& digi, FEDWordsMap& words) const;
119 
120  std::string print(const PixelDigi& digi) const;
121  std::string print(const Word64& word) const;
122 
123  cms_uint32_t errorDetId(const SiPixelFrameConverter* converter, int fedId, int errorType, const Word32& word) const;
124 };
125 
126 #endif // EventFilter_SiPixelRawToDigi_interface_PixelDataFormatter_h
std::string print(const PixelDigi &digi) const
int digi2word(cms_uint32_t detId, const PixelDigi &digi, FEDWordsMap &words) const
void passFrameReverter(const SiPixelFrameReverter *reverter)
void formatRawData(unsigned int lvl1_ID, RawData &fedRawData, const Digis &digis, const BadChannels &badChannels)
int digi2wordPhase1Layer1(cms_uint32_t detId, const PixelDigi &digi, FEDWordsMap &words) const
cms_uint32_t errorDetId(const SiPixelFrameConverter *converter, int fedId, int errorType, const Word32 &word) const
void setErrorStatus(bool ErrorStatus)
std::set< unsigned int > ModuleIDSet
std::vector< PixelDigi > DetDigis
const ModuleIDSet * modulesToUnpack_
void setModulesToUnpack(const ModuleIDSet *moduleIds)
std::map< cms_uint32_t, DetBadChannels > BadChannels
edm::DetSetVector< PixelDigi > Collection
uint64_t word
const SiPixelFrameReverter * theFrameReverter_
std::map< cms_uint32_t, DetDigis > Digis
std::map< int, std::vector< Word32 > > FEDWordsMap
cms_uint32_t Word32
void setQualityStatus(bool QualityStatus, const SiPixelQuality *QualityInfo)
unsigned int cms_uint32_t
Definition: typedefs.h:15
std::map< int, FEDRawData > RawData
void interpretRawData(bool &errorsInEvent, int fedId, const FEDRawData &data, Collection &digis, Errors &errors)
std::unique_ptr< ErrorCheckerBase > errorcheck_
std::vector< PixelFEDChannel > DetBadChannels
SiPixelFedCablingTree const * theCablingTree_
const SiPixelQuality * badPixelInfo_
PixelDataFormatter(const SiPixelFedCablingTree *map, bool phase1_=false)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
int checkError(const Word32 &data) const
void unpackFEDErrors(Errors const &errors, std::vector< int > const &tkerrorlist, std::vector< int > const &usererrorlist, edm::DetSetVector< SiPixelRawDataError > &errorcollection, DetIdCollection &tkerror_detidcollection, DetIdCollection &usererror_detidcollection, edmNew::DetSetVector< PixelFEDChannel > &disabled_channelcollection, DetErrors &nodeterrors)
Definition: errors.py:1
std::vector< SiPixelRawDataError > DetErrors
std::map< cms_uint32_t, DetErrors > Errors
cms_uint64_t Word64