Belle II Software development
PXDPackerModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <pxd/unpacking/PXDRawDataDefinitions.h>
10#include <pxd/modules/pxdUnpacking/PXDPackerModule.h>
11#include <rawdata/dataobjects/RawPXD.h>
12#include <pxd/dataobjects/PXDDigit.h>
13#include <pxd/dataobjects/PXDInjectionBGTiming.h>
14#include <pxd/dbobjects/PXDDHHFirmwareVersionPar.h>
15
16#include <framework/logging/Logger.h>
17#include <framework/dataobjects/EventMetaData.h>
18#include <framework/core/ModuleParam.templateDetails.h>
19
20#include <boost/crc.hpp>
21#include <boost/algorithm/clamp.hpp>
22
23#include <pxd/unpacking/PXDMappingLookup.h>
24
25
26#include <TRandom.h>
27
28using namespace std;
29using namespace Belle2;
30using namespace Belle2::PXD;
31
32//-----------------------------------------------------------------
33// Register the Module
34//-----------------------------------------------------------------
35REG_MODULE(PXDPacker);
36
37//-----------------------------------------------------------------
38// Implementation
39//-----------------------------------------------------------------
40
41using boost::crc_optimal;
42typedef crc_optimal<32, 0x04C11DB7, 0, 0, false, false> dhe_crc_32_type;
43
47
49 Module(),
51{
52 m_trigger_nr = 0;
56 //Set module properties
57 setDescription("Pack PXD Hits to raw data object");
59
60 addParam("PXDDigitsName", m_PXDDigitsName, "The name of the StoreArray of PXDDigits to be processed", std::string(""));
61 addParam("RawPXDsName", m_RawPXDsName, "The name of the StoreArray of generated RawPXDs", std::string(""));
62 addParam("InjectionBGTimingName", m_InjectionBGTimingName, "The name of the StoreObj for Injection Timing", std::string(""));
63 addParam("dhe_to_dhc", m_dhe_to_dhc, "DHE to DHC mapping (DHC_ID, DHE1, DHE2, ..., DHE5) ; -1 disable port");
64 addParam("InvertMapping", m_InvertMapping, "Use inverse mapping to DHP row/col instead of \"remapped\" coordinates", false);
65 addParam("Clusterize", m_Clusterize, "Use clusterizer (FCE format)", false);
66 addParam("overrideFirmwareVersion", m_overrideFirmwareVersion, "Overwrite Firmware Version from DB with this value", 0);
67
68}
69
71{
72 // Register output collections
76
78
79 B2DEBUG(27, "Clusterizer is " << m_Clusterize);
80 B2DEBUG(27, "InvertMapping is " << m_InvertMapping);
81
85 for (auto& it : m_dhe_to_dhc) {
86 bool flag;
87 int dhc_id;
88 B2DEBUG(27, "PXD Packer --> DHC/DHE");
89 flag = false;
90 if (it.size() != 6) {
92 B2WARNING("PXD Packer --> DHC/DHE maps 1 dhc to 5 dhe (1+5 values), but I found " << it.size());
93 }
94 for (auto& it2 : it) {
95 if (flag) {
96 int v;
97 v = it2;
98 B2DEBUG(27, "PXD Packer --> ... DHE " << it2);
99 if (it2 < -1 || it2 >= 64) {
100 if (it2 != -1) B2ERROR("PXD Packer --> DHC id " << it2 << " is out of range (0-64 or -1)! disable channel.");
101 v = -1;
102 }
103// if (v > 0) dhe_mapto_dhc[v] = dhc_id;
104 m_dhc_mapto_dhe[dhc_id].push_back(v);
105 } else {
106 dhc_id = it2;
107 B2DEBUG(27, "PXD Packer --> DHC .. " << it2);
108 if (dhc_id < 0 || dhc_id >= 16) {
109 B2ERROR("PXD Packer --> DHC id " << it2 << " is out of range (0-15)! skip");
110 break;
111 }
112 }
113 flag = true;
114 }
115 }
116 B2DEBUG(27, "PXD Packer --> DHC/DHE done");
117
118// for (auto & it : m_dhe_mapto_dhc) {
119// B2DEBUG(27, "PXD Packer --> DHE " << it.first << " connects to DHC " << it.second);
120// }
121
122 for (auto& it : m_dhc_mapto_dhe) {
123 int port = 0;
124 B2DEBUG(27, "PXD Packer --> DHC " << it.first);
125 for (auto& it2 : it.second) {
126 B2DEBUG(27, "PXD Packer --> .. connects to DHE " << it2 << " port " << port);
127 port++;
128 }
129 }
130
131}
132
134{
135 if (m_overrideFirmwareVersion == 0) {
136 if (m_firmwareFromDB.isValid()) m_firmware = (*m_firmwareFromDB).getDHHFirmwareVersion();
137 else {
138 B2WARNING("Could not read PXD Firmware version from db, assume default (new) firmware");
139 m_firmware = 10;
140 }
141 } else {
143 }
144}
145
149
151{
153
154 // First, throw the dices for a few event-wise properties
155 // optional, use simulated trigger information to calculate it
156
157 m_trigger_dhp_framenr = gRandom->Integer(0x10000);
158 // we use the very same m_trigger_dhp_framenr in DHE and DHP header, no second DHP frame is generated anyway
159 // (-> like in the new firmware)
160
161 if (m_storeInjectionBGTiming.isValid()) {
163 } else {
164 m_trigger_dhe_gate = gRandom->Integer(192);
165 }
166
167 int nDigis = m_storeDigits.getEntries();
168
169 B2DEBUG(27, "PXD Packer --> Nr of Digis: " << nDigis);
170
171 startOfVxdID.clear();
172
173 VxdID lastVxdId = -1;
176 for (auto it = m_storeDigits.begin() ; it != m_storeDigits.end(); ++it) {
177 VxdID currentVxdId;
178 currentVxdId = it->getSensorID();
179 currentVxdId.setSegmentNumber(0);
180 if (currentVxdId != lastVxdId) {
181 // do something...
182 lastVxdId = currentVxdId;
183 B2DEBUG(27, "VxdId: " << currentVxdId << " " << (int)currentVxdId);
184 {
185 unsigned int layer, ladder, sensor, segment, dhe_id;
186 layer = currentVxdId.getLayerNumber();
187 ladder = currentVxdId.getLadderNumber();
188 sensor = currentVxdId.getSensorNumber();
189 segment = currentVxdId.getSegmentNumber();// Frame nr?
190 dhe_id = ((layer - 1) << 5) | ((ladder) << 1) | (sensor - 1);
191 B2DEBUG(27, "Layer: " << layer << " Ladder " << ladder << " Sensor " << sensor << " Segment(Frame) " << segment << " =>DHEID: " <<
192 dhe_id);
193 }
194
195 if (startOfVxdID.count(currentVxdId) > 0) B2FATAL("PXD Digits are not sorted by VxdID!");
196 startOfVxdID[currentVxdId] = std::distance(m_storeDigits.begin(), it);
197 B2DEBUG(27, "Offset : " << startOfVxdID[currentVxdId]);
198 }
199 }
200
201 m_trigger_nr = evtPtr->getEvent();
202 m_run_nr_word1 = ((evtPtr->getRun() & 0xFF) << 8) | (evtPtr->getSubrun() & 0xFF);
203 m_run_nr_word2 = ((evtPtr->getExperiment() & 0x3FF) << 6) | ((evtPtr->getRun() >> 8) & 0x3F);
204 m_meta_time = evtPtr->getTime();
205
206 pack_event();
208}
209
210
212{
213 int dhe_ids[5] = {0, 0, 0, 0, 0};
214 B2DEBUG(27, "PXD Packer --> pack_event");
215
216 // loop for each DHC in system
217 // get active DHCs from a database?
218 for (auto& it : m_dhc_mapto_dhe) {
219 int port = 1, port_inx = 0;
220 int act_port = 0;
221
222 for (auto& it2 : it.second) {
223 if (it2 >= 0) act_port += port;
224 port += port;
225 dhe_ids[port_inx] = it2;
226 port_inx++;
227 if (port_inx == 5) break; // not more than five.. checked above
228 }
229
230 // if(act_port&0x1F) B2ERROR();... checked above
231 // act_port&=0x1F;... checked above
232
233 // get active DHE mask from a database?
234
235 m_onsen_header.clear();// Reset
236 m_onsen_payload.clear();// Reset
237 pack_dhc(it.first, act_port, dhe_ids);
238 // and write to PxdRaw object
239 // header will be finished and endian swapped by constructor; payload already has be on filling the vector
241 }
242
243}
244
246{
247 if (m_current_frame.size() & 0x3) {
248 B2ERROR("Frame is not 32bit aligned!!! Unsupported by Unpacker!");
249 }
250 // checksum frame
251 dhe_crc_32_type current_crc;
252 current_crc.process_bytes(m_current_frame.data(), m_current_frame.size());
253 append_int32(current_crc.checksum());
254
255 // and add it
256 m_onsen_header.push_back(m_current_frame.size());
258}
259
260void PXDPackerModule::append_int8(unsigned char w)
261{
262 m_current_frame.push_back(w);
265}
266
267void PXDPackerModule::append_int16(unsigned short w)
268{
269 m_current_frame.push_back((unsigned char)(w >> 8));
270 m_current_frame.push_back((unsigned char)(w));
271 dhe_byte_count += 2;
272 dhc_byte_count += 2;
273}
274
276{
277 m_current_frame.push_back((unsigned char)(w >> 24));
278 m_current_frame.push_back((unsigned char)(w >> 16));
279 m_current_frame.push_back((unsigned char)(w >> 8));
280 m_current_frame.push_back((unsigned char)(w));
281 dhe_byte_count += 4;
282 dhc_byte_count += 4;
283}
284
286{
287 m_current_frame.clear();
288}
289
290void PXDPackerModule::pack_dhc(int dhc_id, int dhe_active, int* dhe_ids)
291{
292 B2DEBUG(27, "PXD Packer --> pack_dhc ID " << dhc_id << " DHE act: " << dhe_active);
293
295 start_frame();
296 append_int32((EDHCFrameHeaderDataType::c_ONSEN_TRG << 27) | (m_trigger_nr & 0xFFFF));
297 append_int32(0xCAFE8000);// HLT HEADER, accepted flag set
298 append_int32(m_trigger_nr); // HLT Trigger Nr
299 append_int16(m_run_nr_word2); // Exp NR 9-0 | Run Nr 13-8
300 append_int16(m_run_nr_word1); // Run Nr 7-0 | Subrunnr 7-0
301 append_int32(0xCAFE0000);// DATCON HEADER ...
302 append_int32(m_trigger_nr); // DATCON Trigger Nr
303 append_int16(m_run_nr_word2); // Exp NR 9-0 | Run Nr 13-8
304 append_int16(m_run_nr_word1); // Run Nr 7-0 | Subrunnr 7-0
306
308
309 dhc_byte_count = 0;
310 start_frame();
311 append_int32((EDHCFrameHeaderDataType::c_DHC_START << 27) | ((dhc_id & 0xF) << 21) | ((dhe_active & 0x1F) << 16) |
312 (m_trigger_nr & 0xFFFF));
314
315 uint32_t mm = (unsigned int)std::round((m_meta_time % 1000000000ull) * 0.127216); // in 127MHz Ticks
316 uint32_t ss = (unsigned int)(m_meta_time / 1000000000ull) ; // in seconds
317 append_int16(((mm << 4) & 0xFFF0) | 0x1); // TT 11-0 | Type --- fill with something useful TODO
318 append_int16(((mm >> 12) & 0x7FFF) | ((ss & 1) ? 0x8000 : 0x0)); // TT 27-12 ... not clear if completely filled by DHC
319 append_int16((ss >> 1) & 0xFFFF); // TT 43-28 ... not clear if completely filled by DHC
320 append_int16(m_run_nr_word1); // Run Nr 7-0 | Subrunnr 7-0
321 append_int16(m_run_nr_word2); // Exp NR 9-0 | Run Nr 13-8
323
324 // loop for each DHE in system
325 // Run & TTT etc are zero until better idea
326
327 for (int i = 0; i < 5; i++) {
328 if (dhe_active & 0x1) pack_dhe(dhe_ids[i], 0xF);
329 dhe_active >>= 1;
330 }
331
333
334 // start_frame();
335 // append_int32((EDHCFrameHeaderDataType::c_ONSEN_ROI<<27) | (m_trigger_nr & 0xFFFF));
337 // add_frame_to_payload();
338
340 unsigned int dlen = (dhc_byte_count / 4); // 32 bit words
341 start_frame();
342 append_int32((EDHCFrameHeaderDataType::c_DHC_END << 27) | ((dhc_id & 0xF) << 21) | (m_trigger_nr & 0xFFFF));
343 append_int32(dlen); // 32 bit word count
344 append_int32(0x00000000); // Error Flags
346
347}
348
349void PXDPackerModule::pack_dhe(int dhe_id, int dhp_active)
350{
351 B2DEBUG(27, "PXD Packer --> pack_dhe ID " << dhe_id << " DHP act: " << dhp_active);
352 // dhe_id is not dhe_id ...
353 bool dhe_has_remapped = !m_InvertMapping;
354
355 if (m_InvertMapping) {
356 // problem, we do not have an exact definition of if this bit is set in the new firmware and under which circumstances
357 // and its not clear if we have to translate the coordinates back to "DHP" layout! (look up table etc!)
358 // this code has never been completed as pxd cluster format will anyway need mapping in firmware
359 B2FATAL("Inverse Mapping not implemented in Packer");
360 }
361
363 dhe_byte_count = 0;
364 start_frame();
365 append_int32((EDHCFrameHeaderDataType::c_DHE_START << 27) | ((dhe_id & 0x3F) << 20) | ((dhp_active & 0xF) << 16) |
366 (m_trigger_nr & 0xFFFF));
367 append_int16(m_trigger_nr >> 16); // Trigger Nr Hi
368 append_int16(0x00000000); // DHE Timer Lo
369 append_int16(0x00000000); // DHE Time Hi
370 append_int16(((m_trigger_dhp_framenr & 0x3F) << 10) |
371 (m_trigger_dhe_gate & 0xFF)); // Last DHP Frame Nr 15-10, Reserved 9-8, Trigger Offset 7-0
373
374// now prepare the data from one halfladder
375// do the ROI selection??? optional...
376// then loop for each DHP in system
377// get active DHPs from a database?
378// and pack data per halfladder.
379// we fake the framenr and startframenr until we find some better solution
380
381 if (dhp_active != 0) {
382 // const int ladder_min_row = 0; Hardware counts from 0, only include if it does not.
383 const int ladder_max_row = PACKER_NUM_ROWS - 1;
384 // const int ladder_min_col = 0;
385 const int ladder_max_col = PACKER_NUM_COLS - 1;
386
388 bzero(halfladder_pixmap, sizeof(halfladder_pixmap));
389
390 VxdID currentVxdId = 0;
397 unsigned short sensor, ladder, layer;
398 sensor = (dhe_id & 0x1) + 1;
399 ladder = (dhe_id & 0x1E) >> 1; // no +1
400 layer = ((dhe_id & 0x20) >> 5) + 1;
401 currentVxdId = VxdID(layer, ladder, sensor);
402
403 B2DEBUG(27, "pack_dhe: VxdId: " << currentVxdId << " " << (int)currentVxdId);
404
405 {
406 auto it = m_storeDigits.begin();
407 B2DEBUG(27, "Advance: " << startOfVxdID[currentVxdId]);
408 advance(it, startOfVxdID[currentVxdId]);
409 for (; it != m_storeDigits.end(); ++it) {
410 auto id = it->getSensorID();
411 id.setSegmentNumber(0);
412 if (currentVxdId != id) break;
414 {
415 unsigned int row, col;
416 row = it->getVCellID();// hardware starts counting at 0!
417 col = it->getUCellID();// U/V cell ID DO NOT follow Belle2 Note, thus no -1
418 if (row > ladder_max_row || col > ladder_max_col) {
419 B2ERROR("U/V out of range U: " << col << " V: " << row);
420 } else {
421 // fill ADC ... convert float to unsigned char, clamp to 0 - 255 , no scaling ... and how about common mode?
422 B2DEBUG(26, "Pixel: V: " << row << ", U: " << col << ", Ch " << it->getCharge());
423 if (!dhe_has_remapped) {
424 do_the_reverse_mapping(row, col, layer, sensor);
425 }
426 halfladder_pixmap[row][col] = (unsigned char) boost::algorithm::clamp(lrint(it->getCharge()), 0, 255);
427 }
428 }
429 }
430 }
431
432 if (m_Clusterize) {
433 B2FATAL("Clusterizer not supported in Packer");
434 } else {
435 for (int i = 0; i < 4; i++) {
436 if (dhp_active & 0x1) {
437 pack_dhp(i, dhe_id, dhe_has_remapped ? 1 : 0);
440// if (m_trigger_nr == 0x11) {
441// pack_dhp_raw(i, dhe_id, false);
442// pack_dhp_raw(i, dhe_id, true);
443// }
444 }
445 dhp_active >>= 1;
446 }
447 }
448 }
449
451 unsigned int dlen = (dhe_byte_count / 2); // 16 bit words
452 start_frame();
453 append_int32((EDHCFrameHeaderDataType::c_DHE_END << 27) | ((dhe_id & 0x3F) << 20) | (m_trigger_nr & 0xFFFF));
454 append_int16(dlen & 0xFFFF); // 16 bit word count
455 append_int16((dlen >> 16) & 0xFFFF); // 16 bit word count
456 append_int32(0x00000000); // Error Flags
458}
459
460void PXDPackerModule::do_the_reverse_mapping(unsigned int& /*row*/, unsigned int& /*col*/, unsigned short /*layer*/,
461 unsigned short /*sensor*/)
462{
463 B2FATAL("code needs to be written");
464 // work to be done
465 // I suspect this code will never be written.
466 //
467 // PXDMappingLookup::map_uv_to_rc_IF_OB(unsigned int& v_cellID, unsigned int& u_cellID, unsigned int& dhp_id, unsigned int dhe_ID)
468 // PXDMappingLookup::map_uv_to_rc_IB_OF(unsigned int& v_cellID, unsigned int& u_cellID, unsigned int& dhp_id, unsigned int dhe_ID)
469}
470
471void PXDPackerModule::pack_dhp_raw(int chip_id, int dhe_id)
472{
473 B2FATAL("This code needs to be checked against new firmware");
474 B2DEBUG(27, "PXD Packer --> pack_dhp Raw Chip " << chip_id << " of DHE id: " << dhe_id);
475 start_frame();
477 append_int32((EDHCFrameHeaderDataType::c_DHP_RAW << 27) | ((dhe_id & 0x3F) << 20) | ((chip_id & 0x03) << 16) |
478 (m_trigger_nr & 0xFFFF));
479 append_int32((EDHPFrameHeaderDataType::c_RAW << 29) | ((dhe_id & 0x3F) << 18) | ((chip_id & 0x03) << 16) |
480 (m_trigger_dhp_framenr & 0xFFFF));
481
482 int c1, c2;
483 c1 = 64 * chip_id;
484 c2 = c1 + 64;
485 if (c2 >= PACKER_NUM_COLS) c2 = PACKER_NUM_COLS;
486
487 // ADC data / memdump for pedestal calculation
488 for (int row = 0; row < PACKER_NUM_ROWS; row++) {
489 for (int col = c1; col < c2; col++) {
491 }
492 // unconnected drain lines -> 0
493 for (int col = c2; col < c1 + 64; col++) {
494 append_int8(0);
495 }
496 }
497
499}
500
501void PXDPackerModule::pack_dhp(int chip_id, int dhe_id, int dhe_has_remapped, int startrow)
502{
503 B2DEBUG(27, "PXD Packer --> pack_dhp Chip " << chip_id << " of DHE id: " << dhe_id);
504 // remark: chip_id != port most of the time ...
505 bool empty = true;
506 unsigned short last_rowstart = 0;
507
508 if (dhe_has_remapped == 0) {
509 // problem, we do not have an exact definition of if this bit is set in the new firmware and under which circumstances
510 // and its not clear if we have to translate the coordinates back to "DHP" layout! (look up table etc!)
511 B2FATAL("dhe_has_remapped == 0");
512 }
513
514 start_frame();
516 append_int32((EDHCFrameHeaderDataType::c_DHP_ZSD << 27) | ((dhe_id & 0x3F) << 20) | ((dhe_has_remapped & 0x1) << 19) | ((
517 chip_id & 0x03) << 16) | (m_trigger_nr & 0xFFFF));
518 append_int32((EDHPFrameHeaderDataType::c_ZSD << 29) | ((dhe_id & 0x3F) << 18) | ((chip_id & 0x03) << 16) |
519 (m_trigger_dhp_framenr & 0xFFFF));
520
521 int c1, c2;
522 c1 = 64 * chip_id;
523 c2 = c1 + 64;
524 if (c2 >= PACKER_NUM_COLS) c2 = PACKER_NUM_COLS;
525 for (int rr = startrow; rr < startrow + PACKER_NUM_ROWS; rr++) {
526 int row = (rr % PACKER_NUM_ROWS); // warp around
530 bool rowstart = true;
531 for (int col = c1; col < c2; col++) {
532 if (halfladder_pixmap[row][col] != 0) {
533 // Attention, we decided to (mis)use ADC=0 values as truncation marker in future firmware! (discussion 15.1.2021)
534 // ADC cut for sim should have been done already
535 B2DEBUG(26, "Pixel: ROW: " << row << ", COL: " << col << ", Ch " << (int)halfladder_pixmap[row][col]);
536 if (rowstart) {
537 last_rowstart = ((row & 0x3FE) << (6 - 1)) | 0; // plus common mode 6 bits ... set to 0
538 append_int16(last_rowstart);
539 rowstart = false;
540 }
541 int colout = col;
542 append_int16(0x8000 | ((row & 0x1) << 14) | ((colout & 0x3F) << 8) | (halfladder_pixmap[row][col] & 0xFF));
543 empty = false;
544 }
545 }
546 }
547 if (!empty && (m_current_frame.size() & 0x3)) {
548 B2DEBUG(27, "Repeat last rowstart to align to 32bit.");
549 append_int16(last_rowstart);
550 }
551
552 if (empty) {
553 B2DEBUG(27, "Found no data for halfladder! DHEID: " << dhe_id << " Chip: " << chip_id);
557 if (m_firmware < 10) {
558 // behaviour of old firmware is not upward compatible, but for simulation (=Packing) the new behaviour
559 // would work even for the old unpacking, even so not according to firmware documentation
560 // -> maybe we remove this code?
561 // we DROP the frame, thus we have to correct DHE and DHC counters
562 dhc_byte_count -= 8; // fixed size of Header
563 dhe_byte_count -= 8; // fixed size of Header
564 start_frame();
566 append_int32((EDHCFrameHeaderDataType::c_GHOST << 27) | ((dhe_id & 0x3F) << 20) | ((chip_id & 0x03) << 16) |
567 (m_trigger_nr & 0xFFFF));
568 }
569 }
571
572}
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition DataStore.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
Module()
Constructor.
Definition Module.cc:30
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
void do_the_reverse_mapping(unsigned int &row, unsigned int &col, unsigned short layer, unsigned short sensor)
function still to be implemented
std::vector< std::vector< unsigned char > > m_onsen_payload
For one DHC event, we utilize one payload for all DHE/DHP frames.
int m_overrideFirmwareVersion
override firmware version from DB.
void initialize() override final
Initialize the module.
StoreObjPtr< PXDInjectionBGTiming > m_storeInjectionBGTiming
Input Obj InjectionBGTiming.
void add_frame_to_payload(void)
Add Frame to Event payload.
unsigned short m_run_nr_word2
Exp+Run Nr.
std::map< VxdID, int > startOfVxdID
Store start of Vxd Detector related digits.
void append_int16(unsigned short w)
cat 16bit value to frame
void pack_dhe(int dhe_id, int dhp_mask)
Pack one DHE (several DHP) to buffer.
void pack_dhp(int dhp_id, int dhe_id, int dhe_reformat, int startrow=0)
Pack one DHP to buffer.
void pack_dhp_raw(int dhp_id, int dhe_id)
Pack one DHP RAW to buffer.
std::string m_RawPXDsName
The name of the StoreArray of generated RawPXDs.
void pack_dhc(int dhc_id, int dhe_mask, int *dhe_ids)
Pack one DHC (several DHE) stored in one RawPXD object.
PXDPackerModule()
Constructor defining the parameters.
void pack_event(void)
Pack one event (several DHC) stored in separate RawPXD object.
void terminate() override final
Terminate the module.
void event() override final
do the packing
std::string m_InjectionBGTimingName
The name of the StoreObj InjectionBGTiming.
unsigned int dhc_byte_count
Byte count in current DHC package.
std::vector< std::vector< int > > m_dhe_to_dhc
Parameter dhc<->dhe list, mapping from steering file.
bool m_Clusterize
Use clusterizer (FCE format)
unsigned short m_run_nr_word1
Run+Subrun Nr.
OptionalDBObjPtr< PXDDHHFirmwareVersionPar > m_firmwareFromDB
firmware version from DB.
std::vector< unsigned int > m_onsen_header
For one DHC event, we utilize one header (writing out, beware of endianness!)
int m_firmware
Firmware version, must be read from database on run change.
void append_int32(unsigned int w)
cat 32value value to frame
StoreArray< RawPXD > m_storeRaws
Output array for RawPxds.
unsigned int m_trigger_dhp_framenr
DHP Readout Frame Nr for DHP and DHE headers.
unsigned int dhe_byte_count
Byte count in current DHE package.
std::map< int, std::vector< int > > m_dhc_mapto_dhe
mapping calculated from m_dhe_to_dhc for easier handling
void start_frame(void)
Start with a new Frame.
void append_int8(unsigned char w)
cat 8bit value to frame
unsigned int m_trigger_dhe_gate
DHE Trigger Gate for DHE headers.
void beginRun() override final
begin run
unsigned int m_packed_events
Event counter.
bool m_InvertMapping
Flag if we invert mapping to DHP row/col or use premapped coordinates.
std::string m_PXDDigitsName
The name of the StoreArray of PXDDigits to be processed.
unsigned long long int m_meta_time
Time(Tag) from MetaInfo.
std::vector< unsigned char > m_current_frame
For current processed frames.
unsigned char halfladder_pixmap[PACKER_NUM_ROWS][PACKER_NUM_COLS]
temporary hitmap buffer for pixel to raw data conversion
unsigned int m_trigger_nr
Trigger Nr.
StoreArray< PXDDigit > m_storeDigits
Input array for Digits.
Type-safe access to single objects in the data store.
Definition StoreObjPtr.h:96
Class to uniquely identify a any structure of the PXD and SVD.
Definition VxdID.h:32
void setSegmentNumber(baseType segment)
Set the sensor segment.
Definition VxdID.h:112
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition Module.h:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Namespace to encapsulate code needed for simulation and reconstrucion of the PXD.
Abstract base class for different kinds of events.
STL namespace.