103 const auto inputFilename =
fRunInfo->GetInputFileName(0);
106 if (inputFilename.substr(inputFilename.size() - 5) !=
".root") {
107 cerr <<
"TRestRawFeminosRootToSignalProcess::InitProcess: Input file is not a root file" << endl;
111 fInputFile = TFile::Open(inputFilename.c_str(),
"READ");
113 cerr <<
"TRestRawFeminosRootToSignalProcess::InitProcess: Error opening input file" << endl;
118 fInputRunTree = fInputFile->Get<TTree>(
"run");
119 fInputEventTree = fInputFile->Get<TTree>(
"events");
121 if (!fInputRunTree || !fInputEventTree) {
122 cerr <<
"TRestRawFeminosRootToSignalProcess::InitProcess: Error opening input trees" << endl;
126 if (fUseFeminosDaqRunInfo) {
127 ULong64_t startTimeStampMilliseconds = 0;
128 ULong64_t runNumber = 0;
129 std::string* runTag =
new std::string();
130 std::string* runDescription =
new std::string();
131 fInputRunTree->SetBranchAddress(
"timestamp", &startTimeStampMilliseconds);
132 fInputRunTree->SetBranchAddress(
"number", &runNumber);
133 fInputRunTree->SetBranchAddress(
"tag", &runTag);
134 fInputRunTree->SetBranchAddress(
"comments", &runDescription);
150 fInputRunTree->GetEntry(0);
153 Double_t startTimeStamp = startTimeStampMilliseconds / 1000.0;
154 fRunInfo->SetStartTimeStamp(startTimeStamp);
157 if (*runTag ==
"\n") {
160 if (*runDescription ==
"\n") {
161 runDescription->clear();
164 fRunInfo->SetRunDescription(*runDescription);
165 fRunInfo->SetFeminosDaqTotalEvents(fInputEventTree->GetEntries());
168 fInputEventTree->SetBranchAddress(
"timestamp", &fInputEventTreeTimestamp);
169 fInputEventTree->SetBranchAddress(
"signal_ids", &fInputEventTreeSignalIds);
170 fInputEventTree->SetBranchAddress(
"signal_values", &fInputEventTreeSignalValues);
176 fInputEventTree->GetEntry(fInputTreeEntry);
178 fSignalEvent->SetID(fInputTreeEntry);
181 fSignalEvent->SetTime(fInputEventTreeTimestamp / 1000, fInputEventTreeTimestamp % 1000 * 1000000);
185 if (!fUseFeminosDaqRunInfo && fInputEventTreeTimestamp < fStartTimestamp) {
186 fStartTimestamp = fInputEventTreeTimestamp;
189 if (fInputEventTreeTimestamp > fEndTimestamp) {
190 fEndTimestamp = fInputEventTreeTimestamp;
193 for (
size_t i = 0; i < fInputEventTreeSignalIds->size(); i++) {
197 const auto id = fInputEventTreeSignalIds->at(i);
200 for (
int j = 0; j < 512; j++) {
201 signal.AddPoint(
short(fInputEventTreeSignalValues->at(i * 512 + j)));
204 fSignalEvent->AddSignal(signal);
207 fInputTreeEntry += 1;
209 if (fInputTreeEntry >= fInputEventTree->GetEntries()) {