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_COL_bits = 6;
25 constexpr
int m_ROW_bits = 7;
26 constexpr
int m_ADC_bits = 8;
27 constexpr
int min_Dcol = 0;
28 constexpr
int max_Dcol = 25;
29 constexpr
int min_Pixid = 2;
30 constexpr
int max_Pixid = 161;
31 constexpr
int min_COL = 0;
32 constexpr
int max_COL = 51;
33 constexpr
int min_ROW = 0;
34 constexpr
int max_ROW = 79;
35 constexpr
int maxRocIndex = 3;
36 constexpr
int maxLinkIndex = 49;
44 m_ErrorSummary(eSummary)
49 int s8 =
sizeof(char);
50 if (s8 != 1 || s32 != 4 * s8 || s64 != 2 * s32) {
51 LogError(
"UnexpectedSizes") <<
" unexpected sizes: " 52 <<
" size of char is: " << s8 <<
", size of Word32 is: " << s32
53 <<
", size of Word64 is: " << s64 <<
", send exception";
97 bool moreHeaders =
true;
102 moreHeaders = headerStatus;
106 bool moreTrailers =
true;
108 while (moreTrailers) {
112 moreTrailers = trailerStatus;
122 bool skipROC =
false;
128 if (*(ew - 1) == 0) {
145 int convroc = nroc - 1;
149 std::map<CTPPSPixelFramePosition, CTPPSPixelROCInfo>::const_iterator mit;
157 if ((nlink != link) | (nroc !=
roc)) {
161 if ((
roc - 1) < maxRocIndex) {
172 if (nlink >= maxLinkIndex) {
176 }
else if ((nroc - 1) >= maxRocIndex) {
179 fmt::format(
"Id {0}, in link {1}, of FED {2} in DetId {3}", convroc, nlink,
fedId, iD));
188 if (rocp.
rawId() == 0) {
196 if ((*detDigis).empty())
197 (*detDigis).
data.reserve(32);
200 if (skipROC || rocp.
rawId() == 0)
210 if (!
isRun3 && (dcol < min_Dcol || dcol > max_Dcol || pxid < min_Pixid || pxid > max_Pixid)) {
212 "unphysical dcol and/or pxid",
213 fmt::format(
"fedId= {0}, nllink= {1}, convroc= {2}, adc= {3}, dcol= {4}, pxid= {5}, detId= {6}",
226 if (
isRun3 && (col < min_COL || col > max_COL || row < min_ROW || row > max_ROW)) {
228 fmt::format(
"fedId= {0}, nllink= {1}, convroc= {2}, adc= {3}, col= {4}, row= {5}, detId= {6}",
242 std::pair<int, int> rocPixel;
243 std::pair<int, int> modPixel;
246 rocPixel = std::make_pair(row,
col);
249 rocPixel = std::make_pair(dcol, pxid);
256 (*detDigis).data.emplace_back(modPixel.first, modPixel.second,
adc);
261 unsigned int lvl1_ID,
264 std::vector<PPSPixelIndex> iDdet2fed) {
265 std::map<int, vector<Word32> > words;
269 for (
auto const& im : digis) {
273 const DetDigis& detDigis = im.second;
274 for (
auto const& it : detDigis) {
275 int nroc = 999, nlink = 999;
276 int rocPixelRow = -1, rocPixelColumn = -1, rocID = -1;
277 int modulePixelColumn = it.column();
278 int modulePixelRow = it.row();
284 unsigned int urocID = rocID;
287 auto range = std::equal_range(iDdet2fed.begin(), iDdet2fed.end(), myTest,
compare);
289 auto i =
range.first - iDdet2fed.begin();
290 nlink = iDdet2fed.at(
i).fedch;
291 nroc = iDdet2fed.at(
i).rocch + 1;
299 words[iDdet2fed.at(
i).fedid].push_back(
word);
305 words[iDdet2fed.at(
i).fedid].push_back(
word);
315 for (
auto const& feddata : words) {
316 int fedId = feddata.first;
320 if (words.find(
fedId)->second.size() % 2 != 0)
321 words[
fedId].emplace_back(0);
324 size_t dataSize = words.find(
fedId)->second.size() *
sizeof(
Word32);
327 dataSize += (nHeaders + nTrailers) *
sizeof(
Word64);
339 unsigned int nWord32InFed = words.find(
fedId)->second.size();
340 for (
unsigned int i = 0;
i < nWord32InFed;
i += 2) {
351 if (
word != reinterpret_cast<Word64*>(
rawData.data() + dataSize)) {
353 string s =
"** PROBLEM in CTPPSPixelDataFormatter !!!";
354 LogError(
"CTPPSPixelDataFormatter") <<
"** PROBLEM in CTPPSPixelDataFormatter!!!";
362 std::ostringstream
str;
363 str <<
"word64: " <<
reinterpret_cast<const std::bitset<64>&
>(
word);
Contains mappind data related to a ROC.
bool checkHeader(bool &errorsInEvent, int fedId, const Word64 *header, Errors &errors) const
bool checkCRC(bool &errorsInEvent, int fedId, const Word64 *trailer, Errors &errors) const
void setParameters(uint32_t du, int idInDU, int idLk)
bool checkTrailer(bool &errorsInEvent, int fedId, unsigned int nWords, const Word64 *trailer, Errors &errors) const
Log< level::Error, false > LogError
bool checkROC(bool &errorsInEvent, int fedId, uint32_t iD, const Word32 &errorWord, Errors &errors) const
reference find_or_insert(det_id_type id)
void add(const std::string &message, const std::string &details="")
uint32_t iD
the symbolic id
static void set(unsigned char *trailer, uint32_t lenght, uint16_t crc, uint8_t evt_stat, uint8_t tts, bool moreTrailers=false)
Set all fields in the trailer.
int transformToROC(const int col, const int row, int &rocId, int &colROC, int &rowROC) const
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
unsigned int cms_uint32_t
void setErrorStatus(bool errorStatus)
void conversionError(int fedId, uint32_t iD, const State &state, const Word32 &errorWord, Errors &errors) const
static constexpr Word32 dummyDetId
std::pair< int, int > toGlobalfromDcol(const std::pair< int, int > &rocPixel) const
static int DColumn(const int colROC)
uint16_t *__restrict__ uint16_t const *__restrict__ adc
std::pair< int, int > toGlobal(const std::pair< int, int > &rocPixel) const