11 #include <rawdata/dataobjects/RawPXD.h>
12 #include <rawdata/modules/MakeDumHSLBData.h>
16 #include <sys/types.h>
36 addParam(
"OutputFileName", m_out_fname,
"Name of an output file",
string(
"dumhslb.dat"));
40 MakeDumHSLBDataModule::~MakeDumHSLBDataModule()
44 void MakeDumHSLBDataModule::initialize()
46 B2INFO(
"MakeDumHSLBData: initialize() started.");
49 m_filefd = open(m_out_fname.c_str(), O_WRONLY | O_CREAT);
51 printf(
"Error : cannot open %s: %s\n", m_out_fname.c_str(), strerror(errno));
54 if (fstat(m_filefd, &statbuf) < 0) {
59 B2INFO(
"MakeDumHSLBData: initialize() done.");
63 void MakeDumHSLBDataModule::writeData(
RawCOPPER* raw_copper,
int i)
65 unsigned int eve_num = raw_copper->
GetEveNo(i);
66 unsigned int cpr_id = raw_copper->
GetNodeID(i);
67 for (
int j = 0 ; j < 4; j++) {
70 printf(
"===== Detector Buffer(FINESSE A) 0x%x words \n", raw_copper->
GetDetectorNwords(i, 0));
71 int header = 0xCAFEBABE;
73 if ((len = write(m_filefd, &header,
sizeof(
int))) !=
sizeof(
int)) {
74 perror(
"write error");
77 if ((len = write(m_filefd, &eve_num,
sizeof(
int))) !=
sizeof(
int)) {
78 perror(
"write error");
81 if ((len = write(m_filefd, &cpr_id,
sizeof(
int))) !=
sizeof(
int)) {
82 perror(
"write error");
85 if ((len = write(m_filefd, &nwords,
sizeof(
int))) !=
sizeof(
int)) {
86 perror(
"write error");
90 printf(
"hdr 0x%.8x eve %10u cprid 0x%.8x nwrods %d\n", header, eve_num, cpr_id, nwords);
95 void MakeDumHSLBDataModule::event()
99 B2INFO(
"MakeDumHSLBData: event() started.");
104 for (
int i = 0; i < rawcprarray.
getEntries(); i++) {
105 for (
int j = 0; j < rawcprarray[ i ]->GetNumEntries(); j++) {
106 printf(
"\n===== DataBlock(RawCOPPER): Block # %d ", i);
107 writeData(rawcprarray[ i ], j);
115 for (
int i = 0; i < raw_svdarray.
getEntries(); i++) {
116 for (
int j = 0; j < raw_svdarray[ i ]->GetNumEntries(); j++) {
117 printf(
"\n===== DataBlock(RawSVD) : Block # %d ", i);
118 writeData(raw_svdarray[ i ], j);
126 for (
int i = 0; i < raw_cdcarray.
getEntries(); i++) {
127 for (
int j = 0; j < raw_cdcarray[ i ]->GetNumEntries(); j++) {
128 printf(
"\n===== DataBlock(RawCDC) : Block # %d ", i);
129 writeData(raw_cdcarray[ i ], j);
137 for (
int i = 0; i < raw_pxdarray.
getEntries(); i++) {
138 printf(
"\n===== DataBlock(RawPXD) : Block # %d ", i);
139 printPXDEvent(raw_pxdarray[ i ]);
143 for (
int i = 0; i < raw_bpidarray.
getEntries(); i++) {
144 for (
int j = 0; j < raw_bpidarray[ i ]->GetNumEntries(); j++) {
145 printf(
"\n===== DataBlock(RawTOP) : Block # %d ", i);
146 writeData(raw_bpidarray[ i ], j);
151 for (
int i = 0; i < raw_epidarray.
getEntries(); i++) {
152 for (
int j = 0; j < raw_epidarray[ i ]->GetNumEntries(); j++) {
153 printf(
"\n===== DataBlock(RawARICH) : Block # %d ", i);
154 writeData(raw_epidarray[ i ], j);
159 for (
int i = 0; i < raw_klmarray.
getEntries(); i++) {
160 for (
int j = 0; j < raw_klmarray[ i ]->GetNumEntries(); j++) {
161 printf(
"\n===== DataBlock(RawKLM) : Block # %d ", i);
162 writeData(raw_klmarray[ i ], j);
167 for (
int i = 0; i < raw_eclarray.
getEntries(); i++) {
168 for (
int j = 0; j < raw_eclarray[ i ]->GetNumEntries(); j++) {
169 printf(
"\n===== DataBlock(RawECL) : Block # %d ", i);
170 writeData(raw_eclarray[ i ], j);
175 for (
int i = 0; i < raw_trgarray.
getEntries(); i++) {
176 for (
int j = 0; j < raw_trgarray[ i ]->GetNumEntries(); j++) {
177 printf(
"\n===== DataBlock(RawTRG) : Block # %d ", i);
178 writeData(raw_trgarray[ i ], j);
Module to make a binary file from Raw*** events for input of wirte-dumhsbx.
Module to get data from DataStore and send it to another network node.
The Raw COPPER class This class stores data received by COPPER via belle2linkt Data from all detector...
Accessor to arrays stored in the data store.
int getEntries() const
Get the number of objects in the array.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
unsigned int GetEveNo(int n)
get subrun #(8bit)
int GetDetectorNwords(int n, int finesse_num)
get Detector buffer length
int * GetDetectorBuffer(int n, int finesse_num)
get Detector buffer
unsigned int GetNodeID(int n)
get node-ID from data
Abstract base class for different kinds of events.