38 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
39 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
40 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
41 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
46 { 4, 3, 2, 1, 8, 7, 6, 5, 12, 11, 10, 9, 16, 15, 14, 13,
47 20, 19, 18, 17, 24, 23, 22, 21, 28, 27, 26, 25, 32, 31, 30, 29,
48 36, 35, 34, 33, 40, 39, 38, 37, 44, 43, 42, 41, 48, 47, 46, 45,
49 52, 51, 50, 49, 56, 55, 54, 53, 60, 59, 58, 57, 64, 63, 62, 61,
54 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
55 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 0, 0, 0, 0,
56 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
62 { 1, 2, 3, 4, 5, 6, 7, 8, 9,
63 0, 0, 0, 0, 0, 0, 0, 0, 0,
64 10, 11, 12, 13, 14, 15, 16, 0, 0,
65 0, 0, 0, 0, 0, 0, 0, 0, 0,
66 0, 0, 0, 0, 0, 0, 0, 0, 0,
67 0, 0, 0, 0, 0, 0, 0, 0, 0,
68 0, 0, 0, 0, 0, 0, 0, 0, 0,
133 amplCut_(ps.getUntrackedParameter<double>(
"amplCut", 5.)),
134 dump_(ps.getUntrackedParameter<bool>(
"dump",
true)),
135 dumpAdc_(ps.getUntrackedParameter<bool>(
"dumpAdc",
true)),
137 maxEvt_(ps.getUntrackedParameter<int>(
"maxEvt", 10000)),
138 profileFedId_(ps.getUntrackedParameter<int>(
"profileFedId", 0)),
139 profileRuId_(ps.getUntrackedParameter<int>(
"profileRuId", 1)),
140 l1aMinX_(ps.getUntrackedParameter<int>(
"l1aMinX", 1)),
141 l1aMaxX_(ps.getUntrackedParameter<int>(
"l1aMaxX", 601)),
142 lastOrbit_(nDccs_, numeric_limits<uint32_t>::
max()),
143 eventId_(numeric_limits<unsigned>::
max()),
144 eventList_(ps.getUntrackedParameter<vector<unsigned> >(
"eventList", vector<unsigned>())),
151 l1amin_(numeric_limits<int>::
max()),
152 l1amax_(-numeric_limits<int>::
min()),
154 detailedTrigType_(-1),
158 tpg_(maxTccsPerDcc_, std::vector<int>(maxTpgsPerTcc_)),
159 nTpgs_(maxTccsPerDcc_, 0),
171 pulsePerRu_(ps.getUntrackedParameter<bool>(
"pulsePerRu",
true)),
172 pulsePerLmod_(ps.getUntrackedParameter<bool>(
"pulsePerLmod",
true)),
173 pulsePerLme_(ps.getUntrackedParameter<bool>(
"pulsePerLme",
true)),
192 << filename_.c_str() <<
"' specified by "
193 <<
"parameter filename for writing. DCC data "
194 " dump will be disabled.";
222 gettimeofday(&start, 0);
225 event.getByType(rawdata);
228 if(
dump_)
cout <<
"\n----------------------------------------------------------------------\n"
233 <<
"\n----------------------------------------------------------------------\n";
240 bool dccIdErr =
false;
241 bool simpleTrigTypeErr =
false;
242 bool outOfSync =
false;
244 unsigned refDccId = 0;
245 int refSimpleTrigType = -1;
259 if ((data.
size() %16) !=0){
260 cout <<
"***********************************************\n";
261 cout <<
" Fed size in bits not multiple of 64, strange.\n";
262 cout <<
"***********************************************\n";
266 size_t nWord32 = data.
size()/4;
267 const uint32_t * pData = (
reinterpret_cast<uint32_t*
>(
const_cast<unsigned char*
> ( data.
data())));
288 for(
size_t iWord32=0; iWord32 < nWord32; iWord32+=2){
290 if(
id>=601 &&
id<=654){
291 rc =
decode(pData+iWord32, iWord32/2, s);
296 cout << setfill(
'0') << hex
297 <<
"[" << setw(8) << iWord32*4 <<
"] "
298 << setw(4) << (pData[iWord32+1]>>16 & 0xFFFF) <<
" "
299 << setw(4) << (pData[iWord32+1]>>0 & 0xFFFF) <<
" "
300 << setw(4) << (pData[iWord32]>>16 & 0xFFFF) <<
" "
301 << setw(4) << (pData[iWord32]>>0 & 0xFFFF) <<
" "
302 << setfill(
' ') << dec
317 simpleTrigTypeErr =
true;
327 cerr <<
"Bx discrepancy between SRP and DCC, Bx(SRP) = "
334 cerr <<
"Bx discrepancy between TCC and DCC, Bx(TCC) = "
340 bool feBxErr =
false;
344 expectedFeBx =
bx_ - 1;
346 expectedFeBx = (
bx_==3564) ? 0 :
bx_;
350 if(feBxErr)
cerr <<
"Bx discrepancy between DCC and at least one FE"
355 int localL1a =
l1a_ & 0xFFF;
357 cerr <<
"Discrepancy between SRP and DCC L1a counter, L1a(SRP) = "
358 <<
srpL1a_ <<
", L1a(DCC) & 0xFFF = " << localL1a
365 cerr <<
"Discrepancy between TCC and DCC L1a counter, L1a(TCC) = "
366 <<
srpL1a_ <<
", L1a(DCC) & 0xFFF = " << localL1a
372 bool feL1aErr =
false;
375 cout <<
"FE L1A error for RU " << (
i+1) << endl;
379 if(feL1aErr)
cerr <<
"Discrepancy in L1a counter between DCC "
380 "and at least one FE (L1A(DCC) & 0xFFF = " << localL1a <<
")"
386 cerr <<
"Error in RU ID (TT/SC ID)"
392 dumpFile_.write( reinterpret_cast <const char *> (pData), nWord32*4);
400 if(
dump_)
cout <<
"Number of selected FEDs with a data block: "
404 cerr <<
"DCC ID discrepancy in detailed trigger type "
418 gettimeofday(&stop, 0);
429 if(n%100<10 || n%100>20){
452 const bool d =
dump_;
458 int dataType = (data[1] >>28) & 0xF;
467 l1a_ = (data[1]>>0 ) & 0xFFffFF;
468 bx_ = (data[0] >>20) & 0xFFF;
469 fedId_ = (data[0] >>8 ) & 0xFFF;
471 <<
"(" <<
trigNames[(data[1]>>24) & 0xF] <<
")"
475 <<
" FOV: " << ((data[0] >>4 ) & 0xF)
476 <<
" H: " << ((data[0] >>3 ) & 0x1);
477 }
else if((dataType>>2)==0){
482 int dccHeaderId = (data[1] >>24) & 0x3F;
485 if(d) out <<
"Run #: " << ((data[1] >>0 ) & 0xFFFFFF)
486 <<
" DCC Err: " << ((data[0] >>24) & 0xFF)
487 <<
" Evt Len: " << ((data[0] >>0 ) & 0xFFFFFF);
490 side_ = (data[1] >>11) & 0x1;
492 dccId_ = (data[1] >>0 ) & 0x3F;
493 if(d) out <<
"DCC FOV: " << ((data[1] >>16) & 0xF)
494 <<
" Side: " <<
side_
497 <<
" Color: " << ((data[1] >>6 ) & 0x3)
498 <<
" (" <<
colorNames[(data[1]>>6)&0x3] <<
")"
501 if(dccId_>=10 && dccId_<=46 &&
side_ <= 1){
509 if(d) out <<
"TCC Status ch<4..1>: 0x"
510 << hex << ((data[1]>>8) & 0xFFFF) << dec
511 <<
" SR status: " << ((data[1] >>4 ) & 0xF)
512 <<
" TZS: " << ((data[1] >>2 ) & 0x1)
513 <<
" ZS: " << ((data[1] >>1 ) & 0x1)
514 <<
" SR: " << ((data[1] >>0 ) & 0x1);
516 if(d) out <<
" Orbit: " <<
orbit_;
522 if((
unsigned)iDcc0<
nDccs_){
524 if(d) out <<
" (+" << (int)orbit_-(
int)
lastOrbit_[iDcc0] <<
")";
536 int chOffset = (dccHeaderId-4)*14;
537 if(d) out <<
"FE CH status:"
538 <<
" #" << 14+chOffset <<
":" << ((data[1] >>20) & 0xF)
539 <<
" #" << 13+chOffset <<
":" << ((data[1] >>16) & 0xF)
540 <<
" #" << 12+chOffset <<
":" << ((data[1] >>12) & 0xF)
541 <<
" #" << 11+chOffset <<
":" << ((data[1] >>8 ) & 0xF)
542 <<
" #" << 10+chOffset <<
":" << ((data[1] >>4 ) & 0xF)
543 <<
" #" << 9+chOffset <<
":" << ((data[1] >>0) & 0xF)
544 <<
" #" << 8+chOffset <<
":" << ((data[0] >>28) & 0xF)
545 <<
" #" << 7+chOffset <<
":" << ((data[0] >>24) & 0xF)
546 <<
" #" << 6+chOffset <<
":" << ((data[0] >>20) & 0xF)
547 <<
" #" << 5+chOffset <<
":" << ((data[0] >>16) & 0xF)
548 <<
" #" << 4+chOffset <<
":" << ((data[0] >>12) & 0xF)
549 <<
" #" << 3+chOffset <<
":" << ((data[0] >>8 ) & 0xF)
550 <<
" #" << 2+chOffset <<
":" << ((data[0] >>4 ) & 0xF)
551 <<
" #" << 1+chOffset <<
":" << ((data[0] >>0 ) & 0xF);
555 if(d) out <<
" bits<63..62>=0 (DCC header) bits<61..56>=" << dccHeaderId
556 <<
"(unknown=>ERROR?)";
558 }
else if((dataType>>1)==3){
565 tccL1a_ = (data[1] >>0 ) & 0xFFF;
566 tccId_ = ((data[0] >>0 ) & 0xFF);
567 nTts_ = ((data[1] >>16) & 0x7F);
570 if(d) out <<
"LE1: " << ((data[1] >>28) & 0x1)
571 <<
" LE0: " << ((data[1] >>27) & 0x1)
572 <<
" N_samples: " << ((data[1] >>23) & 0x1F)
573 <<
" N_TTs: " <<
nTts_
574 <<
" E1: " << ((data[1] >>12) & 0x1)
576 <<
" '3': " << ((data[0] >>29) & 0x7)
577 <<
" E0: " << ((data[0] >>28) & 0x1)
578 <<
" Bx: " << ((data[0] >>16) & 0xFFF)
583 }
else if(
nTts_ == 16){
585 }
else if(
nTts_ == 28){
588 cerr <<
"Error in #TT field of TCC block."
589 "This field is normally used to determine type of TCC "
590 "(TCC48 or TCC68). Type of TCC will be deduced from the TCC ID.\n";
598 cerr <<
"TCC ID is also invalid. EB- TCC type will be assumed.\n";
606 out <<
"Too many TCC blocks";
608 out <<
"Too many TPG in one TCC block";
610 tpg_[
iTcc_-1][3+tpgOffset] = (data[1] >>16) & 0x1FF;
611 tpg_[
iTcc_-1][2+tpgOffset] = (data[1] >>0 ) & 0x1FF;
612 tpg_[
iTcc_-1][1+tpgOffset] = (data[0] >>16) & 0x1FF;
613 tpg_[
iTcc_-1][0+tpgOffset] = (data[0] >>0 ) & 0x1FF;
618 << ((data[1] >>25) & 0x7) <<
" "
620 << setw(3) <<
tpg_[
iTcc_-1][3+tpgOffset] <<
" "
622 << ((data[1] >>9 ) & 0x7) <<
" "
624 << setw(3) <<
tpg_[
iTcc_-1][2+tpgOffset] <<
" "
625 <<
" '3': " << ((data[0] >>29) & 0x7) <<
" "
627 << ((data[0] >>25) & 0x7) <<
" "
631 << ((data[0] >>9 ) & 0x7) <<
" "
640 }
else if((dataType>>1)==4){
646 srpL1a_ = (data[1] >>0 ) & 0xFFF;
647 srpBx_ = (data[0] >>16) & 0xFFF;
648 if(d) out <<
"LE1: " << ((data[1] >>28) & 0x1)
649 <<
" LE0: " << ((data[1] >>27) & 0x1)
650 <<
" N_SRFs: " << ((data[1] >>16) & 0x7F)
651 <<
" E1: " << ((data[1] >>12) & 0x1)
653 <<
" '4': " << ((data[0] >>29) & 0x7)
654 <<
" E0: " << ((data[0] >>28) & 0x1)
656 <<
" SRP ID: " << ((data[0] >>0 ) & 0xFF);
661 out <<
"SRF# " << setw(6) << right <<
srRange(12+ttfOffset) <<
": "
662 << oct << ((data[1] >>16) & 0xFFF) << dec
663 <<
" SRF# " <<
srRange(8+ttfOffset) <<
": "
664 << oct << ((data[1] >>0 ) & 0xFFF) << dec
665 <<
" '4':" << ((data[0] >>29) & 0x7)
666 <<
" SRF# " <<
srRange(4+ttfOffset) <<
": "
667 << oct << ((data[0] >>16) & 0xFFF) << dec;
671 out <<
" SRF# " <<
srRange(ttfOffset) <<
": "
672 << oct << ((data[0] >>0 ) & 0xFFF) << dec;
675 if(d) out <<
"ERROR";
678 }
else if((dataType>>2)==3){
687 l1a = (data[1] >>0 ) & 0xFFF;
688 bx = (data[0] >>16) & 0xFFF;
689 dccCh_=(data[0] >>0 ) & 0xFF;
691 <<
" E1: " << ((data[1] >>12) & 0x1)
693 <<
" '3': " << ((data[0] >>30) & 0x3)
694 <<
" E0: " << ((data[0] >>28) & 0x1)
696 <<
" N_samples: " << ((data[0] >>8 ) & 0x7F)
714 s[0]=(data[0] >>16) & 0xFFF;
715 g[0]=(data[0] >>28) & 0x3;
716 s[1]=(data[1] >>0 ) & 0xFFF;
717 g[1]=(data[1] >>12) & 0x3;
718 s[2]=(data[1] >>16) & 0xFFF;
719 g[2]=(data[1] >>28) & 0x3;
721 if(da) out <<
"GMF: " << ((data[0] >>11) & 0x1)
722 <<
" SMF: " << ((data[0] >>9 ) & 0x1)
723 <<
" M: " << ((data[0] >>8 ) & 0x1)
724 <<
" XTAL: " << ((data[0] >>4 ) & 0x7)
725 <<
" STRIP: " << ((data[0] >>0 ) & 0x7)
726 <<
" " << setw(4) << s[0]
728 <<
" " << setw(4) << s[1]
730 <<
" " << setw(4) << s[2]
735 s[0]=(data[0] >>0 ) & 0xFFF;
736 g[0]=(data[0] >>12) & 0x3;
737 s[1]=(data[0] >>16) & 0xFFF;
738 g[1]=(data[0] >>28) & 0x3;
739 s[2]=(data[1] >>0 ) & 0xFFF;
740 g[2]=(data[1] >>12) & 0x3;
741 s[3]=(data[1] >>16) & 0xFFF;
742 g[3]=(data[1] >>28) & 0x3;
744 <<
" " << setw(4) << s[0]
746 <<
" " << setw(4) << s[1]
748 <<
" " << setw(4) << s[2]
750 <<
" " << setw(4) << s[3]
755 if(da) out <<
"TZS: " << ((data[1] >>14) & 0x1);
757 s[0]=(data[0] >>0 ) & 0xFFF;
758 g[0]=(data[0] >>12) & 0x3;
759 s[1]=(data[0] >>16) & 0xFFF;
760 g[1]=(data[0] >>28) & 0x3;
761 s[2]=(data[1] >>0 ) & 0xFFF;
762 g[2]=(data[1] >>12) & 0x3 ;
768 if(da) out <<
" Ampl: " << setw(4) << ampl
770 <<
" BoM:" << setw(2) << (bom0+1)
778 if(da) out << setw(29) <<
"";
780 if(da) out <<
" " << setw(4) << s[0]
782 <<
" " << setw(4) << s[1]
784 <<
" " << setw(4) << s[2]
791 if(d) out <<
"ERROR";
798 }
else if(dataType==eoe){
803 int tts = (data[0] >>4) & 0xF;
804 if(d) out <<
"Evt Len.: " << ((data[1] >>0 ) & 0xFFFFFF)
805 <<
" CRC16: " << ((data[0] >>16) & 0xFFFF)
806 <<
" Evt Status: " << ((data[0] >>8 ) & 0xF)
809 <<
" T:" << ((data[0] >>3) & 0x1);
811 if(d) out <<
" incorrect 64-bit word type marker (see MSBs)";
817 int fedid = ((dcc1-1)%600) + 600;
821 if ( fedid <= 607 ) {
822 lmes.push_back(fedid-601+83);
823 }
else if ( fedid == 608 ) {
826 }
else if ( fedid == 609 ) {
830 else if ( fedid >= 610 && fedid <= 645 ) {
831 lmes.push_back(2*(fedid-610)+1);
832 lmes.push_back(lmes[0]+1);
834 else if ( fedid >= 646 ) {
835 if ( fedid <= 652 ) {
836 lmes.push_back(fedid-646+73);
837 }
else if ( fedid == 653 ) {
840 }
else if ( fedid == 654 ) {
844 return lmes.size()==0?-1:lmes[
std::min(lmes.size(), (size_t)side)];
849 if(ru1 < 5 || (ru1-5)%4 >= 2){
858 int iEta0 = (ru1-1)/4;
862 return 2 + (iEta0-5)/4;
867 int iEta0 = (ru1-1)/4;
868 int iPhi0 = (ru1-1)%4;
873 rs = 2 + ((iEta0-1)/4)*2 + (iPhi0%4)/2;
884 buf << right << min <<
".."
887 buf << right << max <<
".."
890 string s = buf.str();
892 buf << setw(6) << right <<
s;
897 if((
unsigned)iSeq >
sizeof(
ttId_))
899 << __FILE__ <<
":" << __LINE__ <<
": "
900 <<
"parameter out of range\n";
902 const int ttId =
ttId_[tccType][iSeq];
908 buf <<
"TTF# " << setw(2) << ttId;
914 if((
unsigned)iSeq >
sizeof(
ttId_))
916 << __FILE__ <<
":" << __LINE__ <<
": "
917 <<
"parameter out of range\n";
919 const int ttId =
ttId_[tccType][iSeq];
925 buf <<
"TPG# " << setw(2) << ttId;
virtual void analyze(const edm::Event &, const edm::EventSetup &)
T getUntrackedParameter(std::string const &, T const &) const
static int sideOfRu(int ru1)
std::string tpgTag(int tccType, unsigned iSeq) const
static const unsigned fedStart_
std::string ttfTag(int tccType, unsigned iSeq) const
double max(std::vector< double > a, unsigned &pos)
std::vector< double > adc_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
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 g
size_t size() const
Lenght of the data buffer in bytes.
static int modOfRu(int ru1)
std::vector< uint32_t > lastOrbit_
bool decode(const uint32_t *data, int iWord32, std::ostream &out)
std::vector< unsigned > eventList_
static int lmodOfRu(int ru1)
std::vector< int > feL1a_
static const char *const ttsNames[]
static const int eeOuterTcc_
static const int ttId_[nTccTypes_][maxTpgsPerTcc_]
const T & max(const T &a, const T &b)
std::vector< int > nTpgs_
EcalDumpRaw(const edm::ParameterSet &)
static const char *const detailedTrigNames[]
unsigned int offset(bool)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< std::vector< int > > tpg_
double min(std::vector< double > a)
static const char *const trigNames[]
std::string srRange(int offset) const
int tccType_
type of TCC currently parsed
static const char *const colorNames[]
static const int eeInnerTcc_
std::vector< int > feRuId_
static const int maxTpgsPerTcc_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
static int lme(int dccId1, int side)
static const unsigned nDccs_
static const int maxTccsPerDcc_