5 const float targetTimePrecision)
6 : startTime_(startTime), stopTime_(stopTime), targetTimePrecision_(targetTimePrecision) {}
9 const std::vector<double>& amplitudes,
14 float& errOnTime)
const {
20 std::vector<float> pedSubSamples(nsample);
21 for (
unsigned int iSample = 0; iSample < nsample; iSample++) {
28 double gainratio = 1.;
53 pulsenorm += fullpulse(iSample);
57 for (
auto const& amplit : amplitudes) {
59 int bxp3 = ipulse - 2;
60 int firstsamplet =
std::max(0, bxp3);
63 for (
unsigned int isample = firstsamplet; isample < nsample; ++isample) {
65 pedSubSamples[isample] =
std::max(0., pedSubSamples[isample] - amplit *
pulse / pulsenorm);
72 float tM = (tStart + tStop) / 2;
74 float distStart, distStop;
79 distStart =
computeCC(pedSubSamples, fullpulse, tStart);
80 distStop =
computeCC(pedSubSamples, fullpulse, tStop);
82 if (distStart > distStop) {
87 tM = (tStart + tStop) / 2;
104 const float time)
const {
114 auto facM1orP2 = 0.25 *
tt * (
tt - 1);
115 auto fac = (0.25 * (
tt - 2) - 0.5 * (
tt + 1)) * (
tt - 1);
116 auto facP1 = (0.25 * (
tt + 1) - 0.5 * (
tt - 2)) *
tt;
119 facM1orP2 * fullpulse[
i - 1] + fac * fullpulse[
i] + facP1 * fullpulse[
i + 1] + facM1orP2 * fullpulse[
i + 2];
125 interpPulse[0] = facM1orP2 * fullpulse[0] + facP1 * fullpulse[1] + facM1orP2 * fullpulse[2];
133 for (
int i = 0;
i < interpPulseShifted.size(); ++
i) {
135 interpPulseShifted[
i] = interpPulse[
i +
shift];
137 interpPulseShifted[
i] = 0;
139 return interpPulseShifted;
144 const float time)
const {
145 constexpr
int exclude = 1;
146 float powerSamples = 0.;
147 float powerTemplate = 0.;
150 for (
int i = exclude;
i <
int(
samples.size() - exclude); ++
i) {
152 powerTemplate +=
std::pow(interpolated[
i], 2);