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