65#include "TRestRawFeminosRootToSignalProcess.h"
71TRestRawFeminosRootToSignalProcess::TRestRawFeminosRootToSignalProcess() {
Initialize(); }
73TRestRawFeminosRootToSignalProcess::TRestRawFeminosRootToSignalProcess(
const char* configFilename) {
77TRestRawFeminosRootToSignalProcess::~TRestRawFeminosRootToSignalProcess() {}
89 const auto inputFilename =
fRunInfo->GetInputFileName(0);
92 if (inputFilename.substr(inputFilename.size() - 5) !=
".root") {
93 cerr <<
"TRestRawFeminosRootToSignalProcess::InitProcess: Input file is not a root file" << endl;
97 fInputFile = TFile::Open(inputFilename.c_str(),
"READ");
99 cerr <<
"TRestRawFeminosRootToSignalProcess::InitProcess: Error opening input file" << endl;
104 fInputRunTree = fInputFile->Get<TTree>(
"run");
105 fInputEventTree = fInputFile->Get<TTree>(
"events");
107 if (!fInputRunTree || !fInputEventTree) {
108 cerr <<
"TRestRawFeminosRootToSignalProcess::InitProcess: Error opening input trees" << endl;
112 fRunInfo->SetFeminosDaqTotalEvents(fInputEventTree->GetEntries());
114 fInputEventTree->SetBranchAddress(
"timestamp", &fInputEventTreeTimestamp);
115 fInputEventTree->SetBranchAddress(
"signal_ids", &fInputEventTreeSignalIds);
116 fInputEventTree->SetBranchAddress(
"signal_values", &fInputEventTreeSignalValues);
122 fInputEventTree->GetEntry(fInputTreeEntry);
124 fSignalEvent->SetID(fInputTreeEntry);
127 fSignalEvent->
SetTime(fInputEventTreeTimestamp / 1000, fInputEventTreeTimestamp % 1000);
129 for (
size_t i = 0; i < fInputEventTreeSignalIds->size(); i++) {
133 const auto id = fInputEventTreeSignalIds->at(i);
136 for (
int j = 0; j < 512; j++) {
137 signal.AddPoint(
short(fInputEventTreeSignalValues->at(i * 512 + j)));
140 fSignalEvent->AddSignal(signal);
143 fInputTreeEntry += 1;
145 if (fInputTreeEntry >= fInputEventTree->GetEntries()) {
bool fIsExternal
It defines if the process reads event data from an external source.
TRestRun * fRunInfo
< Pointer to TRestRun object where to find metadata.
A base class for any REST event.
void SetTime(Double_t time)
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
Process one event.
void Initialize() override
Making default settings.
An event container for time rawdata signals with fixed length.
It defines a Short_t array with a physical parameter that evolves in time using a fixed time bin.