37 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
38 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
39 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
40 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
45 { 4, 3, 2, 1, 8, 7, 6, 5, 12, 11, 10, 9, 16, 15, 14, 13,
46 20, 19, 18, 17, 24, 23, 22, 21, 28, 27, 26, 25, 32, 31, 30, 29,
47 36, 35, 34, 33, 40, 39, 38, 37, 44, 43, 42, 41, 48, 47, 46, 45,
48 52, 51, 50, 49, 56, 55, 54, 53, 60, 59, 58, 57, 64, 63, 62, 61,
53 { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
54 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 0, 0, 0, 0,
55 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
61 { 1, 2, 3, 4, 5, 6, 7, 8, 9,
62 0, 0, 0, 0, 0, 0, 0, 0, 0,
63 10, 11, 12, 13, 14, 15, 16, 0, 0,
64 0, 0, 0, 0, 0, 0, 0, 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,
131 amplCut_(ps.getUntrackedParameter<double>(
"amplCut", 5.)),
132 dump_(ps.getUntrackedParameter<
bool>(
"dump",
true)),
133 dumpAdc_(ps.getUntrackedParameter<
bool>(
"dumpAdc",
true)),
134 l1aHistory_(ps.getUntrackedParameter<
bool>(
"l1aHistory",
true)),
136 maxEvt_(ps.getUntrackedParameter<
int>(
"maxEvt", 10000)),
137 profileFedId_(ps.getUntrackedParameter<
int>(
"profileFedId", 0)),
138 profileRuId_(ps.getUntrackedParameter<
int>(
"profileRuId", 1)),
139 l1aMinX_(ps.getUntrackedParameter<
int>(
"l1aMinX", 1)),
140 l1aMaxX_(ps.getUntrackedParameter<
int>(
"l1aMaxX", 601)),
141 lastOrbit_(nDccs_, numeric_limits<uint32_t>::
max()),
142 eventId_(numeric_limits<unsigned>::
max()),
143 eventList_(ps.getUntrackedParameter<vector<unsigned> >(
"eventList", vector<unsigned>())),
151 detailedTrigType_(-1),
155 tpg_(maxTccsPerDcc_,
std::vector<
int>(maxTpgsPerTcc_)),
156 nTpgs_(maxTccsPerDcc_, 0),
169 pulsePerRu_(ps.getUntrackedParameter<
bool>(
"pulsePerRu",
true)),
170 pulsePerLmod_(ps.getUntrackedParameter<
bool>(
"pulsePerLmod",
true)),
171 pulsePerLme_(ps.getUntrackedParameter<
bool>(
"pulsePerLme",
true)),
173 fedRawDataCollectionTag_(ps.getParameter<
edm::InputTag>(
"fedRawDataCollectionTag")),
174 l1AcceptBunchCrossingCollectionTag_(ps.getParameter<
edm::InputTag>(
"l1AcceptBunchCrossingCollectionTag"))
196 << filename_.c_str() <<
"' specified by " 197 <<
"parameter filename for writing. DCC data " 198 " dump will be disabled.";
226 gettimeofday(&start,
nullptr);
231 if(
dump_ ||
l1aHistory_)
cout <<
"\n======================================================================\n" 236 <<
"\n----------------------------------------------------------------------\n";
242 cout <<
"L1A history not found.\n";
243 }
else if (l1aHist->empty()) {
244 cout <<
"L1A history is empty.\n";
246 cout <<
"L1A history: \n";
247 for(L1AcceptBunchCrossingCollection::const_iterator it = l1aHist->begin();
248 it != l1aHist->end();
250 cout <<
"L1A offset: " << it->l1AcceptOffset() <<
"\t" 251 <<
"BX: " << it->bunchCrossing() <<
"\t" 252 <<
"Orbit ID: " << it->orbitNumber() <<
"\t" 253 <<
"Trigger type: " << it->eventType() <<
" (" 254 <<
trigNames[it->eventType()&0xF] <<
")\n";
257 cout <<
"----------------------------------------------------------------------\n";
265 bool dccIdErr =
false;
267 unsigned refDccId = 0;
280 if ((data.
size() % 8) !=0){
281 cout <<
"***********************************************\n";
282 cout <<
" Fed size in bits not multiple of 64, strange.\n";
283 cout <<
"***********************************************\n";
287 size_t nWord32 = data.
size()/4;
288 const uint32_t * pData = (
reinterpret_cast<uint32_t*
>(
const_cast<unsigned char*
> ( data.
data())));
311 for(
size_t iWord32=0; iWord32 < nWord32; iWord32+=2){
313 if(
id>=601 &&
id<=654){
314 rc =
decode(pData+iWord32, iWord32/2, s);
319 cout << setfill(
'0') << hex
320 <<
"[" << setw(8) << iWord32*4 <<
"] " 321 << setw(4) << (pData[iWord32+1]>>16 & 0xFFFF) <<
" " 322 << setw(4) << (pData[iWord32+1]>>0 & 0xFFFF) <<
" " 323 << setw(4) << (pData[iWord32]>>16 & 0xFFFF) <<
" " 324 << setw(4) << (pData[iWord32]>>0 & 0xFFFF) <<
" " 325 << setfill(
' ') <<
dec 341 cerr <<
"Bx discrepancy between SRP and DCC, Bx(SRP) = " 348 cerr <<
"Bx discrepancy between TCC and DCC, Bx(TCC) = " 354 bool feBxErr =
false;
358 expectedFeBx =
bx_ - 1;
360 expectedFeBx = (
bx_==3564) ? 0 :
bx_;
363 cerr <<
"BX error for " <<
toNth(
i+1) <<
" RU, RU ID " 367 cerr << (detected?
" ":
" not ") <<
"detected by DCC (ch status: " 371 <<
id <<
"." << endl;
376 if(feBxErr)
cerr <<
"Bx discrepancy between DCC and at least one FE" 381 int localL1a =
l1a_ & 0xFFF;
383 cerr <<
"Discrepancy between SRP and DCC L1a counter, L1a(SRP) = " 384 <<
srpL1a_ <<
", L1a(DCC) & 0xFFF = " << localL1a
391 cerr <<
"Discrepancy between TCC and DCC L1a counter, L1a(TCC) = " 392 <<
srpL1a_ <<
", L1a(DCC) & 0xFFF = " << localL1a
398 bool feL1aErr =
false;
401 cerr <<
"FE L1A error for " <<
toNth(
i+1) <<
" RU, RU ID " 405 cerr << (detected?
" ":
" not ") <<
"detected by DCC (ch status: " 409 <<
id <<
"." << endl;
413 if(feL1aErr)
cerr <<
"Discrepancy in L1a counter between DCC " 414 "and at least one FE (L1A(DCC) & 0xFFF = " << localL1a <<
")" 420 cerr <<
"Error in RU ID (TT/SC ID)" 426 dumpFile_.write( reinterpret_cast <const char *> (pData), nWord32*4);
436 if(
dump_)
cout <<
"Number of selected FEDs with a data block: " 441 cerr <<
"DCC ID discrepancy in detailed trigger type " 447 gettimeofday(&stop,
nullptr);
458 if(n%100<10 || n%100>20){
487 int dataType = (data[1] >>28) & 0xF;
496 l1a_ = (data[1]>>0 ) & 0xFFffFF;
497 bx_ = (data[0] >>20) & 0xFFF;
498 fedId_ = (data[0] >>8 ) & 0xFFF;
500 <<
"(" <<
trigNames[(data[1]>>24) & 0xF] <<
")" 504 <<
" FOV: " << ((data[0] >>4 ) & 0xF)
505 <<
" H: " << ((data[0] >>3 ) & 0x1);
506 }
else if((dataType>>2)==0){
511 int dccHeaderId = (data[1] >>24) & 0x3F;
514 if(d) out <<
"Run #: " << ((data[1] >>0 ) & 0xFFFFFF)
515 <<
" DCC Err: " << ((data[0] >>24) & 0xFF)
516 <<
" Evt Len: " << ((data[0] >>0 ) & 0xFFFFFF);
521 dccId_ = (data[1] >>0 ) & 0x3F;
522 if(d) out <<
"DCC FOV: " << ((data[1] >>16) & 0xF)
523 <<
" Side: " <<
side_ 526 <<
" Color: " << ((data[1] >>6 ) & 0x3)
527 <<
" (" <<
colorNames[(data[1]>>6)&0x3] <<
")" 532 if(d) out <<
"TCC Status ch<4..1>: 0x" 533 << hex << ((data[1]>>8) & 0xFFFF) <<
dec 534 <<
" SR status: " << ((data[1] >>4 ) & 0xF)
535 <<
" TZS: " << ((data[1] >>2 ) & 0
x1)
536 <<
" ZS: " << ((data[1] >>1 ) & 0
x1)
537 <<
" SR: " << ((data[1] >>0 ) & 0
x1);
539 if(d) out <<
" Orbit: " <<
orbit_;
545 if((
unsigned)iDcc0<
nDccs_){
547 if(d) out <<
" (+" << (
int)orbit_-(
int)
lastOrbit_[iDcc0] <<
")";
559 int chOffset = (dccHeaderId-4)*14;
576 out <<
"FE CH status:";
577 for(
int i = chOffset;
i < chOffset + 14; ++
i){
584 if(d) out <<
" bits<63..62>=0 (DCC header) bits<61..56>=" << dccHeaderId
585 <<
"(unknown=>ERROR?)";
587 }
else if((dataType>>1)==3){
594 tccL1a_ = (data[1] >>0 ) & 0xFFF;
595 tccId_ = ((data[0] >>0 ) & 0xFF);
596 nTts_ = ((data[1] >>16) & 0x7F);
599 if(d) out <<
"LE1: " << ((data[1] >>28) & 0
x1)
600 <<
" LE0: " << ((data[1] >>27) & 0
x1)
601 <<
" N_samples: " << ((data[1] >>23) & 0x1F)
602 <<
" N_TTs: " <<
nTts_ 603 <<
" E1: " << ((data[1] >>12) & 0
x1)
605 <<
" '3': " << ((data[0] >>29) & 0x7)
606 <<
" E0: " << ((data[0] >>28) & 0
x1)
607 <<
" Bx: " << ((data[0] >>16) & 0xFFF)
612 }
else if(
nTts_ == 16){
614 }
else if(
nTts_ == 28){
618 cerr <<
"Error in #TT field of TCC block." 619 "This field is normally used to determine type of TCC " 620 "(TCC48 or TCC68). Type of TCC will be deduced from the TCC ID.\n";
628 cerr <<
"TCC ID is also invalid. EB- TCC type will be assumed.\n";
637 out <<
"Too many TCC blocks";
639 out <<
"Too many TPG in one TCC block";
641 tpg_[
iTcc_-1][3+tpgOffset] = (data[1] >>16) & 0x1FF;
642 tpg_[
iTcc_-1][2+tpgOffset] = (data[1] >>0 ) & 0x1FF;
643 tpg_[
iTcc_-1][1+tpgOffset] = (data[0] >>16) & 0x1FF;
644 tpg_[
iTcc_-1][0+tpgOffset] = (data[0] >>0 ) & 0x1FF;
649 << ((data[1] >>25) & 0x7) <<
" " 651 << setw(3) <<
tpg_[
iTcc_-1][3+tpgOffset] <<
" " 653 << ((data[1] >>9 ) & 0x7) <<
" " 655 << setw(3) <<
tpg_[
iTcc_-1][2+tpgOffset] <<
" " 656 <<
" '3': " << ((data[0] >>29) & 0x7) <<
" " 658 << ((data[0] >>25) & 0x7) <<
" " 662 << ((data[0] >>9 ) & 0x7) <<
" " 671 }
else if((dataType>>1)==4){
677 srpL1a_ = (data[1] >>0 ) & 0xFFF;
678 srpBx_ = (data[0] >>16) & 0xFFF;
679 if(d) out <<
"LE1: " << ((data[1] >>28) & 0
x1)
680 <<
" LE0: " << ((data[1] >>27) & 0
x1)
681 <<
" N_SRFs: " << ((data[1] >>16) & 0x7F)
682 <<
" E1: " << ((data[1] >>12) & 0
x1)
684 <<
" '4': " << ((data[0] >>29) & 0x7)
685 <<
" E0: " << ((data[0] >>28) & 0
x1)
687 <<
" SRP ID: " << ((data[0] >>0 ) & 0xFF);
692 out <<
"SRF# " << setw(6) << right <<
srRange(12+ttfOffset) <<
": " 693 << oct << ((data[1] >>16) & 0xFFF) <<
dec 694 <<
" SRF# " <<
srRange(8+ttfOffset) <<
": " 695 << oct << ((data[1] >>0 ) & 0xFFF) <<
dec 696 <<
" '4':" << ((data[0] >>29) & 0x7)
697 <<
" SRF# " <<
srRange(4+ttfOffset) <<
": " 698 << oct << ((data[0] >>16) & 0xFFF) <<
dec;
702 out <<
" SRF# " <<
srRange(ttfOffset) <<
": " 703 << oct << ((data[0] >>0 ) & 0xFFF) <<
dec;
706 if(d) out <<
"ERROR";
709 }
else if((dataType>>2)==3){
718 l1a = (data[1] >>0 ) & 0xFFF;
719 bx = (data[0] >>16) & 0xFFF;
720 dccCh_=(data[0] >>0 ) & 0xFF;
722 <<
" E1: " << ((data[1] >>12) & 0
x1)
724 <<
" '3': " << ((data[0] >>30) & 0x3)
725 <<
" E0: " << ((data[0] >>28) & 0
x1)
727 <<
" N_samples: " << ((data[0] >>8 ) & 0x7F)
745 s[0]=(data[0] >>16) & 0xFFF;
746 g[0]=(data[0] >>28) & 0x3;
747 s[1]=(data[1] >>0 ) & 0xFFF;
748 g[1]=(data[1] >>12) & 0x3;
749 s[2]=(data[1] >>16) & 0xFFF;
750 g[2]=(data[1] >>28) & 0x3;
752 if(da) out <<
"GMF: " << ((data[0] >>11) & 0
x1)
753 <<
" SMF: " << ((data[0] >>9 ) & 0
x1)
754 <<
" M: " << ((data[0] >>8 ) & 0
x1)
755 <<
" XTAL: " << ((data[0] >>4 ) & 0x7)
756 <<
" STRIP: " << ((data[0] >>0 ) & 0x7)
757 <<
" " << setw(4) << s[0]
759 <<
" " << setw(4) << s[1]
761 <<
" " << setw(4) << s[2]
766 s[0]=(data[0] >>0 ) & 0xFFF;
767 g[0]=(data[0] >>12) & 0x3;
768 s[1]=(data[0] >>16) & 0xFFF;
769 g[1]=(data[0] >>28) & 0x3;
770 s[2]=(data[1] >>0 ) & 0xFFF;
771 g[2]=(data[1] >>12) & 0x3;
772 s[3]=(data[1] >>16) & 0xFFF;
773 g[3]=(data[1] >>28) & 0x3;
775 <<
" " << setw(4) << s[0]
777 <<
" " << setw(4) << s[1]
779 <<
" " << setw(4) << s[2]
781 <<
" " << setw(4) << s[3]
786 if(da) out <<
"TZS: " << ((data[1] >>14) & 0
x1);
788 s[0]=(data[0] >>0 ) & 0xFFF;
789 g[0]=(data[0] >>12) & 0x3;
790 s[1]=(data[0] >>16) & 0xFFF;
791 g[1]=(data[0] >>28) & 0x3;
792 s[2]=(data[1] >>0 ) & 0xFFF;
793 g[2]=(data[1] >>12) & 0x3 ;
799 if(da) out <<
" Ampl: " << setw(4) << ampl
801 <<
" BoM:" << setw(2) << (bom0+1)
809 if(da) out << setw(29) <<
"";
811 if(da) out <<
" " << setw(4) << s[0]
813 <<
" " << setw(4) << s[1]
815 <<
" " << setw(4) << s[2]
822 if(d) out <<
"ERROR";
829 }
else if(dataType==eoe){
834 int tts = (data[0] >>4) & 0xF;
835 if(d) out <<
"Evt Len.: " << ((data[1] >>0 ) & 0xFFFFFF)
836 <<
" CRC16: " << ((data[0] >>16) & 0xFFFF)
837 <<
" Evt Status: " << ((data[0] >>8 ) & 0xF)
840 <<
" T:" << ((data[0] >>3) & 0
x1);
842 if(d) out <<
" incorrect 64-bit word type marker (see MSBs)";
883 if(ru1 < 5 || (ru1-5)%4 >= 2){
892 int iEta0 = (ru1-1)/4;
896 return 2 + (iEta0-5)/4;
901 int iEta0 = (ru1-1)/4;
902 int iPhi0 = (ru1-1)%4;
907 rs = 2 + ((iEta0-1)/4)*2 + (iPhi0%4)/2;
918 buf << right << min <<
".." 921 buf << right << max <<
".." 924 string s = buf.str();
926 buf << setw(6) << right <<
s;
931 if((
unsigned)iSeq >
sizeof(
ttId_))
933 << __FILE__ <<
":" << __LINE__ <<
": " 934 <<
"parameter out of range\n";
942 buf <<
"TTF# " << setw(2) <<
ttId;
948 if((
unsigned)iSeq >
sizeof(
ttId_))
950 << __FILE__ <<
":" << __LINE__ <<
": " 951 <<
"parameter out of range\n";
959 buf <<
"TPG# " << setw(2) <<
ttId;
T getUntrackedParameter(std::string const &, T const &) const
static int sideOfRu(int ru1)
std::string tpgTag(int tccType, unsigned iSeq) const
edm::EDGetTokenT< FEDRawDataCollection > fedRawDataCollectionToken_
static const unsigned fedStart_
std::string ttfTag(int tccType, unsigned iSeq) const
double min(const std::vector< double > &a)
std::vector< double > adc_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void analyze(const edm::Event &, const edm::EventSetup &) override
unsigned ttId(DetId const &)
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_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
static const int ttId_[nTccTypes_][maxTpgsPerTcc_]
edm::InputTag fedRawDataCollectionTag_
std::vector< int > nTpgs_
EcalDumpRaw(const edm::ParameterSet &)
static const char *const detailedTrigNames[]
constexpr size_t nSamples
std::vector< std::vector< int > > tpg_
static const char *const trigNames[]
std::string srRange(int offset) const
edm::EDGetTokenT< L1AcceptBunchCrossingCollection > l1AcceptBunchCrossingCollectionToken_
static const double mgpaGainFactors[]
int tccType_
type of TCC currently parsed
std::vector< int > dccChStatus_
static const char *const colorNames[]
static const int eeInnerTcc_
std::vector< int > feRuId_
static const int maxTpgsPerTcc_
char data[epos_bytes_allocation]
edm::InputTag l1AcceptBunchCrossingCollectionTag_
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
static const unsigned nDccs_
static constexpr int lastFEDId()
static const int maxTccsPerDcc_
double max(const std::vector< double > &a, unsigned &pos)