CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1TMP7ZeroSupp.cc
Go to the documentation of this file.
2 
3 const unsigned int L1TMP7ZeroSupp::maxMasks_ = 16;
4 
6  : fedDataToken_(consumes<FEDRawDataCollection>(ps.getParameter<edm::InputTag>("rawData"))),
7  zsEnabled_(ps.getUntrackedParameter<bool>("zsEnabled")),
8  fedIds_(ps.getParameter<std::vector<int>>("fedIds")),
9  slinkHeaderSize_(ps.getUntrackedParameter<int>("lenSlinkHeader")),
10  slinkTrailerSize_(ps.getUntrackedParameter<int>("lenSlinkTrailer")),
11  amc13HeaderSize_(ps.getUntrackedParameter<int>("lenAMC13Header")),
12  amc13TrailerSize_(ps.getUntrackedParameter<int>("lenAMC13Trailer")),
13  amcHeaderSize_(ps.getUntrackedParameter<int>("lenAMCHeader")),
14  amcTrailerSize_(ps.getUntrackedParameter<int>("lenAMCTrailer")),
15  newZsFlagMask_(ps.getUntrackedParameter<int>("newZsFlagMask")),
16  zsFlagMask_(ps.getUntrackedParameter<int>("zsFlagMask")),
17  dataInvFlagMask_(ps.getUntrackedParameter<int>("dataInvFlagMask")),
18  maxFedReadoutSize_(ps.getUntrackedParameter<int>("maxFEDReadoutSize")),
19  checkOnlyCapIdsWithMasks_(ps.getUntrackedParameter<bool>("checkOnlyCapIdsWithMasks")),
20  monitorDir_(ps.getUntrackedParameter<std::string>("monitorDir")),
21  verbose_(ps.getUntrackedParameter<bool>("verbose")) {
22  std::vector<int> onesMask(6, 0xffffffff);
23  masks_.reserve(maxMasks_);
24  for (unsigned int i = 0; i < maxMasks_; ++i) {
25  std::string maskCapIdStr{"maskCapId" + std::to_string(i)};
26  masks_.push_back(ps.getUntrackedParameter<std::vector<int>>(maskCapIdStr, onesMask));
27  // which masks are defined?
28  if (ps.exists(maskCapIdStr)) {
29  definedMaskCapIds_.push_back(i);
30  }
31  }
32  if (verbose_) {
33  // check masks
34  std::cout << "masks" << std::endl;
35  for (unsigned int i = 0; i < maxMasks_; ++i) {
36  std::cout << "caption ID" << i << ":" << std::endl;
37  for (const auto& maskIt : masks_.at(i)) {
38  std::cout << std::hex << std::setw(8) << std::setfill('0') << maskIt << std::dec << std::endl;
39  }
40  }
41  std::cout << "----------" << std::endl;
42  }
43 }
44 
46 
49  desc.add<edm::InputTag>("rawData");
50  desc.add<std::vector<int>>("fedIds")->setComment("FED ids to analyze.");
51  desc.addUntracked<bool>("zsEnabled", true)->setComment("MP7 zero suppression is enabled.");
52  desc.addUntracked<int>("lenSlinkHeader", 8)->setComment("Number of Slink header bytes.");
53  desc.addUntracked<int>("lenSlinkTrailer", 8)->setComment("Number of Slink trailer bytes.");
54  desc.addUntracked<int>("lenAMC13Header", 8)->setComment("Number of AMC13 header bytes.");
55  desc.addUntracked<int>("lenAMC13Trailer", 8)->setComment("Number of AMC13 trailer bytes.");
56  desc.addUntracked<int>("lenAMCHeader", 8)->setComment("Number of AMC header bytes.");
57  desc.addUntracked<int>("lenAMCTrailer", 0)->setComment("Number of AMC trailer bytes.");
58  desc.addUntracked<int>("zsFlagMask", 0x1)->setComment("Zero suppression flag mask.");
59  desc.addUntracked<int>("newZsFlagMask", 0x2)->setComment("Per-BX zero suppression flag mask.");
60  desc.addUntracked<int>("dataInvFlagMask", 0x1)->setComment("Data inversion flag mask.");
61  desc.addUntracked<int>("maxFEDReadoutSize", 10000)->setComment("Maximal FED readout size histogram x-axis value.");
62  for (unsigned int i = 0; i < maxMasks_; ++i) {
63  desc.addOptionalUntracked<std::vector<int>>("maskCapId" + std::to_string(i))
64  ->setComment("ZS mask for caption id " + std::to_string(i) + ".");
65  }
66  desc.addUntracked<bool>("checkOnlyCapIdsWithMasks", true)
67  ->setComment("Check only blocks that have a CapId for which a mask is defined.");
68  desc.addUntracked<std::string>("monitorDir", "")
69  ->setComment("Target directory in the DQM file. Will be created if not existing.");
70  desc.addUntracked<bool>("verbose", false);
71  descriptions.add("l1tMP7ZeroSupp", desc);
72 }
73 
75  // overall summary
78  capIds_ = ibooker.book1D("capIds", "Caption ids found in data", maxMasks_, 0, maxMasks_);
79  capIds_->setAxisTitle("caption id", 1);
80 
81  // per caption id subdirectories
82  for (const auto& id : definedMaskCapIds_) {
83  ibooker.setCurrentFolder(monitorDir_ + "/CapId" + std::to_string(id));
84  bookCapIdHistograms(ibooker, id);
85  }
86 }
87 
88 void L1TMP7ZeroSupp::bookCapIdHistograms(DQMStore::IBooker& ibooker, const unsigned int& id) {
89  std::string summaryTitleText = "Zero suppression validation summary";
90  std::string sizeTitleText;
91  if (id == maxMasks_) {
92  sizeTitleText = "FED readout ";
93  } else {
94  summaryTitleText = summaryTitleText + ", caption id " + std::to_string(id);
95  sizeTitleText = "cumulated caption id " + std::to_string(id) + " block ";
96  }
97 
98  zeroSuppValMap_[id] = ibooker.book1D("zeroSuppVal", summaryTitleText, (int)NBINLABELS, 0, (int)NBINLABELS);
99  zeroSuppValMap_[id]->setAxisTitle("ZS status", 1);
100  zeroSuppValMap_[id]->setBinLabel(EVTS + 1, "events", 1);
101  zeroSuppValMap_[id]->setBinLabel(EVTSGOOD + 1, "good events", 1);
102  zeroSuppValMap_[id]->setBinLabel(EVTSBAD + 1, "bad events", 1);
103  zeroSuppValMap_[id]->setBinLabel(BLOCKS + 1, "blocks", 1);
104  zeroSuppValMap_[id]->setBinLabel(ZSBLKSGOOD + 1, "good blocks", 1);
105  zeroSuppValMap_[id]->setBinLabel(ZSBLKSBAD + 1, "bad blocks", 1);
106  zeroSuppValMap_[id]->setBinLabel(ZSBLKSBADFALSEPOS + 1, "false pos.", 1);
107  zeroSuppValMap_[id]->setBinLabel(ZSBLKSBADFALSENEG + 1, "false neg.", 1);
108  zeroSuppValMap_[id]->setBinLabel(BXBLOCKS + 1, "BX blocks", 1);
109  zeroSuppValMap_[id]->setBinLabel(ZSBXBLKSGOOD + 1, "good BX blocks", 1);
110  zeroSuppValMap_[id]->setBinLabel(ZSBXBLKSBAD + 1, "bad BX blocks", 1);
111  zeroSuppValMap_[id]->setBinLabel(ZSBXBLKSBADFALSEPOS + 1, "BX false pos.", 1);
112  zeroSuppValMap_[id]->setBinLabel(ZSBXBLKSBADFALSENEG + 1, "BX false neg.", 1);
113 
114  errorSummaryNumMap_[id] = ibooker.book1D("errorSummaryNum", summaryTitleText, (int)RNBINLABELS, 0, (int)RNBINLABELS);
115  errorSummaryNumMap_[id]->setBinLabel(REVTS + 1, "bad events", 1);
116  errorSummaryNumMap_[id]->setBinLabel(RBLKS + 1, "bad blocks", 1);
117  errorSummaryNumMap_[id]->setBinLabel(RBLKSFALSEPOS + 1, "false pos.", 1);
118  errorSummaryNumMap_[id]->setBinLabel(RBLKSFALSENEG + 1, "false neg.", 1);
119  errorSummaryNumMap_[id]->setBinLabel(RBXBLKS + 1, "bad BX blocks", 1);
120  errorSummaryNumMap_[id]->setBinLabel(RBXBLKSFALSEPOS + 1, "BX false pos.", 1);
121  errorSummaryNumMap_[id]->setBinLabel(RBXBLKSFALSENEG + 1, "BX false neg.", 1);
122 
123  errorSummaryDenMap_[id] = ibooker.book1D("errorSummaryDen", "denominators", (int)RNBINLABELS, 0, (int)RNBINLABELS);
124  errorSummaryDenMap_[id]->setBinLabel(REVTS + 1, "# events", 1);
125  errorSummaryDenMap_[id]->setBinLabel(RBLKS + 1, "# blocks", 1);
126  errorSummaryDenMap_[id]->setBinLabel(RBLKSFALSEPOS + 1, "# blocks", 1);
127  errorSummaryDenMap_[id]->setBinLabel(RBLKSFALSENEG + 1, "# blocks", 1);
128  errorSummaryDenMap_[id]->setBinLabel(RBXBLKS + 1, "# BX blocks", 1);
129  errorSummaryDenMap_[id]->setBinLabel(RBXBLKSFALSEPOS + 1, "# BX blocks", 1);
130  errorSummaryDenMap_[id]->setBinLabel(RBXBLKSFALSENEG + 1, "# BX blocks", 1);
131  // Setting canExtend to false is needed to get the correct behaviour when running multithreaded.
132  // Otherwise, when merging the histgrams of the threads, TH1::Merge sums bins that have the same label in one bin.
133  // This needs to come after the calls to setBinLabel.
134  errorSummaryDenMap_[id]->getTH1F()->GetXaxis()->SetCanExtend(false);
135 
136  readoutSizeNoZSMap_[id] = ibooker.book1D("readoutSize", sizeTitleText + "size", 100, 0, maxFedReadoutSize_);
137  readoutSizeNoZSMap_[id]->setAxisTitle("size (byte)", 1);
139  ibooker.book1D("readoutSizeZS", sizeTitleText + "size with zero suppression", 100, 0, maxFedReadoutSize_);
140  readoutSizeZSMap_[id]->setAxisTitle("size (byte)", 1);
142  "readoutSizeZSExpected", "Expected " + sizeTitleText + "size with zero suppression", 100, 0, maxFedReadoutSize_);
143  readoutSizeZSExpectedMap_[id]->setAxisTitle("size (byte)", 1);
144 }
145 
147  if (verbose_)
148  edm::LogInfo("L1TDQM") << "L1TMP7ZeroSupp: analyze..." << std::endl;
149 
151  e.getByToken(fedDataToken_, feds);
152 
153  if (!feds.isValid()) {
154  edm::LogError("L1TDQM") << "Cannot analyse: no FEDRawDataCollection found";
155  return;
156  }
157 
160  for (const auto& id : definedMaskCapIds_) {
161  zeroSuppValMap_[id]->Fill(EVTS);
162  errorSummaryDenMap_[id]->Fill(REVTS);
163  }
164 
165  std::map<unsigned int, bool> evtGood;
166  evtGood[maxMasks_] = true;
167  for (const auto& id : definedMaskCapIds_) {
168  evtGood[id] = true;
169  }
170  unsigned valid_count = 0;
171  for (const auto& fedId : fedIds_) {
172  const FEDRawData& l1tRcd = feds->FEDData(fedId);
173 
174  unsigned int fedDataSize = l1tRcd.size();
175  std::map<unsigned int, unsigned int> readoutSizeNoZSMap;
176  std::map<unsigned int, unsigned int> readoutSizeZSMap;
177  std::map<unsigned int, unsigned int> readoutSizeZSExpectedMap;
178  readoutSizeNoZSMap[maxMasks_] = 0;
179  readoutSizeZSMap[maxMasks_] = 0;
180  readoutSizeZSExpectedMap[maxMasks_] = 0;
181  for (const auto& id : definedMaskCapIds_) {
182  readoutSizeNoZSMap[id] = 0;
183  readoutSizeZSMap[id] = 0;
184  readoutSizeZSExpectedMap[id] = 0;
185  }
186 
187  edm::LogInfo("L1TDQM") << "Found FEDRawDataCollection with ID " << fedId << " and size " << l1tRcd.size();
188 
191  if (l1tRcd.size() > 0) {
192  edm::LogError("L1TDQM") << "Cannot analyse: invalid L1T raw data (size = " << l1tRcd.size() << ") for ID "
193  << fedId << ".";
194  }
195  continue;
196  } else {
197  valid_count++;
198  }
199 
200  const unsigned char* data = l1tRcd.data();
201  FEDHeader header(data);
202 
203  if (header.check()) {
204  edm::LogInfo("L1TDQM") << "Found SLink header:"
205  << " Trigger type " << header.triggerType() << " L1 event ID " << header.lvl1ID()
206  << " BX Number " << header.bxID() << " FED source " << header.sourceID() << " FED version "
207  << header.version();
208  } else {
209  edm::LogWarning("L1TDQM") << "Did not find a SLink header!";
210  }
211 
212  FEDTrailer trailer(data + (l1tRcd.size() - slinkTrailerSize_));
213 
214  if (trailer.check()) {
215  edm::LogInfo("L1TDQM") << "Found SLink trailer:"
216  << " Length " << trailer.fragmentLength() << " CRC " << trailer.crc() << " Status "
217  << trailer.evtStatus() << " Throttling bits " << trailer.ttsBits();
218  } else {
219  edm::LogWarning("L1TDQM") << "Did not find a SLink trailer!";
220  }
221 
222  amc13::Packet packet;
223  if (!packet.parse((const uint64_t*)data,
224  (const uint64_t*)(data + slinkHeaderSize_),
225  (l1tRcd.size() - slinkHeaderSize_ - slinkTrailerSize_) / 8,
226  header.lvl1ID(),
227  header.bxID())) {
228  edm::LogError("L1TDQM") << "Could not extract AMC13 Packet.";
229  return;
230  }
231 
232  for (auto& amc : packet.payload()) {
233  if (amc.size() == 0)
234  continue;
235 
236  auto payload64 = amc.data();
237  auto start = (const uint32_t*)payload64.get();
238  // Want to have payload size in 32 bit words, but AMC measures
239  // it in 64 bit words -> factor 2.
240  const uint32_t* end = start + (amc.size() * 2);
241 
242  auto payload = std::make_unique<l1t::MP7Payload>(start, end, false);
243 
244  // getBlock() returns a non-null unique_ptr on success
245  std::unique_ptr<l1t::Block> block;
246  while ((block = payload->getBlock()) != nullptr) {
247  if (verbose_) {
248  std::cout << ">>> check zero suppression for block <<<" << std::endl
249  << "hdr: " << std::hex << std::setw(8) << std::setfill('0') << block->header().raw() << std::dec
250  << " (ID " << block->header().getID() << ", size " << block->header().getSize() << ", CapID 0x"
251  << std::hex << std::setw(2) << std::setfill('0') << block->header().getCapID() << ", flags 0x"
252  << std::hex << std::setw(2) << std::setfill('0') << block->header().getFlags() << ")" << std::dec
253  << std::endl;
254  for (const auto& word : block->payload()) {
255  std::cout << "data: " << std::hex << std::setw(8) << std::setfill('0') << word << std::dec << std::endl;
256  }
257  }
258 
259  unsigned int blockCapId = block->header().getCapID();
260  unsigned int blockSize = block->header().getSize() * 4; // times 4 to get the size in byte
261  unsigned int blockHeaderSize = sizeof(block->header().raw());
262  unsigned int blockHeaderFlags = block->header().getFlags();
263  bool newZsFlagSet = ((blockHeaderFlags & newZsFlagMask_) != 0); // use the per-BX ZS
264  bool blockZsFlagSet =
265  newZsFlagSet ? true : ((blockHeaderFlags & zsFlagMask_) != 0); // ZS validation flag for whole block
266  bool dataInvertFlagSet =
267  newZsFlagSet && ((blockHeaderFlags & dataInvFlagMask_) != 0); // invert the data before applying the mask
268 
269  capIds_->Fill(blockCapId);
270 
271  bool capIdDefined = false;
272  if (zeroSuppValMap_.find(blockCapId) != zeroSuppValMap_.end()) {
273  capIdDefined = true;
274  }
275 
276  // Only check blocks with a CapId that has a defined ZS mask.
277  if (checkOnlyCapIdsWithMasks_ and not capIdDefined) {
278  continue;
279  }
280 
281  // fill the denominator histograms
286  if (capIdDefined) {
287  zeroSuppValMap_[blockCapId]->Fill(BLOCKS);
288  errorSummaryDenMap_[blockCapId]->Fill(RBLKS);
289  errorSummaryDenMap_[blockCapId]->Fill(RBLKSFALSEPOS);
290  errorSummaryDenMap_[blockCapId]->Fill(RBLKSFALSENEG);
291  }
292 
293  auto totalBlockSize = blockHeaderSize;
294  if (!newZsFlagSet) {
295  totalBlockSize += blockSize;
296  }
297  auto totalBlockSizeExpected = totalBlockSize;
298  auto totalBlockSizeNoZS = blockHeaderSize + blockSize;
299 
300  auto bxBlocks = block->getBxBlocks(6, newZsFlagSet); // 6 32 bit MP7 payload words per BX
301 
302  // check all BX blocks
303  bool allToSuppress = true;
304  for (const auto& bxBlock : bxBlocks) {
305  bool toSuppress = false;
306  bool bxZsFlagSet = ((bxBlock.header().getFlags() & zsFlagMask_) != 0); // ZS validation flag
307 
308  // check if this bxblock should be suppressed
309  unsigned int wordcounter = 0;
310  unsigned int wordsum = 0;
311  for (const auto& word : bxBlock.payload()) {
312  if (dataInvertFlagSet) {
313  wordsum += masks_[blockCapId].at(wordcounter % 6) & (~word);
314  } else {
315  wordsum += masks_[blockCapId].at(wordcounter % 6) & word;
316  }
317  if (verbose_) {
318  std::cout << "word: " << std::hex << std::setw(8) << std::setfill('0') << word << std::dec << ", maskword"
319  << wordcounter % 6 << ": " << std::hex << std::setw(8) << std::setfill('0')
320  << masks_[blockCapId].at(wordcounter % 6) << std::dec << ", wordsum: " << wordsum << std::endl;
321  }
322  if (wordsum > 0) {
323  if (verbose_) {
324  std::cout << "wordsum not 0: this BX block should be kept" << std::endl;
325  }
326  break;
327  }
328  ++wordcounter;
329  }
330  // the sum of payload words must be 0 for correct ZS
331  if (wordsum == 0 && zsEnabled_) {
332  toSuppress = true;
333  if (verbose_) {
334  std::cout << "wordsum == 0: this BX block should be zero suppressed" << std::endl;
335  }
336  }
337  // update the overall block status
338  allToSuppress = allToSuppress && toSuppress;
339 
340  // only fill the BX related things for the per-BX ZS
341  if (newZsFlagSet) {
342  // the ZS flag of the block is the AND of all BX block ZS flags
343  blockZsFlagSet = blockZsFlagSet && bxZsFlagSet;
344 
345  // fill the BX related bins of the denominator histogram
350  if (capIdDefined) {
351  zeroSuppValMap_[blockCapId]->Fill(BXBLOCKS);
352  errorSummaryDenMap_[blockCapId]->Fill(RBXBLKS);
353  errorSummaryDenMap_[blockCapId]->Fill(RBXBLKSFALSEPOS);
354  errorSummaryDenMap_[blockCapId]->Fill(RBXBLKSFALSENEG);
355  }
356 
357  unsigned int totalBxBlockSize =
358  bxBlock.getSize() * 4 + sizeof(bxBlock.header().raw()); // times 4 to get the size in byte
359  // check if zero suppression flag agrees for the BX block
360  if (toSuppress && bxZsFlagSet) {
361  if (verbose_)
362  std::cout << "GOOD BX block with ZS flag true" << std::endl;
364  if (capIdDefined) {
365  zeroSuppValMap_[blockCapId]->Fill(ZSBXBLKSGOOD);
366  }
367  } else if (!toSuppress && !bxZsFlagSet) {
368  if (verbose_)
369  std::cout << "GOOD BX block with ZS flag false" << std::endl;
370  totalBlockSize += totalBxBlockSize;
371  totalBlockSizeExpected += totalBxBlockSize;
373  if (capIdDefined) {
374  zeroSuppValMap_[blockCapId]->Fill(ZSBXBLKSGOOD);
375  }
376  } else if (!toSuppress && bxZsFlagSet) {
377  if (verbose_)
378  std::cout << "BAD BX block with ZS flag true" << std::endl;
379  totalBlockSizeExpected += totalBxBlockSize;
384  evtGood[maxMasks_] = false;
385  if (capIdDefined) {
386  zeroSuppValMap_[blockCapId]->Fill(ZSBXBLKSBAD);
387  zeroSuppValMap_[blockCapId]->Fill(ZSBXBLKSBADFALSEPOS);
388  errorSummaryNumMap_[blockCapId]->Fill(RBXBLKS);
389  errorSummaryNumMap_[blockCapId]->Fill(RBXBLKSFALSEPOS);
390  evtGood[blockCapId] = false;
391  }
392  } else {
393  if (verbose_)
394  std::cout << "BAD BX block with ZS flag false" << std::endl;
395  totalBlockSize += totalBxBlockSize;
400  evtGood[maxMasks_] = false;
401  if (capIdDefined) {
402  zeroSuppValMap_[blockCapId]->Fill(ZSBXBLKSBAD);
403  zeroSuppValMap_[blockCapId]->Fill(ZSBXBLKSBADFALSENEG);
404  errorSummaryNumMap_[blockCapId]->Fill(RBXBLKS);
405  errorSummaryNumMap_[blockCapId]->Fill(RBXBLKSFALSENEG);
406  evtGood[blockCapId] = false;
407  }
408  }
409  }
410  }
411 
412  readoutSizeNoZSMap[maxMasks_] += totalBlockSizeNoZS;
413  if (capIdDefined) {
414  readoutSizeNoZSMap[blockCapId] += totalBlockSizeNoZS;
415  }
416 
417  // check if zero suppression flag agrees for the whole block
418  if (allToSuppress && blockZsFlagSet) {
419  if (verbose_)
420  std::cout << "GOOD block with ZS flag true" << std::endl;
422  if (capIdDefined) {
423  zeroSuppValMap_[blockCapId]->Fill(ZSBLKSGOOD);
424  }
425  } else if (!allToSuppress && !blockZsFlagSet) {
426  if (verbose_)
427  std::cout << "GOOD block with ZS flag false" << std::endl;
429  readoutSizeZSMap[maxMasks_] += totalBlockSize;
430  readoutSizeZSExpectedMap[maxMasks_] += totalBlockSizeExpected;
431  if (capIdDefined) {
432  zeroSuppValMap_[blockCapId]->Fill(ZSBLKSGOOD);
433  readoutSizeZSMap[blockCapId] += totalBlockSize;
434  readoutSizeZSExpectedMap[blockCapId] += totalBlockSizeExpected;
435  }
436  } else if (!allToSuppress && blockZsFlagSet) {
437  if (verbose_)
438  std::cout << "BAD block with ZS flag true" << std::endl;
443  readoutSizeZSExpectedMap[maxMasks_] += totalBlockSizeExpected;
444  evtGood[maxMasks_] = false;
445  if (capIdDefined) {
446  zeroSuppValMap_[blockCapId]->Fill(ZSBLKSBAD);
447  zeroSuppValMap_[blockCapId]->Fill(ZSBLKSBADFALSEPOS);
448  errorSummaryNumMap_[blockCapId]->Fill(RBLKS);
449  errorSummaryNumMap_[blockCapId]->Fill(RBLKSFALSEPOS);
450  readoutSizeZSExpectedMap[blockCapId] += totalBlockSizeExpected;
451  evtGood[blockCapId] = false;
452  }
453  } else {
454  if (verbose_)
455  std::cout << "BAD block with ZS flag false" << std::endl;
460  readoutSizeZSMap[maxMasks_] += totalBlockSize;
461  evtGood[maxMasks_] = false;
462  if (capIdDefined) {
463  zeroSuppValMap_[blockCapId]->Fill(ZSBLKSBAD);
464  zeroSuppValMap_[blockCapId]->Fill(ZSBLKSBADFALSENEG);
465  errorSummaryNumMap_[blockCapId]->Fill(RBLKS);
466  errorSummaryNumMap_[blockCapId]->Fill(RBLKSFALSENEG);
467  readoutSizeZSMap[blockCapId] += totalBlockSize;
468  evtGood[blockCapId] = false;
469  }
470  }
471  }
472  }
473  if (verbose_) {
474  std::cout << "FED data size: " << fedDataSize << " bytes" << std::endl;
475  std::cout << "Payload size no ZS: " << readoutSizeNoZSMap[maxMasks_] << " bytes" << std::endl;
476  std::cout << "Payload size ZS: " << readoutSizeZSMap[maxMasks_] << " bytes" << std::endl;
477  std::cout << "Payload size expected ZS: " << readoutSizeZSExpectedMap[maxMasks_] << " bytes" << std::endl;
478  std::cout << "Filled readout size ZS with headers: "
479  << readoutSizeZSMap[maxMasks_] + fedDataSize - readoutSizeNoZSMap[maxMasks_] << " bytes" << std::endl;
480  std::cout << "Filled expected readout size ZS with headers: "
481  << readoutSizeZSExpectedMap[maxMasks_] + fedDataSize - readoutSizeNoZSMap[maxMasks_] << " bytes"
482  << std::endl;
483  }
484  readoutSizeNoZSMap_[maxMasks_]->Fill(fedDataSize);
485  readoutSizeZSMap_[maxMasks_]->Fill(readoutSizeZSMap[maxMasks_] + fedDataSize - readoutSizeNoZSMap[maxMasks_]);
486  readoutSizeZSExpectedMap_[maxMasks_]->Fill(readoutSizeZSExpectedMap[maxMasks_] + fedDataSize -
487  readoutSizeNoZSMap[maxMasks_]);
488  for (const auto& id : definedMaskCapIds_) {
489  readoutSizeNoZSMap_[id]->Fill(readoutSizeNoZSMap[id]);
490  readoutSizeZSMap_[id]->Fill(readoutSizeZSMap[id]);
491  readoutSizeZSExpectedMap_[id]->Fill(readoutSizeZSExpectedMap[id]);
492  }
493  }
494 
495  if (evtGood[maxMasks_]) {
497  } else {
500  }
501  for (const auto& id : definedMaskCapIds_) {
502  if (evtGood[id]) {
503  zeroSuppValMap_[id]->Fill(EVTSGOOD);
504  } else {
505  zeroSuppValMap_[id]->Fill(EVTSBAD);
506  errorSummaryNumMap_[id]->Fill(REVTS);
507  }
508  }
509 }
std::vector< amc::Packet > payload() const
Definition: AMC13Spec.h:92
std::map< unsigned int, MonitorElement * > readoutSizeZSExpectedMap_
T getUntrackedParameter(std::string const &, T const &) const
const edm::EventSetup & c
std::map< unsigned int, MonitorElement * > zeroSuppValMap_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
uint16_t *__restrict__ id
uint8_t triggerType() const
Event Trigger type identifier.
Definition: FEDHeader.cc:13
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::map< unsigned int, MonitorElement * > readoutSizeNoZSMap_
bool check() const
Check that the header is OK.
Definition: FEDHeader.cc:44
L1TMP7ZeroSupp(const edm::ParameterSet &ps)
bool exists(std::string const &parameterName) const
checks if a parameter exists
uint16_t sourceID() const
Identifier of the FED.
Definition: FEDHeader.cc:19
std::string monitorDir_
uint16_t crc() const
Cyclic Redundancy Code of the event fragment including header and trailer.
Definition: FEDTrailer.cc:15
std::string to_string(const V &value)
Definition: OMSAccess.h:71
bool check() const
Check that the trailer is OK.
Definition: FEDTrailer.cc:45
uint8_t version() const
Version identifier of the FED data format.
Definition: FEDHeader.cc:21
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Log< level::Error, false > LogError
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
Definition: FEDTrailer.cc:13
void bookCapIdHistograms(DQMStore::IBooker &ibooker, const unsigned int &id)
std::map< unsigned int, MonitorElement * > errorSummaryNumMap_
void Fill(long long x)
std::vector< unsigned int > definedMaskCapIds_
uint64_t word
MonitorElement * capIds_
double amc
Definition: hdecay.h:20
std::map< unsigned int, MonitorElement * > errorSummaryDenMap_
std::vector< std::vector< int > > masks_
static const unsigned int maxMasks_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:70
Log< level::Info, false > LogInfo
uint8_t ttsBits() const
Current value of the Trigger Throttling System bits.
Definition: FEDTrailer.cc:19
unsigned long long uint64_t
Definition: Time.h:13
bool parse(const uint64_t *start, const uint64_t *data, unsigned int size, unsigned int lv1, unsigned int bx, bool legacy_mc=false, bool mtf7_mode=false)
Definition: AMC13Spec.cc:60
uint8_t evtStatus() const
Event fragment status information.
Definition: FEDTrailer.cc:17
void add(std::string const &label, ParameterSetDescription const &psetDescription)
~L1TMP7ZeroSupp() override
uint16_t bxID() const
The bunch crossing number.
Definition: FEDHeader.cc:17
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
string end
Definition: dataset.py:937
std::vector< int > fedIds_
tuple cout
Definition: gather_cfg.py:144
ParameterDescriptionBase * addOptionalUntracked(U const &iLabel, T const &value)
uint32_t lvl1ID() const
Level-1 event number generated by the TTC system.
Definition: FEDHeader.cc:15
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::map< unsigned int, MonitorElement * > readoutSizeZSMap_
bool checkOnlyCapIdsWithMasks_
Definition: Run.h:45
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)