Hi Tao, thanks for reporting this.
Actually, what it is the sum
variable in your image? I cannot find this variable on the code at the repository.
From my perspective, I don’t understand this correction you are adding, but this is probably because I don’t know what means the sum
.
I guess, this problem should be solved on the generation of rsp
at the gaus
definition.
// Line 207
if (fShapingType == "gaus") {
...
Double_t amp = fShapingGain;
rsp = new double[Nr];
for (int i = 0; i < Nr; i++)
rsp[i] = (amp * TMath::Exp(-0.5 * (i - cBin) * (i - cBin) / sigma / sigma));
}
The integral of rsp
should be 1 in order to do not affect the integral of the convoluted result. But there is also the option to insert a given amplitude through the gain
parameter.
I believe, the gaussian is not properly normalised, when defining the rsp
and it should be something like this.
rsp[i] = (amp / sigma / TMath::Sqrt( 2 * M_PI ) * TMath::Exp(-0.5 * (i - cBin) * (i - cBin) / sigma / sigma));
but actually I believe the actual implementation is wrong, is missing the normalisation factor, as it is
rsp[i] = (amp * TMath::Exp(-0.5 * (i - cBin) * (i - cBin) / sigma / sigma));
If you apply/correct this factor, and you define the gain
parameter to be 1
your output result should not be affected.
// See parameter fShapingGain registered by InitFromConfigFile
fShapingGain = StringToDouble(GetParameter("gain", "1"));
Could you then test this?