CMS 3D CMS Logo

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