11 cout <<
"enter in SRBlockFormatter::DigiToRaw " << endl;
19 int SRid = (dccid - 1) / 3 + 1;
24 int icode = 1000 * dccid + SRid;
26 cout <<
"size of header_ map is " <<
header_.size() << endl;
28 std::map<int, int>::const_iterator it_header =
header_.find(icode);
30 if (it_header !=
header_.end()) {
31 SRP_index = rawdata.
size() / 8 - Nrows_SRP;
33 cout <<
"This SRid is already there." << endl;
36 cout <<
"New SR Block added on Raw data " << endl;
38 SRP_index = rawdata.
size() / 8;
39 rawdata.
resize(rawdata.
size() + 8 + 8 * Nrows_SRP);
40 unsigned char* ppData = rawdata.
data();
41 ppData[8 * SRP_index] = SRid & 0xFF;
42 ppData[8 * SRP_index + 2] =
bx & 0xFF;
43 ppData[8 * SRP_index + 3] = (
bx & 0xF00) >> 8;
44 ppData[8 * SRP_index + 3] |= 0x80;
45 ppData[8 * SRP_index + 4] = lv1 & 0xFF;
46 ppData[8 * SRP_index + 5] = (lv1 & 0xF00) >> 8;
48 ppData[8 * SRP_index + 6] = 0;
49 ppData[8 * SRP_index + 7] = 0x80;
52 cout <<
"Added headers and empty lines : " << endl;
58 unsigned char* Data = rawdata.
data();
60 Data[8 *
iline + 7] |= 0x80;
61 Data[8 *
iline + 3] |= 0x80;
65 unsigned char* pData = rawdata.
data();
69 int nflags = pData[8 * (SRP_index - 1) + 6] & 0x7F;
71 pData[8 * (SRP_index - 1) + 6] = nflags & 0x7F;
73 int jTT = (dcc_channel - 1);
76 int kval = (jTT % 16) / 4;
80 cout <<
"Now add SC to SRBlock " <<
dec << dcc_channel <<
" irow ival " <<
dec << irow <<
" " <<
dec << ival
83 cout <<
"new data will be added at line " <<
dec << SRP_index << endl;
85 unsigned char* buff = &pData[8 * SRP_index];
86 Word64* pw =
reinterpret_cast<Word64*
>(
const_cast<unsigned char*
>(buff));
87 int nbits = kval * 16 + 3 * ival;
size_t size() const
Lenght of the data buffer in bytes.
void resize(size_t newsize, size_t wordsize=8)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
static constexpr float b1