69#include "TRestRawSignalRemoveChannelsProcess.h"
111 SetName(
"removeChannels-Default");
112 SetTitle(
"Default config");
152 if (run !=
nullptr) {
161 cerr <<
"TRestRawSignalRemoveChannelsProcess::ProcessEvent: readout metadata is null, cannot filter "
162 "the process by signal type"
167 for (
int n = 0; n <
fInputEvent->GetNumberOfSignals(); n++) {
170 bool removeSignal =
false;
173 for (
int fChannelId : fChannelIds) {
174 if (signal->
GetID() == fChannelId) {
181 if (!removeSignal && !fChannelTypes.empty()) {
184 if (find(fChannelTypes.begin(), fChannelTypes.end(), channelType) != fChannelTypes.end()) {
187 if (fChannelTypesToRemove.find(signalId) != fChannelTypesToRemove.end() &&
188 fChannelTypesToRemove.at(signalId) != channelType) {
190 "TRestRawSignalRemoveChannelsProcess: Signal was already recorded to have some type, "
193 fChannelTypesToRemove[signalId] = channelType;
203 cout <<
"Channel ID : " << signal->
GetID() << endl;
207 cout <<
"Removing channel id : " << signal->
GetID() << endl;
225 string removeChannelDefinition;
226 while (!(removeChannelDefinition =
GetKEYDefinition(
"removeChannel", pos)).empty()) {
231 fChannelIds.push_back(
id);
235 while (!(removeChannelDefinition =
GetKEYDefinition(
"removeChannels", pos)).empty()) {
237 if (v.X() == -1 && v.Y() == -1) {
240 if (v.X() >= 0 && v.Y() >= 0 && v.Y() > v.X()) {
241 for (
int n = (Int_t)v.X(); n <= (Int_t)v.Y(); n++) {
242 fChannelIds.push_back(n);
248 while (!(removeChannelDefinition =
GetKEYDefinition(
"removeChannels", pos)).empty()) {
249 string type =
GetFieldValue(
"type", removeChannelDefinition);
250 if (type.empty() || type ==
"Not defined") {
253 fChannelTypes.push_back(type);
260 for (
int channelId : fChannelIds) {
261 RESTMetadata <<
"Channel id to remove: " << channelId <<
RESTendl;
264 if (!fChannelTypes.empty()) {
265 RESTMetadata <<
"Channel types to be removed: ";
266 for (
const auto& type : fChannelTypes) {
267 RESTMetadata << type <<
" ";
272 for (
const auto& [signalId, type] : fChannelTypesToRemove) {
273 RESTMetadata <<
"Removing channel of type '" << type <<
"' and id " << signalId <<
RESTendl;
TRestRun * GetRunInfo() const
Return the pointer of the hosting TRestRun object.
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
virtual void InitializeReferences(TRestRun *run)
Initialize dynamical references when loading the event from a root file.
An event container for time rawdata signals with fixed length.
A process allowing to remove selected channels from a TRestRawSignalEvent.
void InitFromConfigFile() override
Function reading input parameters from the RML TRestDetectorSignalToRawSignalProcess metadata section...
TRestRawSignalEvent * fOutputEvent
A pointer to the specific TRestRawSignalEvent input.
TRestRawReadoutMetadata * fReadoutMetadata
A pointer to the readout metadata.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void Initialize() override
Function to initialize input/output event members and define the section name.
TRestRawSignalEvent * fInputEvent
A pointer to the specific TRestDetectorSignalEvent input.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
~TRestRawSignalRemoveChannelsProcess()
Default destructor.
TRestRawSignalRemoveChannelsProcess()
Default constructor.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
It defines a Short_t array with a physical parameter that evolves in time using a fixed time bin.
Int_t GetID() const
Returns the value of signal ID.
Int_t GetSignalID() const
Returns the value of signal ID.
@ REST_Extreme
show everything
@ REST_Debug
+show the defined debug messages
Int_t GetChar(std::string hint="Press a KEY to continue ...")
Helps to pause the program, printing a message before pausing.
Int_t StringToInteger(std::string in)
Gets an integer from a string.
TVector2 StringTo2DVector(std::string in)
Gets a 2D-vector from a string.