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