86#include "TRestRawCommonNoiseReductionProcess.h"
172 for (
int sgnl = 0; sgnl <
fInputEvent->GetNumberOfSignals(); sgnl++) {
179 Double_t baseLineMean = 0;
180 for (
int sgnl = 0; sgnl <
fInputEvent->GetNumberOfSignals(); sgnl++) {
183 baseLineMean += baseline;
185 Double_t Baseline = baseLineMean /
fInputEvent->GetNumberOfSignals();
191 for (
int sgnl = 0; sgnl < N; sgnl++) {
196 vector<Double_t> sgnlValues(N, 0.0);
198 for (Int_t bin = 0; bin < nBins; bin++) {
199 for (Int_t sgnl = 0; sgnl < N; sgnl++) {
203 std::sort(sgnlValues.begin(), sgnlValues.end());
206 Int_t begin = 0, middle = 0, end = 0;
207 middle = (Int_t)N / 2;
212 begin = (Int_t)((double_t)N / 2.0);
215 }
else if (
fMode == 1) {
219 norm = (Double_t)end - begin;
223 Double_t binCorrection = 0.0;
224 for (Int_t i = begin; i <= end; i++) binCorrection += sgnlValues[i];
226 binCorrection = binCorrection / norm;
229 for (Int_t sgnl = 0; sgnl < N; sgnl++)
244 for (
int block = 0; block < nBlocks; block++) {
245 firstInBlock = firstID + block * (N + gap);
249 for (Int_t sgnl = 0; sgnl < N; sgnl++) {
250 sigID = firstInBlock + sgnl;
262 vector<Double_t> sgnlValues(nSign, 0.0);
266 for (Int_t bin = 0; bin < nBins; bin++) {
268 for (Int_t sgnl = 0; sgnl < N; sgnl++) {
269 sigID = firstInBlock + sgnl;
281 std::sort(sgnlValues.begin(), sgnlValues.end());
284 Int_t begin = 0, middle = 0, end = 0;
285 middle = (Int_t)nSign / 2;
290 begin = (Int_t)((double_t)nSign / 2.0);
293 }
else if (
fMode == 1) {
297 norm = (Double_t)end - begin;
301 Double_t binCorrection = 0.0;
302 for (Int_t i = begin; i <= end; i++) binCorrection += sgnlValues[i];
304 binCorrection = binCorrection / norm;
307 for (Int_t sgnl = 0; sgnl < N; sgnl++) {
314 for (
int sgnl = 0; sgnl < N; sgnl++) {
A base class for any REST event.
A process to subtract the common channels noise from RawSignal type.
void Initialize() override
Function to initialize input/output event members and define the section name.
~TRestRawCommonNoiseReductionProcess()
Default destructor.
Int_t fBlocks
Common noise to all signals or by groups (It can be 0 or 1).
TRestRawSignalEvent * fInputEvent
A pointer to the specific TRestRawSignalEvent input.
Int_t fMinSignalsRequired
Minimum number of signals required to apply the process.
TRestRawSignalEvent * fOutputEvent
A pointer to the specific TRestRawSignalEvent output.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void EndProcess() override
Function to include required actions after all events have been processed. This method will write the...
TRestRawCommonNoiseReductionProcess()
Default constructor.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
void InitProcess() override
Process initialization.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
Int_t fMode
The mode defines the method to be used (It can be 0 or 1).
An event container for time rawdata signals with fixed length.
Double_t GetBaseLineSigma() const
void CalculateBaseLine(Int_t startBin, Int_t endBin, const std::string &option="")
This method calculates the average and fluctuation of the baseline in the specified range and writes ...
Double_t GetBaseLine() const
void IncreaseBinBy(Int_t bin, Double_t data)
It adds the content of data to fSignalData[bin].
Double_t GetRawData(Int_t n) const
It returns the original data value of point n without baseline correction.
Int_t GetNumberOfPoints() const
Returns the actual number of points, or size of the signal.