Belle II Software  release-05-02-19
PXDPackerErrModule.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/PXDDAQStatus.h>
19 #include <pxd/dataobjects/PXDErrorFlags.h>
20 
21 namespace Belle2 {
27  namespace PXD {
28 
39  class PXDPackerErrModule : 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_RawPXDsName;
57  bool m_InvertMapping;
58  bool m_Clusterize;
59  bool m_Check;
60  std::string m_PXDDAQEvtStatsName;
63  std::vector< std::vector<int >> m_dhe_to_dhc;
64 
66  std::map <int, std::vector <int>> m_dhc_mapto_dhe;
67 
69  unsigned int m_packed_events{0};
71  unsigned int m_real_trigger_nr{0};
73  unsigned int m_trigger_nr{0};
75  unsigned short m_run_nr_word1{0};
77  unsigned short m_run_nr_word2{0};
79  unsigned long long int m_meta_time{0};
80 
82  unsigned int m_trigger_dhp_framenr{0};
84  unsigned int m_trigger_dhe_gate{0};
85 
87  bool m_found_fatal {false};
88 
90  std::vector <unsigned int> m_onsen_header;
91 
93  std::vector <std::vector <unsigned char>> m_onsen_payload;
94 
96  std::vector <unsigned char> m_current_frame;
97 
100 
103 
106  void pack_event(void);
107 
110  void pack_dhc(int dhc_id, int dhe_mask, int* dhe_ids);
111 
114  void pack_dhe(int dhe_id, int dhp_mask);
115 
118  void pack_dhp(int dhp_id, int dhe_id, int dhe_reformat);
119 
122  /* cppcheck-suppress unusedPrivateFunction */
123  void pack_dhp_raw(int dhp_id, int dhe_id);
124 
125  void start_frame(void);
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  bool isErrorIn(uint32_t enr);
136 
138  std::map <VxdID , int> startOfVxdID;
139 
141  unsigned char halfladder_pixmap[PACKER_NUM_ROWS][PACKER_NUM_COLS] = {0};
142 
143  unsigned int dhe_byte_count{0};
144  unsigned int dhc_byte_count{0};
146  bool CheckErrorMaskInEvent(unsigned int eventnr, PXDError::PXDErrorFlags mask);
147 
149  static std::vector <PXDErrorFlags> m_errors;
150 
151  };//end class declaration
152 
153 
154  } //end PXD namespace;
156 } // end namespace Belle2
Belle2::PXD::PXDPackerErrModule::m_current_frame
std::vector< unsigned char > m_current_frame
For current processed frames.
Definition: PXDPackerErrModule.h:104
Belle2::PXD::PXDPackerErrModule::initialize
void initialize() override final
Initialize the module.
Definition: PXDPackerErrModule.cc:270
Belle2::PXD::PXDPackerErrModule::m_real_trigger_nr
unsigned int m_real_trigger_nr
Real Trigger Nr.
Definition: PXDPackerErrModule.h:79
Belle2::PXD::PXDPackerErrModule::pack_dhp_raw
void pack_dhp_raw(int dhp_id, int dhe_id)
Pack one DHP RAW to buffer.
Definition: PXDPackerErrModule.cc:855
Belle2::PXD::PXDPackerErrModule::pack_dhp
void pack_dhp(int dhp_id, int dhe_id, int dhe_reformat)
Pack one DHP to buffer.
Definition: PXDPackerErrModule.cc:884
Belle2::PXD::PXDPackerErrModule::CheckErrorMaskInEvent
bool CheckErrorMaskInEvent(unsigned int eventnr, PXDError::PXDErrorFlags mask)
Definition: PXDPackerErrModule.cc:211
Belle2::PXD::PXDPackerErrModule::isErrorIn
bool isErrorIn(uint32_t enr)
Check if we want this type of error in this event.
Definition: PXDPackerErrModule.cc:975
Belle2::PXD::PXDPackerErrModule::m_trigger_dhp_framenr
unsigned int m_trigger_dhp_framenr
DHP Readout Frame Nr for DHP and DHE headers.
Definition: PXDPackerErrModule.h:90
Belle2::PXD::PXDPackerErrModule::terminate
void terminate() override final
Terminate the module.
Definition: PXDPackerErrModule.cc:328
Belle2::PXD::PXDPackerErrModule::m_onsen_header
std::vector< unsigned int > m_onsen_header
For one DHC event, we utilize one header (writing out, beware of endianess!)
Definition: PXDPackerErrModule.h:98
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreObjPtr
Type-safe access to single objects in the data store.
Definition: ParticleList.h:33
Belle2::PXD::PXDPackerErrModule::pack_dhe
void pack_dhe(int dhe_id, int dhp_mask)
Pack one DHE (several DHP) to buffer.
Definition: PXDPackerErrModule.cc:697
Belle2::PXD::PXDPackerErrModule::m_run_nr_word2
unsigned short m_run_nr_word2
Exp+Run Nr.
Definition: PXDPackerErrModule.h:85
Belle2::PXD::PXDPackerErrModule::m_trigger_dhe_gate
unsigned int m_trigger_dhe_gate
DHE Trigger Gate for DHE headers.
Definition: PXDPackerErrModule.h:92
Belle2::PXD::PXDPackerErrModule::event
void event() override final
do the packing
Definition: PXDPackerErrModule.cc:347
Belle2::PXD::PXDPackerErrModule::m_dhe_to_dhc
std::vector< std::vector< int > > m_dhe_to_dhc
Parameter dhc<->dhe list, mapping from steering file.
Definition: PXDPackerErrModule.h:71
Belle2::PXD::PXDPackerErrModule::m_run_nr_word1
unsigned short m_run_nr_word1
Run+Subrun Nr.
Definition: PXDPackerErrModule.h:83
Belle2::PXD::PXDPackerErrModule::m_errors
static std::vector< PXDErrorFlags > m_errors
The pxd error flags.
Definition: PXDPackerErrModule.h:157
Belle2::PXD::PXDPackerErrModule::m_InvertMapping
bool m_InvertMapping
Flag if we invert mapping to DHP row/col or use premapped coordinates.
Definition: PXDPackerErrModule.h:65
Belle2::PXD::PXDPackerErrModule::m_PXDDAQEvtStatsName
std::string m_PXDDAQEvtStatsName
The name of the StoreObjPtr of PXDDAQStatus to be read.
Definition: PXDPackerErrModule.h:68
Belle2::PXD::PXDPackerErrModule::m_trigger_nr
unsigned int m_trigger_nr
Trigger Nr.
Definition: PXDPackerErrModule.h:81
Belle2::PXD::PXDPackerErrModule::PXDPackerErrModule
PXDPackerErrModule()
Constructor defining the parameters.
Definition: PXDPackerErrModule.cc:249
Belle2::PXD::PXDPackerErrModule::m_storeRaws
StoreArray< RawPXD > m_storeRaws
Output array for RawPxds.
Definition: PXDPackerErrModule.h:107
Belle2::PXD::PXDPackerErrModule::dhe_byte_count
unsigned int dhe_byte_count
Byte count in current DHE package.
Definition: PXDPackerErrModule.h:151
Belle2::PXD::PXDPackerErrModule::start_frame
void start_frame(void)
Start with a new Frame.
Definition: PXDPackerErrModule.cc:524
Belle2::PXD::PXDPackerErrModule::dhc_byte_count
unsigned int dhc_byte_count
Byte count in current DHC package.
Definition: PXDPackerErrModule.h:152
Belle2::PXD::PXDPackerErrModule::append_int16
void append_int16(unsigned short w)
cat 16bit value to frame
Definition: PXDPackerErrModule.cc:496
Belle2::PXD::PXDPackerErrModule::halfladder_pixmap
unsigned char halfladder_pixmap[PACKER_NUM_ROWS][PACKER_NUM_COLS]
temporary hitmap buffer for pixel to raw data conversion
Definition: PXDPackerErrModule.h:149
Belle2::PXD::PXDPackerErrModule::m_RawPXDsName
std::string m_RawPXDsName
The name of the StoreArray of generated RawPXDs.
Definition: PXDPackerErrModule.h:63
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::PXD::PXDPackerErrModule::add_frame_to_payload
void add_frame_to_payload(void)
Add Frame to Event payload.
Definition: PXDPackerErrModule.cc:473
Belle2::PXD::PXDPackerErrModule::m_Clusterize
bool m_Clusterize
Use clusterizer (FCE format)
Definition: PXDPackerErrModule.h:66
Belle2::PXD::PXDPackerErrModule::append_int8
void append_int8(unsigned char w)
cat 8bit value to frame
Definition: PXDPackerErrModule.cc:489
Belle2::PXD::PXDPackerErrModule::m_meta_time
unsigned long long int m_meta_time
Time(Tag) from MetaInfo.
Definition: PXDPackerErrModule.h:87
Belle2::PXD::PXDPackerErrModule::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: PXDPackerErrModule.cc:529
Belle2::PXD::PXDPackerErrModule::startOfVxdID
std::map< VxdID, int > startOfVxdID
Store start of Vxd Detector related digits.
Definition: PXDPackerErrModule.h:146
Belle2::PXD::PXDPackerErrModule::pack_event
void pack_event(void)
Pack one event (several DHC) stored in seperate RawPXD object.
Definition: PXDPackerErrModule.cc:389
Belle2::PXD::PXDPackerErrModule::m_found_fatal
bool m_found_fatal
flag if we found one test failing
Definition: PXDPackerErrModule.h:95
Belle2::PXD::PXDPackerErrModule::m_daqStatus
StoreObjPtr< PXDDAQStatus > m_daqStatus
Output array for RawPxds.
Definition: PXDPackerErrModule.h:110
Belle2::PXD::PXDPackerErrModule::m_packed_events
unsigned int m_packed_events
Event counter.
Definition: PXDPackerErrModule.h:77
Belle2::PXD::PXDPackerErrModule::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: PXDPackerErrModule.h:101
Belle2::PXD::PXDPackerErrModule::m_Check
bool m_Check
false=Pack Raw Data, true=Check unpacked result
Definition: PXDPackerErrModule.h:67
Belle2::PXD::PXDPackerErrModule::append_int32
void append_int32(unsigned int w)
cat 32value value to frame
Definition: PXDPackerErrModule.cc:504
Belle2::PXD::PXDPackerErrModule::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: PXDPackerErrModule.h:74