16 const uint64_t t0)
const
21 std::vector<std::vector<Cluster2D*>>
buffer(numRows);
22 std::vector<size_t> bufferPos(numRows);
23 std::vector<Cluster2D> clustersOut;
24 std::vector<inputType> inputData;
27 for (
auto& input : inVec) {
29 const size_t index = input.second;
31 uint16_t chT = pad << 1;
32 uint16_t chR = chT + 1;
37 const int row = pad / numCols;
38 const int col = pad % numCols;
39 if (dtime < 0) tm += dtime;
40 if (r < 1 && !
fParams.
rowPar[row].padPar[col].chRMasked) chR = 0;
41 if (t < 1 && !
fParams.
rowPar[row].padPar[col].chTMasked) chT = 0;
42 inputData.emplace_back(chT, chR, tm, row, index, d);
46 std::sort(inputData.begin(), inputData.end(),
47 [](
const auto& a,
const auto& b) ->
bool { return std::get<2>(a) < std::get<2>(b); });
50 for (
auto& in : inputData) {
51 auto& [chT, chR, tm, row, id, digi] = in;
62 auto itc = (
buffer[row].begin() + bufferPos[row]);
65 for (; itc !=
buffer[row].end(); itc++) {
66 if ((int64_t)(*itc)->GetStartTime() < tm - 5) {
70 if ((*itc)->IsChannelInRange(chT, chR) == 0) {
71 const uint tc = (*itc)->GetStartTime();
72 (*itc)->AddDigi(
id, digi, chT, chR, tc - tm);
76 if (itc ==
buffer[row].end()) {
82 for (
auto& clRow :
buffer) {
89 for (
auto itc0 = clRow.begin(); itc0 != clRow.end(); itc0++) {
90 if (*itc0 ==
nullptr) {
93 for (
auto itc1 = std::next(itc0); itc1 != clRow.end(); itc1++) {
94 if (*itc1 ==
nullptr) {
97 if ((*itc1)->GetStartTime() - (*itc0)->GetStartTime() > 50) {
100 if ((*itc0)->Merge((*itc1))) {
109 for (
auto& pcluster : clRow) {
110 if (pcluster ==
nullptr) {
113 clustersOut.emplace_back(*pcluster);
114 clustersOut.back().Finalize(
fParams.
rowPar[0].padPar.size());