Skip to content

Commit

Permalink
Merge pull request #124 from rest-for-physics/missing-observables
Browse files Browse the repository at this point in the history
Refactor peaks observables to fix issue with dictionaries
  • Loading branch information
lobis authored Mar 9, 2024
2 parents c9827fd + 50cc47e commit 4e101a4
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/TRestRawPeaksFinderProcess.cxx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
//
// Created by lobis on 24-Aug-23.
//

#include "TRestRawPeaksFinderProcess.h"

#include <utility>

#include "TRestRawReadoutMetadata.h"

ClassImp(TRestRawPeaksFinderProcess);

using namespace std;
Expand Down Expand Up @@ -62,7 +57,20 @@ TRestEvent* TRestRawPeaksFinderProcess::ProcessEvent(TRestEvent* inputEvent) {
return std::tie(std::get<1>(a), std::get<0>(a)) < std::tie(std::get<1>(b), std::get<0>(b));
});

SetObservableValue("peaks", eventPeaks);
// SetObservableValue("peaks", eventPeaks); // problems with dictionaries
std::vector<UShort_t> peaksChannelId;
std::vector<UShort_t> peaksTime;
std::vector<double> peaksAmplitude;

for (const auto& [channelId, time, amplitude] : eventPeaks) {
peaksChannelId.push_back(channelId);
peaksTime.push_back(time);
peaksAmplitude.push_back(amplitude);
}

SetObservableValue("peaksChannelId", peaksChannelId);
SetObservableValue("peaksTime", peaksTime);
SetObservableValue("peaksAmplitude", peaksAmplitude);

std::vector<UShort_t> windowIndex(eventPeaks.size(), 0); // Initialize with zeros
std::vector<UShort_t> windowCenter; // for each different window, the center of the window
Expand Down

0 comments on commit 4e101a4

Please sign in to comment.