83 if (fread(&blockhead,
sizeof(blockhead), 1, fInputBinFile) != 1)
return;
84 totalBytesReaded =
sizeof(blockhead);
85 nSamples = blockhead.NEvents;
86 nChannels = blockhead.NHits / blockhead.NEvents;
87 fRate = blockhead.SRate;
88 pulseDepth = blockhead.PSize;
89 RESTDebug <<
"nSamples " << nSamples <<
" NChannels " << nChannels <<
RESTendl;
90 RESTDebug <<
"SRATE: " << (double)fRate <<
" PULSE DEPTH: " << pulseDepth
91 <<
" PRETRIGGER: " << blockhead.Pretrigger <<
RESTendl;
92 for (
int i = 0; i < nChannels; i++) {
93 fScale[i] = blockhead.mVdiv[i];
94 negPolarity[i] = blockhead.NegPolarity[i];
96 tNow =
static_cast<double>(blockhead.TimeStamp);
112 if (nEvents % nSamples == 0 && nEvents != 0) {
113 if (fread(&blockhead,
sizeof(blockhead), 1, fInputBinFile) != 1)
return nullptr;
114 totalBytesReaded +=
sizeof(blockhead);
116 tNow =
static_cast<double>(blockhead.TimeStamp);
120 if (fread(&eventhead,
sizeof(eventhead), 1, fInputBinFile) != 1)
return nullptr;
121 totalBytesReaded +=
sizeof(eventhead);
123 std::vector<Char_t> buffer(pulseDepth);
124 fSignalEvent->SetID(nEvents);
125 fSignalEvent->
SetTime(tNow +
static_cast<double>(eventhead.clockTicksLT) * 1E-6);
130 for (
int i = 0; i < nChannels; i++) {
132 fSignalEvent->AddSignal(sgnl);
134 if (fread((
char*)&buffer[0], pulseDepth, 1, fInputBinFile) != 1)
return nullptr;
135 totalBytesReaded += pulseDepth;
136 for (
int j = 0; j < pulseDepth; j++) {
137 Short_t data = buffer[j];
138 if (negPolarity[i]) data *= -1;
145 fRunInfo->SetEndTimeStamp(tNow +
static_cast<double>(eventhead.clockTicksLT) * 1E-6);