9 #include "CTPfragment/CTPdataformatVersion.h"
13 const std::string
convertRawCTPData(
const std::vector<uint32_t>&
data,
const bool longFormat,
int ctpFormatVersionNumber)
18 CTPdataformatVersion ctpVersion(ctpFormatVersionNumber);
21 for (
size_t i(0); (
i < ctpVersion.getNumberTimeWords() ) && (
i <
data.size()); ++
i) {
22 if (
i == 0 || longFormat)
s <<
"\nTime";
23 if (longFormat)
s << std::setw(1) <<
i;
24 s <<
" " << std::setw(8) <<
data[
i];
25 if (longFormat)
s << std::endl;
29 if (
data.size() < 2)
return s.str();
33 for (
unsigned int k(0);
k < (
data.size()-2)/ctpVersion.getDAQwordsPerBunch(); ++
k) {
38 for (
size_t i(0),
p(
k*ctpVersion.getDAQwordsPerBunch() + ctpVersion.getTIPpos());
39 (
i < ctpVersion.getTIPwords() ) && (
p <
data.size());
41 if (
i == 0 || longFormat)
s <<
"\nTIP";
42 if (longFormat)
s << std::setw(1) <<
i;
43 s <<
" 0x" << std::hex << std::setw(8) << std::setfill(
'0' ) <<
data[
p] << std::dec << std::setfill(
' ');
44 if (longFormat)
s << std::endl;
48 for (
size_t i(0),
p(
k*ctpVersion.getDAQwordsPerBunch() + ctpVersion.getTBPpos());
49 (
i < ctpVersion.getTBPwords() ) && (
p <
data.size());
51 if (
i == 0 || longFormat)
s <<
"\nTBP";
52 if (longFormat)
s << std::setw(1) <<
i;
53 s <<
" 0x" << std::hex << std::setw(8) << std::setfill(
'0' ) <<
data[
p] << std::dec << std::setfill(
' ');
54 if (longFormat)
s << std::endl;
58 for (
size_t i(0),
p(
k*ctpVersion.getDAQwordsPerBunch() + ctpVersion.getTAPpos());
59 (
i < ctpVersion.getTAPwords() ) && (
p <
data.size());
61 if (
i == 0 || longFormat)
s <<
"\nTAP";
62 if (longFormat)
s << std::setw(1) <<
i;
63 s <<
" 0x" << std::hex << std::setw(8) << std::setfill(
'0' ) <<
data[
p] << std::dec << std::setfill(
' ');
64 if (longFormat)
s << std::endl;
68 for (
size_t i(0),
p(
k*ctpVersion.getDAQwordsPerBunch() + ctpVersion.getTAVpos());
69 (
i < ctpVersion.getTAVwords() ) && (
p <
data.size());
71 if (
i == 0 || longFormat)
s <<
"\nTAV";
72 if (longFormat)
s << std::setw(1) <<
i;
73 s <<
" 0x" << std::hex << std::setw(8) << std::setfill(
'0' ) <<
data[
p] << std::dec << std::setfill(
' ');
74 if (longFormat)
s << std::endl;