20 constexpr
int m_LINK_bits = 6;
21 constexpr
int m_ROC_bits = 5;
22 constexpr
int m_DCOL_bits = 5;
23 constexpr
int m_PXID_bits = 8;
24 constexpr
int m_ADC_bits = 8;
25 constexpr
int min_Dcol = 0;
26 constexpr
int max_Dcol = 25;
27 constexpr
int min_Pixid = 2;
28 constexpr
int max_Pixid = 161;
29 constexpr
int maxRocIndex = 3;
30 constexpr
int maxLinkIndex = 13;
34 : m_WordCounter(0), m_Mapping(
mapping) {
37 int s8 =
sizeof(char);
38 if (s8 != 1 || s32 != 4 * s8 || s64 != 2 * s32) {
39 LogError(
"UnexpectedSizes") <<
" unexpected sizes: "
40 <<
" size of char is: " << s8 <<
", size of Word32 is: " << s32
41 <<
", size of Word64 is: " << s64 <<
", send exception";
77 bool moreHeaders =
true;
82 moreHeaders = headerStatus;
86 bool moreTrailers =
true;
88 while (moreTrailers) {
92 moreTrailers = trailerStatus;
102 bool skipROC =
false;
108 if (*(ew - 1) == 0) {
125 int convroc = nroc - 1;
127 std::map<CTPPSPixelFramePosition, CTPPSPixelROCInfo>::const_iterator mit;
131 if (nlink >= maxLinkIndex) {
133 }
else if ((nroc - 1) >= maxRocIndex) {
145 if ((nlink !=
link) | (nroc !=
roc)) {
153 auto rawId = rocp.
rawId();
156 if ((*detDigis).empty())
157 (*detDigis).
data.reserve(32);
165 if (dcol < min_Dcol || dcol > max_Dcol || pxid < min_Pixid || pxid > max_Pixid) {
167 <<
" unphysical dcol and/or pxid "
168 <<
" nllink=" << nlink <<
" nroc=" << nroc <<
" adc=" <<
adc <<
" dcol=" << dcol <<
" pxid=" << pxid;
175 std::pair<int, int> rocPixel;
176 std::pair<int, int> modPixel;
178 rocPixel = std::make_pair(dcol, pxid);
185 (*detDigis).data.emplace_back(modPixel.first, modPixel.second,
adc);
192 std::vector<PPSPixelIndex> iDdet2fed) {
193 std::map<int, vector<Word32> > words;
197 for (
auto const& im : digis) {
201 const DetDigis& detDigis = im.second;
202 for (
auto const& it : detDigis) {
203 int nroc = 999, nlink = 999;
204 int rocPixelRow = -1, rocPixelColumn = -1, rocID = -1;
205 int modulePixelColumn = it.column();
206 int modulePixelRow = it.row();
210 const int pxid = 2 * (ROCSizeInX - rocPixelRow) + (rocPixelColumn % 2);
212 unsigned int urocID = rocID;
215 auto range = std::equal_range(iDdet2fed.begin(), iDdet2fed.end(), myTest,
compare);
217 auto i =
range.first - iDdet2fed.begin();
218 nlink = iDdet2fed.at(
i).fedch;
219 nroc = iDdet2fed.at(
i).rocch + 1;
226 words[iDdet2fed.at(
i).fedid].push_back(
word);
235 for (
auto const& feddata : words) {
236 int fedId = feddata.first;
240 if (words.find(
fedId)->second.size() % 2 != 0)
241 words[
fedId].emplace_back(0);
244 size_t dataSize = words.find(
fedId)->second.size() *
sizeof(
Word32);
247 dataSize += (nHeaders + nTrailers) *
sizeof(
Word64);
259 unsigned int nWord32InFed = words.find(
fedId)->second.size();
260 for (
unsigned int i = 0;
i < nWord32InFed;
i += 2) {
271 if (
word != reinterpret_cast<Word64*>(
rawData.data() + dataSize)) {
273 string s =
"** PROBLEM in CTPPSPixelDataFormatter !!!";
274 LogError(
"CTPPSPixelDataFormatter") <<
"** PROBLEM in CTPPSPixelDataFormatter!!!";
282 std::ostringstream
str;
283 str <<
"word64: " <<
reinterpret_cast<const std::bitset<64>&
>(
word);