16 if (
debug_)
cout <<
"enter in SRBlockFormatter::DigiToRaw " << endl;
23 int SRid = (dccid -1) / 3 +1;
29 int icode = 1000 * dccid + SRid;
32 std::map<int, int>::const_iterator it_header =
header_.find(icode);
34 if ( it_header !=
header_.end() ) {
35 SRP_index = rawdata.
size() / 8 - Nrows_SRP;
36 if (
debug_)
cout <<
"This SRid is already there." << endl;
39 if (
debug_)
cout <<
"New SR Block added on Raw data " << endl;
41 SRP_index = rawdata.
size() / 8;
42 rawdata.
resize (rawdata.
size() + 8 + 8*Nrows_SRP);
43 unsigned char* ppData = rawdata.
data();
44 ppData[8*SRP_index] = SRid & 0xFF;
45 ppData[8*SRP_index+2] = bx & 0xFF;
46 ppData[8*SRP_index+3] = (bx & 0xF00)>>8;
47 ppData[8*SRP_index+3] |= 0x80;
48 ppData[8*SRP_index+4] = lv1 & 0xFF;
49 ppData[8*SRP_index+5] = (lv1 & 0xF00)>>8;
51 ppData[8*SRP_index+6] = 0;
52 ppData[8*SRP_index+7] = 0x80;
54 if (
debug_)
cout <<
"Added headers and empty lines : " << endl;
59 unsigned char* Data = rawdata.
data();
61 Data[8*
iline + 7] |= 0x80;
62 Data[8*
iline + 3] |= 0x80;
66 unsigned char* pData = rawdata.
data();
70 int nflags = pData[8*(SRP_index-1) +6] & 0x7F;
72 pData[8*(SRP_index-1) + 6] = nflags & 0x7F;
74 int jTT = (dcc_channel-1);
77 int kval = (jTT % 16) / 4;
80 if (
debug_)
cout <<
"Now add SC to SRBlock " <<
dec << dcc_channel <<
" irow ival " <<
dec << irow <<
" " <<
dec << ival << endl;
81 if (
debug_)
cout <<
"new data will be added at line " <<
dec << SRP_index << endl;
84 unsigned char* buff = &pData[8*SRP_index];
85 Word64* pw =
reinterpret_cast<Word64*
>(
const_cast<unsigned char*
>(buff));
86 int nbits = kval*16 + 3*ival;
size_t size() const
Lenght of the data buffer in bytes.
void resize(size_t newsize)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.