Skip to content

Commit

Permalink
Merge pull request #14617 from cms-l1t-offline/pr-unpacker-warning-cl…
Browse files Browse the repository at this point in the history
…eanup-80x

Clean-up L1T unpacker warnings
  • Loading branch information
cmsbuild committed May 24, 2016
2 parents 87feb9b + c1d10e1 commit 7abe827
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 14 deletions.
34 changes: 23 additions & 11 deletions EventFilter/L1TRawToDigi/plugins/L1TRawToDigi.cc
Expand Up @@ -21,8 +21,6 @@
#include <iomanip>
#include <memory>

#define EDM_ML_DEBUG 1

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"
Expand Down Expand Up @@ -59,6 +57,7 @@ namespace l1t {
// ----------member data ---------------------------
edm::EDGetTokenT<FEDRawDataCollection> fedData_;
std::vector<int> fedIds_;
unsigned int minFeds_;
unsigned int fwId_;
bool fwOverride_;

Expand All @@ -75,7 +74,8 @@ namespace l1t {
bool ctp7_mode_;
bool mtf7_mode_;
bool debug_;
int warns_;
int warnsa_;
int warnsb_;
};
}

Expand All @@ -87,6 +87,7 @@ std::ostream & operator<<(std::ostream& o, const l1t::BlockHeader& h) {
namespace l1t {
L1TRawToDigi::L1TRawToDigi(const edm::ParameterSet& config) :
fedIds_(config.getParameter<std::vector<int>>("FedIds")),
minFeds_(config.getParameter<unsigned int>("MinFeds")),
fwId_(config.getParameter<unsigned int>("FWId")),
fwOverride_(config.getParameter<bool>("FWOverride")),
ctp7_mode_(config.getUntrackedParameter<bool>("CTP7")),
Expand All @@ -109,7 +110,8 @@ namespace l1t {
amc13TrailerSize_ = config.getUntrackedParameter<int>("lenAMC13Trailer");

debug_ = config.getUntrackedParameter<bool>("debug");
warns_ = 0;
warnsa_ = 0;
warnsb_ = 0;
}


Expand Down Expand Up @@ -138,22 +140,25 @@ namespace l1t {
return;
}

unsigned valid_count = 0;
for (const auto& fedId: fedIds_) {
const FEDRawData& l1tRcd = feds->FEDData(fedId);

LogDebug("L1T") << "Found FEDRawDataCollection with ID " << fedId << " and size " << l1tRcd.size();

if ((int) l1tRcd.size() < slinkHeaderSize_ + slinkTrailerSize_ + amc13HeaderSize_ + amc13TrailerSize_ + amcHeaderSize_ + amcTrailerSize_) {
if (l1tRcd.size() > 0) {
LogError("L1T") << "Cannot unpack: invalid L1T raw data (size = "
<< l1tRcd.size() << ") for ID " << fedId << ". Returning empty collections!";
} else if (warns_ < 5) {
warns_++;
LogWarning("L1T") << "Cannot unpack: empty L1T raw data (size = "
<< l1tRcd.size() << ") for ID " << fedId << ". Returning empty collections!";
LogError("L1T") << "Cannot unpack: invalid L1T raw data (size = "
<< l1tRcd.size() << ") for ID " << fedId << ". Returning empty collections!";
} else if (warnsa_ < 5){
warnsa_++;
LogInfo("L1T") << "During unpacking, encountered empty L1T raw data (size = "
<< l1tRcd.size() << ") for FED ID " << fedId << ".";
}
continue;
}
} else {
valid_count++;
}

const unsigned char *data = l1tRcd.data();
FEDHeader header(data);
Expand Down Expand Up @@ -267,6 +272,12 @@ namespace l1t {
}
}
}
if (valid_count < minFeds_){
if (warnsb_ < 5){
warnsb_++;
LogWarning("L1T") << "Unpacked " << valid_count << " non-empty FED IDs but minimum is set to " << minFeds_ << "\n";
}
}
}

// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
Expand All @@ -290,6 +301,7 @@ namespace l1t {
desc.addUntracked<int>("lenAMC13Header", 8);
desc.addUntracked<int>("lenAMC13Trailer", 8);
desc.addUntracked<bool>("debug", false)->setComment("turn on verbose output");
desc.add<unsigned int>("MinFeds", 0)->setComment("optional parameter: warn if less than MinFeds non-empty FED ids unpacked.");
descriptions.add("l1tRawToDigi", desc);
}
}
Expand Down
9 changes: 7 additions & 2 deletions L1Trigger/Configuration/python/L1TRawToDigi_cff.py
Expand Up @@ -78,7 +78,7 @@ def unpack_stage2():
if eras.stage1L1Trigger.isChosen() and not eras.stage2L1Trigger.isChosen():
print "L1TRawToDigi Sequence configured for Stage-1 (2015) trigger. "
unpack_stage1()
L1TRawToDigi = cms.Sequence(L1TRawToDigi_Stage1);
L1TRawToDigi = cms.Sequence(L1TRawToDigi_Stage1)

#
# Stage-2 Trigger: fow now, unpack Stage 1 and Stage 2 (in case both available)
Expand All @@ -87,4 +87,9 @@ def unpack_stage2():
print "L1TRawToDigi Sequence configured for Stage-2 (2016) trigger. "
unpack_stage1()
unpack_stage2()
L1TRawToDigi = cms.Sequence(L1TRawToDigi_Stage1+L1TRawToDigi_Stage2);
L1TRawToDigi = cms.Sequence(L1TRawToDigi_Stage1+L1TRawToDigi_Stage2)
# we only warn if it is stage-2 era and it is an essential, always present, stage-2 payload:
caloStage2Digis.MinFeds = cms.uint32(1)
gmtStage2Digis.MinFeds = cms.uint32(1)
gtStage2Digis.MinFeds = cms.uint32(1)

7 changes: 7 additions & 0 deletions L1Trigger/Configuration/python/customiseReEmul.py
Expand Up @@ -77,6 +77,13 @@ def L1TReEmulFromRAW2015(process):
print "L1TReEmul sequence: "
print process.L1TReEmul
print process.schedule
# quiet warning abouts missing Stage-2 payloads, since they won't reliably exist in 2015 data.
if hasattr(process, "caloStage2Digis"):
process.caloStage2Digis.MinFeds = cms.uint32(0)
if hasattr(process, "gmtStage2Digis"):
process.gmtStage2Digis.MinFeds = cms.uint32(0)
if hasattr(process, "gtStage2Digis"):
process.gtStage2Digis.MinFeds = cms.uint32(0)
return process
else:
process.simRctDigis.ecalDigis = cms.VInputTag('simEcalTriggerPrimitiveDigis')
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/L1TCommon/scripts/testL1T.pl
Expand Up @@ -241,7 +241,7 @@ sub test_reemul {
if ($SLOW) {$nevt = 1000; }

if (! $RECYCLE){
$status = long_command("cmsDriver.py L1TEST $PYTHON_OPT -s RAW2DIGI --era=Run2_2016 --customise=L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAW2015 --customise=L1Trigger/L1TNtuples/customiseL1Ntuple.L1NtupleEMU --customise=L1Trigger/Configuration/customiseUtils.L1TTurnOffUnpackStage2GtGmtAndCalo $COND_DATA_2015 -n $nevt --data --no_exec --no_output --filein=$file --geometry=Extended2016,Extended2016Reco --customise=L1Trigger/Configuration/customiseReEmul.L1TEventSetupForHF1x1TPs --customise=L1Trigger/Configuration/customiseUtils.L1TGlobalSimDigisSummary --customise=L1Trigger/Configuration/customiseUtils.L1TAddInfoOutput >& CMSDRIVER.log");
$status = long_command("cmsDriver.py L1TEST $PYTHON_OPT -s RAW2DIGI --era=Run2_2016 --customise=L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAW2015 --customise=L1Trigger/L1TNtuples/customiseL1Ntuple.L1NtupleEMU $COND_DATA_2015 -n $nevt --data --no_exec --no_output --filein=$file --geometry=Extended2016,Extended2016Reco --customise=L1Trigger/Configuration/customiseReEmul.L1TEventSetupForHF1x1TPs --customise=L1Trigger/Configuration/customiseUtils.L1TGlobalSimDigisSummary --customise=L1Trigger/Configuration/customiseUtils.L1TAddInfoOutput >& CMSDRIVER.log");

print "INFO: status of cmsDriver call is $status\n";
if ($status){
Expand Down

0 comments on commit 7abe827

Please sign in to comment.