Skip to content

Commit d89b13e

Browse files
committed
reduced warnings to 1 per FED
1 parent ff40bab commit d89b13e

File tree

4 files changed

+54
-70
lines changed

4 files changed

+54
-70
lines changed

DataFormats/GEMDigi/interface/AMC13Event.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,15 @@ namespace gem {
3939
union CDFTrailer {
4040
uint64_t word;
4141
struct {
42-
uint64_t tts : 8; // tts (first 4 bits)
43-
uint64_t evtStat : 4; // event status
44-
uint64_t crcCDF : 20; // CDF crc (first 16 bits)
42+
uint64_t res1 : 2;
43+
uint64_t crcModified : 1;
44+
uint64_t moreTrailers : 1;
45+
uint64_t tts : 4; // tts
46+
uint64_t evtStat : 4; // event status
47+
uint64_t res2 : 2;
48+
uint64_t slinkError : 1;
49+
uint64_t wrongFedId : 1;
50+
uint64_t crcCDF : 16; // CDF crc
4551
uint64_t evtLength : 24; // event length
4652
uint64_t eventType : 4; // Event Type
4753
uint64_t cbA : 4; // 0xA

EventFilter/GEMRawToDigi/plugins/GEMDigiToRawModule.cc

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
103103
int LV1_id = iEvent.id().event();
104104
int BX_id = iEvent.bunchCrossing();
105105
int OrN = iEvent.orbitNumber();
106-
LogDebug("GEMDigiToRawModule") << "Event bx:" << iEvent.bunchCrossing() << " lv1Id:" << iEvent.id().event()
107-
<< " orbitNumber:" << iEvent.orbitNumber();
108106

109107
// making map of bx GEMDigiCollection
110108
// each bx will be saved as new AMC13Event, so GEMDigiCollection needs to be split into bx
@@ -175,19 +173,16 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
175173
else
176174
msData |= 1UL << (chMap.chNum - 64);
177175

178-
LogDebug("GEMDigiToRawModule")
179-
<< " fed: " << fedId << " amc:" << int(amcNum) << " geb:" << int(gebId)
180-
<< " vfat:" << vfat_dc.localPhi << ",type: " << vfat_dc.vfatType << " id:" << gemId
181-
<< " ch:" << chMap.chNum << " st:" << digi.strip() << " bx:" << digi.bx();
176+
LogDebug("") << " fed: " << fedId << " amc:" << int(amcNum) << " geb:" << int(gebId)
177+
<< " vfat:" << vfat_dc.localPhi << ",type: " << vfat_dc.vfatType << " id:" << gemId
178+
<< " ch:" << chMap.chNum << " st:" << digi.strip() << " bx:" << digi.bx();
182179
}
183180

184181
if (!hasDigi)
185182
continue;
186183
// only make vfat with hits
187184
amcSize += 3;
188185
auto vfatData = std::make_unique<VFATdata>(geb_dc.vfatVer, bc, 0, vfatId, lsData, msData);
189-
LogDebug("GEMDigiToRawModule")
190-
<< "VFAT bx:" << bc << " bx:" << int(vfatData->bc()) << " orbitNumber:" << iEvent.orbitNumber();
191186
gebData->addVFAT(*vfatData);
192187
}
193188

@@ -206,7 +201,6 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
206201
amcData->setAMCheader1(amcSize, BX_id, LV1_id, amcNum);
207202
amcData->setAMCheader2(amcNum, OrN, 1);
208203
amcData->setGEMeventHeader(amcData->gebs()->size(), 0);
209-
LogDebug("GEMDigiToRawModule") << "davCnt: " << int(amcData->davCnt());
210204
amc13Event->addAMCpayload(*amcData);
211205
// AMC header in AMC13Event
212206
amc13Event->addAMCheader(amcSize, 0, amcNum, 0);
@@ -224,13 +218,8 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
224218
amc13Event->setAMC13Trailer(BX_id, LV1_id, BX_id);
225219
//CDF trailer
226220
uint32_t EvtLength = amc13EvtLength + 4; // 2 header and 2 trailer
227-
LogDebug("GEMDigiToRawModule") << " EvtLength: " << int(EvtLength);
228221

229222
amc13Event->setCDFTrailer(EvtLength);
230-
LogDebug("GEMDigiToRawModule") << "getAMCpayloads: " << amc13Event->getAMCpayloads()->size();
231-
LogDebug("GEMDigiToRawModule") << " nAMC: " << int(amc13Event->nAMC()) << " LV1_id: " << int(LV1_id)
232-
<< " BX_id: " << int(BX_id);
233-
234223
amc13Events.emplace_back(std::move(amc13Event));
235224
} // finished making amc13Event data
236225
} // end of FED loop
@@ -277,7 +266,7 @@ void GEMDigiToRawModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
277266
for (const auto& word : words) {
278267
*(w++) = word;
279268
}
280-
LogDebug("GEMDigiToRawModule") << " words " << words.size();
269+
LogDebug("") << " words " << words.size();
281270
}
282271

