Let's say I have a function that represents how much light is produced within a particular volume:
gamma[t_] := Piecewise[{{0.2 Exp[-t/13] + 0.5 Exp[-t/35] + 0.3 Exp[-t/270], t >= 0}}, 0]
And let's say that the light is collected at one end of this volume, and the arrival time is gaussian distributed for a particular source time (i.e. if we isolate all of the light emitted at t
, then it will arrive in a gaussian distribution centered around t'
with a particular standard deviation).
Thus far I have come up with this:
gaussian[t_, μ_, σ_] := 1/(σ Sqrt[2 Pi]) Exp[-(1/2) ((t - μ)/σ)^2]
SetAttributes[gaussianSmear, HoldAll]
gaussianSmear[t_, f_[a___, y_, b___], σ_] := NIntegrate[
f[a, y, b] gaussian[t, y, σ], {y, t-6σ, t+6σ}]
This will work, but it is very slow. Is there a faster way to perform this? Or is there a built-in function of some kind? I'm aware of the function GaussianFilter
, but it only seems to operate on discrete data, not an arbitrary function.
An example usage, original function:
gamma[t_] := Piecewise[{{0.2 Exp[-t/13] + 0.5 Exp[-t/35] + 0.3 Exp[-t/270], t >= 0}}, 0]
neutron[t_] := Piecewise[{{0.2 Exp[-t/13] + 0.5 Exp[-t/59] + 0.3 Exp[-t/490], t >= 0}}, 0]
Plot[{gamma[t], neutron[t]}, {t, 0, 80},
PlotLegends -> {"gamma", "neutron"}, PlotRange -> {0, 1},
PlotLabel -> "Theoretical activity of crystal",
AxesLabel -> {"Time (ns)", "Output level"}]
An example usage, after smearing:
Plot[{gaussianSmear[t, gamma[y], 1],
gaussianSmear[t, neutron[y], 1]}, {t, -2, 80}, PlotRange -> {0, 1},
PlotLegends -> {"gamma", "neutron"},
PlotLabel -> "Light collected by SiPM",
AxesLabel -> {"Time (ns)", "Output level"}]
x
is not defined. An example of how to usegaussianSmear
would be nice also. $\endgroup$