Skip to content

Commit 4e101a4

Browse files
authored
Merge pull request #124 from rest-for-physics/missing-observables
Refactor peaks observables to fix issue with dictionaries
2 parents c9827fd + 50cc47e commit 4e101a4

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/TRestRawPeaksFinderProcess.cxx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
//
2-
// Created by lobis on 24-Aug-23.
3-
//
41

52
#include "TRestRawPeaksFinderProcess.h"
63

74
#include <utility>
85

9-
#include "TRestRawReadoutMetadata.h"
10-
116
ClassImp(TRestRawPeaksFinderProcess);
127

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

65-
SetObservableValue("peaks", eventPeaks);
60+
// SetObservableValue("peaks", eventPeaks); // problems with dictionaries
61+
std::vector<UShort_t> peaksChannelId;
62+
std::vector<UShort_t> peaksTime;
63+
std::vector<double> peaksAmplitude;
64+
65+
for (const auto& [channelId, time, amplitude] : eventPeaks) {
66+
peaksChannelId.push_back(channelId);
67+
peaksTime.push_back(time);
68+
peaksAmplitude.push_back(amplitude);
69+
}
70+
71+
SetObservableValue("peaksChannelId", peaksChannelId);
72+
SetObservableValue("peaksTime", peaksTime);
73+
SetObservableValue("peaksAmplitude", peaksAmplitude);
6674

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

0 commit comments

Comments
 (0)