 |
Belle II Software
release-05-02-19
|
14 #define TRGCDC_SHORT_NAMES
19 #include "trg/cdc/modules/tsstream/TRGCDCTSStreamModule.h"
20 #include "trg/trg/Debug.h"
21 #include "trg/trg/BitStream.h"
22 #include "trg/cdc/Wire.h"
23 #include "trg/cdc/Segment.h"
24 #include "trg/cdc/Layer.h"
38 TRGCDCTSStreamModule::version()
const
40 return string(
"TRGCDCTSStreamModule 0.00");
43 TRGCDCTSStreamModule::TRGCDCTSStreamModule()
47 _streamFilename(
"unknown"),
52 string desc =
"TRGCDCTSStreamModule(" +
version() +
")";
57 "TRGCDCTSStream debug level",
64 "The filename of bit stream",
68 cout <<
"TRGCDCTSStreamModule ... created" << endl;
78 cout <<
"TRGCDCTSStreamModule ... destructed " << endl;
85 cout <<
"TRGCDCTSStreamModule::initialize ... options" << endl;
93 unsigned val = TRGBSRecord_Comment;
94 _out->write((
char*) & val, 4);
95 const string cmt =
"test data ";
97 _out->write((
char*) & val, 4);
98 _out->write(cmt.c_str(), cmt.size());
111 const unsigned nWires = lyr->
nCells();
117 for (
unsigned i = 0; i < nWires; i++) {
118 const TCSegment& s = (TCSegment&) * (* lyr)[i];
119 _wires[l].push_back(s.wires()[5]);
124 unsigned val = TRGBSRecord_BeginRun;
125 _out->write((
char*) & val, 4);
127 _out->write((
char*) & val, 4);
131 cout <<
"TRGCDCTSStreamModule ... beginRun called. TRGCDC version="
144 unsigned val = TRGBSRecord_BeginEvent;
145 _out->write((
char*) & val, 4);
147 _out->write((
char*) & val, 4);
151 for (
unsigned c = 0; c < 100; c++) {
154 unsigned val = TRGBSRecord_Clock;
155 _out->write((
char*) & val, 4);
157 _out->write((
char*) & val, 4);
159 _out->write((
char*) & val, 4);
163 for (
unsigned l = 0; l < 9; l++) {
169 for (
unsigned i = 0; i <
_wires[l].size(); i++) {
171 bool hit = s.state(c);
176 unsigned val = TRGBSRecord_SegmentSL0;
178 _out->write((
char*) & val, 4);
180 _out->write((
char*) & val, 4);
181 for (
unsigned i = 0; i < stream.sizeInChar(); i++) {
182 char cs = stream.c(i);
183 _out->write(& cs, 1);
188 cout <<
"Super layer " << l <<
", clock " << c << endl;
195 unsigned val = TRGBSRecord_EndEvent;
196 _out->write((
char*) & val, 4);
198 _out->write((
char*) & val, 4);
207 unsigned val = TRGBSRecord_EndRun;
208 _out->write((
char*) & val, 4);
210 _out->write((
char*) & val, 4);
214 cout <<
"TRGCDCTSStreamModule ... endRun called " << endl;
226 cout <<
"TRGCDCTSStreamModule ... terminate called " << endl;
std::vector< const TRGCDCWire * > _wires[9]
Storage for TS central wires.
A class to represent a digitized signal. Unit is nano second.
int _debugLevel
Debug level.
unsigned nCells(void) const
returns # of cells.
void setDescription(const std::string &description)
Sets the description of the module.
static int level(void)
returns the debug level.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
unsigned nSegmentLayers(void) const
returns # of track segment layers.
void dump(const std::string &message) const
dumps debug information.
std::ofstream * _out
A pointer to an output file.
A class to represent a cell layer.
A class to represent a bit stream.
std::string version(void) const
returns version of TRGCDCTSStreamModule.
virtual void initialize() override
Initilizes TRGCDCTSStreamModule.
int _mode
Mode for streaming data.
const TRGCDCLayer * segmentLayer(unsigned id) const
returns a pointer to a track segment layer.
virtual void terminate() override
Called when processing ended.
Abstract base class for different kinds of events.
static TRGCDC * getTRGCDC(void)
returns TRGCDC object.
std::string version(void) const
returns version.
virtual void endRun() override
Called when run ended.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
static std::string tab(void)
returns tab spaces.
virtual void beginRun() override
Called when new run started.
std::string _streamFilename
The filename of bit stream.
TRGCDC * _cdc
A pointer to a TRGCDC;.
virtual ~TRGCDCTSStreamModule()
Destructor.
virtual void event() override
Called event by event.