CMS 3D CMS Logo

DTROS8Unpacker.cc
Go to the documentation of this file.
1 
11 
12 #include <iostream>
13 #include <map>
14 
15 using namespace std;
16 using namespace edm;
17 using namespace cms;
18 
19 void DTROS8Unpacker::interpretRawData(const unsigned int* index,
20  int datasize,
21  int dduID,
23  std::unique_ptr<DTDigiCollection>& product,
24  std::unique_ptr<DTLocalTriggerCollection>& product2,
25  uint16_t rosList) {
27  const int wordLength = 4;
28  int numberOfWords = datasize / wordLength;
29  int robID = 0;
30  int rosID = 0;
31 
32  map<int, int> hitOrder;
33 
34  // Loop over the ROS8 words
35  for (int i = 1; i < numberOfWords; i++) {
36  // The word
37  uint32_t word = index[i];
38 
39  // The word type
40  int type = (word >> 28) & 0xF;
41 
42  // Event Header
43  if (type == 15) {
44  robID = word & 0x7;
45  rosID = (word >> 3) & 0xFF;
46  }
47 
48  // TDC Measurement
49  else if (type >= 4 && type <= 5) {
50  int tdcID = (word >> 24) & 0xF;
51  int tdcChannel = (word >> 19) & 0x1F;
52 
53  int channelIndex = robID << 7 | tdcID << 5 | tdcChannel;
54  hitOrder[channelIndex]++;
55 
56  int tdcMeasurement = word & 0x7FFFF;
57  tdcMeasurement >>= 2;
58 
59  try {
60  // Check the ddu ID in the mapping been used
61  dduID = pset.getUntrackedParameter<int>("dduID", 730);
62 
63  // Map the RO channel to the DetId and wire
64  DTWireId detId;
65  if (!mapping->readOutToGeometry(dduID, rosID, robID, tdcID, tdcChannel, detId)) {
66  if (pset.getUntrackedParameter<bool>("debugMode", false))
67  cout << "[DTROS8Unpacker] " << detId << endl;
68  int wire = detId.wire();
69 
70  // Produce the digi
71  DTDigi digi(wire, tdcMeasurement, hitOrder[channelIndex] - 1);
72 
73  // Commit to the event
74  product->insertDigi(detId.layerId(), digi);
75  } else if (pset.getUntrackedParameter<bool>("debugMode", false))
76  cout << "[DTROS8Unpacker] Missing wire!" << endl;
77  }
78 
79  catch (cms::Exception& e1) {
80  cout << "[DTUnpackingModule]: WARNING: Digi not build!" << endl;
81  return;
82  }
83  }
84  }
85 }
__host__ __device__ std::uint32_t channelIndex(fedId_t fed, fedCh_t channel)
uint64_t word
Definition: DTDigi.h:17
Namespace of DDCMS conversion namespace.
HLT enums.
void interpretRawData(const unsigned int *index, int datasize, int dduID, edm::ESHandle< DTReadOutMapping > &mapping, std::unique_ptr< DTDigiCollection > &product, std::unique_ptr< DTLocalTriggerCollection > &product2, uint16_t rosList=0) override