24 using namespace sipixelobjects;
51 : theDigiCounter(0), theWordCounter(0), theCablingTree(map), badPixelInfo(0), modulesToUnpack(0)
55 int s8 =
sizeof(
char);
56 if ( s8 != 1 || s32 != 4*s8 || s64 != 2*s32) {
58 <<
" unexpected sizes: "
59 <<
" size of char is: " << s8
60 <<
", size of Word32 is: " << s32
61 <<
", size of Word64 is: " << s64
62 <<
", send exception" ;
117 using namespace sipixelobjects;
129 const Word64* header =
reinterpret_cast<const Word64*
>(rawData.
data()); header--;
130 bool moreHeaders =
true;
131 while (moreHeaders) {
135 moreHeaders = headerStatus;
139 bool moreTrailers =
true;
141 while (moreTrailers) {
145 moreTrailers = trailerStatus;
150 LogTrace(
"")<<
"data words: "<< (trailer-header-1);
161 for (
auto word = bw; word < ew; ++word) {
170 if ( (nlink!=
link) | (nroc!=roc) ) {
171 link = nlink; roc=nroc;
173 if (skipROC)
continue;
176 errorsInEvent =
true;
181 auto rawId = rocp->rawId();
184 short rocInDet = (short) rocp->idInDetUnit();
186 if (skipROC)
continue;
189 if (skipROC)
continue;
192 if ( (*detDigis).empty() ) (*detDigis).
data.reserve(32);
203 LogDebug(
"PixelDataFormatter::interpretRawData")
205 errorsInEvent =
true;
211 (*detDigis).data.emplace_back(global.
row, global.
col, adc);
213 LogTrace(
"") << (*detDigis).data.back();
239 std::map<int, vector<Word32> > words;
242 for (Digis::const_iterator im = digis.begin(); im != digis.end(); im++) {
246 const DetDigis & detDigis = im->second;
247 for (DetDigis::const_iterator it = detDigis.begin(); it != detDigis.end(); it++) {
253 <<
" digi2word returns error #"<<status
255 <<
" detector: "<<rawId<< endl
256 <<
print(digi) <<endl;
262 typedef std::map<int, vector<Word32> >::const_iterator RI;
263 for (RI feddata = words.begin(); feddata != words.end(); feddata++) {
264 int fedId = feddata->first;
267 if (words.find(fedId)->second.size() %2 != 0) words[fedId].push_back(
Word32(0) );
270 int dataSize = words.find(fedId)->second.size() *
sizeof(
Word32);
273 dataSize += (nHeaders+nTrailers)*
sizeof(
Word64);
280 FEDHeader::set( reinterpret_cast<unsigned char*>(word), 0, lvl1_ID, 0, fedId);
284 unsigned int nWord32InFed = words.find(fedId)->second.size();
285 for (
unsigned int i=0;
i < nWord32InFed;
i+=2) {
286 *word = (
Word64(words.find(fedId)->second[
i]) << 32 ) | words.find(fedId)->second[
i+1];
296 if (word != reinterpret_cast<Word64* >(rawData->
data()+dataSize)) {
297 string s =
"** PROBLEM in PixelDataFormatter !!!";
300 fedRawData[
fedId] = *rawData;
306 std::map<
int, vector<Word32> > & words)
const
315 if (fedId<0)
return fedId;
323 words[
fedId].push_back(word);
335 if (word == 0 )
return 0;
348 <<
" rocRow: "<<local.
rocRow()<<
", rocCol:"<<local.
rocCol()
349 <<
" (dcol: "<<cabling.
dcol<<
", pxid:"<<cabling.
pxid<<
"), adc:"<<
adc;
352 if (!converter)
return 0;
356 if (status)
return status;
363 static_cast<unsigned int>(cabling.
link),
364 static_cast<unsigned int>(cabling.
roc)};
368 if (badROC)
return 0;
373 digis[detIdx.
rawId].emplace_back(detIdx.
row, detIdx.
col, adc);
384 str <<
" DIGI: row: " << digi.
row() <<
", col: " << digi.
column() <<
", adc: " << digi.
adc();
391 str <<
"word64: " <<
reinterpret_cast<const bitset<64>&
> (word);
int adc(sample_type sample)
get the ADC sample (12 bits)
bool checkTrailer(bool &errorsInEvent, int fedId, int nWords, const Word64 *trailer, Errors &errors)
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
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
reference find_or_insert(det_id_type id)
bool checkROC(bool &errorsInEvent, int fedId, const SiPixelFrameConverter *converter, Word32 &errorWord, Errors &errors)
global coordinates (row and column in DetUnit, as in PixelDigi)
bool checkCRC(bool &errorsInEvent, int fedId, const Word64 *trailer, Errors &errors)
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
unsigned short adc() const
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)
sipixelobjects::PixelROC const * toRoc(int link, int roc) const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
int toDetector(const sipixelobjects::ElectronicIndex &cabling, sipixelobjects::DetectorIndex &detector) const
bool checkHeader(bool &errorsInEvent, int fedId, const Word64 *header, Errors &errors)