36 const int nPotentials = mMShapes.
mTimeMS.size();
37 const int nValuesPerSlice = std::round(nPotentials /
float(nSlices) + 0.5);
38 for (
int i = 0;
i < nSlices; ++
i) {
40 const int idx =
i * nValuesPerSlice;
41 const int nOffsStart = (
i == 0) ? 0 : 1;
42 const size_t idxStart = idx - nOffsStart;
43 const int nOffsEnd = (
i == nSlices - 1) ? 0 : 1;
44 int idxEnd = (idx + nValuesPerSlice + 2 * nOffsEnd);
45 idxEnd = std::clamp(idxEnd, 0, nPotentials);
47 corr.mMShapes.
mTimeMS = std::vector<double>(mMShapes.
mTimeMS.begin() + idxStart, mMShapes.
mTimeMS.begin() + idxEnd);
50 long tsCCDBStart = corr.mMShapes.
mTimeMS[nOffsStart];
52 tsCCDBStart -= 2. * mMaxDeltaTimeMS;
55 long tsCCDBEnd = corr.mMShapes.
mTimeMS[corr.mMShapes.
mTimeMS.size() - 1 - nOffsEnd];
57 if (
i == nSlices - 1) {
58 tsCCDBEnd += 2. * mMaxDeltaTimeMS;
60 const std::string fileOut = fmt::format(
"{}_{}_{}_{}.root",
file,
i, tsCCDBStart, tsCCDBEnd);