27 debug_( pset.getUntrackedParameter<bool>(
"debug",
false) ),
29 DTTM7InputTag_( pset.getParameter<
edm::InputTag>(
"DTTM7_FED_Source") ),
30 feds_( pset.getUntrackedParameter<
std::vector<
int> >(
"feds",
std::vector<
int>()) ),
31 wheels_( pset.getUntrackedParameter<
std::vector<
int> >(
"wheels",
std::vector<
int>())),
32 amcsecmap_( pset.getUntrackedParameter<
std::vector<long long
int> >(
"amcsecmap",
std::vector<long long
int>()))
36 produces<L1MuDTChambPhContainer>(
"PhIn").setBranchAlias(
"PhIn");
37 produces<L1MuDTChambThContainer>(
"ThIn").setBranchAlias(
"ThIn");
38 produces<L1MuDTChambPhContainer>(
"PhOut").setBranchAlias(
"PhOut");
45 throw cms::Exception(
"TwinMux_unpacker") <<
"Configuration file error. Size of \'wheels\' and \'feds\' differs.\n";
48 throw cms::Exception(
"TwinMux_unpacker") <<
"Configuration file error. Size of \'wheels\' and \'amcsecmap\' differs.\n";
50 for (
size_t wh_i = 0; wh_i <
amcsecmap_.size(); ++wh_i){
51 std::array<short, 12> whmap;
52 for (
size_t amc_i = 1; amc_i < 13; ++amc_i ){
53 short shift = (12-amc_i)*4;
74 if ( !
fillRawData(e, phi_data, the_data, phi_out_data) )
return;
76 TM7phi_product->setContainer(phi_data);
77 TM7the_product->setContainer(the_data);
78 TM7phi_out_product->setContainer(phi_out_data);
95 for (
size_t w_i = 0; w_i <
nfeds_; ++w_i ) {
105 int bxNorm_ = bx_ - bxCnt_;
106 if (
abs( bxNorm_ ) < 3000 )
return bxNorm_;
108 if ( bxNorm_ > 0 )
return bxNorm_ - 3564;
109 if ( bxNorm_ < 0 )
return bxNorm_ + 3564;
135 std::array<short, 12> twinMuxAmcSec,
142 std::vector<long> DTTM7WordContainer;
145 std::ofstream logfile;
147 std::ostringstream
fname;
148 fname <<
"eventDump_" << twinMuxFed <<
".txt";
149 logfile.open( fname.str() );
154 if ( TM7data.
size() == 0 )
return;
166 int TM7fedId = ( dataWord >> 8 ) & 0xFFF;
171 int BOEevTy = ( dataWord >> 60 ) & 0xF;
174 if (
debug_ ) logfile <<
'[' << ++linecounter <<
"]\t" 175 << std::hex << dataWord <<
std::dec <<
"\t|\t" 176 <<
"BOEevTy " << BOEevTy <<
'\t' 177 <<
"TM7fedId " << TM7fedId <<
'\n';
179 if ( (BOEevTy != 0x5) || ( TM7fedId != twinMuxFed ) ) {
182 << twinMuxFed <<
" header " 183 << std::hex << dataWord;
192 std::map<int, int> AMCsizes;
196 int nAMC = ( dataWord >> 52 ) & 0xF;
198 if (
debug_ ) logfile <<
'[' << ++linecounter <<
"]\t" << std::hex
200 <<
"nAMC " << nAMC <<
'\n';
203 for (
int j = 0; j < nAMC; ++j ) {
208 int AMCno = (dataWord >> 16 ) & 0xF;
213 if ( (AMCno < 1) || (AMCno > 12) ) {
215 <<
" out of range (1-12)";
219 AMCsizes[AMCno] = ( dataWord >> 32 ) & 0xFFFFFF;
221 if (
debug_ ) logfile <<
'[' << ++linecounter <<
"]\t" 222 << std::hex << dataWord
224 <<
"AMCsizes[" << AMCno <<
"] " 230 std::map<int,int>::iterator AMCiterator = AMCsizes.begin();
231 std::map<int,int>::iterator AMCitend = AMCsizes.end();
232 for ( ; AMCiterator != AMCitend; ++AMCiterator ) {
234 for (
int k=0;
k<AMCiterator->second; ++
k) {
238 DTTM7WordContainer.push_back( dataWord );
249 calcCRC( dataWord & 0xFFFFFFFF0000FFFF, newCRC);
252 int chkEOE = (dataWord >> 60 ) & 0xF;
253 int CRC = ( dataWord >> 16 ) & 0xFFFF;
254 int evtLgth = ( dataWord >> 32 ) & 0xFFFFFF;
256 if ( chkEOE != 0xA ) {
257 edm::LogWarning(
"TwinMux_unpacker") <<
"AMC block closing line " << std::hex << dataWord
258 <<
std::dec <<
" does not start with 0xA";
262 if (
debug_ ) logfile <<
"\tevtLgth " << std::hex
263 << evtLgth <<
"\tCRC " << CRC <<
std::dec <<
'\n';
265 if ( nline != evtLgth ) {
266 edm::LogWarning(
"TwinMux_unpacker") <<
"Number of words read " << std::dec << nline
267 <<
" and event length " << std::dec << evtLgth
272 if ( newCRC != CRC ) {
273 edm::LogWarning(
"TwinMux_unpacker") <<
"Calculated CRC " << std::hex << newCRC
274 <<
" differs from CRC in trailer " << std::hex << CRC;
279 std::vector<long>::iterator DTTM7iterator = DTTM7WordContainer.begin();
280 std::vector<long>::iterator DTTM7itend = DTTM7WordContainer.end();
283 for ( ; DTTM7iterator != DTTM7itend; ++DTTM7iterator ) {
285 dataWord = (*DTTM7iterator);
286 int dataLenght = (dataWord & 0xFFFFF);
287 int bxCounter = (dataWord >> 20 ) & 0xFFF;
288 int event = (dataWord >> 32 ) & 0xFFFFFF;
289 int AMC_ID = (dataWord >> 56 ) & 0xF;
290 int control = (dataWord >> 60 ) & 0xF;
291 int wheel = twinMuxWheel;
293 if( ( AMC_ID < 1 )
or ( AMC_ID > 12 ) ) {
295 <<
" TM7fedId " << TM7fedId
296 <<
" AMC_ID " << AMC_ID;
300 int sector = twinMuxAmcSec[AMC_ID-1];
302 if( ( sector < 1 )
or ( sector > 12 ) ) {
303 if( sector != 15 )
edm::LogWarning(
"TwinMux_unpacker") <<
"%%%%%% VALID AMC_ID POINTS TO SECTOR OUT OF RANGE \n" 304 <<
" TM7fedId " << TM7fedId
305 <<
" AMC_ID " << AMC_ID
306 <<
" wheel " << wheel
307 <<
" sector " << sector;
311 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" 312 << std::hex << dataWord << std::dec <<
"\t|\t" 313 <<
"AMC_ID " << AMC_ID <<
'\t' 314 <<
"control " << control <<
'\t' 315 <<
"event " <<
event <<
'\t' 316 <<
"bxCounter " << bxCounter <<
'\t' 317 <<
"dataLenght " << dataLenght <<
'\n';
320 if( DTTM7iterator == DTTM7itend ) {
321 edm::LogInfo(
"TwinMux_unpacker") <<
"TRAILING WORD AS A PAYLOAD END in FED " 322 << std::hex << TM7fedId
323 << std::hex << dataWord
324 << std::dec<<
" [it pos " 325 <<
int(DTTM7iterator - DTTM7itend) <<
" ]";
329 dataWord = (*DTTM7iterator);
330 int boardID = (dataWord & 0xFFFF);
331 int orbit = (dataWord >> 16 ) & 0xFFFF;
333 if ( DTTM7iterator == DTTM7itend ) {
335 <<
" control " << control
336 <<
" event " <<
event 337 <<
" bxCounter " << bxCounter
338 <<
" size " << dataLenght
339 <<
" orbit " << orbit
340 <<
" board " << boardID
341 <<
" AMCsizes " << AMCsizes[AMC_ID]
342 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
346 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" 347 << std::hex << dataWord
348 << std::dec <<
"\t|\t" 349 <<
" orbit " << orbit
350 <<
" board " << boardID <<
'\n';
352 int AMCsize = AMCsizes[AMC_ID] - 1;
358 for (
int tm7eventsize = 2; tm7eventsize < AMCsize; ++tm7eventsize ) {
361 if ( DTTM7iterator == DTTM7itend ) {
363 edm::LogWarning(
"TwinMux_unpacker") <<
"UNEXPECTED END OF PAYLOAD INSIDE CHAMBER DESCRIPTION" 364 <<
" [it pos " <<
int(DTTM7iterator - DTTM7itend) <<
" ]" ;
369 long dataWordSub = (*DTTM7iterator);
370 int selector = ( dataWordSub >> 60 ) & 0xF;
372 if ( selector == 0x4 ) {
374 bxID = ( dataWordSub >> 48 ) & 0xFFF;
375 bc0 = ( dataWordSub >> 22 ) & 0x1;
376 bxNr =
normBx(bxID, bxCounter);
378 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
379 << dataWordSub << std::dec
381 <<
"bxID " << bxID <<
'\t' 382 <<
"bc0 " << bc0 <<
'\n';
386 else if ( selector == 0x1 ) {
388 int mb2_phi = ( dataWordSub & 0xFFF);
389 int mb2_phib = ( dataWordSub >> 12 ) & 0x3FF;
390 int mb2_qual = ( dataWordSub >> 22 ) & 0x7;
391 int mb2_ts2tag = ( dataWordSub >> 28 ) & 0x1;
396 int mb1_phi = ( dataWordSub >> 30 ) & 0xFFF;
397 int mb1_phib = ( dataWordSub >> 42 ) & 0x3FF;
398 int mb1_qual = ( dataWordSub >> 52 ) & 0x7;
399 int mb1_ts2tag = ( dataWordSub >> 58 ) & 0x1;
411 1, mb1_phi_conv, mb1_phib_conv,
412 mb1_qual, mb1_ts2tag, bxCounter ) );
414 2, mb2_phi_conv, mb2_phib_conv,
415 mb2_qual, mb2_ts2tag, bxCounter ) );
417 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t"<< std::hex
418 << dataWordSub << std::dec <<
"\t|\t" 419 <<
"mb1_ts2tag " << mb1_ts2tag <<
'\t' 420 <<
"mb1_qual " << mb1_qual <<
'\t' 421 <<
"mb1_phib " << mb1_phib_conv <<
'\t' 422 <<
"mb1_phi " << mb1_phi_conv <<
'\t' 423 <<
"mb2_ts2tag " << mb2_ts2tag <<
'\t' 424 <<
"mb2_qual " << mb2_qual <<
'\t' 425 <<
"mb2_phib " << mb2_phib_conv <<
'\t' 426 <<
"mb2_phi " << mb2_phi_conv <<
'\n';
429 else if ( selector == 0x2 ) {
431 int mb4_phi = ( dataWordSub & 0xFFF);
432 int mb4_phib = ( dataWordSub >> 12 ) & 0x3FF;
433 int mb4_qual = ( dataWordSub >> 22 ) & 0x7;
434 int mb4_ts2tag = ( dataWordSub >> 28 ) & 0x1;
439 int mb3_phi = ( dataWordSub >> 30 ) & 0xFFF;
440 int mb3_phib = ( dataWordSub >> 42 ) & 0x3FF;
441 int mb3_qual = ( dataWordSub >> 52 ) & 0x7;
442 int mb3_ts2tag = ( dataWordSub >> 58 ) & 0x1;
454 3, mb3_phi_conv, mb3_phib_conv,
455 mb3_qual, mb3_ts2tag, bxCounter) );
457 4, mb4_phi_conv, mb4_phib_conv,
458 mb4_qual, mb4_ts2tag, bxCounter) );
460 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t"<< std::hex
461 << dataWordSub << std::dec <<
"\t|\t" 462 <<
"mb3_ts2tag " << mb3_ts2tag <<
'\t' 463 <<
"mb3_qual " << mb3_qual <<
'\t' 464 <<
"mb3_phib " << mb3_phib_conv <<
'\t' 465 <<
"mb3_phi " << mb3_phi_conv <<
'\t' 466 <<
"mb4_ts2tag " << mb4_ts2tag <<
'\t' 467 <<
"mb4_qual " << mb4_qual <<
'\t' 468 <<
"mb4_phib " << mb4_phib_conv <<
'\t' 469 <<
"mb4_phi " << mb4_phi_conv <<
'\n';
473 else if ( selector == 0x3 ) {
475 int posBTI[7], qualBTI[7];
477 int mb3_eta = ( dataWordSub & 0xFF );
478 int mb2_eta = ( dataWordSub >> 16 ) & 0xFF;
479 int mb1_eta = ( dataWordSub >> 40 ) & 0xFF;
481 int mb3_eta_HQ = ( dataWordSub >> 8 ) & 0xFF;
482 int mb2_eta_HQ = ( dataWordSub >> 32 ) & 0xFF;
483 int mb1_eta_HQ = ( dataWordSub >> 48 ) & 0xFF;
485 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
486 << dataWordSub << std::dec <<
"\t|\t" 487 <<
"mb1_eta " << mb1_eta <<
'\t' 488 <<
"mb2_eta " << mb2_eta <<
'\t' 489 <<
"mb3_eta " << mb3_eta <<
'\t' 490 <<
"mb1_eta_HQ " << mb1_eta_HQ <<
'\t' 491 <<
"mb2_eta_HQ " << mb2_eta_HQ <<
'\t' 492 <<
"mb3_eta_HQ " << mb3_eta_HQ <<
'\n';
495 posBTI[0] = (mb1_eta & 0x01);
496 posBTI[1] = ((mb1_eta & 0x02)>>1);
497 posBTI[2] = ((mb1_eta & 0x04)>>2);
498 posBTI[3] = ((mb1_eta & 0x08)>>3);
499 posBTI[4] = ((mb1_eta & 0x10)>>4);
500 posBTI[5] = ((mb1_eta & 0x20)>>5);
501 posBTI[6] = (((mb1_eta & 0x40)>>6) || ((mb1_eta & 0x80)>>7));
503 qualBTI[0] = (mb1_eta_HQ & 0x01);
504 qualBTI[1] = ((mb1_eta_HQ & 0x02)>>1);
505 qualBTI[2] = ((mb1_eta_HQ & 0x04)>>2);
506 qualBTI[3] = ((mb1_eta_HQ & 0x08)>>3);
507 qualBTI[4] = ((mb1_eta_HQ & 0x10)>>4);
508 qualBTI[5] = ((mb1_eta_HQ & 0x20)>>5);
509 qualBTI[6] = (((mb1_eta_HQ & 0x40)>>6) || ((mb1_eta_HQ & 0x80)>>7));
511 theSegments.push_back(
L1MuDTChambThDigi( bxNr, wheel, sector-1, 1, posBTI, qualBTI) );
514 posBTI[0] = (mb2_eta & 0x01);
515 posBTI[1] = ((mb2_eta & 0x02)>>1);
516 posBTI[2] = ((mb2_eta & 0x04)>>2);
517 posBTI[3] = ((mb2_eta & 0x08)>>3);
518 posBTI[4] = ((mb2_eta & 0x10)>>4);
519 posBTI[5] = ((mb2_eta & 0x20)>>5);
520 posBTI[6] = (((mb2_eta & 0x40)>>6) || ((mb2_eta & 0x80)>>7));
522 qualBTI[0] = (mb2_eta_HQ & 0x01);
523 qualBTI[1] = ((mb2_eta_HQ & 0x02)>>1);
524 qualBTI[2] = ((mb2_eta_HQ & 0x04)>>2);
525 qualBTI[3] = ((mb2_eta_HQ & 0x08)>>3);
526 qualBTI[4] = ((mb2_eta_HQ & 0x10)>>4);
527 qualBTI[5] = ((mb2_eta_HQ & 0x20)>>5);
528 qualBTI[6] = (((mb2_eta_HQ & 0x40)>>6) || ((mb2_eta_HQ & 0x80)>>7));
530 theSegments.push_back(
L1MuDTChambThDigi( bxNr, wheel, sector-1, 2, posBTI, qualBTI) );
533 posBTI[0] = (mb3_eta & 0x01);
534 posBTI[1] = ((mb3_eta & 0x02)>>1);
535 posBTI[2] = ((mb3_eta & 0x04)>>2);
536 posBTI[3] = ((mb3_eta & 0x08)>>3);
537 posBTI[4] = ((mb3_eta & 0x10)>>4);
538 posBTI[5] = ((mb3_eta & 0x20)>>5);
539 posBTI[6] = (((mb3_eta & 0x40)>>6) || ((mb3_eta & 0x80)>>7));
541 qualBTI[0] = (mb3_eta_HQ & 0x01);
542 qualBTI[1] = ((mb3_eta_HQ & 0x02)>>1);
543 qualBTI[2] = ((mb3_eta_HQ & 0x04)>>2);
544 qualBTI[3] = ((mb3_eta_HQ & 0x08)>>3);
545 qualBTI[4] = ((mb3_eta_HQ & 0x10)>>4);
546 qualBTI[5] = ((mb3_eta_HQ & 0x20)>>5);
547 qualBTI[6] = (((mb3_eta_HQ & 0x40)>>6) || ((mb3_eta_HQ & 0x80)>>7));
549 theSegments.push_back(
L1MuDTChambThDigi( bxNr, wheel, sector-1, 3, posBTI, qualBTI) );
553 else if ( selector == 0xB ) {
555 int mb2_phi = ( dataWordSub & 0xFFF);
556 int mb2_phib = ( dataWordSub >> 12 ) & 0x3FF;
557 int mb2_qual = ( dataWordSub >> 22 ) & 0x7;
558 int mb2_q3 = ( dataWordSub >> 25 ) & 0x1;
559 int mb2_q4 = ( dataWordSub >> 26 ) & 0x1;
560 int mb2_ts2tag = ( dataWordSub >> 28 ) & 0x1;
565 int mb1_phi = ( dataWordSub >> 30 ) & 0xFFF;
566 int mb1_phib = ( dataWordSub >> 42 ) & 0x3FF;
567 int mb1_qual = ( dataWordSub >> 52 ) & 0x7;
568 int mb1_q3 = ( dataWordSub >> 55 ) & 0x1;
569 int mb1_q4 = ( dataWordSub >> 56 ) & 0x1;
570 int mb1_ts2tag = ( dataWordSub >> 58 ) & 0x1;
582 1, mb1_phi_conv, mb1_phib_conv,
583 mb1_qual, mb1_ts2tag, bxCounter, mb1_q3 + 2*mb1_q4 ) );
585 2, mb2_phi_conv, mb2_phib_conv,
586 mb2_qual, mb2_ts2tag, bxCounter, mb2_q3 + 2*mb2_q4 ) );
588 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t"<< std::hex
589 << dataWordSub << std::dec <<
"\t|\t" 590 <<
"mb1_ts2tag_out " << mb1_ts2tag <<
'\t' 591 <<
"mb1_qual_out " << mb1_qual <<
'\t' 592 <<
"mb1_q3_out " << mb1_q3 <<
'\t' 593 <<
"mb1_q4_out " << mb1_q4 <<
'\t' 594 <<
"mb1_phib_out " << mb1_phib_conv <<
'\t' 595 <<
"mb1_phi_out " << mb1_phi_conv <<
'\t' 596 <<
"mb2_ts2tag_out " << mb2_ts2tag <<
'\t' 597 <<
"mb2_qual_out " << mb2_qual <<
'\t' 598 <<
"mb2_q3_out " << mb2_q3 <<
'\t' 599 <<
"mb2_q4_out " << mb2_q4 <<
'\t' 600 <<
"mb2_phib_out " << mb2_phib_conv <<
'\t' 601 <<
"mb2_phi_out " << mb2_phi_conv <<
'\n';
606 else if ( selector == 0xC ) {
608 int mb4_phi = ( dataWordSub & 0xFFF);
609 int mb4_phib = ( dataWordSub >> 12 ) & 0x3FF;
610 int mb4_qual = ( dataWordSub >> 22 ) & 0x7;
611 int mb4_q3 = ( dataWordSub >> 25 ) & 0x1;
612 int mb4_q4 = ( dataWordSub >> 26 ) & 0x1;
613 int mb4_ts2tag = ( dataWordSub >> 28 ) & 0x1;
618 int mb3_phi = ( dataWordSub >> 30 ) & 0xFFF;
619 int mb3_phib = ( dataWordSub >> 42 ) & 0x3FF;
620 int mb3_qual = ( dataWordSub >> 52 ) & 0x7;
621 int mb3_q3 = ( dataWordSub >> 55 ) & 0x1;
622 int mb3_q4 = ( dataWordSub >> 56 ) & 0x1;
623 int mb3_ts2tag = ( dataWordSub >> 58 ) & 0x1;
635 3, mb3_phi_conv, mb3_phib_conv,
636 mb3_qual, mb3_ts2tag, bxCounter, mb3_q3 + 2*mb3_q4 ) );
638 4, mb4_phi_conv, mb4_phib_conv,
639 mb4_qual, mb4_ts2tag, bxCounter, mb4_q3 + 2*mb4_q4 ) );
641 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t"<< std::hex
642 << dataWordSub << std::dec <<
"\t|\t" 643 <<
"mb3_ts2tag_out " << mb3_ts2tag <<
'\t' 644 <<
"mb3_qual_out " << mb3_qual <<
'\t' 645 <<
"mb3_q3_out " << mb3_q3 <<
'\t' 646 <<
"mb3_q4_out " << mb3_q4 <<
'\t' 647 <<
"mb3_phib_out " << mb3_phib_conv <<
'\t' 648 <<
"mb3_phi_out " << mb3_phi_conv <<
'\t' 649 <<
"mb4_ts2tag_out " << mb4_ts2tag <<
'\t' 650 <<
"mb4_qual_out " << mb4_qual <<
'\t' 651 <<
"mb4_q3_out " << mb4_q3 <<
'\t' 652 <<
"mb4_q4_out " << mb4_q4 <<
'\t' 653 <<
"mb4_phib_out " << mb4_phib_conv <<
'\t' 654 <<
"mb4_phi_out " << mb4_phi_conv <<
'\n';
658 else if ( selector == 0xD ) {
660 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
661 << dataWordSub << std::dec
662 <<
"\t ETHA OUTPUT WORD\n";
666 else if ( selector == 0x9 || selector == 0xE ) {
668 edm::LogInfo(
"TwinMux_unpacker") <<
"RPC WORD [" << std::dec << tm7eventsize <<
"] : " 669 << std::hex << dataWordSub << std::dec
670 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
672 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
673 << dataWordSub << std::dec
678 else if ( selector == 0x6 ) {
680 edm::LogInfo(
"TwinMux_unpacker") <<
"HO WORD [" << std::dec << tm7eventsize <<
"] : " 681 << std::hex << dataWordSub << std::dec
682 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
684 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
685 << dataWordSub << std::dec
690 else if ( selector == 0xF ) {
692 edm::LogInfo(
"TwinMux_unpacker") <<
"ERROR WORD [" << std::dec << tm7eventsize <<
"] : " 693 << std::hex << dataWordSub << std::dec
694 <<
" it pos " <<
int(DTTM7iterator - DTTM7itend);
696 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
697 << dataWordSub << std::dec
698 <<
"\t ERROR WORD\n";
703 edm::LogInfo(
"TwinMux_unpacker") <<
"UNKNOWN WORD received " << std::hex << dataWordSub
704 <<
" in FED " << std::hex << TM7fedId;
706 if (
debug_ ) logfile <<
'[' << ++lcounter <<
"]\t" << std::hex
707 << dataWordSub << std::dec
708 <<
"\t UNKNOWN WORD\n";
711 if( DTTM7iterator == DTTM7itend )
break;
719 if( DTTM7iterator == DTTM7itend )
break;
730 int myCRC[16],
D[64],
C[16];
732 for (
int i = 0;
i < 64; ++
i ) { D[
i] = (word >>
i) & 0x1; }
733 for (
int i = 0;
i < 16; ++
i ) { C[
i] = (myC>>
i) & 0x1; }
735 myCRC[0] = ( D[63] + D[62] + D[61] + D[60] + D[55] + D[54] +
736 D[53] + D[52] + D[51] + D[50] + D[49] + D[48] +
737 D[47] + D[46] + D[45] + D[43] + D[41] + D[40] +
738 D[39] + D[38] + D[37] + D[36] + D[35] + D[34] +
739 D[33] + D[32] + D[31] + D[30] + D[27] + D[26] +
740 D[25] + D[24] + D[23] + D[22] + D[21] + D[20] +
741 D[19] + D[18] + D[17] + D[16] + D[15] + D[13] +
742 D[12] + D[11] + D[10] + D[9] + D[8] + D[7] +
743 D[6] + D[5] + D[4] + D[3] + D[2] + D[1] +
744 D[0] + C[0] + C[1] + C[2] + C[3] + C[4] +
745 C[5] + C[6] + C[7] + C[12] + C[13] + C[14] +
748 myCRC[1] = ( D[63] + D[62] + D[61] + D[56] + D[55] + D[54] +
749 D[53] + D[52] + D[51] + D[50] + D[49] + D[48] +
750 D[47] + D[46] + D[44] + D[42] + D[41] + D[40] +
751 D[39] + D[38] + D[37] + D[36] + D[35] + D[34] +
752 D[33] + D[32] + D[31] + D[28] + D[27] + D[26] +
753 D[25] + D[24] + D[23] + D[22] + D[21] + D[20] +
754 D[19] + D[18] + D[17] + D[16] + D[14] + D[13] +
755 D[12] + D[11] + D[10] + D[9] + D[8] + D[7] +
756 D[6] + D[5] + D[4] + D[3] + D[2] + D[1] +
757 C[0] + C[1] + C[2] + C[3] + C[4] + C[5] +
758 C[6] + C[7] + C[8] + C[13] + C[14] + C[15] )%2;
760 myCRC[2] = ( D[61] + D[60] + D[57] + D[56] + D[46] + D[42] +
761 D[31] + D[30] + D[29] + D[28] + D[16] + D[14] +
762 D[1] + D[0] + C[8] + C[9] + C[12] + C[13] )%2;
764 myCRC[3] = ( D[62] + D[61] + D[58] + D[57] + D[47] + D[43] +
765 D[32] + D[31] + D[30] + D[29] + D[17] + D[15] +
766 D[2] + D[1] + C[9] + C[10] + C[13] + C[14] )%2;
768 myCRC[4] = ( D[63] + D[62] + D[59] + D[58] + D[48] + D[44] +
769 D[33] + D[32] + D[31] + D[30] + D[18] + D[16] +
770 D[3] + D[2] + C[0] + C[10] + C[11] + C[14] +
773 myCRC[5] = ( D[63] + D[60] + D[59] + D[49] + D[45] + D[34] +
774 D[33] + D[32] + D[31] + D[19] + D[17] + D[4] +
775 D[3] + C[1] + C[11] + C[12] + C[15] )%2;
777 myCRC[6] = ( D[61] + D[60] + D[50] + D[46] + D[35] + D[34] +
778 D[33] + D[32] + D[20] + D[18] + D[5] + D[4] +
779 C[2] + C[12] + C[13] )%2;
781 myCRC[7] = ( D[62] + D[61] + D[51] + D[47] + D[36] + D[35] +
782 D[34] + D[33] + D[21] + D[19] + D[6] + D[5] +
783 C[3] + C[13] + C[14] )%2;
785 myCRC[8] = ( D[63] + D[62] + D[52] + D[48] + D[37] + D[36] +
786 D[35] + D[34] + D[22] + D[20] + D[7] + D[6] +
787 C[0] + C[4] + C[14] + C[15] )%2;
789 myCRC[9] = ( D[63] + D[53] + D[49] + D[38] + D[37] + D[36] +
790 D[35] + D[23] + D[21] + D[8] + D[7] + C[1] +
793 myCRC[10] = ( D[54] + D[50] + D[39] + D[38] + D[37] + D[36] +
794 D[24] + D[22] + D[9] + D[8] + C[2] + C[6] )%2;
796 myCRC[11] = ( D[55] + D[51] + D[40] + D[39] + D[38] + D[37] +
797 D[25] + D[23] + D[10] + D[9] + C[3] + C[7] )%2;
799 myCRC[12] = ( D[56] + D[52] + D[41] + D[40] + D[39] + D[38] +
800 D[26] + D[24] + D[11] + D[10] + C[4] + C[8] )%2;
802 myCRC[13] = ( D[57] + D[53] + D[42] + D[41] + D[40] + D[39] +
803 D[27] + D[25] + D[12] + D[11] + C[5] + C[9] )%2;
805 myCRC[14] = ( D[58] + D[54] + D[43] + D[42] + D[41] + D[40] +
806 D[28] + D[26] + D[13] + D[12] + C[6] + C[10] )%2;
808 myCRC[15] = ( D[63] + D[62] + D[61] + D[60] + D[59] + D[54] +
809 D[53] + D[52] + D[51] + D[50] + D[49] + D[48] +
810 D[47] + D[46] + D[45] + D[44] + D[42] + D[40] +
811 D[39] + D[38] + D[37] + D[36] + D[35] + D[34] +
812 D[33] + D[32] + D[31] + D[30] + D[29] + D[26] +
813 D[25] + D[24] + D[23] + D[22] + D[21] + D[20] +
814 D[19] + D[18] + D[17] + D[16] + D[15] + D[14] +
815 D[12] + D[11] + D[10] + D[9] + D[8] + D[7] +
816 D[6] + D[5] + D[4] + D[3] + D[2] + D[1] +
817 D[0] + C[0] + C[1] + C[2] + C[3] + C[4] +
818 C[5] + C[6] + C[11] + C[12] + C[13] + C[14] +
822 for (
int i = 0;
i < 16 ; ++
i) { tempC = tempC + ( myCRC[
i] <<
i ); }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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.
virtual ~L1TTwinMuxRawToDigi()
Destructor.
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)
void produce(edm::Event &e, const edm::EventSetup &c)
Produce digis out of raw data.
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_)
DecomposeProduct< arg, typename Div::arg > D
void calcCRC(long word, int &myC)
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