283272
iEvent.put(std::move(fedRawDataCol));

EventFilter/GEMRawToDigi/plugins/GEMRawToDigiModule.cc

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -115,58 +115,52 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
115115
const FEDRawData& fedData = fed_buffers->FEDData(fedId);
116116

117117
int nWords = fedData.size() / sizeof(uint64_t);
118-
LogDebug("GEMRawToDigiModule") << "fedId:" << fedId << " words: " << nWords;
118+
LogDebug("") << "fedId:" << fedId << " words: " << nWords;
119119

120120
if (nWords < 5)
121121
continue;
122122

123123
// trailer checks
124124
FEDTrailer trailer(fedData.data() + fedData.size() - FEDTrailer::length);
125-
if (not trailer.check()) {
126-
edm::LogWarning("GEMRawToDigiModule") << " FED trailer check failed\n";
127-
}
128-
if (trailer.fragmentLength() * sizeof(uint64_t) != fedData.size()) {
129-
edm::LogWarning("GEMRawToDigiModule") << " FED fragment size mismatch: " << trailer.fragmentLength()
130-
<< " (fragment length) vs " << nWords << " (data size) words\n";
125+
126+
bool failTrailerCheck = false, failTrailerMatch = false;
127+
if (!trailer.check() || (trailer.fragmentLength() * sizeof(uint64_t) != fedData.size())) {
128+
failTrailerCheck = true;
131129
}
132130

133131
const unsigned char* data = fedData.data();
134132
const uint64_t* word = reinterpret_cast<const uint64_t*>(data);
135133
auto amc13Event = gemRawToDigi_->convertWordToAMC13Event(word);
136134

137135
if (amc13Event == nullptr) {
138-
LogDebug("GEMRawToDigiModule") << "amc13Event FAILED to unpack";
136+
LogDebug("") << "AMC13Event FAILED to be produced";
139137
continue;
140138
}
141-
if (gemRawToDigi_->amcError() || gemRawToDigi_->vfatError()) {
142-
edm::LogWarning("GEMRawToDigiModule")
143-
<< " amcError:" << gemRawToDigi_->amcError() << " vfatError:" << gemRawToDigi_->vfatError();
144-
}
145-
// compare trailers
146-
if (amc13Event->fragmentLength() != trailer.fragmentLength()) {
147-
edm::LogWarning("GEMRawToDigiModule") << " fragmentLength mismatch";
148-
}
149-
if (amc13Event->crc() != trailer.crc()) {
150-
edm::LogWarning("GEMRawToDigiModule") << " crc mismatch";
151-
}
152-
if (amc13Event->evtStatus() != trailer.evtStatus()) {
153-
edm::LogWarning("GEMRawToDigiModule") << " evtStatus mismatch";
154-
}
155-
if (amc13Event->ttsBits() != trailer.ttsBits()) {
156-
edm::LogWarning("GEMRawToDigiModule") << " ttsBits mismatch";
139+
140+
// compare trailers found by last word of fedData.size() and gemRawToDigi
141+
// caused by error in no. of AMC, GEB or VFAT stored in FEDs
142+
if ((amc13Event->fragmentLength() != trailer.fragmentLength()) || (amc13Event->crc() != trailer.crc()))
143+
failTrailerMatch = true;
144+
145+
LogDebug("") << "Event bx:" << iEvent.bunchCrossing() << " lv1Id:" << iEvent.id().event()
146+
<< " orbitNumber:" << iEvent.orbitNumber();
147+
LogDebug("") << "AMC13 bx:" << amc13Event->bxId() << " lv1Id:" << int(amc13Event->lv1Id())
148+
<< " orbitNumber:" << amc13Event->orbitNumber();
149+
150+
if (failTrailerCheck || failTrailerMatch) {
151+
// best to skip these events since FED is most likely corrupt
152+
edm::LogWarning("") << "FED trailer: fail check? " << failTrailerCheck << " fail match? " << failTrailerMatch;
153+
continue;
157154
}
158155

159-
LogDebug("GEMRawToDigiModule") << "Event bx:" << iEvent.bunchCrossing() << " lv1Id:" << iEvent.id().event()
160-
<< " orbitNumber:" << iEvent.orbitNumber();
161-
LogDebug("GEMRawToDigiModule") << "AMC13 bx:" << amc13Event->bxId() << " lv1Id:" << int(amc13Event->lv1Id())
162-
<< " orbitNumber:" << amc13Event->orbitNumber();
156+
bool unknownChamber = false, unknownVFat = false, badVfat = false;
163157

164158
// Read AMC data
165159
for (auto amcData : *(amc13Event->getAMCpayloads())) {
166160
uint16_t amcBx = amcData.bx();
167161
uint8_t amcNum = amcData.amcNum();
168-
LogDebug("GEMRawToDigiModule") << "AMC no.:" << int(amcData.amcNum()) << " bx:" << int(amcData.bx())
169-
<< " lv1Id:" << int(amcData.l1A()) << " orbitNumber:" << int(amcData.orbitNum());
162+
LogDebug("") << "AMC no.:" << int(amcData.amcNum()) << " bx:" << int(amcData.bx())
163+
<< " lv1Id:" << int(amcData.l1A()) << " orbitNumber:" << int(amcData.orbitNum());
170164

171165
// Read GEB data
172166
for (auto gebData : *amcData.gebs()) {
@@ -175,13 +169,13 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
175169

176170
// check if Chamber exists.
177171
if (!gemROMap->isValidChamber(geb_ec)) {
178-
edm::LogWarning("GEMRawToDigiModule") << "InValid: amcNum " << int(amcNum) << " gebId " << int(gebId);
172+
unknownChamber = true;
173+
LogDebug("") << "InValid: amcNum " << int(amcNum) << " gebId " << int(gebId);
179174
continue;
180175
}
181176

182177
GEMROMapping::chamDC geb_dc = gemROMap->chamberPos(geb_ec);
183178
GEMDetId gemChId = geb_dc.detId;
184-
LogDebug("GEMRawToDigiModule") << "GEB bx:" << int(gebData.bcOH()) << " lv1Id:" << int(gebData.ecOH());
185179

186180
//Read vfat data
187181
for (auto vfatData : *gebData.vFATs()) {
@@ -191,20 +185,19 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
191185

192186
// check if ChipID exists.
193187
if (!gemROMap->isValidChipID(vfat_ec)) {
194-
edm::LogWarning("GEMRawToDigiModule")
195-
<< "InValid: amcNum " << int(amcNum) << " gebId " << int(gebId) << " vfatId " << int(vfatId)
196-
<< " vfat Pos " << int(vfatData.position());
188+
unknownVFat = true;
189+
LogDebug("") << "InValid: amcNum " << int(amcNum) << " gebId " << int(gebId) << " vfatId " << int(vfatId)
190+
<< " vfat Pos " << int(vfatData.position());
197191
continue;
198192
}
199193

200194
// check vfat data
201195
if (vfatData.quality()) {
202-
edm::LogWarning("GEMRawToDigiModule")
203-
<< "Quality " << int(vfatData.quality()) << " b1010 " << int(vfatData.b1010()) << " b1100 "
204-
<< int(vfatData.b1100()) << " b1110 " << int(vfatData.b1110());
196+
badVfat = true;
197+
LogDebug("") << "Quality " << int(vfatData.quality()) << " b1010 " << int(vfatData.b1010()) << " b1100 "
198+
<< int(vfatData.b1100()) << " b1110 " << int(vfatData.b1110());
205199
if (vfatData.crc() != vfatData.checkCRC()) {
206-
edm::LogWarning("GEMRawToDigiModule")
207-
<< "DIFFERENT CRC :" << vfatData.crc() << " " << vfatData.checkCRC();
200+
LogDebug("") << "DIFFERENT CRC :" << vfatData.crc() << " " << vfatData.checkCRC();
208201
}
209202
}
210203

@@ -232,11 +225,9 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
232225

233226
GEMDigi digi(stripId, bx);
234227

235-
LogDebug("GEMRawToDigiModule") << "VFATbx:" << int(vfatData.bc()) << " lv1Id:" << int(vfatData.ec());
236-
LogDebug("GEMRawToDigiModule")
237-
<< " fed: " << fedId << " amc:" << int(amcNum) << " geb:" << int(gebId) << " vfat:" << vfat_dc.localPhi
238-
<< ",type: " << vfat_dc.vfatType << " id:" << gemId << " ch:" << chMap.chNum << " st:" << digi.strip()
239-
<< " bx:" << digi.bx();
228+
LogDebug("") << " fed: " << fedId << " amc:" << int(amcNum) << " geb:" << int(gebId)
229+
<< " vfat:" << vfat_dc.localPhi << ",type: " << vfat_dc.vfatType << " id:" << gemId
230+
<< " ch:" << chMap.chNum << " st:" << digi.strip() << " bx:" << digi.bx();
240231

241232
outGEMDigis.get()->insertDigi(gemId, digi);
242233

@@ -267,6 +258,11 @@ void GEMRawToDigiModule::produce(edm::StreamID iID, edm::Event& iEvent, edm::Eve
267258
outAMC13Event.get()->insertDigi(amc13Event->bxId(), AMC13Event(*amc13Event));
268259
}
269260

261+
if (unknownChamber || unknownVFat || badVfat) {
262+
edm::LogWarning("") << "unpacking error: unknown Chamber " << unknownChamber << " unknown VFat " << unknownVFat
263+
<< " bad VFat " << badVfat;
264+
}
265+
270266
} // end of amc13Event
271267

272268
iEvent.put(std::move(outGEMDigis));

EventFilter/GEMRawToDigi/src/GEMRawToDigi.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ std::unique_ptr<AMC13Event> GEMRawToDigi::convertWordToAMC13Event(const uint64_t
1616
amc13Event->setAMC13Header(*(++word));
1717

1818
// Readout out AMC headers
19-
LogDebug("GEMRawToDigi") << "nAMC: " << int(amc13Event->nAMC());
2019
for (uint8_t i = 0; i < amc13Event->nAMC(); ++i)
2120
amc13Event->addAMCheader(*(++word));
2221

@@ -27,13 +26,11 @@ std::unique_ptr<AMC13Event> GEMRawToDigi::convertWordToAMC13Event(const uint64_t
2726
amcData.setAMCheader2(*(++word));
2827
amcData.setGEMeventHeader(*(++word));
2928

30-
LogDebug("GEMRawToDigi") << "davCnt: " << int(amcData.davCnt());
3129
// Fill GEB
3230
for (uint8_t j = 0; j < amcData.davCnt(); ++j) {
3331
auto gebData = GEBdata();
3432
gebData.setChamberHeader(*(++word));
3533

36-
LogDebug("GEMRawToDigi") << "vfatWordCnt: " << int(gebData.vfatWordCnt());
3734
// Fill vfat
3835
for (uint16_t k = 0; k < gebData.vfatWordCnt() / 3; k++) {
3936
auto vfatData = VFATdata();
@@ -47,8 +44,6 @@ std::unique_ptr<AMC13Event> GEMRawToDigi::convertWordToAMC13Event(const uint64_t
4744
gebData.setChamberTrailer(*(++word));
4845
if (gebData.vfatWordCnt() != gebData.vfatWordCntT()) {
4946
vfatError_ = true;
50-
edm::LogWarning("GEMRawToDigi") << "VFAT word count mismatch between header:" << gebData.vfatWordCnt()
51-
<< " and trailer:" << gebData.vfatWordCntT();
5247
}
5348
amcData.addGEB(gebData);
5449

@@ -58,8 +53,6 @@ std::unique_ptr<AMC13Event> GEMRawToDigi::convertWordToAMC13Event(const uint64_t
5853
amcData.setAMCTrailer(*(++word));
5954
if (amc13Event->getAMCsize(i) != amcData.dataLength()) {
6055
amcError_ = true;
61-
edm::LogWarning("GEMRawToDigi") << "AMC size mismatch - AMC13:" << int(amc13Event->getAMCsize(i))
62-
<< " AMC:" << int(amcData.dataLength());
6356
}
6457
amc13Event->addAMCpayload(amcData);
6558

0 commit comments

Comments
 (0)