37 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
38 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
39 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68},
42 {4, 3, 2, 1, 8, 7, 6, 5, 12, 11, 10, 9, 16, 15, 14, 13, 20, 19, 18, 17, 24, 23, 22,
43 21, 28, 27, 26, 25, 32, 31, 30, 29, 36, 35, 34, 33, 40, 39, 38, 37, 44, 43, 42, 41, 48, 47,
44 46, 45, 52, 51, 50, 49, 56, 55, 54, 53, 60, 59, 58, 57, 64, 63, 62, 61, 68, 67, 66, 65},
47 {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
48 24, 25, 26, 27, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
49 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
52 {1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0, 0, 9, 10, 11, 12, 13, 14, 15, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
57 static const char*
const trigNames[] = {
"Unknown",
"Phys",
"Calib",
"Test",
"Ext",
"Simu",
"Trace",
"Err"};
70 static const char*
const colorNames[] = {
"Blue",
"Green",
"Red",
"IR"};
100 amplCut_(ps.getUntrackedParameter<double>(
"amplCut", 5.)),
101 dump_(ps.getUntrackedParameter<
bool>(
"dump",
true)),
102 dumpAdc_(ps.getUntrackedParameter<
bool>(
"dumpAdc",
true)),
103 l1aHistory_(ps.getUntrackedParameter<
bool>(
"l1aHistory",
true)),
105 maxEvt_(ps.getUntrackedParameter<
int>(
"maxEvt", 10000)),
106 profileFedId_(ps.getUntrackedParameter<
int>(
"profileFedId", 0)),
107 profileRuId_(ps.getUntrackedParameter<
int>(
"profileRuId", 1)),
108 l1aMinX_(ps.getUntrackedParameter<
int>(
"l1aMinX", 1)),
109 l1aMaxX_(ps.getUntrackedParameter<
int>(
"l1aMaxX", 601)),
110 lastOrbit_(nDccs_, numeric_limits<uint32_t>::
max()),
111 eventId_(numeric_limits<unsigned>::
max()),
112 eventList_(ps.getUntrackedParameter<
vector<unsigned> >(
"eventList",
vector<unsigned>())),
120 detailedTrigType_(-1),
125 nTpgs_(maxTccsPerDcc_, 0),
138 pulsePerRu_(ps.getUntrackedParameter<
bool>(
"pulsePerRu",
true)),
139 pulsePerLmod_(ps.getUntrackedParameter<
bool>(
"pulsePerLmod",
true)),
140 pulsePerLme_(ps.getUntrackedParameter<
bool>(
"pulsePerLme",
true)),
142 fedRawDataCollectionTag_(ps.getParameter<
edm::
InputTag>(
"fedRawDataCollectionTag")),
143 l1AcceptBunchCrossingCollectionTag_(ps.getParameter<
edm::
InputTag>(
"l1AcceptBunchCrossingCollectionTag")) {
163 <<
"parameter filename for writing. DCC data " 164 " dump will be disabled.";
188 gettimeofday(&
start,
nullptr);
194 cout <<
"\n======================================================================\n" 197 <<
" " <<
eventId_ <<
"\n----------------------------------------------------------------------\n";
203 cout <<
"L1A history not found.\n";
204 }
else if (l1aHist->empty()) {
205 cout <<
"L1A history is empty.\n";
207 cout <<
"L1A history: \n";
208 for (L1AcceptBunchCrossingCollection::const_iterator
it = l1aHist->begin();
it != l1aHist->end(); ++
it) {
209 cout <<
"L1A offset: " <<
it->l1AcceptOffset() <<
"\t" 210 <<
"BX: " <<
it->bunchCrossing() <<
"\t" 211 <<
"Orbit ID: " <<
it->orbitNumber() <<
"\t" 212 <<
"Trigger type: " <<
it->eventType() <<
" (" <<
trigNames[
it->eventType() & 0xF] <<
")\n";
215 cout <<
"----------------------------------------------------------------------\n";
225 bool dccIdErr =
false;
227 unsigned refDccId = 0;
238 if (
data.size() > 4) {
240 if ((
data.size() % 8) != 0) {
241 cout <<
"***********************************************\n";
242 cout <<
" Fed size in bits not multiple of 64, strange.\n";
243 cout <<
"***********************************************\n";
246 size_t nWord32 =
data.size() / 4;
247 const uint32_t* pData = (
reinterpret_cast<uint32_t*
>(
const_cast<unsigned char*
>(
data.data())));
259 for (
int i = 0;
i <
nRu_; ++
i) {
270 for (
size_t iWord32 = 0; iWord32 < nWord32; iWord32 += 2) {
272 if (
id >= 601 &&
id <= 654) {
273 rc =
decode(pData + iWord32, iWord32 / 2,
s);
278 cout << setfill(
'0') << hex <<
"[" << setw(8) << iWord32 * 4 <<
"] " << setw(4)
279 << (pData[iWord32 + 1] >> 16 & 0xFFFF) <<
" " << setw(4) << (pData[iWord32 + 1] >> 0 & 0xFFFF) <<
" " 280 << setw(4) << (pData[iWord32] >> 16 & 0xFFFF) <<
" " << setw(4) << (pData[iWord32] >> 0 & 0xFFFF) <<
" " 281 << setfill(
' ') <<
dec <<
s.str() <<
"\n";
297 cerr <<
"Bx discrepancy between SRP and DCC, Bx(SRP) = " <<
srpBx_ <<
", Bx(DCC) = " <<
bx_ <<
" in " 302 cerr <<
"Bx discrepancy between TCC and DCC, Bx(TCC) = " <<
srpBx_ <<
", Bx(DCC) = " <<
bx_ <<
" in " 306 bool feBxErr =
false;
307 for (
int i = 0;
i <
nRu_; ++
i) {
310 expectedFeBx =
bx_ - 1;
312 expectedFeBx = (
bx_ == 3564) ? 0 :
bx_;
326 cerr <<
"Bx discrepancy between DCC and at least one FE" 327 <<
" in " <<
toNth(
iEvent_) <<
" event, FED " <<
id <<
"\n";
329 int localL1a =
l1a_ & 0xFFF;
331 cerr <<
"Discrepancy between SRP and DCC L1a counter, L1a(SRP) = " <<
srpL1a_ 332 <<
", L1a(DCC) & 0xFFF = " << localL1a <<
" in " <<
toNth(
iEvent_) <<
" event, FED " <<
id << endl;
336 cerr <<
"Discrepancy between TCC and DCC L1a counter, L1a(TCC) = " <<
srpL1a_ 337 <<
", L1a(DCC) & 0xFFF = " << localL1a <<
" in " <<
toNth(
iEvent_) <<
" event, FED " <<
id << endl;
340 bool feL1aErr =
false;
341 for (
int i = 0;
i <
nRu_; ++
i) {
353 cerr <<
"Discrepancy in L1a counter between DCC " 354 "and at least one FE (L1A(DCC) & 0xFFF = " 356 <<
" in " <<
toNth(
iEvent_) <<
" event, FED " <<
id <<
"\n";
359 cerr <<
"Error in RU ID (TT/SC ID)" 360 <<
" in " <<
toNth(
iEvent_) <<
" event, FED " <<
id << endl;
364 dumpFile_.write(reinterpret_cast<const char*>(pData), nWord32 * 4);
376 cout <<
"Number of selected FEDs with a data block: " << iFed <<
"\n";
380 cerr <<
"DCC ID discrepancy in detailed trigger type " 386 gettimeofday(&
stop,
nullptr);
397 if (
n % 100 < 10 ||
n % 100 > 20) {
439 <<
" L1A: " <<
l1a_ <<
" BX: " <<
bx_ <<
" FED ID: " <<
fedId_ <<
" FOV: " << ((
data[0] >> 4) & 0xF)
440 <<
" H: " << ((
data[0] >> 3) & 0x1);
446 int dccHeaderId = (
data[1] >> 24) & 0x3F;
447 switch (dccHeaderId) {
450 out <<
"Run #: " << ((
data[1] >> 0) & 0xFFFFFF) <<
" DCC Err: " << ((
data[0] >> 24) & 0xFF)
451 <<
" Evt Len: " << ((
data[0] >> 0) & 0xFFFFFF);
460 <<
" Color: " << ((
data[1] >> 6) & 0x3) <<
" (" <<
colorNames[(
data[1] >> 6) & 0x3] <<
")" 465 out <<
"TCC Status ch<4..1>: 0x" << hex << ((data[1] >> 8) & 0xFFFF) <<
dec 466 <<
" SR status: " << ((
data[1] >> 4) & 0xF) <<
" TZS: " << ((
data[1] >> 2) & 0
x1)
467 <<
" ZS: " << ((
data[1] >> 1) & 0
x1) <<
" SR: " << ((
data[1] >> 0) & 0
x1);
476 if ((
unsigned)iDcc0 <
nDccs_) {
489 int chOffset = (dccHeaderId - 4) * 14;
506 out <<
"FE CH status:";
507 for (
int i = chOffset;
i < chOffset + 14; ++
i) {
514 out <<
" bits<63..62>=0 (DCC header) bits<61..56>=" << dccHeaderId <<
"(unknown=>ERROR?)";
530 out <<
"LE1: " << ((
data[1] >> 28) & 0
x1) <<
" LE0: " << ((
data[1] >> 27) & 0
x1)
531 <<
" N_samples: " << ((
data[1] >> 23) & 0x1F) <<
" N_TTs: " <<
nTts_ <<
" E1: " << ((
data[1] >> 12) & 0
x1)
532 <<
" L1A: " <<
tccL1a_ <<
" '3': " << ((
data[0] >> 29) & 0x7) <<
" E0: " << ((
data[0] >> 28) & 0
x1)
533 <<
" Bx: " << ((
data[0] >> 16) & 0xFFF) <<
" TTC ID: " <<
tccId_;
539 }
else if (
nTts_ == 16) {
541 }
else if (
nTts_ == 28) {
545 cerr <<
"Error in #TT field of TCC block." 546 "This field is normally used to determine type of TCC " 547 "(TCC48 or TCC68). Type of TCC will be deduced from the TCC ID.\n";
561 cerr <<
"TCC ID is also invalid. EB- TCC type will be assumed.\n";
570 out <<
"Too many TCC blocks";
572 out <<
"Too many TPG in one TCC block";
589 << setw(3) <<
tpg_[
iTcc_ - 1][2 + tpgOffset] <<
" " 615 out <<
"LE1: " << ((
data[1] >> 28) & 0
x1) <<
" LE0: " << ((
data[1] >> 27) & 0
x1)
616 <<
" N_SRFs: " << ((
data[1] >> 16) & 0x7F) <<
" E1: " << ((
data[1] >> 12) & 0
x1) <<
" L1A: " <<
srpL1a_ 617 <<
" '4': " << ((
data[0] >> 29) & 0x7) <<
" E0: " << ((
data[0] >> 28) & 0
x1) <<
" Bx: " <<
srpBx_ 618 <<
" SRP ID: " << ((
data[0] >> 0) & 0xFF);
623 out <<
"SRF# " << setw(6) << right
624 <<
srRange(12 + ttfOffset) <<
": " << oct
625 << ((
data[1] >> 16) & 0xFFF) <<
dec <<
" SRF# " 626 <<
srRange(8 + ttfOffset) <<
": " << oct
627 << ((
data[1] >> 0) & 0xFFF) <<
dec <<
" '4':" << ((
data[0] >> 29) & 0x7) <<
" SRF# " 628 <<
srRange(4 + ttfOffset) <<
": " << oct
629 << ((
data[0] >> 16) & 0xFFF) <<
dec;
633 out <<
" SRF# " <<
srRange(ttfOffset) <<
": " << oct
634 << ((
data[0] >> 0) & 0xFFF) <<
dec;
650 l1a = (
data[1] >> 0) & 0xFFF;
651 bx = (
data[0] >> 16) & 0xFFF;
655 <<
" '3': " << ((
data[0] >> 30) & 0x3) <<
" E0: " << ((
data[0] >> 28) & 0
x1) <<
" Bx: " <<
bx 656 <<
" N_samples: " << ((
data[0] >> 8) & 0x7F) <<
" RU ID: " <<
dccCh_;
673 s[0] = (
data[0] >> 16) & 0xFFF;
674 g[0] = (
data[0] >> 28) & 0x3;
675 s[1] = (
data[1] >> 0) & 0xFFF;
676 g[1] = (
data[1] >> 12) & 0x3;
677 s[2] = (
data[1] >> 16) & 0xFFF;
678 g[2] = (
data[1] >> 28) & 0x3;
681 out <<
"GMF: " << ((
data[0] >> 11) & 0
x1) <<
" SMF: " << ((
data[0] >> 9) & 0
x1)
682 <<
" M: " << ((
data[0] >> 8) & 0
x1) <<
" XTAL: " << ((
data[0] >> 4) & 0x7)
683 <<
" STRIP: " << ((
data[0] >> 0) & 0x7) <<
" " << setw(4) <<
s[0] <<
"G" <<
g[0] <<
" " << setw(4)
684 <<
s[1] <<
"G" <<
g[1] <<
" " << setw(4) <<
s[2] <<
"G" <<
g[2];
685 for (
int i = 0;
i < 3; ++
i)
689 s[0] = (
data[0] >> 0) & 0xFFF;
690 g[0] = (
data[0] >> 12) & 0x3;
691 s[1] = (
data[0] >> 16) & 0xFFF;
692 g[1] = (
data[0] >> 28) & 0x3;
693 s[2] = (
data[1] >> 0) & 0xFFF;
694 g[2] = (
data[1] >> 12) & 0x3;
695 s[3] = (
data[1] >> 16) & 0xFFF;
696 g[3] = (
data[1] >> 28) & 0x3;
699 <<
" " << setw(4) <<
s[0] <<
"G" <<
g[0] <<
" " << setw(4) <<
s[1] <<
"G" <<
g[1] <<
" " << setw(4)
700 <<
s[2] <<
"G" <<
g[2] <<
" " << setw(4) <<
s[3] <<
"G" <<
g[3];
701 for (
int i = 0;
i < 4; ++
i)
706 out <<
"TZS: " << ((
data[1] >> 14) & 0
x1);
708 s[0] = (
data[0] >> 0) & 0xFFF;
709 g[0] = (
data[0] >> 12) & 0x3;
710 s[1] = (
data[0] >> 16) & 0xFFF;
711 g[1] = (
data[0] >> 28) & 0x3;
712 s[2] = (
data[1] >> 0) & 0xFFF;
713 g[2] = (
data[1] >> 12) & 0x3;
715 for (
int i = 0;
i < 3; ++
i)
721 out <<
" Ampl: " << setw(4) << ampl << (ampl >
amplCut_ ?
"*" :
" ") <<
" BoM:" << setw(2) << (bom0 + 1)
729 out << setw(29) <<
"";
732 out <<
" " << setw(4) <<
s[0] <<
"G" <<
g[0] <<
" " << setw(4) <<
s[1] <<
"G" <<
g[1] <<
" " << setw(4)
733 <<
s[2] <<
"G" <<
g[2];
752 int tts = (
data[0] >> 4) & 0xF;
754 out <<
"Evt Len.: " << ((
data[1] >> 0) & 0xFFFFFF) <<
" CRC16: " << ((
data[0] >> 16) & 0xFFFF)
755 <<
" Evt Status: " << ((
data[0] >> 8) & 0xF) <<
" TTS: " << tts <<
" (" <<
ttsNames[tts] <<
")" 756 <<
" T:" << ((
data[0] >> 3) & 0
x1);
759 out <<
" incorrect 64-bit word type marker (see MSBs)";
799 if (ru1 < 5 || (ru1 - 5) % 4 >= 2) {
807 int iEta0 = (ru1 - 1) / 4;
811 return 2 + (iEta0 - 5) / 4;
816 int iEta0 = (ru1 - 1) / 4;
817 int iPhi0 = (ru1 - 1) % 4;
822 rs = 2 + ((iEta0 - 1) / 4) * 2 + (iPhi0 % 4) / 2;
833 buf << right <<
min <<
".." << left <<
max;
835 buf << right <<
max <<
".." << left <<
min;
837 string s =
buf.str();
839 buf << setw(6) << right <<
s;
844 if ((
unsigned)iSeq >
sizeof(
ttId_))
845 throw cms::Exception(
"OutOfRange") << __FILE__ <<
":" << __LINE__ <<
": " 846 <<
"parameter out of range\n";
854 buf <<
"TTF# " << setw(2) <<
ttId;
860 if ((
unsigned)iSeq >
sizeof(
ttId_))
861 throw cms::Exception(
"OutOfRange") << __FILE__ <<
":" << __LINE__ <<
": " 862 <<
"parameter out of range\n";
870 buf <<
"TPG# " << setw(2) <<
ttId;
static int sideOfRu(int ru1)
edm::EDGetTokenT< FEDRawDataCollection > fedRawDataCollectionToken_
std::string srRange(int offset) const
static const unsigned fedStart_
double min(const std::vector< double > &a)
std::vector< double > adc_
std::string tpgTag(int tccType, unsigned iSeq) const
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
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
unsigned ttId(DetId const &, EcalElectronicsMapping const *)
static int modOfRu(int ru1)
std::vector< uint32_t > lastOrbit_
bool decode(const uint32_t *data, int iWord32, std::ostream &out)
std::string ttfTag(int tccType, unsigned iSeq) const
std::vector< unsigned > eventList_
static int lmodOfRu(int ru1)
T getUntrackedParameter(std::string const &, T const &) const
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[]
#define DEFINE_FWK_MODULE(type)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::vector< std::vector< int > > tpg_
static const char *const trigNames[]
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_
static const unsigned nDccs_
static constexpr int lastFEDId()
static const int maxTccsPerDcc_
double max(const std::vector< double > &a, unsigned &pos)