61 std::array<short, 12>
const& twinMuxAmcSec,
74 std::vector<std::array<short, 12> >
amcsec_;
77 inline unsigned char*
readline(
unsigned char* lineFED,
int&
lines,
long& dataWord)
const {
78 dataWord = *((
long*)lineFED);
88 int normBx(
int bx_,
int bxCnt_)
const;
104 produces<L1MuDTChambPhContainer>(
"PhIn").setBranchAlias(
"PhIn");
105 produces<L1MuDTChambThContainer>(
"ThIn").setBranchAlias(
"ThIn");
106 produces<L1MuDTChambPhContainer>(
"PhOut").setBranchAlias(
"PhOut");
113 throw cms::Exception(
"TwinMux_unpacker") <<
"Configuration file error. Size of \'wheels\' and \'feds\' differs.\n";
117 <<
"Configuration file error. Size of \'wheels\' and \'amcsecmap\' differs.\n";
119 for (
size_t wh_i = 0; wh_i <
amcsecmap_.size(); ++wh_i) {
120 std::array<short, 12> whmap;
121 for (
size_t amc_i = 1; amc_i < 13; ++amc_i) {
122 short shift = (12 - amc_i) * 4;
143 TM7phi_product->setContainer(phi_data);
144 TM7the_product->setContainer(the_data);
145 TM7phi_out_product->setContainer(phi_out_data);
149 e.put(
std::move(TM7phi_out_product),
"PhOut");
159 for (
size_t w_i = 0; w_i <
nfeds_; ++w_i) {
167 int bxNorm_ = bx_ - bxCnt_;
168 if (
abs(bxNorm_) < 3000)
172 return bxNorm_ - 3564;
174 return bxNorm_ + 3564;
181 return radAng_ - 4096;
188 return benAng_ - 1024;
195 std::array<short, 12>
const& twinMuxAmcSec,
200 const unsigned int fw_rev_with_zerosupression =
202 int previous_selector = -100;
204 std::vector<long> DTTM7WordContainer;
209 std::ostringstream
fname;
210 fname <<
"eventDump_" << twinMuxFed <<
".txt";
216 if (TM7data.
size() == 0)
220 unsigned char* lineFED = TM7data.
data();
226 lineFED =
readline(lineFED, nline, dataWord);
229 int TM7fedId = (dataWord >> 8) & 0xFFF;
234 int BOEevTy = (dataWord >> 60) & 0xF;
238 logfile <<
'[' << ++linecounter <<
"]\t" << std::hex << dataWord <<
std::dec <<
"\t|\t" 239 <<
"BOEevTy " << BOEevTy <<
'\t' <<
"TM7fedId " << TM7fedId <<
'\n';
241 if ((BOEevTy != 0x5) || (TM7fedId != twinMuxFed)) {
242 edm::LogWarning(
"TwinMux_unpacker") <<
"Not a TM7 of FED " << twinMuxFed <<
" header " << std::hex << dataWord;
247 lineFED =
readline(lineFED, nline, dataWord);
250 std::map<int, int> AMCsizes;
254 int nAMC = (dataWord >> 52) & 0xF;
257 logfile <<
'[' << ++linecounter <<
"]\t" << std::hex << dataWord <<
std::dec <<
"\t|\t" 258 <<
"nAMC " << nAMC <<
'\n';
261 for (
int j = 0;
j < nAMC; ++
j) {
262 lineFED =
readline(lineFED, nline, dataWord);
265 int AMCno = (dataWord >> 16) & 0xF;
270 if ((AMCno < 1) || (AMCno > 12)) {
275 AMCsizes[AMCno] = (dataWord >> 32) & 0xFFFFFF;
278 logfile <<
'[' << ++linecounter <<
"]\t" << std::hex << dataWord <<
std::dec <<
"\t|\t" 279 <<
"AMCsizes[" << AMCno <<
"] " << AMCsizes[AMCno] <<
std::dec <<
'\n';
283 std::map<int, int>::iterator AMCiterator = AMCsizes.begin();
284 std::map<int, int>::iterator AMCitend = AMCsizes.end();
285 for (; AMCiterator != AMCitend; ++AMCiterator) {
286 for (
int k = 0;
k < AMCiterator->second; ++
k) {
287 lineFED =
readline(lineFED, nline, dataWord);
290 DTTM7WordContainer.push_back(dataWord);
295 lineFED =
readline(lineFED, nline, dataWord);
300 lineFED =
readline(lineFED, nline, dataWord);
304 int chkEOE = (dataWord >> 60) & 0xF;
305 int CRC = (dataWord >> 16) & 0xFFFF;
306 int evtLgth = (dataWord >> 32) & 0xFFFFFF;
310 <<
" does not start with 0xA";
315 logfile <<
"\tevtLgth " << std::hex << evtLgth <<
"\tCRC " <<
CRC <<
std::dec <<
'\n';
317 if (nline != evtLgth) {
319 <<
std::dec << evtLgth <<
" differ ";
324 edm::LogWarning(
"TwinMux_unpacker") <<
"Calculated CRC " << std::hex << newCRC <<
" differs from CRC in trailer " 330 std::vector<long>::iterator DTTM7iterator = DTTM7WordContainer.begin();
331 std::vector<long>::iterator DTTM7itend = DTTM7WordContainer.end();
334 for (; DTTM7iterator != DTTM7itend; ++DTTM7iterator) {
335 dataWord = (*DTTM7iterator);
336 int dataLenght = (dataWord & 0xFFFFF);
337 int bxCounter = (dataWord >> 20) & 0xFFF;
338 int event = (dataWord >> 32) & 0xFFFFFF;
339 int AMC_ID = (dataWord >> 56) & 0xF;
340 int control = (dataWord >> 60) & 0xF;
341 int wheel = twinMuxWheel;
343 if ((AMC_ID < 1)
or (AMC_ID > 12)) {
345 <<
" TM7fedId " << TM7fedId <<
" AMC_ID " << AMC_ID;
349 int sector = twinMuxAmcSec[AMC_ID - 1];
354 <<
"%%%%%% VALID AMC_ID POINTS TO SECTOR OUT OF RANGE \n" 355 <<
" TM7fedId " << TM7fedId <<
" AMC_ID " << AMC_ID <<
" wheel " <<
wheel <<
" sector " <<
sector;
360 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWord <<
std::dec <<
"\t|\t" 361 <<
"AMC_ID " << AMC_ID <<
'\t' <<
"control " << control <<
'\t' <<
"event " <<
event <<
'\t' 362 <<
"bxCounter " << bxCounter <<
'\t' <<
"dataLenght " << dataLenght <<
'\n';
365 if (DTTM7iterator == DTTM7itend) {
366 LogDebug(
"TwinMux_unpacker") <<
"TRAILING WORD AS A PAYLOAD END in FED " << std::hex << TM7fedId << std::hex
367 << dataWord <<
std::dec <<
" [it pos " <<
int(DTTM7iterator - DTTM7itend) <<
" ]";
371 dataWord = (*DTTM7iterator);
372 unsigned int firmware_rev = (dataWord >> 7) & 0x1FF;
373 int boardID = (dataWord & 0xFFFF);
374 int orbit = (dataWord >> 16) & 0xFFFF;
376 if (DTTM7iterator == DTTM7itend) {
378 <<
"%%%%%% AMC_ID " << AMC_ID <<
" control " << control <<
" event " <<
event <<
" bxCounter " << bxCounter
379 <<
" size " << dataLenght <<
" orbit " << orbit <<
" board " << boardID <<
" AMCsizes " << AMCsizes[AMC_ID]
380 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
385 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWord <<
std::dec <<
"\t|\t" 386 <<
" orbit " << orbit <<
" board " << boardID <<
'\n';
388 int AMCsize = AMCsizes[AMC_ID] - 1;
394 for (
int tm7eventsize = 2; tm7eventsize < AMCsize; ++tm7eventsize) {
396 if (DTTM7iterator == DTTM7itend) {
397 edm::LogWarning(
"TwinMux_unpacker") <<
"UNEXPECTED END OF PAYLOAD INSIDE CHAMBER DESCRIPTION" 398 <<
" [it pos " <<
int(DTTM7iterator - DTTM7itend) <<
" ]";
402 long dataWordSub = (*DTTM7iterator);
403 int selector = (dataWordSub >> 60) & 0xF;
405 if (firmware_rev >= fw_rev_with_zerosupression) {
406 if (selector == 0xC) {
408 bc0 = (dataWordSub >> 59) & 0
x1;
412 int bxOffset = (dataWordSub >> 48) & 0x3F;
420 int posBTI[7], qualBTI[7];
422 int mb3_eta = (dataWordSub & 0xFF);
423 int mb3_eta_HQ = (dataWordSub >> 8) & 0xFF;
424 int mb2_eta = (dataWordSub >> 16) & 0xFF;
425 int mb2_eta_HQ = (dataWordSub >> 24) & 0xFF;
426 int mb1_eta = (dataWordSub >> 32) & 0xFF;
427 int mb1_eta_HQ = (dataWordSub >> 40) & 0xFF;
430 for (
int i = 0;
i <= 5;
i++) {
431 posBTI[
i] = (mb1_eta >>
i) & 0x01;
432 qualBTI[
i] = (mb1_eta_HQ >>
i) & 0x01;
434 posBTI[6] = (((mb1_eta >> 6) & 0x01) || ((mb1_eta >> 7) & 0x01));
435 qualBTI[6] = (((mb1_eta_HQ >> 6) & 0x01) || ((mb1_eta_HQ >> 7) & 0x01));
442 for (
int i = 0;
i <= 5;
i++) {
443 posBTI[
i] = (mb2_eta >>
i) & 0x01;
444 qualBTI[
i] = (mb2_eta_HQ >>
i) & 0x01;
446 posBTI[6] = ((mb2_eta >> 6) & 0x01) || ((mb2_eta >> 7) & 0x01);
447 qualBTI[6] = ((mb2_eta_HQ >> 6) & 0x01) || ((mb2_eta_HQ >> 7) & 0x01);
452 for (
int i = 0;
i <= 5;
i++) {
453 posBTI[
i] = (mb3_eta >>
i) & 0x01;
454 qualBTI[
i] = (mb3_eta_HQ >>
i) & 0x01;
456 posBTI[6] = ((mb3_eta >> 6) & 0x01) || ((mb3_eta >> 7) & 0x01);
457 qualBTI[6] = ((mb3_eta_HQ >> 6) & 0x01) || ((mb3_eta_HQ >> 7) & 0x01);
462 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t bx info word\t" 463 <<
"bxOffset " <<
bxOffset <<
'\t' <<
"bc0 " << bc0 <<
'\t' <<
"mb1_eta " << mb1_eta <<
'\t' 464 <<
"mb2_eta " << mb2_eta <<
'\t' <<
"mb3_eta " << mb3_eta <<
'\t' <<
"mb1_eta_HQ " << mb1_eta_HQ
465 <<
'\t' <<
"mb2_eta_HQ " << mb2_eta_HQ <<
'\t' <<
"mb3_eta_HQ " << mb3_eta_HQ <<
'\n';
469 else if (selector >= 1 && selector <= 4) {
471 int out_phi = (dataWordSub >> 0) & 0xFFF;
472 int out_phib = (dataWordSub >> 12) & 0x3FF;
473 int out_qual = (dataWordSub >> 22) & 0x7;
474 int out_q3 = (dataWordSub >> 25) & 0
x1;
475 int out_q4 = (dataWordSub >> 26) & 0
x1;
476 int out_updown = (dataWordSub >> 27) & 0
x1;
477 int out_ts2tag = (dataWordSub >> 28) & 0
x1;
481 int in_phi = (dataWordSub >> 30) & 0xFFF;
482 int in_phib = (dataWordSub >> 42) & 0x3FF;
483 int in_qual = (dataWordSub >> 52) & 0x7;
484 int in_updown = (dataWordSub >> 57) & 0
x1;
485 int in_ts2tag = (dataWordSub >> 58) & 0
x1;
495 if (previous_selector != selector) {
504 in_ts2tag + in_updown * 2,
515 out_ts2tag + out_updown * 2,
517 out_q3 + 2 * out_q4));
529 in_ts2tag + in_updown * 2,
541 out_ts2tag + out_updown * 2,
543 out_q3 + 2 * out_q4));
547 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t|\t" 548 <<
"in_ts2tag " << in_ts2tag <<
'\t' <<
"in_updown " << in_updown <<
'\t' <<
"in_qual " << in_qual
549 <<
'\t' <<
"in_phib " << in_phib_conv <<
'\t' <<
"in_phi " << in_phi_conv <<
'\t' <<
"out_ts2tag " 550 << out_ts2tag <<
'\t' <<
"out_updown " << out_updown <<
'\t' <<
"out_qual " << out_qual <<
'\t' 551 <<
"out_q3_out " << out_q3 <<
'\t' <<
"out_q4_out " << out_q4 <<
'\t' <<
"out_phib " 552 << out_phib_conv <<
'\t' <<
"out_phi " << out_phi_conv <<
'\t' <<
"2nd track " 553 << ((previous_selector == selector) ? 1 : 0) <<
'\n';
556 else if (selector == 0x9 || selector == 0xE) {
558 LogDebug(
"TwinMux_unpacker") <<
"RPC WORD [" <<
std::dec << tm7eventsize <<
"] : " << std::hex << dataWordSub
559 <<
std::dec <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
562 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t RPC WORD\n";
566 else if (selector == 0x6) {
568 LogDebug(
"TwinMux_unpacker") <<
"HO WORD [" <<
std::dec << tm7eventsize <<
"] : " << std::hex << dataWordSub
569 <<
std::dec <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
572 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t HO WORD\n";
576 else if (selector == 0xF) {
578 LogDebug(
"TwinMux_unpacker") <<
"ERROR WORD [" <<
std::dec << tm7eventsize <<
"] : " << std::hex
579 << dataWordSub <<
std::dec <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
582 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t ERROR WORD\n";
587 LogDebug(
"TwinMux_unpacker") <<
"UNKNOWN WORD received " << std::hex << dataWordSub <<
" in FED " << std::hex
591 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t UNKNOWN WORD\n";
593 previous_selector = selector;
596 if (selector == 0x4) {
598 bxID = (dataWordSub >> 48) & 0xFFF;
599 bc0 = (dataWordSub >> 22) & 0
x1;
600 bxNr =
normBx(bxID, bxCounter);
603 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t TSC WORD\t" 604 <<
"bxID " << bxID <<
'\t' <<
"bc0 " << bc0 <<
'\n';
608 else if (selector == 0
x1) {
610 int mb2_phi = (dataWordSub & 0xFFF);
611 int mb2_phib = (dataWordSub >> 12) & 0x3FF;
612 int mb2_qual = (dataWordSub >> 22) & 0x7;
613 int mb2_ts2tag = (dataWordSub >> 28) & 0
x1;
618 int mb1_phi = (dataWordSub >> 30) & 0xFFF;
619 int mb1_phib = (dataWordSub >> 42) & 0x3FF;
620 int mb1_qual = (dataWordSub >> 52) & 0x7;
621 int mb1_ts2tag = (dataWordSub >> 58) & 0
x1;
633 bxNr,
wheel,
sector - 1, 1, mb1_phi_conv, mb1_phib_conv, mb1_qual, mb1_ts2tag, bxCounter, -1));
635 bxNr,
wheel,
sector - 1, 2, mb2_phi_conv, mb2_phib_conv, mb2_qual, mb2_ts2tag, bxCounter, -1));
638 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t|\t" 639 <<
"mb1_ts2tag " << mb1_ts2tag <<
'\t' <<
"mb1_qual " << mb1_qual <<
'\t' <<
"mb1_phib " 640 << mb1_phib_conv <<
'\t' <<
"mb1_phi " << mb1_phi_conv <<
'\t' <<
"mb2_ts2tag " << mb2_ts2tag
641 <<
'\t' <<
"mb2_qual " << mb2_qual <<
'\t' <<
"mb2_phib " << mb2_phib_conv <<
'\t' <<
"mb2_phi " 642 << mb2_phi_conv <<
'\n';
645 else if (selector == 0
x2) {
646 int mb4_phi = (dataWordSub & 0xFFF);
647 int mb4_phib = (dataWordSub >> 12) & 0x3FF;
648 int mb4_qual = (dataWordSub >> 22) & 0x7;
649 int mb4_ts2tag = (dataWordSub >> 28) & 0
x1;
654 int mb3_phi = (dataWordSub >> 30) & 0xFFF;
655 int mb3_phib = (dataWordSub >> 42) & 0x3FF;
656 int mb3_qual = (dataWordSub >> 52) & 0x7;
657 int mb3_ts2tag = (dataWordSub >> 58) & 0
x1;
669 bxNr,
wheel,
sector - 1, 3, mb3_phi_conv, mb3_phib_conv, mb3_qual, mb3_ts2tag, bxCounter, -1));
671 bxNr,
wheel,
sector - 1, 4, mb4_phi_conv, mb4_phib_conv, mb4_qual, mb4_ts2tag, bxCounter, -1));
674 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t|\t" 675 <<
"mb3_ts2tag " << mb3_ts2tag <<
'\t' <<
"mb3_qual " << mb3_qual <<
'\t' <<
"mb3_phib " 676 << mb3_phib_conv <<
'\t' <<
"mb3_phi " << mb3_phi_conv <<
'\t' <<
"mb4_ts2tag " << mb4_ts2tag
677 <<
'\t' <<
"mb4_qual " << mb4_qual <<
'\t' <<
"mb4_phib " << mb4_phib_conv <<
'\t' <<
"mb4_phi " 678 << mb4_phi_conv <<
'\n';
682 else if (selector == 0x3) {
684 int posBTI[7], qualBTI[7];
686 int mb3_eta = (dataWordSub & 0xFF);
687 int mb2_eta = (dataWordSub >> 16) & 0xFF;
688 int mb1_eta = (dataWordSub >> 40) & 0xFF;
690 int mb3_eta_HQ = (dataWordSub >> 8) & 0xFF;
691 int mb2_eta_HQ = (dataWordSub >> 32) & 0xFF;
692 int mb1_eta_HQ = (dataWordSub >> 48) & 0xFF;
695 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t|\t" 696 <<
"mb1_eta " << mb1_eta <<
'\t' <<
"mb2_eta " << mb2_eta <<
'\t' <<
"mb3_eta " << mb3_eta <<
'\t' 697 <<
"mb1_eta_HQ " << mb1_eta_HQ <<
'\t' <<
"mb2_eta_HQ " << mb2_eta_HQ <<
'\t' <<
"mb3_eta_HQ " 698 << mb3_eta_HQ <<
'\n';
701 posBTI[0] = (mb1_eta & 0x01);
702 posBTI[1] = ((mb1_eta & 0x02) >> 1);
703 posBTI[2] = ((mb1_eta & 0x04) >> 2);
704 posBTI[3] = ((mb1_eta & 0x08) >> 3);
705 posBTI[4] = ((mb1_eta & 0x10) >> 4);
706 posBTI[5] = ((mb1_eta & 0x20) >> 5);
707 posBTI[6] = (((mb1_eta & 0x40) >> 6) || ((mb1_eta & 0x80) >> 7));
709 qualBTI[0] = (mb1_eta_HQ & 0x01);
710 qualBTI[1] = ((mb1_eta_HQ & 0x02) >> 1);
711 qualBTI[2] = ((mb1_eta_HQ & 0x04) >> 2);
712 qualBTI[3] = ((mb1_eta_HQ & 0x08) >> 3);
713 qualBTI[4] = ((mb1_eta_HQ & 0x10) >> 4);
714 qualBTI[5] = ((mb1_eta_HQ & 0x20) >> 5);
715 qualBTI[6] = (((mb1_eta_HQ & 0x40) >> 6) || ((mb1_eta_HQ & 0x80) >> 7));
720 posBTI[0] = (mb2_eta & 0x01);
721 posBTI[1] = ((mb2_eta & 0x02) >> 1);
722 posBTI[2] = ((mb2_eta & 0x04) >> 2);
723 posBTI[3] = ((mb2_eta & 0x08) >> 3);
724 posBTI[4] = ((mb2_eta & 0x10) >> 4);
725 posBTI[5] = ((mb2_eta & 0x20) >> 5);
726 posBTI[6] = (((mb2_eta & 0x40) >> 6) || ((mb2_eta & 0x80) >> 7));
728 qualBTI[0] = (mb2_eta_HQ & 0x01);
729 qualBTI[1] = ((mb2_eta_HQ & 0x02) >> 1);
730 qualBTI[2] = ((mb2_eta_HQ & 0x04) >> 2);
731 qualBTI[3] = ((mb2_eta_HQ & 0x08) >> 3);
732 qualBTI[4] = ((mb2_eta_HQ & 0x10) >> 4);
733 qualBTI[5] = ((mb2_eta_HQ & 0x20) >> 5);
734 qualBTI[6] = (((mb2_eta_HQ & 0x40) >> 6) || ((mb2_eta_HQ & 0x80) >> 7));
739 posBTI[0] = (mb3_eta & 0x01);
740 posBTI[1] = ((mb3_eta & 0x02) >> 1);
741 posBTI[2] = ((mb3_eta & 0x04) >> 2);
742 posBTI[3] = ((mb3_eta & 0x08) >> 3);
743 posBTI[4] = ((mb3_eta & 0x10) >> 4);
744 posBTI[5] = ((mb3_eta & 0x20) >> 5);
745 posBTI[6] = (((mb3_eta & 0x40) >> 6) || ((mb3_eta & 0x80) >> 7));
747 qualBTI[0] = (mb3_eta_HQ & 0x01);
748 qualBTI[1] = ((mb3_eta_HQ & 0x02) >> 1);
749 qualBTI[2] = ((mb3_eta_HQ & 0x04) >> 2);
750 qualBTI[3] = ((mb3_eta_HQ & 0x08) >> 3);
751 qualBTI[4] = ((mb3_eta_HQ & 0x10) >> 4);
752 qualBTI[5] = ((mb3_eta_HQ & 0x20) >> 5);
753 qualBTI[6] = (((mb3_eta_HQ & 0x40) >> 6) || ((mb3_eta_HQ & 0x80) >> 7));
759 else if (selector == 0xB) {
761 int mb2_phi = (dataWordSub & 0xFFF);
762 int mb2_phib = (dataWordSub >> 12) & 0x3FF;
763 int mb2_qual = (dataWordSub >> 22) & 0x7;
764 int mb2_q3 = (dataWordSub >> 25) & 0
x1;
765 int mb2_q4 = (dataWordSub >> 26) & 0
x1;
766 int mb2_ts2tag = (dataWordSub >> 28) & 0
x1;
771 int mb1_phi = (dataWordSub >> 30) & 0xFFF;
772 int mb1_phib = (dataWordSub >> 42) & 0x3FF;
773 int mb1_qual = (dataWordSub >> 52) & 0x7;
774 int mb1_q3 = (dataWordSub >> 55) & 0
x1;
775 int mb1_q4 = (dataWordSub >> 56) & 0
x1;
776 int mb1_ts2tag = (dataWordSub >> 58) & 0
x1;
796 mb1_q3 + 2 * mb1_q4));
806 mb2_q3 + 2 * mb2_q4));
809 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t|\t" 810 <<
"mb1_ts2tag_out " << mb1_ts2tag <<
'\t' <<
"mb1_qual_out " << mb1_qual <<
'\t' <<
"mb1_q3_out " 811 << mb1_q3 <<
'\t' <<
"mb1_q4_out " << mb1_q4 <<
'\t' <<
"mb1_phib_out " << mb1_phib_conv <<
'\t' 812 <<
"mb1_phi_out " << mb1_phi_conv <<
'\t' <<
"mb2_ts2tag_out " << mb2_ts2tag <<
'\t' 813 <<
"mb2_qual_out " << mb2_qual <<
'\t' <<
"mb2_q3_out " << mb2_q3 <<
'\t' <<
"mb2_q4_out " << mb2_q4
814 <<
'\t' <<
"mb2_phib_out " << mb2_phib_conv <<
'\t' <<
"mb2_phi_out " << mb2_phi_conv <<
'\n';
818 else if (selector == 0xC) {
820 int mb4_phi = (dataWordSub & 0xFFF);
821 int mb4_phib = (dataWordSub >> 12) & 0x3FF;
822 int mb4_qual = (dataWordSub >> 22) & 0x7;
823 int mb4_q3 = (dataWordSub >> 25) & 0
x1;
824 int mb4_q4 = (dataWordSub >> 26) & 0
x1;
825 int mb4_ts2tag = (dataWordSub >> 28) & 0
x1;
830 int mb3_phi = (dataWordSub >> 30) & 0xFFF;
831 int mb3_phib = (dataWordSub >> 42) & 0x3FF;
832 int mb3_qual = (dataWordSub >> 52) & 0x7;
833 int mb3_q3 = (dataWordSub >> 55) & 0
x1;
834 int mb3_q4 = (dataWordSub >> 56) & 0
x1;
835 int mb3_ts2tag = (dataWordSub >> 58) & 0
x1;
855 mb3_q3 + 2 * mb3_q4));
865 mb4_q3 + 2 * mb4_q4));
868 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t|\t" 869 <<
"mb3_ts2tag_out " << mb3_ts2tag <<
'\t' <<
"mb3_qual_out " << mb3_qual <<
'\t' <<
"mb3_q3_out " 870 << mb3_q3 <<
'\t' <<
"mb3_q4_out " << mb3_q4 <<
'\t' <<
"mb3_phib_out " << mb3_phib_conv <<
'\t' 871 <<
"mb3_phi_out " << mb3_phi_conv <<
'\t' <<
"mb4_ts2tag_out " << mb4_ts2tag <<
'\t' 872 <<
"mb4_qual_out " << mb4_qual <<
'\t' <<
"mb4_q3_out " << mb4_q3 <<
'\t' <<
"mb4_q4_out " << mb4_q4
873 <<
'\t' <<
"mb4_phib_out " << mb4_phib_conv <<
'\t' <<
"mb4_phi_out " << mb4_phi_conv <<
'\n';
877 else if (selector == 0xD) {
880 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t ETHA OUTPUT WORD\n";
884 else if (selector == 0x9 || selector == 0xE) {
886 LogDebug(
"TwinMux_unpacker") <<
"RPC WORD [" <<
std::dec << tm7eventsize <<
"] : " << std::hex << dataWordSub
887 <<
std::dec <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
890 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t RPC WORD\n";
894 else if (selector == 0x6) {
896 LogDebug(
"TwinMux_unpacker") <<
"HO WORD [" <<
std::dec << tm7eventsize <<
"] : " << std::hex << dataWordSub
897 <<
std::dec <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
900 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t HO WORD\n";
904 else if (selector == 0xF) {
906 LogDebug(
"TwinMux_unpacker") <<
"ERROR WORD [" <<
std::dec << tm7eventsize <<
"] : " << std::hex
907 << dataWordSub <<
std::dec <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
910 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t ERROR WORD\n";
915 LogDebug(
"TwinMux_unpacker") <<
"UNKNOWN WORD received " << std::hex << dataWordSub <<
" in FED " << std::hex
919 logfile <<
'[' << ++lcounter <<
"]\t" << std::hex << dataWordSub <<
std::dec <<
"\t UNKNOWN WORD\n";
922 if (DTTM7iterator == DTTM7itend)
930 if (DTTM7iterator == DTTM7itend)
bool fillRawData(edm::Event &e, L1MuDTChambPhContainer::Phi_Container &phi_data, L1MuDTChambThContainer::The_Container &the_data, L1MuDTChambPhContainer::Phi_Container &phi_out_data) const
Generate and fill FED raw data for a full event.
~L1TTwinMuxRawToDigi() override
Destructor.
std::vector< long long int > amcsecmap_
std::vector< std::array< short, 12 > > amcsec_
L1TTwinMuxRawToDigi(const edm::ParameterSet &pset)
Constructor.
size_t size() const
Lenght of the data buffer in bytes.
unsigned char * readline(unsigned char *lineFED, int &lines, long &dataWord) const
int benAngConversion(int benAng_) const
void produce(edm::StreamID, edm::Event &e, const edm::EventSetup &c) const override
Produce digis out of raw data.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Abs< T >::type abs(const T &t)
int normBx(int bx_, int bxCnt_) const
#define DEFINE_FWK_MODULE(type)
std::vector< L1MuDTChambPhDigi > Phi_Container
int radAngConversion(int radAng_) const
std::vector< L1MuDTChambThDigi > The_Container
std::vector< int > wheels_
edm::EDGetTokenT< FEDRawDataCollection > Raw_token
edm::InputTag DTTM7InputTag_
void calcCRC(long, int &)
char data[epos_bytes_allocation]
edm::InputTag getDTTM7InputTag() const
static unsigned int const shift
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Log< level::Warning, false > LogWarning
void processFed(int twinmuxfed, int wheel, std::array< short, 12 > const &twinMuxAmcSec, edm::Handle< FEDRawDataCollection > data, L1MuDTChambPhContainer::Phi_Container &phi_data, L1MuDTChambThContainer::The_Container &the_data, L1MuDTChambPhContainer::Phi_Container &phi_out_data) const