CMS 3D CMS Logo

CSCDCCUnpacker.cc
Go to the documentation of this file.
1 
7 //Framework stuff
21 
26 
27 //FEDRawData
30 
31 //Digi stuff
32 
51 
57 
58 #include <iostream>
59 #include <sstream>
60 #include <string>
61 #include <iomanip>
62 #include <cstdio>
63 
65 
67 public:
70 
72  ~CSCDCCUnpacker() override;
73 
74  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
75 
77  void produce(edm::Event& e, const edm::EventSetup& c) override;
78 
80  void visual_raw(int hl, int id, int run, int event, bool fedshort, bool fDump, short unsigned int* buf) const;
81 
82 private:
85 
87  bool useGEMs_;
88 
91 
96 
98  unsigned int errorMask, examinerMask;
101 
106 };
107 
109  // Tracked
110  i_token = consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("InputObjects"));
111  crateToken = esConsumes<CSCCrateMap, CSCCrateMapRcd>();
112  cscmapToken = esConsumes<CSCChamberMap, CSCChamberMapRcd>();
113 
114  useExaminer = pset.getParameter<bool>("UseExaminer");
115  examinerMask = pset.getParameter<unsigned int>("ExaminerMask");
117  useSelectiveUnpacking = pset.getParameter<bool>("UseSelectiveUnpacking");
118  errorMask = pset.getParameter<unsigned int>("ErrorMask");
119  unpackStatusDigis = pset.getParameter<bool>("UnpackStatusDigis");
121  useFormatStatus = pset.getParameter<bool>("UseFormatStatus");
122 
123  useGEMs_ = pset.getParameter<bool>("useGEMs");
124  useCSCShowers_ = pset.getParameter<bool>("useCSCShowers");
125 
126  // Untracked
127  printEventNumber = pset.getUntrackedParameter<bool>("PrintEventNumber", true);
128  debug = pset.getUntrackedParameter<bool>("Debug", false);
129  instantiateDQM = pset.getUntrackedParameter<bool>("runDQM", false);
130 
132  visualFEDInspect = pset.getUntrackedParameter<bool>("VisualFEDInspect", false);
133  visualFEDShort = pset.getUntrackedParameter<bool>("VisualFEDShort", false);
134  formatedEventDump = pset.getUntrackedParameter<bool>("FormatedEventDump", false);
135 
137  SuppressZeroLCT = pset.getUntrackedParameter<bool>("SuppressZeroLCT", true);
138 
139  if (instantiateDQM) {
141  }
142 
143  produces<CSCWireDigiCollection>("MuonCSCWireDigi");
144  produces<CSCStripDigiCollection>("MuonCSCStripDigi");
145  produces<CSCComparatorDigiCollection>("MuonCSCComparatorDigi");
146  produces<CSCALCTDigiCollection>("MuonCSCALCTDigi");
147  produces<CSCCLCTDigiCollection>("MuonCSCCLCTDigi");
148  produces<CSCRPCDigiCollection>("MuonCSCRPCDigi");
149  produces<CSCCorrelatedLCTDigiCollection>("MuonCSCCorrelatedLCTDigi");
150 
151  if (unpackStatusDigis) {
152  produces<CSCCFEBStatusDigiCollection>("MuonCSCCFEBStatusDigi");
153  produces<CSCTMBStatusDigiCollection>("MuonCSCTMBStatusDigi");
154  produces<CSCDMBStatusDigiCollection>("MuonCSCDMBStatusDigi");
155  produces<CSCALCTStatusDigiCollection>("MuonCSCALCTStatusDigi");
156  produces<CSCDDUStatusDigiCollection>("MuonCSCDDUStatusDigi");
157  produces<CSCDCCStatusDigiCollection>("MuonCSCDCCStatusDigi");
158  }
159 
160  if (useFormatStatus) {
161  produces<CSCDCCFormatStatusDigiCollection>("MuonCSCDCCFormatStatusDigi");
162  }
163 
164  if (useGEMs_) {
165  produces<GEMPadDigiClusterCollection>("MuonGEMPadDigiCluster");
166  }
167 
168  if (useCSCShowers_) {
169  produces<CSCShowerDigiCollection>("MuonCSCShowerDigi");
170  }
171 
172  //CSCAnodeData::setDebug(debug);
182 }
183 
185  //fill destructor here
186 }
187 
190  desc.add<edm::InputTag>("InputObjects", edm::InputTag("rawDataCollector"))
191  ->setComment("# Define input to the unpacker");
192  desc.add<bool>("UseExaminer", true)
193  ->setComment("# Use CSC examiner to check for corrupt or semi-corrupt data & avoid unpacker crashes");
194  desc.add<unsigned int>("ExaminerMask", 535557110)->setComment("# This mask is needed by the examiner");
195  desc.add<bool>("UseSelectiveUnpacking", true)
196  ->setComment("# Use Examiner to unpack good chambers and skip only bad ones");
197  desc.add<unsigned int>("ErrorMask", 0)->setComment("# This mask simply reduces error reporting");
198  desc.add<bool>("UnpackStatusDigis", false)->setComment("# Unpack general status digis?");
199  desc.add<bool>("UseFormatStatus", true)->setComment("# Unpack FormatStatus digi?");
200  desc.add<bool>("useGEMs", false)->setComment("Unpack GEM trigger data");
201  desc.add<bool>("useCSCShowers", false)->setComment("Unpack CSCShower trigger data");
202  desc.addUntracked<bool>("Debug", false)->setComment("# Turn on lots of output");
203  desc.addUntracked<bool>("PrintEventNumber", false);
204  desc.addUntracked<bool>("runDQM", false);
205  desc.addUntracked<bool>("VisualFEDInspect", false)->setComment("# Visualization of raw data in corrupted events");
206  desc.addUntracked<bool>("VisualFEDShort", false)->setComment("# Visualization of raw data in corrupted events");
207  desc.addUntracked<bool>("FormatedEventDump", false);
208  desc.addUntracked<bool>("SuppressZeroLCT", true);
209  descriptions.add("muonCSCDCCUnpacker", desc);
210  descriptions.setComment(" This is the generic cfi file for CSC unpacking");
211 }
212 
215  // Do we really have to do this every event???
216  // ... Yes, because framework is more efficient than you are at caching :)
217  // (But if you want to actually DO something specific WHEN the mapping changes, check out ESWatcher)
218  edm::ESHandle<CSCCrateMap> hcrate = c.getHandle(crateToken);
219  const CSCCrateMap* pcrate = hcrate.product();
220 
221  // Need access to CSCChamberMap for chamber<->FED/DDU mapping consistency checks
223  const CSCChamberMap* cscmapping = cscmap.product();
224 
225  if (printEventNumber)
226  ++numOfEvents;
227 
230  e.getByToken(i_token, rawdata);
231 
233  auto wireProduct = std::make_unique<CSCWireDigiCollection>();
234  auto stripProduct = std::make_unique<CSCStripDigiCollection>();
235  auto alctProduct = std::make_unique<CSCALCTDigiCollection>();
236  auto clctProduct = std::make_unique<CSCCLCTDigiCollection>();
237  auto comparatorProduct = std::make_unique<CSCComparatorDigiCollection>();
238  auto rpcProduct = std::make_unique<CSCRPCDigiCollection>();
239  auto corrlctProduct = std::make_unique<CSCCorrelatedLCTDigiCollection>();
240  auto cfebStatusProduct = std::make_unique<CSCCFEBStatusDigiCollection>();
241  auto dmbStatusProduct = std::make_unique<CSCDMBStatusDigiCollection>();
242  auto tmbStatusProduct = std::make_unique<CSCTMBStatusDigiCollection>();
243  auto dduStatusProduct = std::make_unique<CSCDDUStatusDigiCollection>();
244  auto dccStatusProduct = std::make_unique<CSCDCCStatusDigiCollection>();
245  auto alctStatusProduct = std::make_unique<CSCALCTStatusDigiCollection>();
246 
247  auto formatStatusProduct = std::make_unique<CSCDCCFormatStatusDigiCollection>();
248 
249  auto gemProduct = std::make_unique<GEMPadDigiClusterCollection>();
250 
251  auto showerProduct = std::make_unique<CSCShowerDigiCollection>();
252 
253  // If set selective unpacking mode
254  // hardcoded examiner mask below to check for DCC and DDU level errors will be used first
255  // then examinerMask for CSC level errors will be used during unpacking of each CSC block
256  unsigned long dccBinCheckMask = 0x06080016;
257 
258  // Post-LS1 FED/DDU ID mapping fix
259  const unsigned postLS1_map[] = {841, 842, 843, 844, 845, 846, 847, 848, 849, 831, 832, 833,
260  834, 835, 836, 837, 838, 839, 861, 862, 863, 864, 865, 866,
261  867, 868, 869, 851, 852, 853, 854, 855, 856, 857, 858, 859};
262 
263  // For new CSC readout layout, which wont include DCCs need to loop over DDU FED IDs. DCC IDs are included for backward compatibility with old data
264  std::vector<unsigned int> cscFEDids;
265 
266  for (unsigned int id = FEDNumbering::MINCSCFEDID; id <= FEDNumbering::MAXCSCFEDID; ++id) // loop over DCCs
267  {
268  cscFEDids.push_back(id);
269  }
270 
271  for (unsigned int id = FEDNumbering::MINCSCDDUFEDID; id <= FEDNumbering::MAXCSCDDUFEDID; ++id) // loop over DDUs
272  {
273  cscFEDids.push_back(id);
274  }
275 
276  for (unsigned int i = 0; i < cscFEDids.size(); i++) // loop over all CSC FEDs (DCCs and DDUs)
277  {
278  unsigned int id = cscFEDids[i];
279  bool isDDU_FED = ((id >= FEDNumbering::MINCSCDDUFEDID) && (id <= FEDNumbering::MAXCSCDDUFEDID)) ? true : false;
280 
283 
285  const FEDRawData& fedData = rawdata->FEDData(id);
286  unsigned long length = fedData.size();
287 
288  if (length >= 32)
289  {
290  CSCDCCExaminer* examiner = nullptr;
291  goodEvent = true;
292  if (useExaminer)
293  {
294  // CSCDCCExaminer examiner;
295  examiner = new CSCDCCExaminer();
296  if (examinerMask & 0x40000)
297  examiner->crcCFEB(true);
298  if (examinerMask & 0x8000)
299  examiner->crcTMB(true);
300  if (examinerMask & 0x0400)
301  examiner->crcALCT(true);
302  examiner->setMask(examinerMask);
303 
305  if (isDDU_FED) {
306  if (examiner != nullptr)
307  examiner->modeDDU(true);
308  }
309 
310  const short unsigned int* data = (short unsigned int*)fedData.data();
311 
312  LogTrace("badData") << "Length: " << length / 2;
313  // Event data hex dump
314  /*
315  short unsigned * buf = (short unsigned int *)fedData.data();
316  std::cout <<std::endl<<length/2<<" words of data:"<<std::endl;
317  for (short unsigned int i=0;i<length/2;i++) {
318  printf("%04x %04x %04x %04x\n",buf[i+3],buf[i+2],buf[i+1],buf[i]);
319  i+=3;
320  }
321  */
322 
323  int res = examiner->check(data, long(fedData.size() / 2));
324  if (res < 0) {
325  goodEvent = false;
326  } else {
328  goodEvent = !(examiner->errors() & dccBinCheckMask);
329  else
330  goodEvent = !(examiner->errors() & examinerMask);
331  }
332 
333  /*
334  std::cout << "FED" << id << " " << fedData.size() << " " << goodEvent << " "
335  << std::hex << examiner->errors() << std::dec << " " << status << std::endl;
336  */
337 
338  // Fill Format status digis per FED
339  // Remove examiner->errors() != 0 check if we need to put status digis for every event
340  if (useFormatStatus && (examiner->errors() != 0))
341  // formatStatusProduct->insertDigi(CSCDetId(1,1,1,1,1), CSCDCCFormatStatusDigi(id,examiner,dccBinCheckMask));
342  formatStatusProduct->insertDigi(CSCDetId(1, 1, 1, 1, 1),
344  dccBinCheckMask,
345  examiner->getMask(),
346  examiner->errors(),
347  examiner->errorsDetailedDDU(),
348  examiner->errorsDetailed(),
349  examiner->payloadDetailed(),
350  examiner->statusDetailed()));
351  }
352 
355  if (!goodEvent || formatedEventDump) {
356  short unsigned* buf = (short unsigned int*)fedData.data();
357  visual_raw(length / 2, id, (int)e.id().run(), (int)e.id().event(), visualFEDShort, formatedEventDump, buf);
358  }
359  }
360 
361  if (goodEvent) {
363 
364  CSCDCCExaminer* ptrExaminer = examiner;
366  ptrExaminer = nullptr;
367 
368  std::vector<CSCDDUEventData> fed_Data;
369  std::vector<CSCDDUEventData>* ptr_fedData = &fed_Data;
370 
372  CSCDetId layer(1, 1, 1, 1, 1);
373 
374  if (isDDU_FED) // Use new DDU FED readout mode
375  {
376  CSCDDUEventData single_dduData((short unsigned int*)fedData.data(), ptrExaminer);
377  fed_Data.push_back(single_dduData);
378 
379  // if(instantiateDQM) monitor->process(examiner, &single_dduData);
380 
381  } else // Use old DCC FED readout mode
382  {
383  CSCDCCEventData dccData((short unsigned int*)fedData.data(), ptrExaminer);
384 
385  //std::cout << " DCC Size [UNPK] " << dccData.sizeInWords() << std::endl;
386 
387  if (instantiateDQM)
388  monitor->process(examiner, &dccData);
389 
391  // const std::vector<CSCDDUEventData> & dduData = dccData.dduData();
392  // ptr_fedData = &(dccData.dduData());
393  fed_Data = dccData.dduData();
394 
395  if (unpackStatusDigis) {
397  short unsigned* bufForDcc = (short unsigned int*)fedData.data();
398 
399  //std::cout << "FED Length: " << std::dec << length/2 <<
400  //" Trailer 2: " << std::hex << bufForDcc[length/2-4] << std::endl;
401 
402  dccStatusProduct->insertDigi(layer,
403  CSCDCCStatusDigi(dccData.dccHeader().data(),
404  dccData.dccTrailer().data(),
405  examiner->errors(),
406  bufForDcc[length / 2 - 4]));
407  }
408  }
409 
410  const std::vector<CSCDDUEventData>& dduData = *ptr_fedData;
411 
412  for (unsigned int iDDU = 0; iDDU < dduData.size(); ++iDDU) // loop over DDUs
413  {
416  if (dduData[iDDU].trailer().errorstat() & errorMask) {
417  LogTrace("CSCDCCUnpacker|CSCRawToDigi")
418  << "FED ID" << id << " DDU# " << iDDU << " has serious error - no digis unpacked! " << std::hex
419  << dduData[iDDU].trailer().errorstat();
420  continue; // to next iteration of DDU loop
421  }
422 
423  if (unpackStatusDigis)
424  dduStatusProduct->insertDigi(
425  layer,
426  CSCDDUStatusDigi(dduData[iDDU].header().data(),
427  dduData[iDDU].trailer().data(),
429  dduData[iDDU].trailer0()));
430 
432  const std::vector<CSCEventData>& cscData = dduData[iDDU].cscData();
433 
434  // if (cscData.size() != 0) std::cout << "FED" << id << " DDU Source ID: " << dduData[iDDU].header().source_id() << " firmware version: " << dduData[iDDU].header().format_version() << std::endl;
435 
436  for (unsigned int iCSC = 0; iCSC < cscData.size(); ++iCSC) // loop over CSCs
437  {
439  int vmecrate = cscData[iCSC].dmbHeader()->crateID();
440  int dmb = cscData[iCSC].dmbHeader()->dmbID();
441 
442  int icfeb = 0;
443  int ilayer = 0;
444 
445  if (debug)
446  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "crate = " << vmecrate << "; dmb = " << dmb;
447 
448  if ((vmecrate >= 1) && (vmecrate <= 60) && (dmb >= 1) && (dmb <= 10) && (dmb != 6)) {
449  layer = pcrate->detId(vmecrate, dmb, icfeb, ilayer);
450  } else {
451  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << " detID input out of range!!! ";
452  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << " skipping chamber vme= " << vmecrate << " dmb= " << dmb;
453  continue; // to next iteration of iCSC loop
454  }
455 
458  if (isDDU_FED) {
459  unsigned int dduid = cscmapping->ddu(layer);
460  if ((dduid >= 1) && (dduid <= 36))
461  dduid = postLS1_map[dduid - 1]; // Fix for Post-LS1 FED/DDU IDs mappings
462  // std::cout << "CSC " << layer << " -> " << id << ":" << dduid << ":" << vmecrate << ":" << dmb ;
463  if (id != dduid) {
464  LogTrace("CSCDDUUnpacker|CSCRawToDigi") << " CSC->FED/DDU mapping inconsistency!!! ";
465  LogTrace("CSCDCCUnpacker|CSCRawToDigi")
466  << "readout FED/DDU ID=" << id << " expected ID=" << dduid << ", skipping chamber " << layer
467  << " vme= " << vmecrate << " dmb= " << dmb;
468  continue;
469  }
470  }
471 
473  int nalct = cscData[iCSC].dmbHeader()->nalct();
474  bool goodALCT = false;
475  //if (nalct&&(cscData[iCSC].dataPresent>>6&0x1)==1) {
476  if (nalct && cscData[iCSC].alctHeader()) {
477  if (cscData[iCSC].alctHeader()->check()) {
478  goodALCT = true;
479  } else {
480  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "not storing ALCT digis; alct is bad or not present";
481  }
482  } else {
483  if (debug)
484  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "nALCT==0 !!!";
485  }
486 
488  if (goodALCT) {
489  std::vector<CSCALCTDigi> alctDigis = cscData[iCSC].alctHeader()->ALCTDigis();
490  if (SuppressZeroLCT) {
491  std::vector<CSCALCTDigi> alctDigis_0;
492  for (int unsigned i = 0; i < alctDigis.size(); ++i) {
493  if (alctDigis[i].isValid())
494  alctDigis_0.push_back(alctDigis[i]);
495  }
496  alctProduct->move(std::make_pair(alctDigis_0.begin(), alctDigis_0.end()), layer);
497  } else
498  alctProduct->move(std::make_pair(alctDigis.begin(), alctDigis.end()), layer);
499  }
500 
502  int nclct = cscData[iCSC].dmbHeader()->nclct();
503  bool goodTMB = false;
504  // if (nclct&&(cscData[iCSC].dataPresent>>5&0x1)==1) {
505  if (nclct && cscData[iCSC].tmbData()) {
506  if (cscData[iCSC].tmbHeader()->check()) {
507  if (cscData[iCSC].comparatorData()->check())
508  goodTMB = true;
509  } else {
510  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "one of TMB checks failed! not storing TMB digis ";
511  }
512  } else {
513  if (debug)
514  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "nCLCT==0 !!!";
515  }
516 
518  if (goodTMB) {
519  std::vector<CSCCorrelatedLCTDigi> correlatedlctDigis =
520  cscData[iCSC].tmbHeader()->CorrelatedLCTDigis(layer.rawId());
521  if (SuppressZeroLCT) {
522  std::vector<CSCCorrelatedLCTDigi> correlatedlctDigis_0;
523  for (int unsigned i = 0; i < correlatedlctDigis.size(); ++i) {
524  if (correlatedlctDigis[i].isValid())
525  correlatedlctDigis_0.push_back(correlatedlctDigis[i]);
526  }
527  corrlctProduct->move(std::make_pair(correlatedlctDigis_0.begin(), correlatedlctDigis_0.end()), layer);
528  } else
529  corrlctProduct->move(std::make_pair(correlatedlctDigis.begin(), correlatedlctDigis.end()), layer);
530 
531  std::vector<CSCCLCTDigi> clctDigis = cscData[iCSC].tmbHeader()->CLCTDigis(layer.rawId());
532  if (SuppressZeroLCT) {
533  std::vector<CSCCLCTDigi> clctDigis_0;
534  for (int unsigned i = 0; i < clctDigis.size(); ++i) {
535  if (clctDigis[i].isValid())
536  clctDigis_0.push_back(clctDigis[i]);
537  }
538  clctProduct->move(std::make_pair(clctDigis_0.begin(), clctDigis_0.end()), layer);
539  } else
540  clctProduct->move(std::make_pair(clctDigis.begin(), clctDigis.end()), layer);
541 
543  if (cscData[iCSC].tmbData()->checkSize()) {
544  if (cscData[iCSC].tmbData()->hasRPC()) {
545  std::vector<CSCRPCDigi> rpcDigis = cscData[iCSC].tmbData()->rpcData()->digis();
546  rpcProduct->move(std::make_pair(rpcDigis.begin(), rpcDigis.end()), layer);
547  }
548  } else
549  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << " TMBData check size failed!";
550  }
551 
553  if (unpackStatusDigis) {
554  for (icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb)
555  {
556  if (cscData[iCSC].cfebData(icfeb) != nullptr)
557  cfebStatusProduct->insertDigi(layer, cscData[iCSC].cfebData(icfeb)->statusDigi());
558  }
560  dmbStatusProduct->insertDigi(
561  layer, CSCDMBStatusDigi(cscData[iCSC].dmbHeader()->data(), cscData[iCSC].dmbTrailer()->data()));
562  if (goodTMB)
563  tmbStatusProduct->insertDigi(
564  layer,
565  CSCTMBStatusDigi(cscData[iCSC].tmbHeader()->data(), cscData[iCSC].tmbData()->tmbTrailer()->data()));
566  if (goodALCT)
567  alctStatusProduct->insertDigi(
568  layer, CSCALCTStatusDigi(cscData[iCSC].alctHeader()->data(), cscData[iCSC].alctTrailer()->data()));
569  }
570 
572  for (int ilayer = CSCDetId::minLayerId(); ilayer <= CSCDetId::maxLayerId(); ++ilayer) {
574  // (You have to be kidding. Line 240 in whose universe?)
575 
576  // Allocate all ME1/1 wire digis to ring 1
577  layer = pcrate->detId(vmecrate, dmb, 0, ilayer);
578  {
579  std::vector<CSCWireDigi> wireDigis = cscData[iCSC].wireDigis(ilayer);
580  wireProduct->move(std::make_pair(wireDigis.begin(), wireDigis.end()), layer);
581  }
582 
583  for (icfeb = 0; icfeb < CSCConstants::MAX_CFEBS_RUN2; ++icfeb) {
584  layer = pcrate->detId(vmecrate, dmb, icfeb, ilayer);
585  if (cscData[iCSC].cfebData(icfeb) && cscData[iCSC].cfebData(icfeb)->check()) {
586  std::vector<CSCStripDigi> stripDigis;
587  cscData[iCSC].cfebData(icfeb)->digis(layer.rawId(), stripDigis);
588  stripProduct->move(std::make_pair(stripDigis.begin(), stripDigis.end()), layer);
589  }
590  }
591 
592  if (goodTMB && (cscData[iCSC].tmbHeader() != nullptr)) {
593  int nCFEBs = cscData[iCSC].tmbHeader()->NCFEBs();
594  for (icfeb = 0; icfeb < nCFEBs; ++icfeb) {
595  layer = pcrate->detId(vmecrate, dmb, icfeb, ilayer);
596  std::vector<CSCComparatorDigi> comparatorDigis =
597  cscData[iCSC].comparatorData()->comparatorDigis(layer.rawId(), icfeb);
598  // Set cfeb=0, so that ME1/a and ME1/b comparators go to
599  // ring 1.
600  layer = pcrate->detId(vmecrate, dmb, 0, ilayer);
601  comparatorProduct->move(std::make_pair(comparatorDigis.begin(), comparatorDigis.end()), layer);
602  }
603  } // end of loop over cfebs
604  } // end of loop over layers
605  } // end of loop over chambers
606  } // endof loop over DDUs
607  } // end of good event
608  else {
609  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "ERROR! Examiner rejected FED #" << id;
610  if (examiner) {
611  for (int i = 0; i < examiner->nERRORS; ++i) {
612  if (((examinerMask & examiner->errors()) >> i) & 0x1)
613  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << examiner->errName(i);
614  }
615  if (debug) {
616  LogTrace("CSCDCCUnpacker|CSCRawToDigi")
617  << " Examiner errors:0x" << std::hex << examiner->errors() << " & 0x" << examinerMask << " = "
618  << (examiner->errors() & examinerMask);
619  }
620  }
621 
622  // dccStatusProduct->insertDigi(CSCDetId(1,1,1,1,1), CSCDCCStatusDigi(examiner->errors()));
623  // if(instantiateDQM) monitor->process(examiner, NULL);
624  }
625  if (examiner != nullptr)
626  delete examiner;
627  } // end of if fed has data
628  } // end of loop over DCCs
629  // put into the event
630  e.put(std::move(wireProduct), "MuonCSCWireDigi");
631  e.put(std::move(stripProduct), "MuonCSCStripDigi");
632  e.put(std::move(alctProduct), "MuonCSCALCTDigi");
633  e.put(std::move(clctProduct), "MuonCSCCLCTDigi");
634  e.put(std::move(comparatorProduct), "MuonCSCComparatorDigi");
635  e.put(std::move(rpcProduct), "MuonCSCRPCDigi");
636  e.put(std::move(corrlctProduct), "MuonCSCCorrelatedLCTDigi");
637 
638  if (useFormatStatus)
639  e.put(std::move(formatStatusProduct), "MuonCSCDCCFormatStatusDigi");
640 
641  if (unpackStatusDigis) {
642  e.put(std::move(cfebStatusProduct), "MuonCSCCFEBStatusDigi");
643  e.put(std::move(dmbStatusProduct), "MuonCSCDMBStatusDigi");
644  e.put(std::move(tmbStatusProduct), "MuonCSCTMBStatusDigi");
645  e.put(std::move(dduStatusProduct), "MuonCSCDDUStatusDigi");
646  e.put(std::move(dccStatusProduct), "MuonCSCDCCStatusDigi");
647  e.put(std::move(alctStatusProduct), "MuonCSCALCTStatusDigi");
648  }
649  if (useGEMs_) {
650  e.put(std::move(gemProduct), "MuonGEMPadDigiCluster");
651  }
652  if (useCSCShowers_) {
653  e.put(std::move(showerProduct), "MuonCSCShowerDigi");
654  }
655  if (printEventNumber)
656  LogTrace("CSCDCCUnpacker|CSCRawToDigi") << "[CSCDCCUnpacker]: " << numOfEvents << " events processed ";
657 }
658 
660 
662  int hl, int id, int run, int event, bool fedshort, bool fDump, short unsigned int* buf) const {
663  std::cout << std::endl << std::endl << std::endl;
664  std::cout << "Run: " << run << " Event: " << event << std::endl;
665  std::cout << std::endl << std::endl;
666  if (formatedEventDump)
667  std::cout << "FED-" << id << " "
668  << "(scroll down to see summary)" << std::endl;
669  else
670  std::cout << "Problem seems in FED-" << id << " "
671  << "(scroll down to see summary)" << std::endl;
672  std::cout << "********************************************************************************" << std::endl;
673  std::cout << hl << " words of data:" << std::endl;
674 
675  //================================================
676  // FED codes in DCC
677  std::vector<int> dcc_id;
678  int dcc_h1_id = 0;
679  // Current codes
680  for (int i = 750; i < 758; i++)
681  dcc_id.push_back(i);
682  // Codes for upgrade
683  for (int i = 830; i < 838; i++)
684  dcc_id.push_back(i);
685 
686  char dcc_common[] = "DCC-";
687 
688  //================================================
689  // DDU codes per FED
690  std::vector<int> ddu_id;
691  int ddu_h1_12_13 = 0;
692  for (int i = 1; i < 37; i++)
693  ddu_id.push_back(i);
694  // For DDU Headers and tarailers
695  char ddu_common[] = "DDU-";
696  char ddu_header1[] = "Header 1";
697  char ddu_header2[] = "Header 2";
698  char ddu_header3[] = "Header 3";
699  char ddu_trail1[] = "Trailer 1", ddu_trail2[] = "Trailer 2", ddu_trail3[] = "Trailer 3";
700  // For Header 2
701  char ddu_trailer1_bit[] = {'8', '0', '0', '0', 'f', 'f', 'f', 'f', '8', '0', '0', '0', '8', '0', '0', '0'};
702  char ddu_trailer3_bit[] = {'a'};
703  // Corrupted Trailers
704  char ddu_tr1_err_common[] = "Incomplet";
705  //====================================================
706 
707  //DMB
708  char dmb_common[] = "DMB", dmb_header1[] = "Header 1", dmb_header2[] = "Header 2";
709  char dmb_common_crate[] = "crate:", dmb_common_slot[] = "slot:";
710  char dmb_common_l1a[] = "L1A:";
711  char dmb_header1_bit[] = {'9', '9', '9', '9'};
712  char dmb_header2_bit[] = {'a', 'a', 'a', 'a'};
713  char dmb_tr1[] = "Trailer 1", dmb_tr2[] = "Trailer 2";
714  char dmb_tr1_bit[] = {'f', 'f', 'f', 'f'}, dmb_tr2_bit[] = {'e', 'e', 'e', 'e'};
715 
716  //=====================================================
717 
718  // ALCT
719  char alct_common[] = "ALCT", alct_header1[] = "Header 1", alct_header2[] = "Header 2";
720  char alct_common_bxn[] = "BXN:";
721  char alct_common_wcnt2[] = "| Actual word count:";
722  char alct_common_wcnt1[] = "Expected word count:";
723  char alct_header1_bit[] = {'d', 'd', 'd', 'd', 'b', '0', 'a'};
724  char alct_header2_bit[] = {'0', '0', '0', '0'};
725  char alct_tr1[] = "Trailer 1";
726 
727  //======================================================
728 
729  //TMB
730  char tmb_common[] = "TMB", tmb_header1[] = "Header", tmb_tr1[] = "Trailer";
731  char tmb_header1_bit[] = {'d', 'd', 'd', 'd', 'b', '0', 'c'};
732  char tmb_tr1_bit[] = {'d', 'd', 'd', 'd', 'e', '0', 'f'};
733 
734  //======================================================
735 
736  //CFEB
737  char cfeb_common[] = "CFEB", cfeb_tr1[] = "Trailer", cfeb_b[] = "B-word";
738  char cfeb_common_sample[] = "sample:";
739 
740  //======================================================
741 
742  //Auxiliary variables
743 
744  // Bufers
745  int word_lines = hl / 4;
746  char tempbuf[80];
747  char tempbuf1[130];
748  char tempbuf_short[17];
749  char sign1[] = " --->| ";
750 
751  // Counters
752  int word_numbering = 0;
753  int ddu_inst_i = 0, ddu_inst_n = 0, ddu_inst_l1a = 0;
754  int ddu_inst_bxn = 0;
755  int dmb_inst_crate = 0, dmb_inst_slot = 0, dmb_inst_l1a = 0;
756  int cfeb_sample = 0;
757  int alct_inst_l1a = 0;
758  int alct_inst_bxn = 0;
759  int alct_inst_wcnt1 = 0;
760  int alct_inst_wcnt2 = 0;
761  int alct_start = 0;
762  int alct_stop = 0;
763  int tmb_inst_l1a = 0;
764  int tmb_inst_wcnt1 = 0;
765  int tmb_inst_wcnt2 = 0;
766  int tmb_start = 0;
767  int tmb_stop = 0;
768  int dcc_h1_check = 0;
769 
770  //Flags
771  int ddu_h2_found = 0; //DDU Header 2 found
772  int w = 0;
773 
774  //Logic variables
775  const int sz1 = 5;
776  bool dcc_check = false;
777  bool ddu_h2_check[sz1] = {false};
778  bool ddu_h1_check = false;
779  bool dmb_h1_check[sz1] = {false};
780  bool dmb_h2_check[sz1] = {false};
781  bool ddu_h2_h1 = false;
782  bool ddu_tr1_check[sz1] = {false};
783  bool alct_h1_check[sz1] = {false};
784  bool alct_h2_check[sz1] = {false};
785  bool alct_tr1_check[sz1] = {false};
786  bool dmb_tr1_check[sz1] = {false};
787  bool dmb_tr2_check[sz1] = {false};
788  bool tmb_h1_check[sz1] = {false};
789  bool tmb_tr1_check[sz1] = {false};
790  bool cfeb_tr1_check[sz1] = {false};
791  bool cfeb_b_check[sz1] = {false};
792  bool ddu_tr1_bad_check[sz1] = {false};
793  bool extraction = fedshort;
794 
795  //Summary vectors
796  //DDU
797  std::vector<int> ddu_h1_coll;
798  std::vector<int> ddu_h1_n_coll;
799  std::vector<int> ddu_h2_coll;
800  std::vector<int> ddu_h3_coll;
801  std::vector<int> ddu_t1_coll;
802  std::vector<int> ddu_t2_coll;
803  std::vector<int> ddu_t3_coll;
804  std::vector<int> ddu_l1a_coll;
805  std::vector<int> ddu_bxn_coll;
806  //DMB
807  std::vector<int> dmb_h1_coll;
808  std::vector<int> dmb_h2_coll;
809  std::vector<int> dmb_t1_coll;
810  std::vector<int> dmb_t2_coll;
811  std::vector<int> dmb_crate_coll;
812  std::vector<int> dmb_slot_coll;
813  std::vector<int> dmb_l1a_coll;
814  //ALCT
815  std::vector<int> alct_h1_coll;
816  std::vector<int> alct_h2_coll;
817  std::vector<int> alct_t1_coll;
818  std::vector<int> alct_l1a_coll;
819  std::vector<int> alct_bxn_coll;
820  std::vector<int> alct_wcnt1_coll;
821  std::vector<int> alct_wcnt2_coll;
822  std::vector<int> alct_wcnt2_id_coll;
823  //TMB
824  std::vector<int> tmb_h1_coll;
825  std::vector<int> tmb_t1_coll;
826  std::vector<int> tmb_l1a_coll;
827  std::vector<int> tmb_wcnt1_coll;
828  std::vector<int> tmb_wcnt2_coll;
829  //CFEB
830  std::vector<int> cfeb_t1_coll;
831 
832  //========================================================
833 
834  // DCC Header and Ttrailer information
835  char dcc_header1[] = "DCC Header 1";
836  char dcc_header2[] = "DCC Header 2";
837  char dcc_trail1[] = "DCC Trailer 1", dcc_trail1_bit[] = {'e'};
838  char dcc_trail2[] = "DCC Trailer 2", dcc_trail2_bit[] = {'a'};
839  //=========================================================
840 
841  for (int i = 0; i < hl; i++) {
842  ++word_numbering;
843  for (int j = -1; j < 4; j++) {
844  sprintf(tempbuf_short,
845  "%04x%04x%04x%04x",
846  buf[i + 4 * (j - 1) + 3],
847  buf[i + 4 * (j - 1) + 2],
848  buf[i + 4 * (j - 1) + 1],
849  buf[i + 4 * (j - 1)]);
850 
851  // WARNING in 5_0_X for time being
852  ddu_h2_found++;
853  ddu_h2_found--;
854 
855  ddu_h2_check[j] = ((buf[i + 4 * (j - 1) + 1] == 0x8000) && (buf[i + 4 * (j - 1) + 2] == 0x0001) &&
856  (buf[i + 4 * (j - 1) + 3] == 0x8000));
857 
858  ddu_tr1_check[j] = ((tempbuf_short[0] == ddu_trailer1_bit[0]) && (tempbuf_short[1] == ddu_trailer1_bit[1]) &&
859  (tempbuf_short[2] == ddu_trailer1_bit[2]) && (tempbuf_short[3] == ddu_trailer1_bit[3]) &&
860  (tempbuf_short[4] == ddu_trailer1_bit[4]) && (tempbuf_short[5] == ddu_trailer1_bit[5]) &&
861  (tempbuf_short[6] == ddu_trailer1_bit[6]) && (tempbuf_short[7] == ddu_trailer1_bit[7]) &&
862  (tempbuf_short[8] == ddu_trailer1_bit[8]) && (tempbuf_short[9] == ddu_trailer1_bit[9]) &&
863  (tempbuf_short[10] == ddu_trailer1_bit[10]) && (tempbuf_short[11] == ddu_trailer1_bit[11]) &&
864  (tempbuf_short[12] == ddu_trailer1_bit[12]) && (tempbuf_short[13] == ddu_trailer1_bit[13]) &&
865  (tempbuf_short[14] == ddu_trailer1_bit[14]) && (tempbuf_short[15] == ddu_trailer1_bit[15]));
866 
867  dmb_h1_check[j] = ((tempbuf_short[0] == dmb_header1_bit[0]) && (tempbuf_short[4] == dmb_header1_bit[1]) &&
868  (tempbuf_short[8] == dmb_header1_bit[2]) && (tempbuf_short[12] == dmb_header1_bit[3]));
869 
870  dmb_h2_check[j] = ((tempbuf_short[0] == dmb_header2_bit[0]) && (tempbuf_short[4] == dmb_header2_bit[1]) &&
871  (tempbuf_short[8] == dmb_header2_bit[2]) && (tempbuf_short[12] == dmb_header2_bit[3]));
872  alct_h1_check[j] = ((tempbuf_short[0] == alct_header1_bit[0]) && (tempbuf_short[4] == alct_header1_bit[1]) &&
873  (tempbuf_short[8] == alct_header1_bit[2]) && (tempbuf_short[12] == alct_header1_bit[3]) &&
874  (tempbuf_short[13] == alct_header1_bit[4]) && (tempbuf_short[14] == alct_header1_bit[5]) &&
875  (tempbuf_short[15] == alct_header1_bit[6]));
876  alct_h2_check[j] = (((tempbuf_short[0] == alct_header2_bit[0]) && (tempbuf_short[1] == alct_header2_bit[1]) &&
877  (tempbuf_short[2] == alct_header2_bit[2]) && (tempbuf_short[3] == alct_header2_bit[3])) ||
878  ((tempbuf_short[4] == alct_header2_bit[0]) && (tempbuf_short[5] == alct_header2_bit[1]) &&
879  (tempbuf_short[6] == alct_header2_bit[2]) && (tempbuf_short[7] == alct_header2_bit[3])) ||
880  ((tempbuf_short[8] == alct_header2_bit[0]) && (tempbuf_short[9] == alct_header2_bit[1]) &&
881  (tempbuf_short[10] == alct_header2_bit[2]) && (tempbuf_short[11] == alct_header2_bit[3])) ||
882  ((tempbuf_short[12] == alct_header2_bit[0]) && (tempbuf_short[13] == alct_header2_bit[1]) &&
883  (tempbuf_short[14] == alct_header2_bit[2]) && (tempbuf_short[15] == alct_header2_bit[3]))
884  //(tempbuf_short[4]==alct_header2_bit[4])&&(tempbuf_short[5]==alct_header2_bit[5])
885  );
886  // ALCT Trailers
887  alct_tr1_check[j] =
888  (((buf[i + 4 * (j - 1)] & 0xFFFF) == 0xDE0D) && ((buf[i + 4 * (j - 1) + 1] & 0xF800) == 0xD000) &&
889  ((buf[i + 4 * (j - 1) + 2] & 0xF800) == 0xD000) && ((buf[i + 4 * (j - 1) + 3] & 0xF000) == 0xD000));
890  // DMB Trailers
891  dmb_tr1_check[j] = ((tempbuf_short[0] == dmb_tr1_bit[0]) && (tempbuf_short[4] == dmb_tr1_bit[1]) &&
892  (tempbuf_short[8] == dmb_tr1_bit[2]) && (tempbuf_short[12] == dmb_tr1_bit[3]));
893  dmb_tr2_check[j] = ((tempbuf_short[0] == dmb_tr2_bit[0]) && (tempbuf_short[4] == dmb_tr2_bit[1]) &&
894  (tempbuf_short[8] == dmb_tr2_bit[2]) && (tempbuf_short[12] == dmb_tr2_bit[3]));
895  // TMB
896  tmb_h1_check[j] = ((tempbuf_short[0] == tmb_header1_bit[0]) && (tempbuf_short[4] == tmb_header1_bit[1]) &&
897  (tempbuf_short[8] == tmb_header1_bit[2]) && (tempbuf_short[12] == tmb_header1_bit[3]) &&
898  (tempbuf_short[13] == tmb_header1_bit[4]) && (tempbuf_short[14] == tmb_header1_bit[5]) &&
899  (tempbuf_short[15] == tmb_header1_bit[6]));
900  tmb_tr1_check[j] = ((tempbuf_short[0] == tmb_tr1_bit[0]) && (tempbuf_short[4] == tmb_tr1_bit[1]) &&
901  (tempbuf_short[8] == tmb_tr1_bit[2]) && (tempbuf_short[12] == tmb_tr1_bit[3]) &&
902  (tempbuf_short[13] == tmb_tr1_bit[4]) && (tempbuf_short[14] == tmb_tr1_bit[5]) &&
903  (tempbuf_short[15] == tmb_tr1_bit[6]));
904  // CFEB
905  cfeb_tr1_check[j] =
906  (((buf[i + 4 * (j - 1) + 1] & 0xF000) == 0x7000) && ((buf[i + 4 * (j - 1) + 2] & 0xF000) == 0x7000) &&
907  ((buf[i + 4 * (j - 1) + 1] != 0x7FFF) || (buf[i + 4 * (j - 1) + 2] != 0x7FFF)) &&
908  ((buf[i + 4 * (j - 1) + 3] == 0x7FFF) || ((buf[i + 4 * (j - 1) + 3] & buf[i + 4 * (j - 1)]) == 0x0 &&
909  (buf[i + 4 * (j - 1) + 3] + buf[i + 4 * (j - 1)] == 0x7FFF))));
910  cfeb_b_check[j] =
911  (((buf[i + 4 * (j - 1) + 3] & 0xF000) == 0xB000) && ((buf[i + 4 * (j - 1) + 2] & 0xF000) == 0xB000) &&
912  ((buf[i + 4 * (j - 1) + 1] & 0xF000) == 0xB000) && ((buf[i + 4 * (j - 1)] = 3 & 0xF000) == 0xB000));
913  // DDU Trailers with errors
914  ddu_tr1_bad_check[j] =
915  ((tempbuf_short[0] != ddu_trailer1_bit[0]) &&
916  //(tempbuf_short[1]!=ddu_trailer1_bit[1])&&(tempbuf_short[2]!=ddu_trailer1_bit[2])&&
917  //(tempbuf_short[3]==ddu_trailer1_bit[3])&&
918  (tempbuf_short[4] != ddu_trailer1_bit[4]) &&
919  //(tempbuf_short[5]==ddu_trailer1_bit[5])&&
920  //(tempbuf_short[6]==ddu_trailer1_bit[6])&&(tempbuf_short[7]==ddu_trailer1_bit[7])&&
921  (tempbuf_short[8] == ddu_trailer1_bit[8]) && (tempbuf_short[9] == ddu_trailer1_bit[9]) &&
922  (tempbuf_short[10] == ddu_trailer1_bit[10]) && (tempbuf_short[11] == ddu_trailer1_bit[11]) &&
923  (tempbuf_short[12] == ddu_trailer1_bit[12]) && (tempbuf_short[13] == ddu_trailer1_bit[13]) &&
924  (tempbuf_short[14] == ddu_trailer1_bit[14]) && (tempbuf_short[15] == ddu_trailer1_bit[15]));
925  }
926 
927  // DDU Header 2 next to Header 1
928  ddu_h2_h1 = ddu_h2_check[2];
929 
930  sprintf(tempbuf_short, "%04x%04x%04x%04x", buf[i + 3], buf[i + 2], buf[i + 1], buf[i]);
931 
932  // Looking for DDU Header 1
933  ddu_h1_12_13 = (buf[i] >> 8);
934  for (int kk = 0; kk < 36; kk++) {
935  if (((buf[i + 3] & 0xF000) == 0x5000) && (ddu_h1_12_13 == ddu_id[kk]) && ddu_h2_h1) {
936  ddu_h1_coll.push_back(word_numbering);
937  ddu_h1_n_coll.push_back(ddu_id[kk]);
938  ddu_inst_l1a = ((buf[i + 2] & 0xFFFF) + ((buf[i + 3] & 0x00FF) << 16));
939  ddu_l1a_coll.push_back(ddu_inst_l1a);
940  ddu_inst_bxn = (buf[i + 1] & 0xFFF0) >> 4;
941  ddu_bxn_coll.push_back(ddu_inst_bxn);
942  sprintf(tempbuf1,
943  "%6i %04x %04x %04x %04x%s%s%i %s%s %s %i %s %i",
944  word_numbering,
945  buf[i + 3],
946  buf[i + 2],
947  buf[i + 1],
948  buf[i],
949  sign1,
950  ddu_common,
951  ddu_id[kk],
952  ddu_header1,
953  sign1,
954  dmb_common_l1a,
955  ddu_inst_l1a,
956  alct_common_bxn,
957  ddu_inst_bxn);
958  std::cout << tempbuf1 << std::endl;
959  w = 0;
960  ddu_h1_check = true;
961  cfeb_sample = 0;
962  }
963  }
964 
965  // Looking for DCC Header 1
966  dcc_h1_id = (((buf[i + 1] << 12) & 0xF000) >> 4) + (buf[i] >> 8);
967  for (int dcci = 0; dcci < 16; dcci++) {
968  if ((dcc_id[dcci] == dcc_h1_id) && (((buf[i + 3] & 0xF000) == 0x5000) && (!ddu_h1_check))) {
969  sprintf(tempbuf1,
970  "%6i %04x %04x %04x %04x%s%s%i %s",
971  word_numbering,
972  buf[i + 3],
973  buf[i + 2],
974  buf[i + 1],
975  buf[i],
976  sign1,
977  dcc_common,
978  dcc_h1_id,
979  dcc_header1);
980  dcc_h1_check = word_numbering;
981  w = 0;
982  dcc_check = true;
983  std::cout << tempbuf1 << std::endl;
984  }
985  }
986 
987  // Looking for DCC Header 2 and trailers
988  if (((word_numbering - 1) == dcc_h1_check) && ((buf[i + 3] & 0xFF00) == 0xD900)) {
989  sprintf(tempbuf1,
990  "%6i %04x %04x %04x %04x%s%s",
991  word_numbering,
992  buf[i + 3],
993  buf[i + 2],
994  buf[i + 1],
995  buf[i],
996  sign1,
997  dcc_header2);
998  std::cout << tempbuf1 << std::endl;
999  w = 0;
1000  } else if ((word_numbering == word_lines - 1) && (tempbuf_short[0] == dcc_trail1_bit[0])) {
1001  sprintf(tempbuf1,
1002  "%6i %04x %04x %04x %04x%s%s",
1003  word_numbering,
1004  buf[i + 3],
1005  buf[i + 2],
1006  buf[i + 1],
1007  buf[i],
1008  sign1,
1009  dcc_trail1);
1010  std::cout << tempbuf1 << std::endl;
1011  w = 0;
1012  } else if ((word_numbering == word_lines) && (tempbuf_short[0] == dcc_trail2_bit[0])) {
1013  sprintf(tempbuf1,
1014  "%6i %04x %04x %04x %04x%s%s",
1015  word_numbering,
1016  buf[i + 3],
1017  buf[i + 2],
1018  buf[i + 1],
1019  buf[i],
1020  sign1,
1021  dcc_trail2);
1022  std::cout << tempbuf1 << std::endl;
1023  w = 0;
1024  }
1025 
1026  // DDU Header 2
1027  else if (ddu_h2_check[1]) {
1028  ddu_inst_i = ddu_h1_n_coll.size(); //ddu_inst_n=ddu_h1_n_coll[0];
1029  if (ddu_inst_i > 0) {
1030  ddu_inst_n = ddu_h1_n_coll[ddu_inst_i - 1];
1031  }
1032  sprintf(tempbuf1,
1033  "%6i %04x %04x %04x %04x%s%s%i %s",
1034  word_numbering,
1035  buf[i + 3],
1036  buf[i + 2],
1037  buf[i + 1],
1038  buf[i],
1039  sign1,
1040  ddu_common,
1041  ddu_inst_n,
1042  ddu_header2);
1043  ddu_h2_coll.push_back(word_numbering);
1044  std::cout << tempbuf1 << std::endl;
1045  w = 0;
1046  ddu_h2_found = 1;
1047  }
1048 
1049  // DDU Header 3 (either between DDU Header 2 DMB Header or DDU Header 2 DDU Trailer1)
1050  else if ((ddu_h2_check[0] && dmb_h1_check[2]) || (ddu_h2_check[0] && ddu_tr1_check[2])) {
1051  ddu_inst_i = ddu_h1_n_coll.size();
1052  if (ddu_inst_i > 0) {
1053  ddu_inst_n = ddu_h1_n_coll[ddu_inst_i - 1];
1054  }
1055  sprintf(tempbuf1,
1056  "%6i %04x %04x %04x %04x%s%s%i %s",
1057  word_numbering,
1058  buf[i + 3],
1059  buf[i + 2],
1060  buf[i + 1],
1061  buf[i],
1062  sign1,
1063  ddu_common,
1064  ddu_inst_n,
1065  ddu_header3);
1066  ddu_h3_coll.push_back(word_numbering);
1067  std::cout << tempbuf1 << std::endl;
1068  w = 0;
1069  ddu_h2_found = 0;
1070  }
1071 
1072  // DMB Header 1,2
1073 
1074  else if (dmb_h1_check[1]) {
1075  dmb_inst_crate = 0;
1076  dmb_inst_slot = 0;
1077  dmb_inst_l1a = ((buf[i] & 0x0FFF) + ((buf[i + 1] & 0xFFF) << 12));
1078  dmb_l1a_coll.push_back(dmb_inst_l1a);
1079  if (dmb_h2_check[2]) {
1080  dmb_inst_crate = ((buf[i + 4 + 1] >> 4) & 0xFF);
1081  dmb_inst_slot = (buf[i + 4 + 1] & 0xF);
1082  dmb_crate_coll.push_back(dmb_inst_crate);
1083  dmb_slot_coll.push_back(dmb_inst_slot);
1084  }
1085  sprintf(tempbuf1,
1086  "%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i %s %i",
1087  word_numbering,
1088  buf[i + 3],
1089  buf[i + 2],
1090  buf[i + 1],
1091  buf[i],
1092  sign1,
1093  dmb_common,
1094  dmb_header1,
1095  sign1,
1096  dmb_common_crate,
1097  dmb_inst_crate,
1098  dmb_common_slot,
1099  dmb_inst_slot,
1100  dmb_common_l1a,
1101  dmb_inst_l1a);
1102  dmb_h1_coll.push_back(word_numbering);
1103  std::cout << tempbuf1 << std::endl;
1104  w = 0;
1105  ddu_h2_found = 1;
1106  }
1107 
1108  else if (dmb_h2_check[1]) {
1109  dmb_inst_crate = ((buf[i + 1] >> 4) & 0xFF);
1110  dmb_inst_slot = (buf[i + 1] & 0xF);
1111  dmb_h2_coll.push_back(word_numbering);
1112  if (dmb_h1_check[0])
1113  dmb_inst_l1a = ((buf[i - 4] & 0x0FFF) + ((buf[i - 4 + 1] & 0xFFF) << 12));
1114  sprintf(tempbuf1,
1115  "%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i %s %i",
1116  word_numbering,
1117  buf[i + 3],
1118  buf[i + 2],
1119  buf[i + 1],
1120  buf[i],
1121  sign1,
1122  dmb_common,
1123  dmb_header2,
1124  sign1,
1125  dmb_common_crate,
1126  dmb_inst_crate,
1127  dmb_common_slot,
1128  dmb_inst_slot,
1129  dmb_common_l1a,
1130  dmb_inst_l1a);
1131  std::cout << tempbuf1 << std::endl;
1132  w = 0;
1133  ddu_h2_found = 1;
1134  }
1135 
1136  //DDU Trailer 1
1137 
1138  else if (ddu_tr1_check[1]) {
1139  ddu_inst_i = ddu_h1_n_coll.size();
1140  if (ddu_inst_i > 0) {
1141  ddu_inst_n = ddu_h1_n_coll[ddu_inst_i - 1];
1142  }
1143  //ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1144  sprintf(tempbuf1,
1145  "%6i %04x %04x %04x %04x%s%s%i %s",
1146  word_numbering,
1147  buf[i + 3],
1148  buf[i + 2],
1149  buf[i + 1],
1150  buf[i],
1151  sign1,
1152  ddu_common,
1153  ddu_inst_n,
1154  ddu_trail1);
1155  ddu_t1_coll.push_back(word_numbering);
1156  std::cout << tempbuf1 << std::endl;
1157  w = 0;
1158  }
1159 
1161  else if (alct_h1_check[1]) {
1162  alct_start = word_numbering;
1163  alct_inst_l1a = (buf[i + 2] & 0x0FFF);
1164  alct_l1a_coll.push_back(alct_inst_l1a);
1165  sprintf(tempbuf1,
1166  "%6i %04x %04x %04x %04x%s%s %s%s %s %i",
1167  word_numbering,
1168  buf[i + 3],
1169  buf[i + 2],
1170  buf[i + 1],
1171  buf[i],
1172  sign1,
1173  alct_common,
1174  alct_header1,
1175  sign1,
1176  dmb_common_l1a,
1177  alct_inst_l1a);
1178  alct_h1_coll.push_back(word_numbering);
1179  std::cout << tempbuf1 << std::endl;
1180  w = 0;
1181  }
1182 
1183  else if ((alct_h1_check[0]) && (alct_h2_check[2])) {
1184  alct_inst_bxn = (buf[i] & 0x0FFF);
1185  alct_bxn_coll.push_back(alct_inst_bxn);
1186  sprintf(tempbuf1,
1187  "%6i %04x %04x %04x %04x%s%s %s%s%s %i",
1188  word_numbering,
1189  buf[i + 3],
1190  buf[i + 2],
1191  buf[i + 1],
1192  buf[i],
1193  sign1,
1194  alct_common,
1195  alct_header2,
1196  sign1,
1197  alct_common_bxn,
1198  alct_inst_bxn);
1199  alct_h2_coll.push_back(word_numbering);
1200  std::cout << tempbuf1 << std::endl;
1201  w = 0;
1202  }
1203 
1204  //ALCT Trailer 1
1205  else if (alct_tr1_check[1]) {
1206  alct_stop = word_numbering;
1207  if ((alct_start != 0) && (alct_stop != 0) && (alct_stop > alct_start)) {
1208  alct_inst_wcnt2 = 4 * (alct_stop - alct_start + 1);
1209  alct_wcnt2_coll.push_back(alct_inst_wcnt2);
1210  alct_wcnt2_id_coll.push_back(alct_start);
1211  }
1212  alct_inst_wcnt1 = (buf[i + 3] & 0x7FF);
1213  alct_wcnt1_coll.push_back(alct_inst_wcnt1);
1214  sprintf(tempbuf1,
1215  "%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i",
1216  word_numbering,
1217  buf[i + 3],
1218  buf[i + 2],
1219  buf[i + 1],
1220  buf[i],
1221  sign1,
1222  alct_common,
1223  alct_tr1,
1224  sign1,
1225  alct_common_wcnt1,
1226  alct_inst_wcnt1,
1227  alct_common_wcnt2,
1228  alct_inst_wcnt2);
1229  alct_t1_coll.push_back(word_numbering);
1230  std::cout << tempbuf1 << std::endl;
1231  w = 0;
1232  alct_inst_wcnt2 = 0;
1233  }
1234 
1235  //DDU Trailer 3
1236 
1237  // else if ((ddu_tr1_check[-1])&&(tempbuf_short[0]==ddu_trailer3_bit[0])) { // !!! TO FIX: negative index
1238  else if ((ddu_h2_h1) && (tempbuf_short[0] == ddu_trailer3_bit[0])) {
1239  //&&(tempbuf_short[0]==ddu_trailer3_bit[0])){
1240  ddu_inst_i = ddu_h1_n_coll.size();
1241  if (ddu_inst_i > 0) {
1242  ddu_inst_n = ddu_h1_n_coll[ddu_inst_i - 1];
1243  }
1244  //ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1245  sprintf(tempbuf1,
1246  "%6i %04x %04x %04x %04x%s%s%i %s",
1247  word_numbering,
1248  buf[i + 3],
1249  buf[i + 2],
1250  buf[i + 1],
1251  buf[i],
1252  sign1,
1253  ddu_common,
1254  ddu_inst_n,
1255  ddu_trail3);
1256  ddu_t3_coll.push_back(word_numbering);
1257  std::cout << tempbuf1 << std::endl;
1258  w = 0;
1259  }
1260  //DDU Trailer 2
1261  else if ((ddu_tr1_check[0]) && (tempbuf_short[0] != ddu_trailer3_bit[0])) {
1262  //&&(tempbuf_short[0]==ddu_trailer3_bit[0])){
1263  ddu_inst_i = ddu_h1_n_coll.size();
1264  if (ddu_inst_i > 0) {
1265  ddu_inst_n = ddu_h1_n_coll[ddu_inst_i - 1];
1266  }
1267  //ddu_inst_n=ddu_h1_n_coll[ddu_inst_i-1];
1268  sprintf(tempbuf1,
1269  "%6i %04x %04x %04x %04x%s%s%i %s",
1270  word_numbering,
1271  buf[i + 3],
1272  buf[i + 2],
1273  buf[i + 1],
1274  buf[i],
1275  sign1,
1276  ddu_common,
1277  ddu_inst_n,
1278  ddu_trail2);
1279  ddu_t2_coll.push_back(word_numbering);
1280  std::cout << tempbuf1 << std::endl;
1281  w = 0;
1282  }
1283 
1284  //DMB Trailer 1,2
1285  else if (dmb_tr1_check[1]) {
1286  sprintf(tempbuf1,
1287  "%6i %04x %04x %04x %04x%s%s %s",
1288  word_numbering,
1289  buf[i + 3],
1290  buf[i + 2],
1291  buf[i + 1],
1292  buf[i],
1293  sign1,
1294  dmb_common,
1295  dmb_tr1);
1296  dmb_t1_coll.push_back(word_numbering);
1297  std::cout << tempbuf1 << std::endl;
1298  w = 0;
1299  cfeb_sample = 0;
1300  }
1301 
1302  else if (dmb_tr2_check[1]) {
1303  sprintf(tempbuf1,
1304  "%6i %04x %04x %04x %04x%s%s %s",
1305  word_numbering,
1306  buf[i + 3],
1307  buf[i + 2],
1308  buf[i + 1],
1309  buf[i],
1310  sign1,
1311  dmb_common,
1312  dmb_tr2);
1313  dmb_t2_coll.push_back(word_numbering);
1314  std::cout << tempbuf1 << std::endl;
1315  w = 0;
1316  }
1317  // TMB
1318  else if (tmb_h1_check[1]) {
1319  tmb_start = word_numbering;
1320  tmb_inst_l1a = (buf[i + 2] & 0x000F);
1321  tmb_l1a_coll.push_back(tmb_inst_l1a);
1322  sprintf(tempbuf1,
1323  "%6i %04x %04x %04x %04x%s%s %s%s%s %i",
1324  word_numbering,
1325  buf[i + 3],
1326  buf[i + 2],
1327  buf[i + 1],
1328  buf[i],
1329  sign1,
1330  tmb_common,
1331  tmb_header1,
1332  sign1,
1333  dmb_common_l1a,
1334  tmb_inst_l1a);
1335  tmb_h1_coll.push_back(word_numbering);
1336  std::cout << tempbuf1 << std::endl;
1337  w = 0;
1338  } else if (tmb_tr1_check[1]) {
1339  tmb_stop = word_numbering;
1340  if ((tmb_start != 0) && (tmb_stop != 0) && (tmb_stop > tmb_start)) {
1341  tmb_inst_wcnt2 = 4 * (tmb_stop - tmb_start + 1);
1342  tmb_wcnt2_coll.push_back(tmb_inst_wcnt2);
1343  }
1344  tmb_inst_wcnt1 = (buf[i + 3] & 0x7FF);
1345  tmb_wcnt1_coll.push_back(tmb_inst_wcnt1);
1346  sprintf(tempbuf1,
1347  "%6i %04x %04x %04x %04x%s%s %s%s%s %i %s %i",
1348  word_numbering,
1349  buf[i + 3],
1350  buf[i + 2],
1351  buf[i + 1],
1352  buf[i],
1353  sign1,
1354  tmb_common,
1355  tmb_tr1,
1356  sign1,
1357  alct_common_wcnt1,
1358  tmb_inst_wcnt1,
1359  alct_common_wcnt2,
1360  tmb_inst_wcnt2);
1361  tmb_t1_coll.push_back(word_numbering);
1362  std::cout << tempbuf1 << std::endl;
1363  w = 0;
1364  tmb_inst_wcnt2 = 0;
1365  }
1366  // CFEB
1367  else if (cfeb_tr1_check[1]) {
1368  ++cfeb_sample;
1369  sprintf(tempbuf1,
1370  "%6i %04x %04x %04x %04x%s%s %s%s %s %i",
1371  word_numbering,
1372  buf[i + 3],
1373  buf[i + 2],
1374  buf[i + 1],
1375  buf[i],
1376  sign1,
1377  cfeb_common,
1378  cfeb_tr1,
1379  sign1,
1380  cfeb_common_sample,
1381  cfeb_sample);
1382  cfeb_t1_coll.push_back(word_numbering);
1383  std::cout << tempbuf1 << std::endl;
1384  w = 0;
1385  } else if (cfeb_b_check[1]) {
1386  sprintf(tempbuf1,
1387  "%6i %04x %04x %04x %04x%s%s %s",
1388  word_numbering,
1389  buf[i + 3],
1390  buf[i + 2],
1391  buf[i + 1],
1392  buf[i],
1393  sign1,
1394  cfeb_common,
1395  cfeb_b);
1396  std::cout << tempbuf1 << std::endl;
1397  w = 0;
1398  }
1399 
1400  //ERRORS ddu_tr1_bad_check
1401 
1402  else if (ddu_tr1_bad_check[1]) {
1403  ddu_inst_i = ddu_h1_n_coll.size();
1404  ddu_inst_n = ddu_h1_n_coll[ddu_inst_i - 1];
1405  sprintf(tempbuf1,
1406  "%6i %04x %04x %04x %04x%s%s%i %s %s",
1407  word_numbering,
1408  buf[i + 3],
1409  buf[i + 2],
1410  buf[i + 1],
1411  buf[i],
1412  sign1,
1413  ddu_common,
1414  ddu_inst_n,
1415  ddu_trail1,
1416  ddu_tr1_err_common);
1417  std::cout << tempbuf1 << std::endl;
1418  w = 0;
1419  }
1420 
1421  else if (extraction && (!ddu_h1_check) && (!dcc_check)) {
1422  if (w < 3) {
1423  sprintf(tempbuf, "%6i %04x %04x %04x %04x", word_numbering, buf[i + 3], buf[i + 2], buf[i + 1], buf[i]);
1424  std::cout << tempbuf << std::endl;
1425  w++;
1426  }
1427  if (w == 3) {
1428  std::cout << "..................................................." << std::endl;
1429  w++;
1430  }
1431  }
1432 
1433  else if ((!ddu_h1_check) && (!dcc_check)) {
1434  sprintf(tempbuf, "%6i %04x %04x %04x %04x", word_numbering, buf[i + 3], buf[i + 2], buf[i + 1], buf[i]);
1435  std::cout << tempbuf << std::endl;
1436  }
1437 
1438  i += 3;
1439  ddu_h1_check = false;
1440  dcc_check = false;
1441  }
1442  //char sign[30]; //WARNING 5_0_X
1443  std::cout << "********************************************************************************" << std::endl
1444  << std::endl;
1445  if (fedshort)
1446  std::cout << "For complete output turn off VisualFEDShort in muonCSCDigis configuration file." << std::endl;
1447  std::cout << "********************************************************************************" << std::endl
1448  << std::endl;
1449  std::cout << std::endl << std::endl;
1450  std::cout << " Summary " << std::endl;
1451  std::cout << std::endl << std::endl;
1452  std::cout << ddu_h1_coll.size() << " " << ddu_common << " " << ddu_header1 << " "
1453  << "found" << std::endl;
1454  /*
1455  std::cout << ddu_h1_coll.size() << " " << ddu_h1_n_coll.size() << " " << ddu_l1a_coll.size() <<
1456  " " << ddu_bxn_coll.size() << std::endl;
1457  */
1458  for (unsigned int k = 0; k < ddu_h1_coll.size(); ++k) {
1459  /*
1460  sprintf(sign,"%s%6i%5s %s%i %s %i %s %i","Line: ",
1461  ddu_h1_coll[k],sign1,ddu_common,ddu_h1_n_coll[k],dmb_common_l1a,ddu_l1a_coll[k],
1462  alct_common_bxn,ddu_bxn_coll[k]);
1463  */
1464  std::cout << "Line: "
1465  << " " << ddu_h1_coll[k] << " " << sign1 << " " << ddu_common << " " << ddu_h1_n_coll[k] << " "
1466  << dmb_common_l1a << " " << ddu_l1a_coll[k] << " " << alct_common_bxn << " " << ddu_bxn_coll[k]
1467  << std::endl;
1468  }
1469 
1470  std::cout << std::endl << std::endl;
1471  std::cout << "||||||||||||||||||||" << std::endl;
1472  std::cout << std::endl << std::endl;
1473  std::cout << ddu_h2_coll.size() << " " << ddu_common << " " << ddu_header2 << " "
1474  << "found" << std::endl;
1475  for (unsigned int k = 0; k < ddu_h2_coll.size(); ++k)
1476  std::cout << "Line: " << ddu_h2_coll[k] << std::endl;
1477  std::cout << std::endl << std::endl;
1478  std::cout << "||||||||||||||||||||" << std::endl;
1479  std::cout << std::endl << std::endl;
1480  std::cout << ddu_h3_coll.size() << " " << ddu_common << " " << ddu_header3 << " "
1481  << "found" << std::endl;
1482  for (unsigned int k = 0; k < ddu_h3_coll.size(); ++k)
1483  std::cout << "Line: " << ddu_h3_coll[k] << std::endl;
1484  std::cout << std::endl << std::endl;
1485  std::cout << "||||||||||||||||||||" << std::endl;
1486  std::cout << std::endl << std::endl;
1487  std::cout << ddu_t1_coll.size() << " " << ddu_common << " " << ddu_trail1 << " "
1488  << "found" << std::endl;
1489  for (unsigned int k = 0; k < ddu_t1_coll.size(); ++k)
1490  std::cout << "Line: " << ddu_t1_coll[k] << std::endl;
1491  std::cout << std::endl << std::endl;
1492  std::cout << "||||||||||||||||||||" << std::endl;
1493  std::cout << std::endl << std::endl;
1494  std::cout << ddu_t2_coll.size() << " " << ddu_common << " " << ddu_trail2 << " "
1495  << "found" << std::endl;
1496  for (unsigned int k = 0; k < ddu_t2_coll.size(); ++k)
1497  std::cout << "Line: " << ddu_t2_coll[k] << std::endl;
1498  std::cout << std::endl << std::endl;
1499  std::cout << "||||||||||||||||||||" << std::endl;
1500  std::cout << std::endl << std::endl;
1501  std::cout << ddu_t3_coll.size() << " " << ddu_common << " " << ddu_trail3 << " "
1502  << "found" << std::endl;
1503  for (unsigned int k = 0; k < ddu_t3_coll.size(); ++k)
1504  std::cout << "Line: " << ddu_t3_coll[k] << std::endl;
1505  std::cout << std::endl << std::endl;
1506  std::cout << "||||||||||||||||||||" << std::endl;
1507  std::cout << std::endl << std::endl;
1508  std::cout << dmb_h1_coll.size() << " " << dmb_common << " " << dmb_header1 << " "
1509  << "found" << std::endl;
1510 
1511  for (unsigned int k = 0; k < dmb_h1_coll.size(); ++k) {
1512  /*
1513  sprintf(sign,"%s%6i%5s %s %s %i %s %i %s %i","Line: ",
1514  dmb_h1_coll[k],sign1,dmb_common,dmb_common_crate,dmb_crate_coll[k],dmb_common_slot,
1515  dmb_slot_coll[k],dmb_common_l1a,dmb_l1a_coll[k]);
1516  */
1517  std::cout << "Line: "
1518  << " " << dmb_h1_coll[k] << " " << sign1 << dmb_common << " " << dmb_common_crate << " "
1519  << dmb_crate_coll[k] << " " << dmb_common_slot << " " << dmb_slot_coll[k] << " " << dmb_common_l1a << " "
1520  << dmb_l1a_coll[k] << std::endl;
1521  }
1522  std::cout << std::endl << std::endl;
1523  std::cout << "||||||||||||||||||||" << std::endl;
1524  std::cout << std::endl << std::endl;
1525  std::cout << dmb_h2_coll.size() << " " << dmb_common << " " << dmb_header2 << " "
1526  << "found" << std::endl;
1527  for (unsigned int k = 0; k < dmb_h2_coll.size(); ++k)
1528  std::cout << "Line: " << dmb_h2_coll[k] << std::endl;
1529  std::cout << std::endl << std::endl;
1530  std::cout << "||||||||||||||||||||" << std::endl;
1531  std::cout << std::endl << std::endl;
1532  std::cout << dmb_t1_coll.size() << " " << dmb_common << " " << dmb_tr1 << " "
1533  << "found" << std::endl;
1534  for (unsigned int k = 0; k < dmb_t1_coll.size(); ++k)
1535  std::cout << "Line: " << dmb_t1_coll[k] << std::endl;
1536  std::cout << std::endl << std::endl;
1537  std::cout << "||||||||||||||||||||" << std::endl;
1538  std::cout << std::endl << std::endl;
1539  std::cout << dmb_t2_coll.size() << " " << dmb_common << " " << dmb_tr2 << " "
1540  << "found" << std::endl;
1541  for (unsigned int k = 0; k < dmb_t2_coll.size(); ++k)
1542  std::cout << "Line: " << dmb_t2_coll[k] << std::endl;
1543  std::cout << std::endl << std::endl;
1544  std::cout << "||||||||||||||||||||" << std::endl;
1545  std::cout << std::endl << std::endl;
1546  std::cout << alct_h1_coll.size() << " " << alct_common << " " << alct_header1 << " "
1547  << "found" << std::endl;
1548  for (unsigned int k = 0; k < alct_h1_coll.size(); ++k) {
1549  /*
1550  sprintf(sign,"%s%6i%5s %s %s %i","Line: ",
1551  alct_h1_coll[k],sign1,alct_common,
1552  dmb_common_l1a,alct_l1a_coll[k]);
1553  std::cout << sign << std::endl;
1554  */
1555  std::cout << "Line: "
1556  << " " << alct_h1_coll[k] << " " << sign1 << " " << alct_common << " " << dmb_common_l1a << " "
1557  << alct_l1a_coll[k] << std::endl;
1558  }
1559 
1560  std::cout << std::endl << std::endl;
1561  std::cout << "||||||||||||||||||||" << std::endl;
1562  std::cout << std::endl << std::endl;
1563  std::cout << alct_h2_coll.size() << " " << alct_common << " " << alct_header2 << " "
1564  << "found" << std::endl;
1565  for (unsigned int k = 0; k < alct_h2_coll.size(); ++k) {
1566  /*
1567  sprintf(sign,"%s%6i%5s %s %s %i","Line: ",
1568  alct_h1_coll[k],sign1,alct_common,
1569  alct_common_bxn,alct_bxn_coll[k]);
1570  std::cout << sign << std::endl;
1571  */
1572  std::cout << "Line: "
1573  << " " << alct_h1_coll[k] << " " << sign1 << " " << alct_common << " " << alct_common_bxn << " "
1574  << alct_bxn_coll[k] << std::endl;
1575  }
1576 
1577  std::cout << std::endl << std::endl;
1578  std::cout << "||||||||||||||||||||" << std::endl;
1579  std::cout << std::endl << std::endl;
1580  std::cout << alct_t1_coll.size() << " " << alct_common << " " << alct_tr1 << " "
1581  << "found" << std::endl;
1582  for (unsigned int k = 0; k < alct_t1_coll.size(); ++k) {
1583  /*
1584  sprintf(sign,"%s%6i%5s %s %s %i %s %i","Line: ",
1585  alct_t1_coll[k],sign1,alct_common,
1586  alct_common_wcnt1,alct_wcnt1_coll[k],alct_common_wcnt2,alct_wcnt2_coll[k]);
1587  std::cout << sign << std::endl;
1588  */
1589  std::cout << "Line: "
1590  << " " << alct_t1_coll[k] << " " << sign1 << " " << alct_common << " " << alct_common_wcnt1 << " "
1591  << alct_wcnt1_coll[k] << " " << alct_common_wcnt2 << " ";
1592  if (!alct_wcnt2_coll.empty()) {
1593  std::cout << alct_wcnt2_coll[k] << std::endl;
1594  } else {
1595  std::cout << "Undefined (ALCT Header is not found) " << std::endl;
1596  }
1597  }
1598 
1599  std::cout << std::endl << std::endl;
1600  std::cout << "||||||||||||||||||||" << std::endl;
1601  std::cout << std::endl << std::endl;
1602  std::cout << tmb_h1_coll.size() << " " << tmb_common << " " << tmb_header1 << " "
1603  << "found" << std::endl;
1604  for (unsigned int k = 0; k < tmb_h1_coll.size(); ++k) {
1605  /*
1606  sprintf(sign,"%s%6i%5s %s %s %i","Line: ",
1607  tmb_h1_coll[k],sign1,tmb_common,
1608  dmb_common_l1a,tmb_l1a_coll[k]);
1609  std::cout << sign << std::endl;
1610  */
1611  std::cout << "Line: "
1612  << " " << tmb_h1_coll[k] << " " << sign1 << " " << tmb_common << " " << dmb_common_l1a << " "
1613  << tmb_l1a_coll[k] << std::endl;
1614  }
1615 
1616  std::cout << std::endl << std::endl;
1617  std::cout << "||||||||||||||||||||" << std::endl;
1618  std::cout << std::endl << std::endl;
1619  std::cout << tmb_t1_coll.size() << " " << tmb_common << " " << tmb_tr1 << " "
1620  << "found" << std::endl;
1621  for (unsigned int k = 0; k < tmb_t1_coll.size(); ++k) {
1622  /*
1623  sprintf(sign,"%s%6i%5s %s %s %i %s %i","Line: ",
1624  tmb_t1_coll[k],sign1,tmb_common,
1625  alct_common_wcnt1,tmb_wcnt1_coll[k],alct_common_wcnt2,tmb_wcnt2_coll[k]);
1626  std::cout << sign << std::endl;
1627  */
1628  std::cout << "Line: "
1629  << " " << tmb_t1_coll[k] << " " << sign1 << " " << tmb_common << " " << alct_common_wcnt1 << " "
1630  << tmb_wcnt1_coll[k] << " " << alct_common_wcnt2 << " " << tmb_wcnt2_coll[k] << std::endl;
1631  }
1632 
1633  std::cout << std::endl << std::endl;
1634  std::cout << "||||||||||||||||||||" << std::endl;
1635  std::cout << std::endl << std::endl;
1636  std::cout << cfeb_t1_coll.size() << " " << cfeb_common << " " << cfeb_tr1 << " "
1637  << "found" << std::endl;
1638  for (unsigned int k = 0; k < cfeb_t1_coll.size(); ++k)
1639  std::cout << "Line: " << cfeb_t1_coll[k] << std::endl;
1640  std::cout << "********************************************************************************" << std::endl;
1641 }
1642 
ConfigurationDescriptions.h
FEDNumbering.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
Handle.h
FEDNumbering::MINCSCFEDID
Definition: FEDNumbering.h:51
CSCCorrelatedLCTDigiCollection.h
mps_fire.i
i
Definition: mps_fire.py:428
CSCDCCUnpacker::useExaminer
bool useExaminer
Definition: CSCDCCUnpacker.cc:83
MessageLogger.h
CSCEventData.h
CSCDCCUnpacker::instantiateDQM
bool instantiateDQM
Definition: CSCDCCUnpacker.cc:99
CSCCrateMapRcd.h
CSCDCCUnpacker::crateToken
edm::ESGetToken< CSCCrateMap, CSCCrateMapRcd > crateToken
Definition: CSCDCCUnpacker.cc:104
CSCRPCData::setDebug
static void setDebug(bool debugValue)
Definition: CSCRPCData.h:26
CSCDCCUnpacker::produce
void produce(edm::Event &e, const edm::EventSetup &c) override
Produce digis out of raw data.
Definition: CSCDCCUnpacker.cc:213
CSCDDUEventData::setErrorMask
static void setErrorMask(unsigned int value)
Definition: CSCDDUEventData.h:30
CSCDCCExaminer::errors
ExaminerStatusType errors(void) const
Definition: CSCDCCExaminer.h:169
ESHandle.h
CSCEventData::setDebug
static void setDebug(const bool value)
Definition: CSCEventData.h:42
CSCChamberMapRcd.h
edm::EDGetTokenT< FEDRawDataCollection >
CSCTMBStatusDigi
Definition: CSCTMBStatusDigi.h:15
CSCDCCUnpacker::~CSCDCCUnpacker
~CSCDCCUnpacker() override
Destructor.
Definition: CSCDCCUnpacker.cc:184
CSCDCCExaminer::nERRORS
const uint16_t nERRORS
Definition: CSCDCCExaminer.h:17
CSCDCCEventData
01/20/05 A.Tumanov
Definition: CSCDCCEventData.h:13
FEDNumbering::MAXCSCDDUFEDID
Definition: FEDNumbering.h:90
gather_cfg.cout
cout
Definition: gather_cfg.py:144
CSCTMBData::setDebug
static void setDebug(const bool value)
Definition: CSCTMBData.h:34
CSCCFEBData.h
CSCDCCUnpacker::formatedEventDump
bool formatedEventDump
Definition: CSCDCCUnpacker.cc:93
CSCDCCUnpacker::unpackStatusDigis
bool unpackStatusDigis
Definition: CSCDCCUnpacker.cc:83
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
CSCALCTHeader::setDebug
static void setDebug(bool value)
to access data by via status digis
Definition: CSCALCTHeader.h:30
EDProducer.h
cscmap
Definition: CSCMap.h:8
CSCChamberMap::ddu
int ddu(const CSCDetId &) const
ddu id for given DetId
Definition: CSCChamberMap.cc:36
CSCMonitorInterface::process
virtual void process(CSCDCCExaminer *examiner, CSCDCCEventData *dccData)=0
CSCDCCUnpacker::visualFEDInspect
bool visualFEDInspect
Visualization of raw data.
Definition: CSCDCCUnpacker.cc:93
CSCDCCUnpacker::cscmapToken
edm::ESGetToken< CSCChamberMap, CSCChamberMapRcd > cscmapToken
Definition: CSCDCCUnpacker.cc:105
CSCDDUEventData::setDebug
static void setDebug(bool value)
Definition: CSCDDUEventData.h:29
CSCDCCExaminer::modeDDU
void modeDDU(bool enable)
Definition: CSCDCCExaminer.cc:53
edm::Handle< FEDRawDataCollection >
ESGetToken.h
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
GEMPadDigiClusterCollection.h
MakerMacros.h
RPCNoise_example.check
check
Definition: RPCNoise_example.py:71
CSCRPCDigiCollection.h
CSCTMBData.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CSCDCCFormatStatusDigi
CSC Format Status Object.
Definition: CSCDCCFormatStatusDigi.h:160
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
CSCDCCUnpacker::visual_raw
void visual_raw(int hl, int id, int run, int event, bool fedshort, bool fDump, short unsigned int *buf) const
Visualization of raw data in FED-less events (Robert Harr and Alexander Sakharov)
Definition: CSCDCCUnpacker.cc:661
CSCDCCUnpacker::useCSCShowers_
bool useCSCShowers_
option to unpack CSC shower data
Definition: CSCDCCUnpacker.cc:90
CSCCFEBStatusDigiCollection.h
Service.h
w
const double w
Definition: UKUtility.cc:23
CSCDCCExaminer::errorsDetailed
std::map< CSCIdType, ExaminerStatusType > errorsDetailed(void) const
Definition: CSCDCCExaminer.h:301
CSCDCCStatusDigiCollection.h
CSCDCCEventData.h
CSCComparatorData::setDebug
static void setDebug(const bool value)
Definition: CSCComparatorData.h:31
edm::ESHandle
Definition: DTSurvey.h:22
CSCDCCUnpacker::examinerMask
unsigned int examinerMask
Definition: CSCDCCUnpacker.cc:98
CSCConstants.h
GetRecoTauVFromDQM_MC_cff.kk
kk
Definition: GetRecoTauVFromDQM_MC_cff.py:84
dqmdumpme.k
k
Definition: dqmdumpme.py:60
ParameterSetDescription.h
sistrip::SpyUtilities::isValid
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
Definition: SiStripSpyUtilities.cc:124
CSCDCCUnpacker
Definition: CSCDCCUnpacker.cc:66
CSCDCCStatusDigi
Definition: CSCDCCStatusDigi.h:15
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
CSCDCCExaminer::getMask
ExaminerMaskType getMask() const
Definition: CSCDCCExaminer.h:167
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
CSCDetId::minLayerId
static int minLayerId()
Definition: CSCDetId.h:242
CSCALCTStatusDigi
Definition: CSCALCTStatusDigi.h:15
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
CSCDCCExaminer::setMask
void setMask(ExaminerMaskType mask)
Definition: CSCDCCExaminer.h:166
CSCChamberMap.h
edm::ConfigurationDescriptions::setComment
void setComment(std::string const &value)
Definition: ConfigurationDescriptions.cc:48
CSCDetId
Definition: CSCDetId.h:26
CSCDDUStatusDigi
Definition: CSCDDUStatusDigi.h:15
CSCDCCExaminer::check
int32_t check(const uint16_t *&buffer, int32_t length)
Definition: CSCDCCExaminer.cc:263
CSCChamberMap
Definition: CSCChamberMap.h:11
CSCDCCExaminer
Definition: CSCDCCExaminer.h:15
edm::Service
Definition: Service.h:30
createfilelist.int
int
Definition: createfilelist.py:10
CSCDCCUnpacker::debug
bool debug
Definition: CSCDCCUnpacker.cc:83
CSCDCCUnpacker::numOfEvents
int numOfEvents
Definition: CSCDCCUnpacker.cc:97
FEDNumbering::MINCSCDDUFEDID
Definition: FEDNumbering.h:89
FEDRawDataCollection.h
CSCDCCUnpacker::visualFEDShort
bool visualFEDShort
Definition: CSCDCCUnpacker.cc:93
edm::stream::EDProducer
Definition: EDProducer.h:36
CSCStripDigiCollection.h
edm::EventSetup
Definition: EventSetup.h:58
res
Definition: Electron.h:6
visDQMUpload.buf
buf
Definition: visDQMUpload.py:160
edm::ESGetToken< CSCCrateMap, CSCCrateMapRcd >
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
CSCConstants::MAX_CFEBS_RUN2
Definition: CSCConstants.h:24
InputTag.h
CSCMonitorInterface.h
CSCMonitorInterface
Definition: CSCMonitorInterface.h:16
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
CSCDCCUnpacker::useGEMs_
bool useGEMs_
option to unpack GEM cluster data
Definition: CSCDCCUnpacker.cc:87
eostools.move
def move(src, dest)
Definition: eostools.py:511
CSCDCCUnpacker::goodEvent
bool goodEvent
Definition: CSCDCCUnpacker.cc:83
writedatasetfile.run
run
Definition: writedatasetfile.py:27
CSCDDUEventData
Definition: CSCDDUEventData.h:19
CSCDCCExaminer::payloadDetailed
std::map< CSCIdType, ExaminerStatusType > payloadDetailed(void) const
Definition: CSCDCCExaminer.h:303
CSCDCCUnpacker::i_token
edm::EDGetTokenT< FEDRawDataCollection > i_token
Token for consumes interface & access to data.
Definition: CSCDCCUnpacker.cc:103
CSCDCCExaminer::crcTMB
void crcTMB(bool enable)
Definition: CSCDCCExaminer.cc:37
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
FEDNumbering::MAXCSCFEDID
Definition: FEDNumbering.h:52
CSCALCTStatusDigiCollection.h
CSCDCCExaminer::crcALCT
void crcALCT(bool enable)
Definition: CSCDCCExaminer.cc:29
CSCDCCUnpacker::monitor
CSCMonitorInterface * monitor
Definition: CSCDCCUnpacker.cc:100
CSCCrateMap::detId
CSCDetId detId(int vme, int dmb, int cfeb, int layer=0) const
Definition: CSCCrateMap.cc:9
CSCDetId::maxLayerId
static int maxLayerId()
Definition: CSCDetId.h:243
EventSetup.h
CSCTMBStatusDigiCollection.h
CSCDMBStatusDigiCollection.h
CSCComparatorDigiCollection.h
CSCDCCUnpacker::useFormatStatus
bool useFormatStatus
Definition: CSCDCCUnpacker.cc:84
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
CSCCrateMap
Definition: CSCCrateMap.h:11
CSCDCCUnpacker::SuppressZeroLCT
bool SuppressZeroLCT
Suppress zeros LCTs.
Definition: CSCDCCUnpacker.cc:95
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:291
CSCWireDigiCollection.h
CSCDCCExaminer::statusDetailed
std::map< CSCIdType, ExaminerStatusType > statusDetailed(void) const
Definition: CSCDCCExaminer.h:304
CSCDCCExaminer::crcCFEB
void crcCFEB(bool enable)
Definition: CSCDCCExaminer.cc:45
CSCDCCUnpacker::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: CSCDCCUnpacker.cc:188
CSCALCTDigiCollection.h
ConsumesCollector.h
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
ParameterSet.h
CSCCLCTDigiCollection.h
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
event
Definition: event.py:1
CSCDDUStatusDigiCollection.h
edm::Event
Definition: Event.h:73
CSCDMBStatusDigi
Definition: CSCDMBStatusDigi.h:15
CSCDCCExaminer::errorsDetailedDDU
std::map< DDUIdType, ExaminerStatusType > errorsDetailedDDU(void) const
Definition: CSCDCCExaminer.h:299
CSCDCCUnpacker::CSCDCCUnpacker
CSCDCCUnpacker(const edm::ParameterSet &pset)
Constructor.
Definition: CSCDCCUnpacker.cc:108
CSCDCCEventData::setDebug
static void setDebug(bool value)
Definition: CSCDCCEventData.h:22
CSCDCCExaminer::errName
const char * errName(int num) const
Definition: CSCDCCExaminer.h:172
edm::InputTag
Definition: InputTag.h:15
CSCDCCUnpacker::errorMask
unsigned int errorMask
Definition: CSCDCCUnpacker.cc:98
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
CSCTMBHeader::setDebug
static void setDebug(const bool value)
Definition: CSCTMBHeader.h:85
CSCDCCUnpacker::printEventNumber
bool printEventNumber
Definition: CSCDCCUnpacker.cc:83
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
CSCDCCUnpacker::useSelectiveUnpacking
bool useSelectiveUnpacking
Definition: CSCDCCUnpacker.cc:84
CSCShowerDigiCollection.h
CSCCrateMap.h
CSCDCCFormatStatusDigiCollection.h