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 }
mps_fire.i
i
Definition: mps_fire.py:355
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTROS8Unpacker.h
DTROS8Unpacker::interpretRawData
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
Definition: DTROS8Unpacker.cc:19
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
DTWireId
Definition: DTWireId.h:12
edm::ESHandle< DTReadOutMapping >
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
type
type
Definition: HCALResponse.h:21
std
Definition: JetResolutionObject.h:76
DTWireId.h
DTDigi
Definition: DTDigi.h:17
Exception.h
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
cms::Exception
Definition: Exception.h:70
taus_updatedMVAIds_cff.mapping
mapping
Definition: taus_updatedMVAIds_cff.py:28
DTReadOutMapping.h
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
cms
Namespace of DDCMS conversion namespace.
Definition: ProducerAnalyzer.cc:21