31 for (
size_t iDigi = 0; iDigi < digisIn.size(); iDigi++) {
32 const CbmTofDigi* pDigi = &digisIn[iDigi].first;
33 const int32_t index = digisIn[iDigi].second;
35 result[chan].emplace_back(pDigi, index);
57 auto& [clustersOut, chanSizes, chanAddresses, digiIndRef] = result;
63 int32_t lastChan = -1;
64 double lastPosY = 0.0;
65 double lastTime = 0.0;
70 std::vector<inputType::iterator> lastChanPos;
71 for (
size_t chan = 0; chan < numChan; chan++) {
72 lastChanPos.push_back(input[chan].begin());
75 for (int32_t chan = 0; (size_t) chan < numChan; chan++) {
78 chanSizes.push_back(clustersOut.size());
87 auto digiIt = storDigi.begin();
89 while (1 < std::distance(digiIt, storDigi.end())) {
90 while (digiIt->first->GetSide() == std::next(digiIt)->first->GetSide()) {
92 if (2 > std::distance(digiIt, storDigi.end())) {
96 if (2 > std::distance(digiIt, storDigi.end())) {
103 const CbmTofDigi* xDigiB = std::next(digiIt)->first;
106 ROOT::Math::XYZVector
pos(((-(
double) numChan / 2. + (
double) chan) + 0.5) * cell->
sizeX, 0., 0.);
117 const CbmTofDigi* xDigiC = std::next(digiIt, 2)->first;
127 if (std::abs(posYN) >= std::abs(
pos.Y())) {
146 const double time = 0.5 * (xDigiA->
GetTime() + xDigiB->
GetTime());
149 const double totSum = xDigiA->
GetTot() + xDigiB->
GetTot();
161 clustersOut.push_back(cluster);
165 cluster.
add(
pos, time, totSum, totSum);
166 digiIndRef.push_back(digiIt->second);
167 digiIndRef.push_back(std::next(digiIt)->second);
173 AddNextChan(input, lastChan, cluster, clustersOut, digiIndRef, &lastChanPos);
177 chanSizes.back() = clustersOut.size() - chanSizes.back();
188 clustersOut.push_back(cluster);
195 std::vector<Hit>& clustersOut, std::vector<int32_t>& digiIndRef,
196 std::vector<inputType::iterator>* lastChanPos)
202 int32_t chan = lastChan + 1;
206 if ((
size_t) chan >= numChan) {
210 if ((
size_t) chan == numChan) {
215 if (0 == storDigi.size()) {
223 auto i1 = (lastChanPos ==
nullptr) ? storDigi.begin() : (*lastChanPos)[chan];
228 [
this, cell](
const auto& obj,
double val) {
229 return obj.first->GetTime() + cell.sizeY * fParams.fPosYMaxScal / fParams.fSigVel < val;
236 (*lastChanPos)[chan] = i1;
239 for (; i1 < storDigi.end() - 1; i1++) {
247 while (++i2 < storDigi.end()) {
254 const double time = 0.5 * (xDigiA->
GetTime() + xDigiB->
GetTime());
283 const double posX = ((-(double) numChan / 2. + chan) + 0.5) * cell.
sizeX;
284 const double totSum = xDigiA->
GetTot() + xDigiB->
GetTot();
286 ROOT::Math::XYZVector
pos(posX, posY, 0.);
287 cluster.
add(
pos, time, totSum, totSum);
288 digiIndRef.push_back(i1->second);
289 digiIndRef.push_back(i2->second);
292 std::move(i1 + 1, i2, i1);
293 std::move(i2 + 1, storDigi.end(), i2 - 1);
294 storDigi.resize(storDigi.size() - 2);
296 if (
AddNextChan(input, chan, cluster, clustersOut, digiIndRef)) {
308 clustersOut.push_back(cluster);
bool AddNextChan(std::vector< inputType > &input, int32_t iLastChan, Hit &cluster, std::vector< Hit > &clustersOut, std::vector< int32_t > &digiIndRef, std::vector< inputType::iterator > *lastChanPos=nullptr)