36 debug_( pset.getUntrackedParameter<
bool>(
"debug",
false) ),
38 DTTM7InputTag_( pset.getParameter<
edm::InputTag>(
"DTTM7_FED_Source") ),
39 feds_( pset.getUntrackedParameter<
std::vector<
int> >(
"feds",
std::vector<
int>()) ),
40 wheels_( pset.getUntrackedParameter<
std::vector<
int> >(
"wheels",
std::vector<
int>())),
41 amcsecmap_( pset.getUntrackedParameter<
std::vector<long long
int> >(
"amcsecmap",
std::vector<long long
int>()))
45 produces<L1MuDTChambPhContainer>(
"PhIn").setBranchAlias(
"PhIn");
46 produces<L1MuDTChambThContainer>(
"ThIn").setBranchAlias(
"ThIn");
47 produces<L1MuDTChambPhContainer>(
"PhOut").setBranchAlias(
"PhOut");
54 throw cms::Exception(
"TwinMux_unpacker") <<
"Configuration file error. Size of \'wheels\' and \'feds\' differs.\n";
57 throw cms::Exception(
"TwinMux_unpacker") <<
"Configuration file error. Size of \'wheels\' and \'amcsecmap\' differs.\n";
59 for (
size_t wh_i = 0; wh_i <
amcsecmap_.size(); ++wh_i){
60 std::array<short, 12> whmap;
61 for (
size_t amc_i = 1; amc_i < 13; ++amc_i ){
62 short shift = (12-amc_i)*4;
83 if ( !
fillRawData(e, phi_data, the_data, phi_out_data) )
return;
85 TM7phi_product->setContainer(phi_data);
86 TM7the_product->setContainer(the_data);
87 TM7phi_out_product->setContainer(phi_out_data);
104 for (
size_t w_i = 0; w_i <
nfeds_; ++w_i ) {
114 int bxNorm_ = bx_ - bxCnt_;
115 if (
abs( bxNorm_ ) < 3000 )
return bxNorm_;
117 if ( bxNorm_ > 0 )
return bxNorm_ - 3564;
118 if ( bxNorm_ < 0 )
return bxNorm_ + 3564;
144 std::array<short, 12> twinMuxAmcSec,
150 const unsigned int fw_rev_with_zerosupression = 93 ;
151 int previous_selector = -100;
153 std::vector<long> DTTM7WordContainer;
156 std::ofstream logfile;
158 std::ostringstream
fname;
159 fname <<
"eventDump_" << twinMuxFed <<
".txt";
160 logfile.open( fname.str() );
165 if ( TM7data.
size() == 0 )
return;
177 int TM7fedId = ( dataWord >> 8 ) & 0xFFF;
182 int BOEevTy = ( dataWord >> 60 ) & 0xF;
185 if (
debug_ ) logfile <<
'[' << ++linecounter <<
"]\t" 186 << std::hex << dataWord <<
std::dec <<
"\t|\t" 187 <<
"BOEevTy " << BOEevTy <<
'\t' 188 <<
"TM7fedId " << TM7fedId <<
'\n';
190 if ( (BOEevTy != 0x5) || ( TM7fedId != twinMuxFed ) ) {
193 << twinMuxFed <<
" header " 194 << std::hex << dataWord;
203 std::map<int, int> AMCsizes;
207 int nAMC = ( dataWord >> 52 ) & 0xF;
209 if (
debug_ ) logfile <<
'[' << ++linecounter <<
"]\t" << std::hex
211 <<
"nAMC " << nAMC <<
'\n';
214 for (
int j = 0; j < nAMC; ++j ) {
219 int AMCno = (dataWord >> 16 ) & 0xF;
224 if ( (AMCno < 1) || (AMCno > 12) ) {
226 <<
" out of range (1-12)";
230 AMCsizes[AMCno] = ( dataWord >> 32 ) & 0xFFFFFF;
232 if (
debug_ ) logfile <<
'[' << ++linecounter <<
"]\t" 233 << std::hex << dataWord
235 <<
"AMCsizes[" << AMCno <<
"] " 241 std::map<int,int>::iterator AMCiterator = AMCsizes.begin();
242 std::map<int,int>::iterator AMCitend = AMCsizes.end();
243 for ( ; AMCiterator != AMCitend; ++AMCiterator ) {
245 for (
int k=0;
k<AMCiterator->second; ++
k) {
250 DTTM7WordContainer.push_back( dataWord );
264 int chkEOE = (dataWord >> 60 ) & 0xF;
265 int CRC = ( dataWord >> 16 ) & 0xFFFF;
266 int evtLgth = ( dataWord >> 32 ) & 0xFFFFFF;
268 if ( chkEOE != 0xA ) {
269 edm::LogWarning(
"TwinMux_unpacker") <<
"AMC block closing line " << std::hex << dataWord
270 <<
std::dec <<
" does not start with 0xA";
274 if (
debug_ ) logfile <<
"\tevtLgth " << std::hex
275 << evtLgth <<
"\tCRC " << CRC <<
std::dec <<
'\n';
277 if ( nline != evtLgth ) {
278 edm::LogWarning(
"TwinMux_unpacker") <<
"Number of words read " << std::dec << nline
279 <<
" and event length " << std::dec << evtLgth
284 if ( newCRC != CRC ) {
285 edm::LogWarning(
"TwinMux_unpacker") <<
"Calculated CRC " << std::hex << newCRC
286 <<
" differs from CRC in trailer " << std::hex << CRC;
291 std::vector<long>::iterator DTTM7iterator = DTTM7WordContainer.begin();
292 std::vector<long>::iterator DTTM7itend = DTTM7WordContainer.end();
295 for ( ; DTTM7iterator != DTTM7itend; ++DTTM7iterator ) {
297 dataWord = (*DTTM7iterator);
298 int dataLenght = (dataWord & 0xFFFFF);
299 int bxCounter = (dataWord >> 20 ) & 0xFFF;
300 int event = (dataWord >> 32 ) & 0xFFFFFF;
301 int AMC_ID = (dataWord >> 56 ) & 0xF;
302 int control = (dataWord >> 60 ) & 0xF;
303 int wheel = twinMuxWheel;
305 if( ( AMC_ID < 1 )
or ( AMC_ID > 12 ) ) {
307 <<
" TM7fedId " << TM7fedId
308 <<
" AMC_ID " << AMC_ID;
312 int sector = twinMuxAmcSec[AMC_ID-1];
314 if( ( sector < 1 )
or ( sector > 12 ) ) {
315 if( sector != 15 )
edm::LogWarning(
"TwinMux_unpacker") <<
"%%%%%% VALID AMC_ID POINTS TO SECTOR OUT OF RANGE \n" 316 <<
" TM7fedId " << TM7fedId
317 <<
" AMC_ID " << AMC_ID
318 <<
" wheel " << wheel
319 <<
" sector " << sector;
323 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" 324 << std::hex << dataWord << std::dec <<
"\t|\t" 325 <<
"AMC_ID " << AMC_ID <<
'\t' 326 <<
"control " << control <<
'\t' 327 <<
"event " <<
event <<
'\t' 328 <<
"bxCounter " << bxCounter <<
'\t' 329 <<
"dataLenght " << dataLenght <<
'\n';
332 if( DTTM7iterator == DTTM7itend ) {
333 edm::LogInfo(
"TwinMux_unpacker") <<
"TRAILING WORD AS A PAYLOAD END in FED " 334 << std::hex << TM7fedId
335 << std::hex << dataWord
336 << std::dec<<
" [it pos " 337 <<
int(DTTM7iterator - DTTM7itend) <<
" ]";
341 dataWord = (*DTTM7iterator);
342 unsigned int firmware_rev = (dataWord >>7) & 0x1FF ;
343 int boardID = (dataWord & 0xFFFF);
344 int orbit = (dataWord >> 16 ) & 0xFFFF;
346 if ( DTTM7iterator == DTTM7itend ) {
348 <<
" control " << control
349 <<
" event " <<
event 350 <<
" bxCounter " << bxCounter
351 <<
" size " << dataLenght
352 <<
" orbit " << orbit
353 <<
" board " << boardID
354 <<
" AMCsizes " << AMCsizes[AMC_ID]
355 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
359 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" 360 << std::hex << dataWord
361 << std::dec <<
"\t|\t" 362 <<
" orbit " << orbit
363 <<
" board " << boardID <<
'\n';
365 int AMCsize = AMCsizes[AMC_ID] - 1;
371 for (
int tm7eventsize = 2; tm7eventsize < AMCsize; ++tm7eventsize ) {
374 if ( DTTM7iterator == DTTM7itend ) {
376 edm::LogWarning(
"TwinMux_unpacker") <<
"UNEXPECTED END OF PAYLOAD INSIDE CHAMBER DESCRIPTION" 377 <<
" [it pos " <<
int(DTTM7iterator - DTTM7itend) <<
" ]" ;
382 long dataWordSub = (*DTTM7iterator);
383 int selector = ( dataWordSub >> 60 ) & 0xF;
385 if (firmware_rev >= fw_rev_with_zerosupression ){
386 if ( selector == 0xC ) {
388 bc0 = ( dataWordSub >> 59 ) & 0
x1;
392 int bxOffset = ( dataWordSub >> 48 ) & 0x3F;
396 bxNr = bxOffset < 32 ? bxOffset : bxOffset - 64;
402 int posBTI[7], qualBTI[7];
404 int mb3_eta = ( dataWordSub & 0xFF );
405 int mb3_eta_HQ = ( dataWordSub >> 8 ) & 0xFF;
406 int mb2_eta = ( dataWordSub >> 16 ) & 0xFF;
407 int mb2_eta_HQ = ( dataWordSub >> 24 ) & 0xFF;
408 int mb1_eta = ( dataWordSub >> 32 ) & 0xFF;
409 int mb1_eta_HQ = ( dataWordSub >> 40 ) & 0xFF;
412 for (
int i = 0 ;
i<=5;
i++){
413 posBTI[
i] = (mb1_eta >>
i) & 0x01;
414 qualBTI[
i] = (mb1_eta_HQ >>
i) & 0x01;
416 posBTI[6] = (((mb1_eta >> 6) & 0x01) || ((mb1_eta >> 7) & 0x01));
417 qualBTI[6] = (((mb1_eta_HQ >> 6) & 0x01) || ((mb1_eta_HQ >> 7) & 0x01));
419 theSegments.push_back(
L1MuDTChambThDigi( bxNr, wheel, sector-1, 1, posBTI, qualBTI) );
424 for (
int i = 0 ;
i<=5;
i++){
425 posBTI[
i] = (mb2_eta >>
i) & 0x01;
426 qualBTI[
i] = (mb2_eta_HQ >>
i) & 0x01;
428 posBTI[6] = ((mb2_eta >> 6) & 0x01) || ((mb2_eta >> 7) & 0x01);
429 qualBTI[6] = ((mb2_eta_HQ >> 6) & 0x01) || ((mb2_eta_HQ >> 7) & 0x01);
431 theSegments.push_back(
L1MuDTChambThDigi( bxNr, wheel, sector-1, 2, posBTI, qualBTI) );
434 for (
int i = 0 ;
i<=5;
i++){
435 posBTI[
i] = (mb3_eta >>
i) & 0x01;
436 qualBTI[
i] = (mb3_eta_HQ >>
i) & 0x01;
438 posBTI[6] = ((mb3_eta >> 6) & 0x01) || ((mb3_eta >> 7) & 0x01);
439 qualBTI[6] = ((mb3_eta_HQ >> 6) & 0x01) || ((mb3_eta_HQ >> 7) & 0x01);
441 theSegments.push_back(
L1MuDTChambThDigi( bxNr, wheel, sector-1, 3, posBTI, qualBTI) );
443 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
444 << dataWordSub << std::dec
445 <<
"\t bx info word\t" 446 <<
"bxOffset " << bxOffset <<
'\t' 447 <<
"bc0 " << bc0 <<
'\t' 448 <<
"mb1_eta " << mb1_eta <<
'\t' 449 <<
"mb2_eta " << mb2_eta <<
'\t' 450 <<
"mb3_eta " << mb3_eta <<
'\t' 451 <<
"mb1_eta_HQ " << mb1_eta_HQ <<
'\t' 452 <<
"mb2_eta_HQ " << mb2_eta_HQ <<
'\t' 453 <<
"mb3_eta_HQ " << mb3_eta_HQ <<
'\n';
457 else if ( selector >= 1 && selector <= 4 ) {
459 int out_phi = ( dataWordSub >> 0 ) & 0xFFF;
460 int out_phib = ( dataWordSub >> 12 ) & 0x3FF;
461 int out_qual = ( dataWordSub >> 22 ) & 0x7;
462 int out_q3 = ( dataWordSub >> 25 ) & 0
x1;
463 int out_q4 = ( dataWordSub >> 26 ) & 0
x1;
464 int out_updown = ( dataWordSub >> 27 ) & 0
x1;
465 int out_ts2tag = ( dataWordSub >> 28 ) & 0
x1;
469 int in_phi = ( dataWordSub >> 30 ) & 0xFFF;
470 int in_phib = ( dataWordSub >> 42 ) & 0x3FF;
471 int in_qual = ( dataWordSub >> 52 ) & 0x7;
472 int in_updown = ( dataWordSub >> 57 ) & 0
x1;
473 int in_ts2tag = ( dataWordSub >> 58 ) & 0
x1;
483 if (previous_selector != selector ) {
488 in_phi_conv, in_phib_conv,
489 in_qual, in_ts2tag + in_updown*2, bxCounter ) );
491 if ( out_qual != 7) {
494 out_phi_conv, out_phib_conv,
495 out_qual, out_ts2tag+ out_updown*2, bxCounter,
496 out_q3 + 2*out_q4 ) );
503 in_phi_conv, in_phib_conv,
504 in_qual, in_ts2tag + in_updown*2, bxCounter ) );
507 if ( out_qual != 7) {
510 out_phi_conv, out_phib_conv,
511 out_qual, out_ts2tag + out_updown*2, bxCounter,
512 out_q3 + 2*out_q4 ) );
516 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t"<< std::hex
517 << dataWordSub << std::dec <<
"\t|\t" 518 <<
"in_ts2tag " << in_ts2tag <<
'\t' 519 <<
"in_updown " << in_updown <<
'\t' 520 <<
"in_qual " << in_qual <<
'\t' 521 <<
"in_phib " << in_phib_conv <<
'\t' 522 <<
"in_phi " << in_phi_conv <<
'\t' 523 <<
"out_ts2tag " << out_ts2tag <<
'\t' 524 <<
"out_updown " << out_updown <<
'\t' 525 <<
"out_qual " << out_qual <<
'\t' 526 <<
"out_q3_out " << out_q3 <<
'\t' 527 <<
"out_q4_out " << out_q4 <<
'\t' 528 <<
"out_phib " << out_phib_conv <<
'\t' 529 <<
"out_phi " << out_phi_conv <<
'\t' 530 <<
"2nd track " << ((previous_selector == selector)?1:0) <<
'\n';
533 else if ( selector == 0x9 || selector == 0xE ) {
535 edm::LogInfo(
"TwinMux_unpacker") <<
"RPC WORD [" << std::dec << tm7eventsize <<
"] : " 536 << std::hex << dataWordSub << std::dec
537 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
539 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
540 << dataWordSub << std::dec
545 else if ( selector == 0x6 ) {
547 edm::LogInfo(
"TwinMux_unpacker") <<
"HO WORD [" << std::dec << tm7eventsize <<
"] : " 548 << std::hex << dataWordSub << std::dec
549 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
551 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
552 << dataWordSub << std::dec
557 else if ( selector == 0xF ) {
559 edm::LogInfo(
"TwinMux_unpacker") <<
"ERROR WORD [" << std::dec << tm7eventsize <<
"] : " 560 << std::hex << dataWordSub << std::dec
561 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
563 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
564 << dataWordSub << std::dec
565 <<
"\t ERROR WORD\n";
570 edm::LogInfo(
"TwinMux_unpacker") <<
"UNKNOWN WORD received " << std::hex << dataWordSub
571 <<
" in FED " << std::hex << TM7fedId;
573 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
574 << dataWordSub << std::dec
575 <<
"\t UNKNOWN WORD\n";
577 previous_selector = selector ;
580 if ( selector == 0x4 ) {
582 bxID = ( dataWordSub >> 48 ) & 0xFFF;
583 bc0 = ( dataWordSub >> 22 ) & 0
x1;
584 bxNr =
normBx(bxID, bxCounter);
586 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
587 << dataWordSub << std::dec
589 <<
"bxID " << bxID <<
'\t' 590 <<
"bc0 " << bc0 <<
'\n';
594 else if ( selector == 0
x1 ) {
596 int mb2_phi = ( dataWordSub & 0xFFF);
597 int mb2_phib = ( dataWordSub >> 12 ) & 0x3FF;
598 int mb2_qual = ( dataWordSub >> 22 ) & 0x7;
599 int mb2_ts2tag = ( dataWordSub >> 28 ) & 0
x1;
604 int mb1_phi = ( dataWordSub >> 30 ) & 0xFFF;
605 int mb1_phib = ( dataWordSub >> 42 ) & 0x3FF;
606 int mb1_qual = ( dataWordSub >> 52 ) & 0x7;
607 int mb1_ts2tag = ( dataWordSub >> 58 ) & 0
x1;
619 1, mb1_phi_conv, mb1_phib_conv,
620 mb1_qual, mb1_ts2tag, bxCounter , -1) );
622 2, mb2_phi_conv, mb2_phib_conv,
623 mb2_qual, mb2_ts2tag, bxCounter , -1) );
625 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t"<< std::hex
626 << dataWordSub << std::dec <<
"\t|\t" 627 <<
"mb1_ts2tag " << mb1_ts2tag <<
'\t' 628 <<
"mb1_qual " << mb1_qual <<
'\t' 629 <<
"mb1_phib " << mb1_phib_conv <<
'\t' 630 <<
"mb1_phi " << mb1_phi_conv <<
'\t' 631 <<
"mb2_ts2tag " << mb2_ts2tag <<
'\t' 632 <<
"mb2_qual " << mb2_qual <<
'\t' 633 <<
"mb2_phib " << mb2_phib_conv <<
'\t' 634 <<
"mb2_phi " << mb2_phi_conv <<
'\n';
637 else if ( selector == 0
x2 ) {
639 int mb4_phi = ( dataWordSub & 0xFFF);
640 int mb4_phib = ( dataWordSub >> 12 ) & 0x3FF;
641 int mb4_qual = ( dataWordSub >> 22 ) & 0x7;
642 int mb4_ts2tag = ( dataWordSub >> 28 ) & 0
x1;
647 int mb3_phi = ( dataWordSub >> 30 ) & 0xFFF;
648 int mb3_phib = ( dataWordSub >> 42 ) & 0x3FF;
649 int mb3_qual = ( dataWordSub >> 52 ) & 0x7;
650 int mb3_ts2tag = ( dataWordSub >> 58 ) & 0
x1;
662 3, mb3_phi_conv, mb3_phib_conv,
663 mb3_qual, mb3_ts2tag, bxCounter, -1) );
665 4, mb4_phi_conv, mb4_phib_conv,
666 mb4_qual, mb4_ts2tag, bxCounter, -1) );
668 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t"<< std::hex
669 << dataWordSub << std::dec <<
"\t|\t" 670 <<
"mb3_ts2tag " << mb3_ts2tag <<
'\t' 671 <<
"mb3_qual " << mb3_qual <<
'\t' 672 <<
"mb3_phib " << mb3_phib_conv <<
'\t' 673 <<
"mb3_phi " << mb3_phi_conv <<
'\t' 674 <<
"mb4_ts2tag " << mb4_ts2tag <<
'\t' 675 <<
"mb4_qual " << mb4_qual <<
'\t' 676 <<
"mb4_phib " << mb4_phib_conv <<
'\t' 677 <<
"mb4_phi " << mb4_phi_conv <<
'\n';
681 else if ( selector == 0x3 ) {
683 int posBTI[7], qualBTI[7];
685 int mb3_eta = ( dataWordSub & 0xFF );
686 int mb2_eta = ( dataWordSub >> 16 ) & 0xFF;
687 int mb1_eta = ( dataWordSub >> 40 ) & 0xFF;
689 int mb3_eta_HQ = ( dataWordSub >> 8 ) & 0xFF;
690 int mb2_eta_HQ = ( dataWordSub >> 32 ) & 0xFF;
691 int mb1_eta_HQ = ( dataWordSub >> 48 ) & 0xFF;
693 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
694 << dataWordSub << std::dec <<
"\t|\t" 695 <<
"mb1_eta " << mb1_eta <<
'\t' 696 <<
"mb2_eta " << mb2_eta <<
'\t' 697 <<
"mb3_eta " << mb3_eta <<
'\t' 698 <<
"mb1_eta_HQ " << mb1_eta_HQ <<
'\t' 699 <<
"mb2_eta_HQ " << mb2_eta_HQ <<
'\t' 700 <<
"mb3_eta_HQ " << mb3_eta_HQ <<
'\n';
703 posBTI[0] = (mb1_eta & 0x01);
704 posBTI[1] = ((mb1_eta & 0x02)>>1);
705 posBTI[2] = ((mb1_eta & 0x04)>>2);
706 posBTI[3] = ((mb1_eta & 0x08)>>3);
707 posBTI[4] = ((mb1_eta & 0x10)>>4);
708 posBTI[5] = ((mb1_eta & 0x20)>>5);
709 posBTI[6] = (((mb1_eta & 0x40)>>6) || ((mb1_eta & 0x80)>>7));
711 qualBTI[0] = (mb1_eta_HQ & 0x01);
712 qualBTI[1] = ((mb1_eta_HQ & 0x02)>>1);
713 qualBTI[2] = ((mb1_eta_HQ & 0x04)>>2);
714 qualBTI[3] = ((mb1_eta_HQ & 0x08)>>3);
715 qualBTI[4] = ((mb1_eta_HQ & 0x10)>>4);
716 qualBTI[5] = ((mb1_eta_HQ & 0x20)>>5);
717 qualBTI[6] = (((mb1_eta_HQ & 0x40)>>6) || ((mb1_eta_HQ & 0x80)>>7));
719 theSegments.push_back(
L1MuDTChambThDigi( bxNr, wheel, sector-1, 1, posBTI, qualBTI) );
722 posBTI[0] = (mb2_eta & 0x01);
723 posBTI[1] = ((mb2_eta & 0x02)>>1);
724 posBTI[2] = ((mb2_eta & 0x04)>>2);
725 posBTI[3] = ((mb2_eta & 0x08)>>3);
726 posBTI[4] = ((mb2_eta & 0x10)>>4);
727 posBTI[5] = ((mb2_eta & 0x20)>>5);
728 posBTI[6] = (((mb2_eta & 0x40)>>6) || ((mb2_eta & 0x80)>>7));
730 qualBTI[0] = (mb2_eta_HQ & 0x01);
731 qualBTI[1] = ((mb2_eta_HQ & 0x02)>>1);
732 qualBTI[2] = ((mb2_eta_HQ & 0x04)>>2);
733 qualBTI[3] = ((mb2_eta_HQ & 0x08)>>3);
734 qualBTI[4] = ((mb2_eta_HQ & 0x10)>>4);
735 qualBTI[5] = ((mb2_eta_HQ & 0x20)>>5);
736 qualBTI[6] = (((mb2_eta_HQ & 0x40)>>6) || ((mb2_eta_HQ & 0x80)>>7));
738 theSegments.push_back(
L1MuDTChambThDigi( bxNr, wheel, sector-1, 2, posBTI, qualBTI) );
741 posBTI[0] = (mb3_eta & 0x01);
742 posBTI[1] = ((mb3_eta & 0x02)>>1);
743 posBTI[2] = ((mb3_eta & 0x04)>>2);
744 posBTI[3] = ((mb3_eta & 0x08)>>3);
745 posBTI[4] = ((mb3_eta & 0x10)>>4);
746 posBTI[5] = ((mb3_eta & 0x20)>>5);
747 posBTI[6] = (((mb3_eta & 0x40)>>6) || ((mb3_eta & 0x80)>>7));
749 qualBTI[0] = (mb3_eta_HQ & 0x01);
750 qualBTI[1] = ((mb3_eta_HQ & 0x02)>>1);
751 qualBTI[2] = ((mb3_eta_HQ & 0x04)>>2);
752 qualBTI[3] = ((mb3_eta_HQ & 0x08)>>3);
753 qualBTI[4] = ((mb3_eta_HQ & 0x10)>>4);
754 qualBTI[5] = ((mb3_eta_HQ & 0x20)>>5);
755 qualBTI[6] = (((mb3_eta_HQ & 0x40)>>6) || ((mb3_eta_HQ & 0x80)>>7));
757 theSegments.push_back(
L1MuDTChambThDigi( bxNr, wheel, sector-1, 3, posBTI, qualBTI) );
761 else if ( selector == 0xB ) {
763 int mb2_phi = ( dataWordSub & 0xFFF);
764 int mb2_phib = ( dataWordSub >> 12 ) & 0x3FF;
765 int mb2_qual = ( dataWordSub >> 22 ) & 0x7;
766 int mb2_q3 = ( dataWordSub >> 25 ) & 0
x1;
767 int mb2_q4 = ( dataWordSub >> 26 ) & 0
x1;
768 int mb2_ts2tag = ( dataWordSub >> 28 ) & 0
x1;
773 int mb1_phi = ( dataWordSub >> 30 ) & 0xFFF;
774 int mb1_phib = ( dataWordSub >> 42 ) & 0x3FF;
775 int mb1_qual = ( dataWordSub >> 52 ) & 0x7;
776 int mb1_q3 = ( dataWordSub >> 55 ) & 0
x1;
777 int mb1_q4 = ( dataWordSub >> 56 ) & 0
x1;
778 int mb1_ts2tag = ( dataWordSub >> 58 ) & 0
x1;
790 1, mb1_phi_conv, mb1_phib_conv,
791 mb1_qual, mb1_ts2tag, bxCounter, mb1_q3 + 2*mb1_q4 ) );
793 2, mb2_phi_conv, mb2_phib_conv,
794 mb2_qual, mb2_ts2tag, bxCounter, mb2_q3 + 2*mb2_q4 ) );
796 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t"<< std::hex
797 << dataWordSub << std::dec <<
"\t|\t" 798 <<
"mb1_ts2tag_out " << mb1_ts2tag <<
'\t' 799 <<
"mb1_qual_out " << mb1_qual <<
'\t' 800 <<
"mb1_q3_out " << mb1_q3 <<
'\t' 801 <<
"mb1_q4_out " << mb1_q4 <<
'\t' 802 <<
"mb1_phib_out " << mb1_phib_conv <<
'\t' 803 <<
"mb1_phi_out " << mb1_phi_conv <<
'\t' 804 <<
"mb2_ts2tag_out " << mb2_ts2tag <<
'\t' 805 <<
"mb2_qual_out " << mb2_qual <<
'\t' 806 <<
"mb2_q3_out " << mb2_q3 <<
'\t' 807 <<
"mb2_q4_out " << mb2_q4 <<
'\t' 808 <<
"mb2_phib_out " << mb2_phib_conv <<
'\t' 809 <<
"mb2_phi_out " << mb2_phi_conv <<
'\n';
814 else if ( selector == 0xC ) {
816 int mb4_phi = ( dataWordSub & 0xFFF);
817 int mb4_phib = ( dataWordSub >> 12 ) & 0x3FF;
818 int mb4_qual = ( dataWordSub >> 22 ) & 0x7;
819 int mb4_q3 = ( dataWordSub >> 25 ) & 0
x1;
820 int mb4_q4 = ( dataWordSub >> 26 ) & 0
x1;
821 int mb4_ts2tag = ( dataWordSub >> 28 ) & 0
x1;
826 int mb3_phi = ( dataWordSub >> 30 ) & 0xFFF;
827 int mb3_phib = ( dataWordSub >> 42 ) & 0x3FF;
828 int mb3_qual = ( dataWordSub >> 52 ) & 0x7;
829 int mb3_q3 = ( dataWordSub >> 55 ) & 0
x1;
830 int mb3_q4 = ( dataWordSub >> 56 ) & 0
x1;
831 int mb3_ts2tag = ( dataWordSub >> 58 ) & 0
x1;
843 3, mb3_phi_conv, mb3_phib_conv,
844 mb3_qual, mb3_ts2tag, bxCounter, mb3_q3 + 2*mb3_q4 ) );
846 4, mb4_phi_conv, mb4_phib_conv,
847 mb4_qual, mb4_ts2tag, bxCounter, mb4_q3 + 2*mb4_q4 ) );
849 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t"<< std::hex
850 << dataWordSub << std::dec <<
"\t|\t" 851 <<
"mb3_ts2tag_out " << mb3_ts2tag <<
'\t' 852 <<
"mb3_qual_out " << mb3_qual <<
'\t' 853 <<
"mb3_q3_out " << mb3_q3 <<
'\t' 854 <<
"mb3_q4_out " << mb3_q4 <<
'\t' 855 <<
"mb3_phib_out " << mb3_phib_conv <<
'\t' 856 <<
"mb3_phi_out " << mb3_phi_conv <<
'\t' 857 <<
"mb4_ts2tag_out " << mb4_ts2tag <<
'\t' 858 <<
"mb4_qual_out " << mb4_qual <<
'\t' 859 <<
"mb4_q3_out " << mb4_q3 <<
'\t' 860 <<
"mb4_q4_out " << mb4_q4 <<
'\t' 861 <<
"mb4_phib_out " << mb4_phib_conv <<
'\t' 862 <<
"mb4_phi_out " << mb4_phi_conv <<
'\n';
866 else if ( selector == 0xD ) {
868 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
869 << dataWordSub << std::dec
870 <<
"\t ETHA OUTPUT WORD\n";
874 else if ( selector == 0x9 || selector == 0xE ) {
876 edm::LogInfo(
"TwinMux_unpacker") <<
"RPC WORD [" << std::dec << tm7eventsize <<
"] : " 877 << std::hex << dataWordSub << std::dec
878 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
880 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
881 << dataWordSub << std::dec
886 else if ( selector == 0x6 ) {
888 edm::LogInfo(
"TwinMux_unpacker") <<
"HO WORD [" << std::dec << tm7eventsize <<
"] : " 889 << std::hex << dataWordSub << std::dec
890 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
892 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
893 << dataWordSub << std::dec
898 else if ( selector == 0xF ) {
900 edm::LogInfo(
"TwinMux_unpacker") <<
"ERROR WORD [" << std::dec << tm7eventsize <<
"] : " 901 << std::hex << dataWordSub << std::dec
902 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
904 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
905 << dataWordSub << std::dec
906 <<
"\t ERROR WORD\n";
911 edm::LogInfo(
"TwinMux_unpacker") <<
"UNKNOWN WORD received " << std::hex << dataWordSub
912 <<
" in FED " << std::hex << TM7fedId;
914 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
915 << dataWordSub << std::dec
916 <<
"\t UNKNOWN WORD\n";
919 if( DTTM7iterator == DTTM7itend )
break;
927 if( DTTM7iterator == DTTM7itend )
break;
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
~L1TTwinMuxRawToDigi() override
Destructor.
int normBx(int bx_, int bxCnt_)
std::vector< long long int > amcsecmap_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< std::array< short, 12 > > amcsec_
L1TTwinMuxRawToDigi(const edm::ParameterSet &pset)
Constructor.
void processFed(int twinmuxfed, int wheel, std::array< short, 12 > twinMuxAmcSec, edm::Handle< FEDRawDataCollection > data, L1MuDTChambPhContainer::Phi_Container &phi_data, L1MuDTChambThContainer::The_Container &the_data, L1MuDTChambPhContainer::Phi_Container &phi_out_data)
int radAngConversion(int radAng_)
void readline(int &lines, long &dataWord)
bool fillRawData(edm::Event &e, L1MuDTChambPhContainer::Phi_Container &phi_data, L1MuDTChambThContainer::The_Container &the_data, L1MuDTChambPhContainer::Phi_Container &phi_out_data)
Generate and fill FED raw data for a full event.
size_t size() const
Lenght of the data buffer in bytes.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
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)
std::vector< L1MuDTChambPhDigi > Phi_Container
std::vector< L1MuDTChambThDigi > The_Container
std::vector< int > wheels_
edm::EDGetTokenT< FEDRawDataCollection > Raw_token
edm::InputTag DTTM7InputTag_
int benAngConversion(int benAng_)
void calcCRC(long, int &)
char data[epos_bytes_allocation]
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
static unsigned int const shift
void produce(edm::Event &e, const edm::EventSetup &c) override
Produce digis out of raw data.