94#include "TRestDetectorSignalRecoveryProcess.h"
134 SetName(
"removeChannels-Default");
135 SetTitle(
"Default config");
172 fReadout = GetMetadata<TRestDetectorReadout>();
175 RESTError <<
"TRestDetectorSignalRecoveryProcess. Readout has not been initialized!" <<
RESTendl;
191 for (
unsigned int x = 0; x < fChannelIds.size(); x++) {
193 RESTDebug <<
"Channel id : " << fChannelIds[x] <<
" Left : " << idL <<
" Right : " << idR <<
RESTendl;
195 if (idL == -1 || idR == -1)
continue;
205 if (leftSgnl ==
nullptr || rightSgnl ==
nullptr)
continue;
208 recoveredSignal.SetID(fChannelIds[x]);
212 for (
int n = 0; n < leftSgnl->GetNumberOfPoints(); n++) {
213 recoveredSignal.
IncreaseAmplitude(leftSgnl->GetTime(n), leftSgnl->GetData(n) / 2.);
215 leftSgnl->
IncreaseAmplitude(leftSgnl->GetTime(n), -1. * leftSgnl->GetData(n) / 2.);
218 for (
int n = 0; n < rightSgnl->GetNumberOfPoints(); n++) {
219 recoveredSignal.
IncreaseAmplitude(rightSgnl->GetTime(n), rightSgnl->GetData(n) / 2.);
221 rightSgnl->
IncreaseAmplitude(rightSgnl->GetTime(n), -1. * rightSgnl->GetData(n) / 2.);
223 }
else if (type == 2 || type == 3) {
226 for (
int n = 0; n < leftSgnl->GetNumberOfPoints(); n++)
227 recoveredSignal.
IncreaseAmplitude(leftSgnl->GetTime(n), leftSgnl->GetData(n) / 6.);
229 for (
int n = 0; n < rightSgnl->GetNumberOfPoints(); n++)
230 recoveredSignal.
IncreaseAmplitude(rightSgnl->GetTime(n), 2 * rightSgnl->GetData(n) / 6.);
235 for (
int n = 0; n < leftSgnl->GetNumberOfPoints(); n++)
236 recoveredSignal.
IncreaseAmplitude(leftSgnl->GetTime(n), 2 * leftSgnl->GetData(n) / 6.);
238 for (
int n = 0; n < rightSgnl->GetNumberOfPoints(); n++)
239 recoveredSignal.
IncreaseAmplitude(rightSgnl->GetTime(n), rightSgnl->GetData(n) / 6.);
244 for (
int n = 0; n < leftSgnl->GetNumberOfPoints(); n++)
245 leftSgnl->
IncreaseAmplitude(leftSgnl->GetTime(n), -1. * leftSgnl->GetData(n) / 4.);
246 for (
int n = 0; n < rightSgnl->GetNumberOfPoints(); n++)
247 rightSgnl->
IncreaseAmplitude(rightSgnl->GetTime(n), -1. * rightSgnl->GetData(n) / 4.);
249 RESTWarning <<
"Adjacent channels for signal " << fChannelIds[x] <<
" not found " <<
RESTendl;
264 RESTDebug <<
"Channel recovered!! " <<
RESTendl;
265 if (leftSgnl !=
nullptr && rightSgnl !=
nullptr)
266 for (
int n = 0; n < leftSgnl->GetNumberOfPoints(); n++)
267 RESTDebug <<
"Sample " << n <<
" : " << leftSgnl->GetData(n) <<
" + " << rightSgnl->GetData(n)
268 <<
" = " << recoveredSignal.GetData(n) <<
RESTendl;
291 for (
int p = 0; p <
fReadout->GetNumberOfReadoutPlanes(); p++) {
306 if (std::find(fChannelIds.begin(), fChannelIds.end(), idLeft) != fChannelIds.end()) {
312 if (std::find(fChannelIds.begin(), fChannelIds.end(), idRight) != fChannelIds.end()) {
Int_t GetDaqID() const
Returns the corresponding daq channel id.
TRestDetectorReadoutChannel * GetChannel(size_t n)
Returns a pointer to a readout channel by index.
Bool_t IsDaqIDInside(Int_t daqID)
Determines if a given daqID number is in the range of the module.
Int_t DaqToReadoutChannel(Int_t daqChannel)
Returns the physical readout channel index for a given daq id channel number.
size_t GetNumberOfModules() const
Returns the total number of modules in the readout plane.
TRestDetectorReadoutModule * GetModule(size_t mod)
Returns a pointer to a readout module using its std::vector index.
TRestDetectorReadoutPlane * GetReadoutPlane(int p)
Returns a pointer to the readout plane by index.
A process allowing to recover selected channels from a TRestRawSignalEvent.
~TRestDetectorSignalRecoveryProcess()
Default destructor.
void InitProcess() override
Function to initialize the process. TRestDetectorSignalRecoveryProcess requires to get a pointer to T...
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
TRestDetectorSignalRecoveryProcess()
Default constructor.
int GetAdjacentSignalIds(Int_t signalId, Int_t &idLeft, Int_t &idRight)
It returns the channel daq id of the adjacent readout channels. It will properly identify that we got...
TRestDetectorSignalEvent * fOutputSignalEvent
A pointer to the specific TRestDetectorSignalEvent input.
void Initialize() override
Function to initialize input/output event members and define the section name.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
TRestDetectorSignalEvent * fInputSignalEvent
A pointer to the specific TRestDetectorSignalEvent input.
TRestEvent * ProcessEvent(TRestEvent *eventInput) override
The main processing event function.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
TRestDetectorReadout * fReadout
A pointer to the readout that will be extracted from TRestRun.
void IncreaseAmplitude(TVector2 p)
If the point already exists inside the detector signal event, the amplitude value will be added to th...
A base class for any REST event.