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) {
126 int convroc = nroc - 1;
128 std::map<CTPPSPixelFramePosition, CTPPSPixelROCInfo>::const_iterator mit;
132 if (nlink >= maxLinkIndex) {
134 }
else if ((nroc - 1) >= maxRocIndex) {
146 if ((nlink !=
link) | (nroc !=
roc)) {
154 auto rawId = rocp.
rawId();
157 if ((*detDigis).empty())
158 (*detDigis).
data.reserve(32);
166 if (dcol < min_Dcol || dcol > max_Dcol || pxid < min_Pixid || pxid > max_Pixid) {
168 <<
" unphysical dcol and/or pxid "
169 <<
" nllink=" << nlink <<
" nroc=" << nroc <<
" adc=" <<
adc <<
" dcol=" << dcol <<
" pxid=" << pxid;
176 std::pair<int, int> rocPixel;
177 std::pair<int, int> modPixel;
179 rocPixel = std::make_pair(dcol, pxid);
186 (*detDigis).data.emplace_back(modPixel.first, modPixel.second,
adc);
193 std::vector<PPSPixelIndex> iDdet2fed) {
194 std::map<int, vector<Word32> > words;
198 for (
auto const& im : digis) {
202 const DetDigis& detDigis = im.second;
203 for (
auto const& it : detDigis) {
204 int nroc = 999, nlink = 999;
205 int rocPixelRow = -1, rocPixelColumn = -1, rocID = -1;
206 int modulePixelColumn = it.column();
207 int modulePixelRow = it.row();
211 const int pxid = 2 * (ROCSizeInX - rocPixelRow) + (rocPixelColumn % 2);
213 unsigned int urocID = rocID;
216 auto range = std::equal_range(iDdet2fed.begin(), iDdet2fed.end(), myTest,
compare);
218 auto i =
range.first - iDdet2fed.begin();
219 nlink = iDdet2fed.at(
i).fedch;
220 nroc = iDdet2fed.at(
i).rocch + 1;
227 words[iDdet2fed.at(
i).fedid].push_back(
word);
236 for (
auto const& feddata : words) {
237 int fedId = feddata.first;
241 if (words.find(
fedId)->second.size() % 2 != 0)
245 size_t dataSize = words.find(
fedId)->second.size() *
sizeof(
Word32);
248 dataSize += (nHeaders + nTrailers) *
sizeof(
Word64);
260 unsigned int nWord32InFed = words.find(
fedId)->second.size();
261 for (
unsigned int i = 0;
i < nWord32InFed;
i += 2) {
272 if (
word != reinterpret_cast<Word64*>(
rawData.data() + dataSize)) {
274 string s =
"** PROBLEM in CTPPSPixelDataFormatter !!!";
275 LogError(
"CTPPSPixelDataFormatter") <<
"** PROBLEM in CTPPSPixelDataFormatter!!!";
283 std::ostringstream
str;
284 str <<
"word64: " <<
reinterpret_cast<const std::bitset<64>&
>(
word);