diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GlobalAlgBlkUnpacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GlobalAlgBlkUnpacker.cc index f057000ab55f7..35205c27d6474 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GlobalAlgBlkUnpacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GlobalAlgBlkUnpacker.cc @@ -40,6 +40,12 @@ namespace l1t { // Loop over multiple BX and then number of EG cands filling collection int numBX = 0; //positive int to count BX for (int bx = firstBX; bx <= lastBX; bx++) { + // Check to make sure that we are receiving the first expected header here + // If we are not, throw a more informative error than the failure of the following "at->" call + if (res_->size(bx) == 0 and block.header().getID() != initialBlkID) + throw( + std::runtime_error("The GlobalAlgBlk unpacker result vector is size 0, but is not receiving the first " + "expected header ID! This may be due to corrupted, or poorly formatted events.")); // If this is the first block on first board, instantiate GlobalAlg so it is there to fill from mult. blocks if (block.header().getID() == initialBlkID && uGTBoard == 0) { LogDebug("L1T") << "Creating GT Algorithm Block for BX =" << bx << std::endl;