69 #include "TRestRawSignalRemoveChannelsProcess.h"
95 if (LoadConfigFromFile(configFilename) == -1) LoadDefaultConfig();
109 SetName(
"removeChannels-Default");
110 SetTitle(
"Default config");
118 SetSectionName(this->ClassName());
119 SetLibraryVersion(LIBRARY_VERSION);
121 fInputSignalEvent =
nullptr;
138 if (LoadConfigFromFile(configFilename, name) == -1) LoadDefaultConfig();
147 for (
int n = 0; n < fInputSignalEvent->GetNumberOfSignals(); n++) {
150 Bool_t removeChannel =
false;
151 for (
unsigned int x = 0; x < fChannelIds.size() && !removeChannel; x++)
152 if (sgnl->
GetID() == fChannelIds[x]) removeChannel =
true;
154 if (!removeChannel) fOutputSignalEvent->AddSignal(*sgnl);
157 cout <<
"Channel ID : " << sgnl->
GetID() << endl;
160 cout <<
"Removing channel id : " << sgnl->
GetID() << endl;
165 return fOutputSignalEvent;
175 string removeChannelDefinition;
176 while ((removeChannelDefinition = GetKEYDefinition(
"removeChannel", pos)) !=
"") {
177 Int_t
id =
StringToInteger(GetFieldValue(
"id", removeChannelDefinition));
178 fChannelIds.push_back(
id);
182 while ((removeChannelDefinition = GetKEYDefinition(
"removeChannels", pos)) !=
"") {
183 TVector2 v =
StringTo2DVector(GetFieldValue(
"range", removeChannelDefinition));
184 if (v.X() >= 0 && v.Y() >= 0 && v.Y() > v.X())
185 for (
int n = (Int_t)v.X(); n <= (Int_t)v.Y(); n++) fChannelIds.push_back(n);
A base class for any REST event.
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...
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.
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.
@ 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.