24 using namespace sipixelobjects;
48 : theDigiCounter(0), theWordCounter(0), theCablingTree(map), badPixelInfo(0), modulesToUnpack(0)
52 int s8 =
sizeof(char);
53 if ( s8 != 1 || s32 != 4*s8 || s64 != 2*s32) {
55 <<
" unexpected sizes: "
56 <<
" size of char is: " << s8
57 <<
", size of Word32 is: " << s32
58 <<
", size of Word64 is: " << s64
59 <<
", send exception" ;
93 if (nWords==0)
return;
99 const Word64* trailer =
reinterpret_cast<const Word64*
>(rawData.
data())+(nWords-1);
104 const Word64* header =
reinterpret_cast<const Word64*
>(rawData.
data()); header--;
105 bool moreHeaders =
true;
106 while (moreHeaders) {
110 moreHeaders = headerStatus;
114 bool moreTrailers =
true;
116 while (moreTrailers) {
120 moreTrailers = trailerStatus;
125 if (
debug)
LogTrace(
"")<<
"data words: "<< (trailer-header-1);
126 for (
const Word64* word = header+1; word != trailer; word++) {
138 LogDebug(
"PixelDataFormatter::interpretRawData")
139 <<
"status #" <<status1<<
" returned for word1";
140 errorsInEvent =
true;
148 LogDebug(
"PixelDataFormatter::interpretRawData")
149 <<
"status #" <<status2<<
" returned for word2";
150 errorsInEvent =
true;
162 std::map<int, vector<Word32> > words;
165 for (Digis::const_iterator im = digis.begin(); im != digis.end(); im++) {
169 const DetDigis & detDigis = im->second;
170 for (DetDigis::const_iterator it = detDigis.begin(); it != detDigis.end(); it++) {
176 <<
" digi2word returns error #"<<status
178 <<
" detector: "<<rawId<< endl
179 <<
print(digi) <<endl;
185 typedef std::map<int, vector<Word32> >::const_iterator RI;
186 for (RI feddata = words.begin(); feddata != words.end(); feddata++) {
187 int fedId = feddata->first;
190 if (words.find(fedId)->second.size() %2 != 0) words[fedId].push_back(
Word32(0) );
193 int dataSize = words.find(fedId)->second.size() *
sizeof(
Word32);
196 dataSize += (nHeaders+nTrailers)*
sizeof(
Word64);
203 FEDHeader::set( reinterpret_cast<unsigned char*>(word), 0, lvl1_ID, 0, fedId);
207 unsigned int nWord32InFed = words.find(fedId)->second.size();
208 for (
unsigned int i=0;
i < nWord32InFed;
i+=2) {
209 *word = (
Word64(words.find(fedId)->second[
i]) << 32 ) | words.find(fedId)->second[
i+1];
219 if (word != reinterpret_cast<Word64* >(rawData->
data()+dataSize)) {
220 string s =
"** PROBLEM in PixelDataFormatter !!!";
223 fedRawData[fedId] = *rawData;
229 std::map<
int, vector<Word32> > & words)
const
238 if (fedId<0)
return fedId;
246 words[fedId].push_back(word);
254 const bool includeErrors,
const bool useQuality,
const Word32 & word,
Digis & digis)
const
257 if (word == 0 )
return 0;
270 <<
" rocRow: "<<local.
rocRow()<<
", rocCol:"<<local.
rocCol()
271 <<
" (dcol: "<<cabling.
dcol<<
", pxid:"<<cabling.
pxid<<
"), adc:"<<
adc;
274 if (!converter)
return 0;
278 if (status)
return status;
285 static_cast<unsigned int>(cabling.
link),
286 static_cast<unsigned int>(cabling.
roc)};
290 if (badROC)
return 0;
296 digis[detIdx.
rawId].push_back(pd);
307 str <<
" DIGI: row: " << digi.
row() <<
", col: " << digi.
column() <<
", adc: " << digi.
adc();
314 str <<
"word64: " <<
reinterpret_cast<const bitset<64>&
> (word);
int adc(sample_type sample)
get the ADC sample (12 bits)
common ppss p3p6s2 common epss epspn46 common const1 w2
bool checkTrailer(bool &errorsInEvent, int fedId, int nWords, const Word64 *trailer, Errors &errors)
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
static MessageDrop * instance()
const ErrorChecker::Word32 DCOL_mask
bool IsRocBad(const uint32_t &detid, const short &rocNb) const
static void set(unsigned char *trailer, int evt_lgth, int crc, int evt_stat, int tts, bool T=false)
Set all fields in the trailer.
size_t size() const
Lenght of the data buffer in bytes.
identify pixel inside single ROC
int toCabling(sipixelobjects::ElectronicIndex &cabling, const sipixelobjects::DetectorIndex &detector) const
bool checkROC(bool &errorsInEvent, int fedId, const SiPixelFrameConverter *converter, Word32 &errorWord, Errors &errors)
bool checkCRC(bool &errorsInEvent, int fedId, const Word64 *trailer, Errors &errors)
const ErrorChecker::Word32 ROC_mask
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
unsigned short adc() const
const ErrorChecker::Word32 PXID_mask
void setErrorStatus(bool ErrorStatus)
unsigned int cms_uint32_t
double collumn and pixel ID in double collumn representation
void conversionError(int fedId, const SiPixelFrameConverter *converter, int status, Word32 &errorWord, Errors &errors)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
const ErrorChecker::Word32 LINK_mask
int toDetector(const sipixelobjects::ElectronicIndex &cabling, sipixelobjects::DetectorIndex &detector) const
bool checkHeader(bool &errorsInEvent, int fedId, const Word64 *header, Errors &errors)