Belle II Software  release-05-02-19
PXDPackerModule.h
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 #pragma once
12 
13 #include <framework/core/Module.h>
14 #include <vxd/dataobjects/VxdID.h>
15 #include <framework/datastore/StoreArray.h>
16 #include <framework/datastore/StoreObjPtr.h>
17 #include <rawdata/dataobjects/RawPXD.h>
18 #include <pxd/dataobjects/PXDDigit.h>
19 #include <pxd/dataobjects/PXDInjectionBGTiming.h>
20 
21 namespace Belle2 {
27  namespace PXD {
28 
39  class PXDPackerModule : public Module {
40  enum {PACKER_NUM_ROWS = 768};
41  enum {PACKER_NUM_COLS = 250};
42 
43  public:
46 
47  private:
49  void initialize() override final;
51  void event() override final;
53  void terminate() override final;
54 
55  std::string m_PXDDigitsName;
56  std::string m_RawPXDsName;
57  std::string m_InjectionBGTimingName;
59  bool m_InvertMapping;
60  bool m_Clusterize;
63  std::vector< std::vector<int >> m_dhe_to_dhc;
64 
65 // /** mapping calculated from m_dhe_to_dhc for easier handling */
66 // std::map <int, int> dhe_mapto_dhc;
67 
69  std::map <int, std::vector <int>> m_dhc_mapto_dhe;
70 
72  unsigned int m_packed_events{0};
74  unsigned int m_trigger_nr{0};
76  unsigned short m_run_nr_word1{0};
78  unsigned short m_run_nr_word2{0};
80  unsigned long long int m_meta_time{0};
81 
83  unsigned int m_trigger_dhp_framenr{0};
85  unsigned int m_trigger_dhe_gate{0};
86 
88  std::vector <unsigned int> m_onsen_header;
89 
91  std::vector <std::vector <unsigned char>> m_onsen_payload;
92 
94  std::vector <unsigned char> m_current_frame;
95 
102 
105  void pack_event(void);
106 
109  void pack_dhc(int dhc_id, int dhe_mask, int* dhe_ids);
110 
113  void pack_dhe(int dhe_id, int dhp_mask);
114 
117  void pack_dhp(int dhp_id, int dhe_id, int dhe_reformat, int startrow = 0);
118 
121  /* cppcheck-suppress unusedPrivateFunction */
122  void pack_dhp_raw(int dhp_id, int dhe_id);
123 
124  void start_frame(void);
125  /* cppcheck-suppress unusedPrivateFunction */
126  void append_int8(unsigned char w);
127  void append_int16(unsigned short w);
128  void append_int32(unsigned int w);
129  void add_frame_to_payload(void);
130 
131  /* function still to be implemented */
132  void do_the_reverse_mapping(unsigned int& row, unsigned int& col, unsigned short layer, unsigned short sensor);
133 
135  std::map <VxdID , int> startOfVxdID;
136 
138  unsigned char halfladder_pixmap[PACKER_NUM_ROWS][PACKER_NUM_COLS] {0};
139 
140  unsigned int dhe_byte_count{0};
141  unsigned int dhc_byte_count{0};
143  };//end class declaration
144 
145 
146  } //end PXD namespace;
148 } // end namespace Belle2
Belle2::PXD::PXDPackerModule::m_packed_events
unsigned int m_packed_events
Event counter.
Definition: PXDPackerModule.h:80
Belle2::PXD::PXDPackerModule::m_trigger_dhe_gate
unsigned int m_trigger_dhe_gate
DHE Trigger Gate for DHE headers.
Definition: PXDPackerModule.h:93
Belle2::PXD::PXDPackerModule::append_int32
void append_int32(unsigned int w)
cat 32value value to frame
Definition: PXDPackerModule.cc:258
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::PXDPackerModule
PXDPackerModule()
Constructor defining the parameters.
Definition: PXDPackerModule.cc:47
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::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::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::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::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::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
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