25 produces<FEDRawDataCollection>();
29 debug_ =
pset.getUntrackedParameter<
bool>(
"debug",
false);
37 mapping_token_ = esConsumes<DTReadOutMapping, DTReadOutMappingRcd>();
48 auto fed_product = std::make_unique<FEDRawDataCollection>(
data);
61 for (
int w_i = 0; w_i <
nfeds_; ++w_i) {
77 for (dttax = digis->begin(); dttax != digis->end(); ++dttax) {
81 int wheelId = dttal.
wheel();
82 int sectorId = dttal.
sector();
83 int stationId = dttal.
station();
85 int layerId = dttal.
layer();
86 int cellId = (*ta).wire();
88 int dduId, rosId, robId, tdcId, tdcChannel;
89 if (!
mapping->geometryToReadOut(
90 wheelId, stationId, sectorId, slId, layerId, cellId, dduId, rosId, robId, tdcId, tdcChannel)) {
91 int crate =
theCRT(dduId, rosId);
93 if (crate != DTuROSFED)
96 int slot =
theSLT(dduId, rosId, robId);
99 int tdcTime = (*ta).countsTDC();
103 int word = ((
link & 0x7F) << 21) + ((tdcId & 0x03) << 19) + ((tdcChannel & 0x1F) << 14) + (tdcTime & 0x3FFF);
113 for (
int sltit = 0; sltit <
DOCESLOTS; sltit++) {
114 if (
bslts[sltit] == 0)
125 unsigned char* lineFED = dttfdata.
data();
127 int dataWord1, dataWord2;
131 dataWord1 = 0x50000000 + (
eventNum & 0xFFFFFF);
132 dataWord2 = (DTuROSFED & 0xFFF) << 8;
137 *((
int*)lineFED) = dataWord2;
139 *((
int*)lineFED) = dataWord1;
143 dataWord1 = (nslts & 0xF) << 20;
149 *((
int*)lineFED) = dataWord2;
151 *((
int*)lineFED) = dataWord1;
153 for (
int sltit = 0; sltit <
DOCESLOTS; sltit++) {
154 if (
bslts[sltit] == 0)
157 dataWord1 = (
dslts[sltit] & 0xFFFFFF);
158 dataWord2 = ((sltit + 1) & 0xF) << 16;
163 *((
int*)lineFED) = dataWord2;
165 *((
int*)lineFED) = dataWord1;
170 for (
int sltit = 0; sltit <
DOCESLOTS; sltit++) {
171 if (
bslts[sltit] == 0)
174 dataWord1 = ((sltit + 1) & 0xF) << 24;
180 *((
int*)lineFED) = dataWord2;
182 *((
int*)lineFED) = dataWord1;
190 *((
int*)lineFED) = dataWord2;
192 *((
int*)lineFED) = dataWord1;
194 for (
int nhit = 0; nhit <
bslts[sltit] / 2; nhit++) {
195 dataWord1 = 0x20000000 +
wslts[sltit].at(nhit * 2);
196 dataWord2 =
wslts[sltit].at(nhit * 2 + 1);
201 *((
int*)lineFED) = dataWord2;
203 *((
int*)lineFED) = dataWord1;
206 if (
bslts[sltit] % 2 == 1) {
207 dataWord1 = 0x20000000 +
wslts[sltit].at(
bslts[sltit] - 1);
208 dataWord2 = 0x1FFFFFFF;
213 *((
int*)lineFED) = dataWord2;
215 *((
int*)lineFED) = dataWord1;
218 dataWord1 = 0x40000000;
224 *((
int*)lineFED) = dataWord2;
226 *((
int*)lineFED) = dataWord1;
228 dataWord1 = 0x40000000;
234 *((
int*)lineFED) = dataWord2;
236 *((
int*)lineFED) = dataWord1;
239 dataWord2 = (
dslts[sltit] & 0xFFFFF);
244 *((
int*)lineFED) = dataWord2;
246 *((
int*)lineFED) = dataWord1;
257 *((
int*)lineFED) = dataWord2;
259 *((
int*)lineFED) = dataWord1;
263 dataWord1 = 0xA0000000 + (
lines & 0xFFFFFF);
268 dataWord2 += (newCRC & 0xFFFF) << 16;
271 *((
int*)lineFED) = dataWord2;
273 *((
int*)lineFED) = dataWord1;
279 for (
int sltit = 0; sltit <
DOCESLOTS; sltit++) {
282 wslts[sltit].clear();
289 if (ros > 6 && ddu > 774)
302 if (ros > 6 && ddu > 774)
305 int slot = ((ros - 1) / 3) + 1;
321 link += ((ros - 1) % 3) * 24;