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