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>())),
150 l1amin_(numeric_limits<int>::
max()),
151 l1amax_(-numeric_limits<int>::
min()),
153 detailedTrigType_(-1),
157 tpg_(maxTccsPerDcc_, std::vector<int>(maxTpgsPerTcc_)),
158 nTpgs_(maxTccsPerDcc_, 0),
171 pulsePerRu_(ps.getUntrackedParameter<bool>(
"pulsePerRu",
true)),
172 pulsePerLmod_(ps.getUntrackedParameter<bool>(
"pulsePerLmod",
true)),
173 pulsePerLme_(ps.getUntrackedParameter<bool>(
"pulsePerLme",
true)),
175 fedRawDataCollectionTag_(ps.getParameter<edm::
InputTag>(
"fedRawDataCollectionTag")),
176 l1AcceptBunchCrossingCollectionTag_(ps.getParameter<edm::
InputTag>(
"l1AcceptBunchCrossingCollectionTag"))
194 << filename_.c_str() <<
"' specified by "
195 <<
"parameter filename for writing. DCC data "
196 " dump will be disabled.";
224 gettimeofday(&start, 0);
229 if(
dump_ ||
l1aHistory_)
cout <<
"\n======================================================================\n"
234 <<
"\n----------------------------------------------------------------------\n";
240 cout <<
"L1A history not found.\n";
241 }
else if (l1aHist->size() == 0) {
242 cout <<
"L1A history is empty.\n";
244 cout <<
"L1A history: \n";
245 for(L1AcceptBunchCrossingCollection::const_iterator it = l1aHist->begin();
246 it != l1aHist->end();
248 cout <<
"L1A offset: " << it->l1AcceptOffset() <<
"\t"
249 <<
"BX: " << it->bunchCrossing() <<
"\t"
250 <<
"Orbit ID: " << it->orbitNumber() <<
"\t"
251 <<
"Trigger type: " << it->eventType() <<
" ("
252 <<
trigNames[it->eventType()&0xF] <<
")\n";
255 cout <<
"----------------------------------------------------------------------\n";
263 bool dccIdErr =
false;
265 unsigned refDccId = 0;
278 if ((data.
size() % 8) !=0){
279 cout <<
"***********************************************\n";
280 cout <<
" Fed size in bits not multiple of 64, strange.\n";
281 cout <<
"***********************************************\n";
285 size_t nWord32 = data.
size()/4;
286 const uint32_t * pData = (
reinterpret_cast<uint32_t*
>(
const_cast<unsigned char*
> ( data.
data())));
309 for(
size_t iWord32=0; iWord32 < nWord32; iWord32+=2){
311 if(
id>=601 &&
id<=654){
312 rc =
decode(pData+iWord32, iWord32/2, s);
317 cout << setfill(
'0') << hex
318 <<
"[" << setw(8) << iWord32*4 <<
"] "
319 << setw(4) << (pData[iWord32+1]>>16 & 0xFFFF) <<
" "
320 << setw(4) << (pData[iWord32+1]>>0 & 0xFFFF) <<
" "
321 << setw(4) << (pData[iWord32]>>16 & 0xFFFF) <<
" "
322 << setw(4) << (pData[iWord32]>>0 & 0xFFFF) <<
" "
323 << setfill(
' ') <<
dec
339 cerr <<
"Bx discrepancy between SRP and DCC, Bx(SRP) = "
346 cerr <<
"Bx discrepancy between TCC and DCC, Bx(TCC) = "
352 bool feBxErr =
false;
356 expectedFeBx =
bx_ - 1;
358 expectedFeBx = (
bx_==3564) ? 0 :
bx_;
361 cerr <<
"BX error for " <<
toNth(
i+1) <<
" RU, RU ID "
365 cerr << (detected?
" ":
" not ") <<
"detected by DCC (ch status: "
369 <<
id <<
"." << endl;
374 if(feBxErr)
cerr <<
"Bx discrepancy between DCC and at least one FE"
379 int localL1a =
l1a_ & 0xFFF;
381 cerr <<
"Discrepancy between SRP and DCC L1a counter, L1a(SRP) = "
382 <<
srpL1a_ <<
", L1a(DCC) & 0xFFF = " << localL1a
389 cerr <<
"Discrepancy between TCC and DCC L1a counter, L1a(TCC) = "
390 <<
srpL1a_ <<
", L1a(DCC) & 0xFFF = " << localL1a
396 bool feL1aErr =
false;
399 cerr <<
"FE L1A error for " <<
toNth(
i+1) <<
" RU, RU ID "
403 cerr << (detected?
" ":
" not ") <<
"detected by DCC (ch status: "
407 <<
id <<
"." << endl;
411 if(feL1aErr)
cerr <<
"Discrepancy in L1a counter between DCC "
412 "and at least one FE (L1A(DCC) & 0xFFF = " << localL1a <<
")"
418 cerr <<
"Error in RU ID (TT/SC ID)"
424 dumpFile_.write( reinterpret_cast <const char *> (pData), nWord32*4);
434 if(
dump_)
cout <<
"Number of selected FEDs with a data block: "
439 cerr <<
"DCC ID discrepancy in detailed trigger type "
449 gettimeofday(&stop, 0);
460 if(n%100<10 || n%100>20){
489 int dataType = (data[1] >>28) & 0xF;
498 l1a_ = (data[1]>>0 ) & 0xFFffFF;
499 bx_ = (data[0] >>20) & 0xFFF;
500 fedId_ = (data[0] >>8 ) & 0xFFF;
502 <<
"(" <<
trigNames[(data[1]>>24) & 0xF] <<
")"
506 <<
" FOV: " << ((data[0] >>4 ) & 0xF)
507 <<
" H: " << ((data[0] >>3 ) & 0x1);
508 }
else if((dataType>>2)==0){
513 int dccHeaderId = (data[1] >>24) & 0x3F;
516 if(d) out <<
"Run #: " << ((data[1] >>0 ) & 0xFFFFFF)
517 <<
" DCC Err: " << ((data[0] >>24) & 0xFF)
518 <<
" Evt Len: " << ((data[0] >>0 ) & 0xFFFFFF);
521 side_ = (data[1] >>11) & 0x1;
523 dccId_ = (data[1] >>0 ) & 0x3F;
524 if(d) out <<
"DCC FOV: " << ((data[1] >>16) & 0xF)
525 <<
" Side: " <<
side_
528 <<
" Color: " << ((data[1] >>6 ) & 0x3)
529 <<
" (" <<
colorNames[(data[1]>>6)&0x3] <<
")"
534 if(d) out <<
"TCC Status ch<4..1>: 0x"
535 << hex << ((data[1]>>8) & 0xFFFF) <<
dec
536 <<
" SR status: " << ((data[1] >>4 ) & 0xF)
537 <<
" TZS: " << ((data[1] >>2 ) & 0x1)
538 <<
" ZS: " << ((data[1] >>1 ) & 0x1)
539 <<
" SR: " << ((data[1] >>0 ) & 0x1);
541 if(d) out <<
" Orbit: " <<
orbit_;
547 if((
unsigned)iDcc0<
nDccs_){
549 if(d) out <<
" (+" << (int)orbit_-(
int)
lastOrbit_[iDcc0] <<
")";
561 int chOffset = (dccHeaderId-4)*14;
578 out <<
"FE CH status:";
579 for(
int i = chOffset;
i < chOffset + 14; ++
i){
586 if(d) out <<
" bits<63..62>=0 (DCC header) bits<61..56>=" << dccHeaderId
587 <<
"(unknown=>ERROR?)";
589 }
else if((dataType>>1)==3){
596 tccL1a_ = (data[1] >>0 ) & 0xFFF;
597 tccId_ = ((data[0] >>0 ) & 0xFF);
598 nTts_ = ((data[1] >>16) & 0x7F);
601 if(d) out <<
"LE1: " << ((data[1] >>28) & 0x1)
602 <<
" LE0: " << ((data[1] >>27) & 0x1)
603 <<
" N_samples: " << ((data[1] >>23) & 0x1F)
604 <<
" N_TTs: " <<
nTts_
605 <<
" E1: " << ((data[1] >>12) & 0x1)
607 <<
" '3': " << ((data[0] >>29) & 0x7)
608 <<
" E0: " << ((data[0] >>28) & 0x1)
609 <<
" Bx: " << ((data[0] >>16) & 0xFFF)
614 }
else if(
nTts_ == 16){
616 }
else if(
nTts_ == 28){
620 cerr <<
"Error in #TT field of TCC block."
621 "This field is normally used to determine type of TCC "
622 "(TCC48 or TCC68). Type of TCC will be deduced from the TCC ID.\n";
630 cerr <<
"TCC ID is also invalid. EB- TCC type will be assumed.\n";
639 out <<
"Too many TCC blocks";
641 out <<
"Too many TPG in one TCC block";
643 tpg_[
iTcc_-1][3+tpgOffset] = (data[1] >>16) & 0x1FF;
644 tpg_[
iTcc_-1][2+tpgOffset] = (data[1] >>0 ) & 0x1FF;
645 tpg_[
iTcc_-1][1+tpgOffset] = (data[0] >>16) & 0x1FF;
646 tpg_[
iTcc_-1][0+tpgOffset] = (data[0] >>0 ) & 0x1FF;
651 << ((data[1] >>25) & 0x7) <<
" "
653 << setw(3) <<
tpg_[
iTcc_-1][3+tpgOffset] <<
" "
655 << ((data[1] >>9 ) & 0x7) <<
" "
657 << setw(3) <<
tpg_[
iTcc_-1][2+tpgOffset] <<
" "
658 <<
" '3': " << ((data[0] >>29) & 0x7) <<
" "
660 << ((data[0] >>25) & 0x7) <<
" "
664 << ((data[0] >>9 ) & 0x7) <<
" "
673 }
else if((dataType>>1)==4){
679 srpL1a_ = (data[1] >>0 ) & 0xFFF;
680 srpBx_ = (data[0] >>16) & 0xFFF;
681 if(d) out <<
"LE1: " << ((data[1] >>28) & 0x1)
682 <<
" LE0: " << ((data[1] >>27) & 0x1)
683 <<
" N_SRFs: " << ((data[1] >>16) & 0x7F)
684 <<
" E1: " << ((data[1] >>12) & 0x1)
686 <<
" '4': " << ((data[0] >>29) & 0x7)
687 <<
" E0: " << ((data[0] >>28) & 0x1)
689 <<
" SRP ID: " << ((data[0] >>0 ) & 0xFF);
694 out <<
"SRF# " << setw(6) << right <<
srRange(12+ttfOffset) <<
": "
695 << oct << ((data[1] >>16) & 0xFFF) <<
dec
696 <<
" SRF# " <<
srRange(8+ttfOffset) <<
": "
697 << oct << ((data[1] >>0 ) & 0xFFF) <<
dec
698 <<
" '4':" << ((data[0] >>29) & 0x7)
699 <<
" SRF# " <<
srRange(4+ttfOffset) <<
": "
700 << oct << ((data[0] >>16) & 0xFFF) <<
dec;
704 out <<
" SRF# " <<
srRange(ttfOffset) <<
": "
705 << oct << ((data[0] >>0 ) & 0xFFF) <<
dec;
708 if(d) out <<
"ERROR";
711 }
else if((dataType>>2)==3){
720 l1a = (data[1] >>0 ) & 0xFFF;
721 bx = (data[0] >>16) & 0xFFF;
722 dccCh_=(data[0] >>0 ) & 0xFF;
724 <<
" E1: " << ((data[1] >>12) & 0x1)
726 <<
" '3': " << ((data[0] >>30) & 0x3)
727 <<
" E0: " << ((data[0] >>28) & 0x1)
729 <<
" N_samples: " << ((data[0] >>8 ) & 0x7F)
747 s[0]=(data[0] >>16) & 0xFFF;
748 g[0]=(data[0] >>28) & 0x3;
749 s[1]=(data[1] >>0 ) & 0xFFF;
750 g[1]=(data[1] >>12) & 0x3;
751 s[2]=(data[1] >>16) & 0xFFF;
752 g[2]=(data[1] >>28) & 0x3;
754 if(da) out <<
"GMF: " << ((data[0] >>11) & 0x1)
755 <<
" SMF: " << ((data[0] >>9 ) & 0x1)
756 <<
" M: " << ((data[0] >>8 ) & 0x1)
757 <<
" XTAL: " << ((data[0] >>4 ) & 0x7)
758 <<
" STRIP: " << ((data[0] >>0 ) & 0x7)
759 <<
" " << setw(4) << s[0]
761 <<
" " << setw(4) << s[1]
763 <<
" " << setw(4) << s[2]
768 s[0]=(data[0] >>0 ) & 0xFFF;
769 g[0]=(data[0] >>12) & 0x3;
770 s[1]=(data[0] >>16) & 0xFFF;
771 g[1]=(data[0] >>28) & 0x3;
772 s[2]=(data[1] >>0 ) & 0xFFF;
773 g[2]=(data[1] >>12) & 0x3;
774 s[3]=(data[1] >>16) & 0xFFF;
775 g[3]=(data[1] >>28) & 0x3;
777 <<
" " << setw(4) << s[0]
779 <<
" " << setw(4) << s[1]
781 <<
" " << setw(4) << s[2]
783 <<
" " << setw(4) << s[3]
788 if(da) out <<
"TZS: " << ((data[1] >>14) & 0x1);
790 s[0]=(data[0] >>0 ) & 0xFFF;
791 g[0]=(data[0] >>12) & 0x3;
792 s[1]=(data[0] >>16) & 0xFFF;
793 g[1]=(data[0] >>28) & 0x3;
794 s[2]=(data[1] >>0 ) & 0xFFF;
795 g[2]=(data[1] >>12) & 0x3 ;
801 if(da) out <<
" Ampl: " << setw(4) << ampl
803 <<
" BoM:" << setw(2) << (bom0+1)
811 if(da) out << setw(29) <<
"";
813 if(da) out <<
" " << setw(4) << s[0]
815 <<
" " << setw(4) << s[1]
817 <<
" " << setw(4) << s[2]
824 if(d) out <<
"ERROR";
831 }
else if(dataType==eoe){
836 int tts = (data[0] >>4) & 0xF;
837 if(d) out <<
"Evt Len.: " << ((data[1] >>0 ) & 0xFFFFFF)
838 <<
" CRC16: " << ((data[0] >>16) & 0xFFFF)
839 <<
" Evt Status: " << ((data[0] >>8 ) & 0xF)
842 <<
" T:" << ((data[0] >>3) & 0x1);
844 if(d) out <<
" incorrect 64-bit word type marker (see MSBs)";
885 if(ru1 < 5 || (ru1-5)%4 >= 2){
894 int iEta0 = (ru1-1)/4;
898 return 2 + (iEta0-5)/4;
903 int iEta0 = (ru1-1)/4;
904 int iPhi0 = (ru1-1)%4;
909 rs = 2 + ((iEta0-1)/4)*2 + (iPhi0%4)/2;
920 buf << right << min <<
".."
923 buf << right << max <<
".."
926 string s = buf.str();
928 buf << setw(6) << right <<
s;
933 if((
unsigned)iSeq >
sizeof(
ttId_))
935 << __FILE__ <<
":" << __LINE__ <<
": "
936 <<
"parameter out of range\n";
944 buf <<
"TTF# " << setw(2) <<
ttId;
950 if((
unsigned)iSeq >
sizeof(
ttId_))
952 << __FILE__ <<
":" << __LINE__ <<
": "
953 <<
"parameter out of range\n";
961 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
tuple start
Check for commandline option errors.
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)
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_
static const int ttId_[nTccTypes_][maxTpgsPerTcc_]
edm::InputTag fedRawDataCollectionTag_
std::vector< int > nTpgs_
EcalDumpRaw(const edm::ParameterSet &)
static const char *const detailedTrigNames[]
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
constexpr size_t nSamples
std::vector< std::vector< int > > tpg_
static const char *const trigNames[]
std::string srRange(int offset) const
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.
volatile std::atomic< bool > shutdown_flag false
static const unsigned nDccs_
static const int maxTccsPerDcc_
double max(const std::vector< double > &a, unsigned &pos)