9 #include <daq/rawdata/modules/Root2Raw.h>
11 #include <daq/dataobjects/SendHeader.h>
12 #include <daq/dataobjects/SendTrailer.h>
13 #include <framework/core/Module.h>
14 #include <framework/core/ModuleParamBase.h>
15 #include <framework/datastore/StoreArray.h>
16 #include <framework/logging/Logger.h>
17 #include <rawdata/dataobjects/RawARICH.h>
18 #include <rawdata/dataobjects/RawCDC.h>
19 #include <rawdata/dataobjects/RawECL.h>
20 #include <rawdata/dataobjects/RawFTSW.h>
21 #include <rawdata/dataobjects/RawHeader_v1.h>
22 #include <rawdata/dataobjects/RawKLM.h>
23 #include <rawdata/dataobjects/RawSVD.h>
24 #include <rawdata/dataobjects/RawTOP.h>
44 addParam(
"outputFileName", m_filename,
"Output binary filename",
string(
"datafile.binary"));
47 Root2RawModule::~Root2RawModule()
51 void Root2RawModule::initialize()
53 B2INFO(
"Root2Raw: initialize() started.");
55 m_file = open(m_filename.c_str(), O_CREAT | O_RDWR | O_TRUNC, 0644);
61 B2INFO(
"Root2Raw: initialize() done.");
64 void Root2RawModule::endRun()
68 B2INFO(
"endRun done.");
72 void Root2RawModule::terminate()
75 B2INFO(
"terminate called");
79 void Root2RawModule::event()
83 B2INFO(
"Root2Raw: event() started.");
91 int* evtbuf = (
int*) malloc(MAXEVTSIZE);
114 for (
int i = 0; i < svdarray.
getEntries(); i++) {
116 RawSVD* svd = svdarray[i];
118 memcpy(databuf, svd->GetBuffer(0), svd->GetBlockNwords(0)*
sizeof(
int));
119 nwords += svd->GetBlockNwords(0);
120 databuf += svd->GetBlockNwords(0);
126 for (
int i = 0; i < cdcarray.
getEntries(); i++) {
128 RawCDC* cdc = cdcarray[i];
130 memcpy(databuf, cdc->GetBuffer(0), cdc->GetBlockNwords(0)*
sizeof(
int));
131 nwords += cdc->GetBlockNwords(0);
132 databuf += cdc->GetBlockNwords(0);
138 for (
int i = 0; i < toparray.
getEntries(); i++) {
140 RawTOP* top = toparray[i];
142 memcpy(databuf, top->GetBuffer(0), top->GetBlockNwords(0)*
sizeof(
int));
143 nwords += top->GetBlockNwords(0);
144 databuf += top->GetBlockNwords(0);
150 for (
int i = 0; i < aricharray.
getEntries(); i++) {
154 memcpy(databuf, arich->GetBuffer(0), arich->GetBlockNwords(0)*
sizeof(
int));
155 nwords += arich->GetBlockNwords(0);
156 databuf += arich->GetBlockNwords(0);
162 for (
int i = 0; i < eclarray.
getEntries(); i++) {
164 RawECL* ecl = eclarray[i];
166 memcpy(databuf, ecl->GetBuffer(0), ecl->GetBlockNwords(0)*
sizeof(
int));
167 nwords += ecl->GetBlockNwords(0);
168 databuf += ecl->GetBlockNwords(0);
174 for (
int i = 0; i < klmarray.
getEntries(); i++) {
176 RawKLM* klm = klmarray[i];
186 for (
int i = 0; i < ftswarray.
getEntries(); i++) {
211 nwords += trl.GetTrlNwords();
218 hdr.SetNumNodesinPacket(nblock);
221 rhdr.
SetBuffer(cdcarray[0]->GetBuffer(0));
222 hdr.SetEventNumber(rhdr.
GetEveNo());
232 memcpy(databuf, trl.GetBuffer(), trl.GetTrlNwords()*
sizeof(
int));
234 int is = write(m_file, evtbuf, nwords *
sizeof(
int));
The Raw ARICH class Class for RawCOPPER class data taken by ARICH Currently, this class is almost sam...
The Raw CDC class Class for RawCOPPER class data taken by CDC Currently, this class is almost same as...
virtual int * GetBuffer(int n)
get nth buffer pointer
virtual int GetBlockNwords(int n)
get size of a data block
The Raw ECL class Class for RawCOPPER class data taken by ECL Currently, this class is almost same as...
The Raw KLM class Class for RawCOPPER class data taken by KLM.
The Raw SVD class Class for RawCOPPER class data taken by SVD Currently, this class is almost same as...
The Raw TOP class Class for RawCOPPER class data taken by TOP Currently, this class is almost same as...
A class definition of an input module for Sequential ROOT I/O.
void Initialize()
set buffer
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()
get restart #(8bit)
unsigned int GetExpRunSubrun()
get contents of header
Abstract base class for different kinds of events.