54#include "TRestRawTDSToSignalProcess.h"
83 if (fread(&blockhead,
sizeof(blockhead), 1, fInputBinFile) != 1)
return;
84 totalbytesRead =
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 totalbytesRead +=
sizeof(blockhead);
116 tNow =
static_cast<double>(blockhead.TimeStamp);
120 if (fread(&eventhead,
sizeof(eventhead), 1, fInputBinFile) != 1)
return nullptr;
121 totalbytesRead +=
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 totalbytesRead += 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);
TRestRun * fRunInfo
< Pointer to TRestRun object where to find metadata.
A base class for any REST event.
void SetTime(Double_t time)
void AddChargeToSignal(Int_t sgnlID, Int_t bin, Short_t value)
It defines a Short_t array with a physical parameter that evolves in time using a fixed time bin.
void SetSignalID(Int_t sID)
It sets the id number of the signal.
A process to read binary files produced with TDS (Tektronix oscilloscope) DAQ.
TRestRawTDSToSignalProcess()
Default constructor.
void Initialize() override
Function to initialize input/output event members and define the section name, calls parent TRestRawT...
~TRestRawTDSToSignalProcess()
Default destructor.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void InitProcess() override
Process initialization. Read first header block and initializes several variables such as: nSamples,...
void Initialize() override
Making default settings.