83#include "TRestRawSignalShapingProcess.h"
199 std::vector<double> response;
211 for (
int i = 0; i < Nr; i++) {
212 response[i] = TMath::Exp(-0.5 * (i - cBin) * (i - cBin) / sigma / sigma);
213 response[i] = response[i] / TMath::Sqrt(2 * M_PI) / sigma;
220 for (
int i = 0; i < Nr; i++) {
222 response[i] = TMath::Exp(-coeff);
229 for (
int i = 0; i < Nr; i++) {
231 response[i] = TMath::Exp(-3. * coeff) * coeff * coeff * coeff;
238 for (
int i = 0; i < Nr; i++) {
240 response[i] = TMath::Exp(-3. * coeff) * coeff * coeff * coeff * sin(coeff);
243 if (
GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Warning)
244 cout <<
"REST WARNING. Shaping type : " <<
fShapingType <<
" is not defined!!" << endl;
250 for (
int n = 0; n < Nr; n++) sum += response[n];
251 for (
int n = 0; n < Nr; n++) response[n] = response[n] *
fShapingGain / sum;
258 vector<double> out(nBins);
259 for (
int m = 0; m < nBins; m++) out[m] = 0;
261 for (
int m = 0; m < nBins; m++) {
262 if (inSignal.
GetData(m) >= 0) {
264 for (
int n = -Nr / 2; m + n < nBins && n < Nr / 2; n++)
265 if (m + n >= 0) out[m + n] += response[n + Nr / 2] * inSignal.
GetData(m);
267 for (
int n = 0; m + n < nBins && n < Nr; n++)
268 out[m + n] += response[n] * inSignal.
GetData(m);
272 for (
int i = 0; i < nBins; i++) {
273 shapingSignal.
AddPoint((Short_t)round(out[i]));
A base class for any REST event.
An event container for time rawdata signals with fixed length.
Double_t fShapingTime
The characteristic time of the shaping.
void Initialize() override
Function to initialize input/output event members and define the section name.
TRestRawSignalEvent * fOutputSignalEvent
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.
TRestRawSignalEvent * fInputSignalEvent
A pointer to the specific TRestRawSignalEvent input.
TString fShapingType
Types are : gaus, shaper, shaperSin, responseFile.
~TRestRawSignalShapingProcess()
Default destructor.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
TRestRawSignalShapingProcess()
Default constructor.
void InitProcess() override
Process initialization. Observable names are interpreted and auxiliar observable members,...
Double_t fShapingGain
A value used to scale the input signal.
It defines a Short_t array with a physical parameter that evolves in time using a fixed time bin.
void SetSignalID(Int_t sID)
It sets the id number of the signal.
Double_t GetData(Int_t n) const
It returns the data value of point n including baseline correction.
void AddPoint(Short_t)
Adds a new point to the end of the signal data array.
Int_t GetSignalID() const
Returns the value of signal ID.
Int_t GetNumberOfPoints() const
Returns the actual number of points, or size of the signal.